( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
var hz = Object.defineProperty;
var dz = (en, it, qn) => it in en ? hz(en, it, {
enumerable: !0,
configurable: !0,
writable: !0,
value: qn
}) : en[it] = qn;
var Ce = (en, it, qn) => (dz(en, typeof it != "symbol" ? it + "" : it, qn), qn);
(function(en, it) {
typeof exports == "object" && typeof module < "u" ? module.exports = it() : typeof define == "function" && define.amd ? define(it) : (en = typeof globalThis < "u" ? globalThis : en || self, en.Pixie = it())
})(this, function() {
var F_, z_, N_;
"use strict";
function en(t, e) {
for (var n = 0; n < e.length; n++) {
const r = e[n];
if (typeof r != "string" && !Array.isArray(r)) {
for (const i in r)
if (i !== "default" && !(i in t)) {
const s = Object.getOwnPropertyDescriptor(r, i);
s && Object.defineProperty(t, i, s.get ? s : {
enumerable: !0,
get: () => r[i]
})
}
}
}
return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, {
value: "Module"
}))
}
var it = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function qn(t) {
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t
}
function B_(t) {
var e = t.default;
if (typeof e == "function") {
var n = function() {
return e.apply(this, arguments)
};
n.prototype = e.prototype
} else n = {};
return Object.defineProperty(n, "__esModule", {
value: !0
}), Object.keys(t).forEach(function(r) {
var i = Object.getOwnPropertyDescriptor(t, r);
Object.defineProperty(n, r, i.get ? i : {
enumerable: !0,
get: function() {
return t[r]
}
})
}), n
}
var E = {
exports: {}
},
ke = {};
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Io = Symbol.for("react.element"),
$_ = Symbol.for("react.portal"),
V_ = Symbol.for("react.fragment"),
H_ = Symbol.for("react.strict_mode"),
U_ = Symbol.for("react.profiler"),
W_ = Symbol.for("react.provider"),
Y_ = Symbol.for("react.context"),
X_ = Symbol.for("react.forward_ref"),
G_ = Symbol.for("react.suspense"),
K_ = Symbol.for("react.memo"),
q_ = Symbol.for("react.lazy"),
Sg = Symbol.iterator;
function Z_(t) {
return t === null || typeof t != "object" ? null : (t = Sg && t[Sg] || t["@@iterator"], typeof t == "function" ? t : null)
}
var Cg = {
isMounted: function() {
return !1
},
enqueueForceUpdate: function() {},
enqueueReplaceState: function() {},
enqueueSetState: function() {}
},
Tg = Object.assign,
kg = {};
function Ti(t, e, n) {
this.props = t, this.context = e, this.refs = kg, this.updater = n || Cg
}
Ti.prototype.isReactComponent = {}, Ti.prototype.setState = function(t, e) {
if (typeof t != "object" && typeof t != "function" && t != null) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
this.updater.enqueueSetState(this, t, e, "setState")
}, Ti.prototype.forceUpdate = function(t) {
this.updater.enqueueForceUpdate(this, t, "forceUpdate")
};
function Eg() {}
Eg.prototype = Ti.prototype;
function uu(t, e, n) {
this.props = t, this.context = e, this.refs = kg, this.updater = n || Cg
}
var fu = uu.prototype = new Eg;
fu.constructor = uu, Tg(fu, Ti.prototype), fu.isPureReactComponent = !0;
var Og = Array.isArray,
Pg = Object.prototype.hasOwnProperty,
hu = {
current: null
},
Mg = {
key: !0,
ref: !0,
__self: !0,
__source: !0
};
function Ag(t, e, n) {
var r, i = {},
s = null,
d = null;
if (e != null)
for (r in e.ref !== void 0 && (d = e.ref), e.key !== void 0 && (s = "" + e.key), e) Pg.call(e, r) && !Mg.hasOwnProperty(r) && (i[r] = e[r]);
var a = arguments.length - 2;
if (a === 1) i.children = n;
else if (1 < a) {
for (var o = Array(a), c = 0; c < a; c++) o[c] = arguments[c + 2];
i.children = o
}
if (t && t.defaultProps)
for (r in a = t.defaultProps, a) i[r] === void 0 && (i[r] = a[r]);
return {
$$typeof: Io,
type: t,
key: s,
ref: d,
props: i,
_owner: hu.current
}
}
function Q_(t, e) {
return {
$$typeof: Io,
type: t.type,
key: e,
ref: t.ref,
props: t.props,
_owner: t._owner
}
}
function du(t) {
return typeof t == "object" && t !== null && t.$$typeof === Io
}
function J_(t) {
var e = {
"=": "=0",
":": "=2"
};
return "$" + t.replace(/[=:]/g, function(n) {
return e[n]
})
}
var Dg = /\/+/g;
function pu(t, e) {
return typeof t == "object" && t !== null && t.key != null ? J_("" + t.key) : e.toString(36)
}
function wa(t, e, n, r, i) {
var s = typeof t;
(s === "undefined" || s === "boolean") && (t = null);
var d = !1;
if (t === null) d = !0;
else switch (s) {
case "string":
case "number":
d = !0;
break;
case "object":
switch (t.$$typeof) {
case Io:
case $_:
d = !0
}
}
if (d) return d = t, i = i(d), t = r === "" ? "." + pu(d, 0) : r, Og(i) ? (n = "", t != null && (n = t.replace(Dg, "$&/") + "/"), wa(i, e, n, "", function(c) {
return c
})) : i != null && (du(i) && (i = Q_(i, n + (!i.key || d && d.key === i.key ? "" : ("" + i.key).replace(Dg, "$&/") + "/") + t)), e.push(i)), 1;
if (d = 0, r = r === "" ? "." : r + ":", Og(t))
for (var a = 0; a < t.length; a++) {
s = t[a];
var o = r + pu(s, a);
d += wa(s, e, n, o, i)
} else if (o = Z_(t), typeof o == "function")
for (t = o.call(t), a = 0; !(s = t.next()).done;) s = s.value, o = r + pu(s, a++), d += wa(s, e, n, o, i);
else if (s === "object") throw e = String(t), Error("Objects are not valid as a React child (found: " + (e === "[object Object]" ? "object with keys {" + Object.keys(t).join(", ") + "}" : e) + "). If you meant to render a collection of children, use an array instead.");
return d
}
function xa(t, e, n) {
if (t == null) return t;
var r = [],
i = 0;
return wa(t, r, "", "", function(s) {
return e.call(n, s, i++)
}), r
}
function eS(t) {
if (t._status === -1) {
var e = t._result;
e = e(), e.then(function(n) {
(t._status === 0 || t._status === -1) && (t._status = 1, t._result = n)
}, function(n) {
(t._status === 0 || t._status === -1) && (t._status = 2, t._result = n)
}), t._status === -1 && (t._status = 0, t._result = e)
}
if (t._status === 1) return t._result.default;
throw t._result
}
var xt = {
current: null
},
_a = {
transition: null
},
tS = {
ReactCurrentDispatcher: xt,
ReactCurrentBatchConfig: _a,
ReactCurrentOwner: hu
};
ke.Children = {
map: xa,
forEach: function(t, e, n) {
xa(t, function() {
e.apply(this, arguments)
}, n)
},
count: function(t) {
var e = 0;
return xa(t, function() {
e++
}), e
},
toArray: function(t) {
return xa(t, function(e) {
return e
}) || []
},
only: function(t) {
if (!du(t)) throw Error("React.Children.only expected to receive a single React element child.");
return t
}
}, ke.Component = Ti, ke.Fragment = V_, ke.Profiler = U_, ke.PureComponent = uu, ke.StrictMode = H_, ke.Suspense = G_, ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = tS, ke.cloneElement = function(t, e, n) {
if (t == null) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + t + ".");
var r = Tg({}, t.props),
i = t.key,
s = t.ref,
d = t._owner;
if (e != null) {
if (e.ref !== void 0 && (s = e.ref, d = hu.current), e.key !== void 0 && (i = "" + e.key), t.type && t.type.defaultProps) var a = t.type.defaultProps;
for (o in e) Pg.call(e, o) && !Mg.hasOwnProperty(o) && (r[o] = e[o] === void 0 && a !== void 0 ? a[o] : e[o])
}
var o = arguments.length - 2;
if (o === 1) r.children = n;
else if (1 < o) {
a = Array(o);
for (var c = 0; c < o; c++) a[c] = arguments[c + 2];
r.children = a
}
return {
$$typeof: Io,
type: t.type,
key: i,
ref: s,
props: r,
_owner: d
}
}, ke.createContext = function(t) {
return t = {
$$typeof: Y_,
_currentValue: t,
_currentValue2: t,
_threadCount: 0,
Provider: null,
Consumer: null,
_defaultValue: null,
_globalName: null
}, t.Provider = {
$$typeof: W_,
_context: t
}, t.Consumer = t
}, ke.createElement = Ag, ke.createFactory = function(t) {
var e = Ag.bind(null, t);
return e.type = t, e
}, ke.createRef = function() {
return {
current: null
}
}, ke.forwardRef = function(t) {
return {
$$typeof: X_,
render: t
}
}, ke.isValidElement = du, ke.lazy = function(t) {
return {
$$typeof: q_,
_payload: {
_status: -1,
_result: t
},
_init: eS
}
}, ke.memo = function(t, e) {
return {
$$typeof: K_,
type: t,
compare: e === void 0 ? null : e
}
}, ke.startTransition = function(t) {
var e = _a.transition;
_a.transition = {};
try {
t()
} finally {
_a.transition = e
}
}, ke.unstable_act = function() {
throw Error("act(...) is not supported in production builds of React.")
}, ke.useCallback = function(t, e) {
return xt.current.useCallback(t, e)
}, ke.useContext = function(t) {
return xt.current.useContext(t)
}, ke.useDebugValue = function() {}, ke.useDeferredValue = function(t) {
return xt.current.useDeferredValue(t)
}, ke.useEffect = function(t, e) {
return xt.current.useEffect(t, e)
}, ke.useId = function() {
return xt.current.useId()
}, ke.useImperativeHandle = function(t, e, n) {
return xt.current.useImperativeHandle(t, e, n)
}, ke.useInsertionEffect = function(t, e) {
return xt.current.useInsertionEffect(t, e)
}, ke.useLayoutEffect = function(t, e) {
return xt.current.useLayoutEffect(t, e)
}, ke.useMemo = function(t, e) {
return xt.current.useMemo(t, e)
}, ke.useReducer = function(t, e, n) {
return xt.current.useReducer(t, e, n)
}, ke.useRef = function(t) {
return xt.current.useRef(t)
}, ke.useState = function(t) {
return xt.current.useState(t)
}, ke.useSyncExternalStore = function(t, e, n) {
return xt.current.useSyncExternalStore(t, e, n)
}, ke.useTransition = function() {
return xt.current.useTransition()
}, ke.version = "18.2.0",
function(t) {
t.exports = ke
}(E);
const ue = qn(E.exports),
gu = en({
__proto__: null,
default: ue
}, [E.exports]);
var nS = function(e) {
return rS(e) && !iS(e)
};
function rS(t) {
return !!t && typeof t == "object"
}
function iS(t) {
var e = Object.prototype.toString.call(t);
return e === "[object RegExp]" || e === "[object Date]" || aS(t)
}
var oS = typeof Symbol == "function" && Symbol.for,
sS = oS ? Symbol.for("react.element") : 60103;
function aS(t) {
return t.$$typeof === sS
}
function lS(t) {
return Array.isArray(t) ? [] : {}
}
function Lo(t, e) {
return e.clone !== !1 && e.isMergeableObject(t) ? ki(lS(t), t, e) : t
}
function cS(t, e, n) {
return t.concat(e).map(function(r) {
return Lo(r, n)
})
}
function uS(t, e) {
if (!e.customMerge) return ki;
var n = e.customMerge(t);
return typeof n == "function" ? n : ki
}
function fS(t) {
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(e) {
return t.propertyIsEnumerable(e)
}) : []
}
function Rg(t) {
return Object.keys(t).concat(fS(t))
}
function Ig(t, e) {
try {
return e in t
} catch {
return !1
}
}
function hS(t, e) {
return Ig(t, e) && !(Object.hasOwnProperty.call(t, e) && Object.propertyIsEnumerable.call(t, e))
}
function dS(t, e, n) {
var r = {};
return n.isMergeableObject(t) && Rg(t).forEach(function(i) {
r[i] = Lo(t[i], n)
}), Rg(e).forEach(function(i) {
hS(t, i) || (Ig(t, i) && n.isMergeableObject(e[i]) ? r[i] = uS(i, n)(t[i], e[i], n) : r[i] = Lo(e[i], n))
}), r
}
function ki(t, e, n) {
n = n || {}, n.arrayMerge = n.arrayMerge || cS, n.isMergeableObject = n.isMergeableObject || nS, n.cloneUnlessOtherwiseSpecified = Lo;
var r = Array.isArray(e),
i = Array.isArray(t),
s = r === i;
return s ? r ? n.arrayMerge(t, e, n) : dS(t, e, n) : Lo(e, n)
}
ki.all = function(e, n) {
if (!Array.isArray(e)) throw new Error("first argument should be an array");
return e.reduce(function(r, i) {
return ki(r, i, n)
}, {})
};
var pS = ki,
Lg = pS;
function gS(t, e) {
e === void 0 && (e = {});
var n = e.insertAt;
if (!(!t || typeof document > "u")) {
var r = document.head || document.getElementsByTagName("head")[0],
i = document.createElement("style");
i.type = "text/css", n === "top" && r.firstChild ? r.insertBefore(i, r.firstChild) : r.appendChild(i), i.styleSheet ? i.styleSheet.cssText = t : i.appendChild(document.createTextNode(t))
}
}
function mu(t, e) {
return e === void 0 && (e = 15), +parseFloat(Number(t).toPrecision(e))
}
function pn(t) {
var e = t.toString().split(/[eE]/),
n = (e[0].split(".")[1] || "").length - +(e[1] || 0);
return n > 0 ? n : 0
}
function Fo(t) {
if (t.toString().indexOf("e") === -1) return Number(t.toString().replace(".", ""));
var e = pn(t);
return e > 0 ? mu(Number(t) * Math.pow(10, e)) : Number(t)
}
function vu(t) {
Ng && (t > Number.MAX_SAFE_INTEGER || t < Number.MIN_SAFE_INTEGER) && console.warn(t + " is beyond boundary when transfer to integer, the results may not be accurate")
}
function Sa(t, e) {
var n = t[0],
r = t[1],
i = t.slice(2),
s = e(n, r);
return i.forEach(function(d) {
s = e(s, d)
}), s
}
function kn() {
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
if (t.length > 2) return Sa(t, kn);
var n = t[0],
r = t[1],
i = Fo(n),
s = Fo(r),
d = pn(n) + pn(r),
a = i * s;
return vu(a), a / Math.pow(10, d)
}
function Fg() {
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
if (t.length > 2) return Sa(t, Fg);
var n = t[0],
r = t[1],
i = Math.pow(10, Math.max(pn(n), pn(r)));
return (kn(n, i) + kn(r, i)) / i
}
function zg() {
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
if (t.length > 2) return Sa(t, zg);
var n = t[0],
r = t[1],
i = Math.pow(10, Math.max(pn(n), pn(r)));
return (kn(n, i) - kn(r, i)) / i
}
function yu() {
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
if (t.length > 2) return Sa(t, yu);
var n = t[0],
r = t[1],
i = Fo(n),
s = Fo(r);
return vu(i), vu(s), kn(i / s, mu(Math.pow(10, pn(r) - pn(n))))
}
function mS(t, e) {
var n = Math.pow(10, e),
r = yu(Math.round(Math.abs(kn(t, n))), n);
return t < 0 && r !== 0 && (r = kn(r, -1)), r
}
var Ng = !0;
function vS(t) {
t === void 0 && (t = !0), Ng = t
}
var bu = {
strip: mu,
plus: Fg,
minus: zg,
times: kn,
divide: yu,
round: mS,
digitLength: pn,
float2Fixed: Fo,
enableBoundaryChecking: vS
};
function Ca(t) {
return t && t.Math == Math ? t : void 0
}
var jg = typeof globalThis == "object" && Ca(globalThis) || typeof window == "object" && Ca(window) || typeof self == "object" && Ca(self) || typeof global == "object" && Ca(global) || function() {
return this
}() || {};
function Xe() {
return jg
}
function wu(t, e, n) {
var r = n || jg,
i = r.__SENTRY__ = r.__SENTRY__ || {},
s = i[t] || (i[t] = e());
return s
}
var Bg = Object.prototype.toString;
function $g(t) {
switch (Bg.call(t)) {
case "[object Error]":
case "[object Exception]":
case "[object DOMException]":
return !0;
default:
return Zn(t, Error)
}
}
function Ei(t, e) {
return Bg.call(t) === `[object ${e}]`
}
function Vg(t) {
return Ei(t, "ErrorEvent")
}
function Hg(t) {
return Ei(t, "DOMError")
}
function yS(t) {
return Ei(t, "DOMException")
}
function Oi(t) {
return Ei(t, "String")
}
function Ug(t) {
return t === null || typeof t != "object" && typeof t != "function"
}
function Pi(t) {
return Ei(t, "Object")
}
function xu(t) {
return typeof Event < "u" && Zn(t, Event)
}
function bS(t) {
return typeof Element < "u" && Zn(t, Element)
}
function wS(t) {
return Ei(t, "RegExp")
}
function _u(t) {
return Boolean(t && t.then && typeof t.then == "function")
}
function xS(t) {
return Pi(t) && "nativeEvent" in t && "preventDefault" in t && "stopPropagation" in t
}
function _S(t) {
return typeof t == "number" && t !== t
}
function Zn(t, e) {
try {
return t instanceof e
} catch {
return !1
}
}
function Su(t, e) {
try {
let a = t;
var n = 5,
r = 80,
i = [];
let o = 0,
c = 0;
var s = " > ",
d = s.length;
let h;
for (; a && o++ < n && (h = SS(a, e), !(h === "html" || o > 1 && c + i.length * d + h.length >= r));) i.push(h), c += h.length, a = a.parentNode;
return i.reverse().join(s)
} catch {
return "<unknown>"
}
}
function SS(t, e) {
var n = t,
r = [];
let i, s, d, a, o;
if (!n || !n.tagName) return "";
r.push(n.tagName.toLowerCase());
var c = e && e.length ? e.filter(l => n.getAttribute(l)).map(l => [l, n.getAttribute(l)]) : null;
if (c && c.length) c.forEach(l => {
r.push(`[${l[0]}="${l[1]}"]`)
});
else if (n.id && r.push(`#${n.id}`), i = n.className, i && Oi(i))
for (s = i.split(/\s+/), o = 0; o < s.length; o++) r.push(`.${s[o]}`);
var h = ["type", "name", "title", "alt"];
for (o = 0; o < h.length; o++) d = h[o], a = n.getAttribute(d), a && r.push(`[${d}="${a}"]`);
return r.join("")
}
function CS() {
var t = Xe();
try {
return t.document.location.href
} catch {
return ""
}
}
class dt extends Error {
constructor(e, n = "warn") {
super(e), this.message = e, this.name = new.target.prototype.constructor.name, Object.setPrototypeOf(this, new.target.prototype), this.logLevel = n
}
}
var TS = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/;
function kS(t) {
return t === "http" || t === "https"
}
function Cu(t, e = !1) {
const {
host: n,
path: r,
pass: i,
port: s,
projectId: d,
protocol: a,
publicKey: o
} = t;
return `${a}://${o}${e&&i?`:${i}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${d}`
}
function ES(t) {
var e = TS.exec(t);
if (!e) throw new dt(`Invalid Sentry Dsn: ${t}`);
const [n, r, i = "", s, d = "", a] = e.slice(1);
let o = "",
c = a;
var h = c.split("/");
if (h.length > 1 && (o = h.slice(0, -1).join("/"), c = h.pop()), c) {
var l = c.match(/^\d+/);
l && (c = l[0])
}
return Wg({
host: s,
pass: i,
path: o,
projectId: c,
port: d,
protocol: n,
publicKey: r
})
}
function Wg(t) {
return {
protocol: t.protocol,
publicKey: t.publicKey || "",
pass: t.pass || "",
host: t.host,
port: t.port || "",
path: t.path || "",
projectId: t.projectId
}
}
function OS(t) {
if (!(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__)) return;
const {
port: e,
projectId: n,
protocol: r
} = t;
var i = ["protocol", "publicKey", "host", "projectId"];
if (i.forEach(s => {
if (!t[s]) throw new dt(`Invalid Sentry Dsn: ${s} missing`)
}), !n.match(/^\d+$/)) throw new dt(`Invalid Sentry Dsn: Invalid projectId ${n}`);
if (!kS(r)) throw new dt(`Invalid Sentry Dsn: Invalid protocol ${r}`);
if (e && isNaN(parseInt(e, 10))) throw new dt(`Invalid Sentry Dsn: Invalid port ${e}`);
return !0
}
function PS(t) {
var e = typeof t == "string" ? ES(t) : Wg(t);
return OS(e), e
}
var MS = Xe(),
AS = "Sentry Logger ",
Ta = ["debug", "info", "warn", "error", "log", "assert", "trace"];
function Yg(t) {
var e = Xe();
if (!("console" in e)) return t();
var n = e.console,
r = {};
Ta.forEach(i => {
var s = n[i] && n[i].__sentry_original__;
i in e.console && s && (r[i] = n[i], n[i] = s)
});
try {
return t()
} finally {
Object.keys(r).forEach(i => {
n[i] = r[i]
})
}
}
function Xg() {
let t = !1;
var e = {
enable: () => {
t = !0
},
disable: () => {
t = !1
}
};
return typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__ ? Ta.forEach(n => {
e[n] = (...r) => {
t && Yg(() => {
MS.console[n](`${AS}[${n}]:`, ...r)
})
}
}) : Ta.forEach(n => {
e[n] = () => {}
}), e
}
let Te;
typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__ ? Te = wu("logger", Xg) : Te = Xg();
function zo(t, e = 0) {
return typeof t != "string" || e === 0 || t.length <= e ? t : `${t.substr(0,e)}...`
}
function Gg(t, e) {
if (!Array.isArray(t)) return "";
var n = [];
for (let i = 0; i < t.length; i++) {
var r = t[i];
try {
n.push(String(r))
} catch {
n.push("[value cannot be serialized]")
}
}
return n.join(e)
}
function Tu(t, e) {
return Oi(t) ? wS(e) ? e.test(t) : typeof e == "string" ? t.indexOf(e) !== -1 : !1 : !1
}
function pt(t, e, n) {
if (e in t) {
var r = t[e],
i = n(r);
if (typeof i == "function") try {
Kg(i, r)
} catch {}
t[e] = i
}
}
function ku(t, e, n) {
Object.defineProperty(t, e, {
value: n,
writable: !0,
configurable: !0
})
}
function Kg(t, e) {
var n = e.prototype || {};
t.prototype = e.prototype = n, ku(t, "__sentry_original__", e)
}
function Eu(t) {
return t.__sentry_original__
}
function DS(t) {
return Object.keys(t).map(e => `${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")
}
function qg(t) {
if ($g(t)) return {
message: t.message,
name: t.name,
stack: t.stack,
...Qg(t)
};
if (xu(t)) {
var e = {
type: t.type,
target: Zg(t.target),
currentTarget: Zg(t.currentTarget),
...Qg(t)
};
return typeof CustomEvent < "u" && Zn(t, CustomEvent) && (e.detail = t.detail), e
} else return t
}
function Zg(t) {
try {
return bS(t) ? Su(t) : Object.prototype.toString.call(t)
} catch {
return "<unknown>"
}
}
function Qg(t) {
if (typeof t == "object" && t !== null) {
var e = {};
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
return e
} else return {}
}
function RS(t, e = 40) {
var n = Object.keys(qg(t));
if (n.sort(), !n.length) return "[object has no keys]";
if (n[0].length >= e) return zo(n[0], e);
for (let i = n.length; i > 0; i--) {
var r = n.slice(0, i).join(", ");
if (!(r.length > e)) return i === n.length ? r : zo(r, e)
}
return ""
}
function Ou(t) {
var e = new Map;
return Pu(t, e)
}
function Pu(t, e) {
if (Pi(t)) {
var n = e.get(t);
if (n !== void 0) return n;
var r = {};
e.set(t, r);
for (var i of Object.keys(t)) typeof t[i] < "u" && (r[i] = Pu(t[i], e));
return r
}
if (Array.isArray(t)) {
var n = e.get(t);
if (n !== void 0) return n;
var r = [];
return e.set(t, r), t.forEach(a => {
r.push(Pu(a, e))
}), r
}
return t
}
var IS = 50;
function Jg(...t) {
var e = t.sort((n, r) => n[0] - r[0]).map(n => n[1]);
return (n, r = 0) => {
var i = [];
for (var s of n.split(`
`).slice(r)) {
var d = s.replace(/\(error: (.*)\)/, "$1");
for (var a of e) {
var o = a(d);
if (o) {
i.push(o);
break
}
}
}
return FS(i)
}
}
function LS(t) {
return Array.isArray(t) ? Jg(...t) : t
}
function FS(t) {
if (!t.length) return [];
let e = t;
var n = e[0].function || "",
r = e[e.length - 1].function || "";
return (n.indexOf("captureMessage") !== -1 || n.indexOf("captureException") !== -1) && (e = e.slice(1)), r.indexOf("sentryWrapped") !== -1 && (e = e.slice(0, -1)), e.slice(0, IS).map(i => ({
...i,
filename: i.filename || e[0].filename,
function: i.function || "?"
})).reverse()
}
var Mu = "<anonymous>";
function Qn(t) {
try {
return !t || typeof t != "function" ? Mu : t.name || Mu
} catch {
return Mu
}
}
function em() {
if (!("fetch" in Xe())) return !1;
try {
return new Headers, new Request("http://www.example.com"), new Response, !0
} catch {
return !1
}
}
function Au(t) {
return t && /^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())
}
function zS() {
if (!em()) return !1;
var t = Xe();
if (Au(t.fetch)) return !0;
let e = !1;
var n = t.document;
if (n && typeof n.createElement == "function") try {
var r = n.createElement("iframe");
r.hidden = !0, n.head.appendChild(r), r.contentWindow && r.contentWindow.fetch && (e = Au(r.contentWindow.fetch)), n.head.removeChild(r)
} catch (i) {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ", i)
}
return e
}
function NS() {
var t = Xe(),
e = t.chrome,
n = e && e.app && e.app.runtime,
r = "history" in t && !!t.history.pushState && !!t.history.replaceState;
return !n && r
}
var ze = Xe(),
No = {},
tm = {};
function jS(t) {
if (!tm[t]) switch (tm[t] = !0, t) {
case "console":
BS();
break;
case "dom":
KS();
break;
case "xhr":
US();
break;
case "fetch":
$S();
break;
case "history":
WS();
break;
case "error":
qS();
break;
case "unhandledrejection":
ZS();
break;
default:
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn("unknown instrumentation type:", t);
return
}
}
function Jn(t, e) {
No[t] = No[t] || [], No[t].push(e), jS(t)
}
function tn(t, e) {
if (!(!t || !No[t]))
for (var n of No[t] || []) try {
n(e)
} catch (r) {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.error(`Error while triggering instrumentation handler.
Type: ${t}
Name: ${Qn(n)}
Error:`, r)
}
}
function BS() {
"console" in ze && Ta.forEach(function(t) {
t in ze.console && pt(ze.console, t, function(e) {
return function(...n) {
tn("console", {
args: n,
level: t
}), e && e.apply(ze.console, n)
}
})
})
}
function $S() {
!zS() || pt(ze, "fetch", function(t) {
return function(...e) {
var n = {
args: e,
fetchData: {
method: VS(e),
url: HS(e)
},
startTimestamp: Date.now()
};
return tn("fetch", {
...n
}), t.apply(ze, e).then(r => (tn("fetch", {
...n,
endTimestamp: Date.now(),
response: r
}), r), r => {
throw tn("fetch", {
...n,
endTimestamp: Date.now(),
error: r
}), r
})
}
})
}
function VS(t = []) {
return "Request" in ze && Zn(t[0], Request) && t[0].method ? String(t[0].method).toUpperCase() : t[1] && t[1].method ? String(t[1].method).toUpperCase() : "GET"
}
function HS(t = []) {
return typeof t[0] == "string" ? t[0] : "Request" in ze && Zn(t[0], Request) ? t[0].url : String(t[0])
}
function US() {
if ("XMLHttpRequest" in ze) {
var t = XMLHttpRequest.prototype;
pt(t, "open", function(e) {
return function(...n) {
var r = this,
i = n[1],
s = r.__sentry_xhr__ = {
method: Oi(n[0]) ? n[0].toUpperCase() : n[0],
url: n[1]
};
Oi(i) && s.method === "POST" && i.match(/sentry_key/) && (r.__sentry_own_request__ = !0);
var d = function() {
if (r.readyState === 4) {
try {
s.status_code = r.status
} catch {}
tn("xhr", {
args: n,
endTimestamp: Date.now(),
startTimestamp: Date.now(),
xhr: r
})
}
};
return "onreadystatechange" in r && typeof r.onreadystatechange == "function" ? pt(r, "onreadystatechange", function(a) {
return function(...o) {
return d(), a.apply(r, o)
}
}) : r.addEventListener("readystatechange", d), e.apply(r, n)
}
}), pt(t, "send", function(e) {
return function(...n) {
return this.__sentry_xhr__ && n[0] !== void 0 && (this.__sentry_xhr__.body = n[0]), tn("xhr", {
args: n,
startTimestamp: Date.now(),
xhr: this
}), e.apply(this, n)
}
})
}
}
let ka;
function WS() {
if (!NS()) return;
var t = ze.onpopstate;
ze.onpopstate = function(...n) {
var r = ze.location.href,
i = ka;
if (ka = r, tn("history", {
from: i,
to: r
}), t) try {
return t.apply(this, n)
} catch {}
};
function e(n) {
return function(...r) {
var i = r.length > 2 ? r[2] : void 0;
if (i) {
var s = ka,
d = String(i);
ka = d, tn("history", {
from: s,
to: d
})
}
return n.apply(this, r)
}
}
pt(ze.history, "pushState", e), pt(ze.history, "replaceState", e)
}
var YS = 1e3;
let Ea, Oa;
function XS(t, e) {
if (!t || t.type !== e.type) return !0;
try {
if (t.target !== e.target) return !0
} catch {}
return !1
}
function GS(t) {
if (t.type !== "keypress") return !1;
try {
var e = t.target;
if (!e || !e.tagName) return !0;
if (e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.isContentEditable) return !1
} catch {}
return !0
}
function nm(t, e = !1) {
return n => {
if (!(!n || Oa === n) && !GS(n)) {
var r = n.type === "keypress" ? "input" : n.type;
Ea === void 0 ? (t({
event: n,
name: r,
global: e
}), Oa = n) : XS(Oa, n) && (t({
event: n,
name: r,
global: e
}), Oa = n), clearTimeout(Ea), Ea = ze.setTimeout(() => {
Ea = void 0
}, YS)
}
}
}
function KS() {
if ("document" in ze) {
var t = tn.bind(null, "dom"),
e = nm(t, !0);
ze.document.addEventListener("click", e, !1), ze.document.addEventListener("keypress", e, !1), ["EventTarget", "Node"].forEach(n => {
var r = ze[n] && ze[n].prototype;
!r || !r.hasOwnProperty || !r.hasOwnProperty("addEventListener") || (pt(r, "addEventListener", function(i) {
return function(s, d, a) {
if (s === "click" || s == "keypress") try {
var o = this,
c = o.__sentry_instrumentation_handlers__ = o.__sentry_instrumentation_handlers__ || {},
h = c[s] = c[s] || {
refCount: 0
};
if (!h.handler) {
var l = nm(t);
h.handler = l, i.call(this, s, l, a)
}
h.refCount += 1
} catch {}
return i.call(this, s, d, a)
}
}), pt(r, "removeEventListener", function(i) {
return function(s, d, a) {
if (s === "click" || s == "keypress") try {
var o = this,
c = o.__sentry_instrumentation_handlers__ || {},
h = c[s];
h && (h.refCount -= 1, h.refCount <= 0 && (i.call(this, s, h.handler, a), h.handler = void 0, delete c[s]), Object.keys(c).length === 0 && delete o.__sentry_instrumentation_handlers__)
} catch {}
return i.call(this, s, d, a)
}
}))
})
}
}
let Du = null;
function qS() {
Du = ze.onerror, ze.onerror = function(t, e, n, r, i) {
return tn("error", {
column: r,
error: i,
line: n,
msg: t,
url: e
}), Du ? Du.apply(this, arguments) : !1
}
}
let Ru = null;
function ZS() {
Ru = ze.onunhandledrejection, ze.onunhandledrejection = function(t) {
return tn("unhandledrejection", t), Ru ? Ru.apply(this, arguments) : !0
}
}
function QS() {
var t = typeof WeakSet == "function",
e = t ? new WeakSet : [];
function n(i) {
if (t) return e.has(i) ? !0 : (e.add(i), !1);
for (let d = 0; d < e.length; d++) {
var s = e[d];
if (s === i) return !0
}
return e.push(i), !1
}
function r(i) {
if (t) e.delete(i);
else
for (let s = 0; s < e.length; s++)
if (e[s] === i) {
e.splice(s, 1);
break
}
}
return [n, r]
}
function Mi() {
var t = Xe(),
e = t.crypto || t.msCrypto;
if (e && e.randomUUID) return e.randomUUID().replace(/-/g, "");
var n = e && e.getRandomValues ? () => e.getRandomValues(new Uint8Array(1))[0] : () => Math.random() * 16;
return ([1e7] + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, r => (r ^ (n() & 15) >> r / 4).toString(16))
}
function rm(t) {
return t.exception && t.exception.values ? t.exception.values[0] : void 0
}
function Nr(t) {
const {
message: e,
event_id: n
} = t;
if (e) return e;
var r = rm(t);
return r ? r.type && r.value ? `${r.type}: ${r.value}` : r.type || r.value || n || "<unknown>" : n || "<unknown>"
}
function Iu(t, e, n) {
var r = t.exception = t.exception || {},
i = r.values = r.values || [],
s = i[0] = i[0] || {};
s.value || (s.value = e || ""), s.type || (s.type = n || "Error")
}
function jo(t, e) {
var n = rm(t);
if (!!n) {
var r = {
type: "generic",
handled: !0
},
i = n.mechanism;
if (n.mechanism = {
...r,
...i,
...e
}, e && "data" in e) {
var s = {
...i && i.data,
...e.data
};
n.mechanism.data = s
}
}
}
function im(t) {
if (t && t.__sentry_captured__) return !0;
try {
ku(t, "__sentry_captured__", !0)
} catch {}
return !1
}
function om(t) {
return Array.isArray(t) ? t : [t]
}
function JS() {
return typeof __SENTRY_BROWSER_BUNDLE__ < "u" && !!__SENTRY_BROWSER_BUNDLE__
}
function sm() {
return !JS() && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]"
}
function eC(t, e) {
return t.require(e)
}
function jr(t, e = 1 / 0, n = 1 / 0) {
try {
return Lu("", t, e, n)
} catch (r) {
return {
ERROR: `**non-serializable** (${r})`
}
}
}
function am(t, e = 3, n = 100 * 1024) {
var r = jr(t, e);
return rC(r) > n ? am(t, e - 1, n) : r
}
function Lu(t, e, n = 1 / 0, r = 1 / 0, i = QS()) {
const [s, d] = i;
if (e === null || ["number", "boolean", "string"].includes(typeof e) && !_S(e)) return e;
var a = tC(t, e);
if (!a.startsWith("[object ")) return a;
if (e.__sentry_skip_normalization__) return e;
if (n === 0) return a.replace("object ", "");
if (s(e)) return "[Circular ~]";
var o = e;
if (o && typeof o.toJSON == "function") try {
var c = o.toJSON();
return Lu("", c, n - 1, r, i)
} catch {}
var h = Array.isArray(e) ? [] : {};
let l = 0;
var u = qg(e);
for (var f in u)
if (!!Object.prototype.hasOwnProperty.call(u, f)) {
if (l >= r) {
h[f] = "[MaxProperties ~]";
break
}
var p = u[f];
h[f] = Lu(f, p, n - 1, r, i), l += 1
} return d(e), h
}
function tC(t, e) {
try {
return t === "domain" && e && typeof e == "object" && e._events ? "[Domain]" : t === "domainEmitter" ? "[DomainEmitter]" : typeof global < "u" && e === global ? "[Global]" : typeof window < "u" && e === window ? "[Window]" : typeof document < "u" && e === document ? "[Document]" : xS(e) ? "[SyntheticEvent]" : typeof e == "number" && e !== e ? "[NaN]" : e === void 0 ? "[undefined]" : typeof e == "function" ? `[Function: ${Qn(e)}]` : typeof e == "symbol" ? `[${String(e)}]` : typeof e == "bigint" ? `[BigInt: ${String(e)}]` : `[object ${Object.getPrototypeOf(e).constructor.name}]`
} catch (n) {
return `**non-serializable** (${n})`
}
}
function nC(t) {
return ~-encodeURI(t).split(/%..|./).length
}
function rC(t) {
return nC(JSON.stringify(t))
}
var En;
(function(t) {
var e = 0;
t[t.PENDING = e] = "PENDING";
var n = 1;
t[t.RESOLVED = n] = "RESOLVED";
var r = 2;
t[t.REJECTED = r] = "REJECTED"
})(En || (En = {}));
function Br(t) {
return new _t(e => {
e(t)
})
}
function Fu(t) {
return new _t((e, n) => {
n(t)
})
}
class _t {
__init() {
this._state = En.PENDING
}
__init2() {
this._handlers = []
}
constructor(e) {
_t.prototype.__init.call(this), _t.prototype.__init2.call(this), _t.prototype.__init3.call(this), _t.prototype.__init4.call(this), _t.prototype.__init5.call(this), _t.prototype.__init6.call(this);
try {
e(this._resolve, this._reject)
} catch (n) {
this._reject(n)
}
}
then(e, n) {
return new _t((r, i) => {
this._handlers.push([!1, s => {
if (!e) r(s);
else try {
r(e(s))
} catch (d) {
i(d)
}
}, s => {
if (!n) i(s);
else try {
r(n(s))
} catch (d) {
i(d)
}
}]), this._executeHandlers()
})
} catch (e) {
return this.then(n => n, e)
} finally(e) {
return new _t((n, r) => {
let i, s;
return this.then(d => {
s = !1, i = d, e && e()
}, d => {
s = !0, i = d, e && e()
}).then(() => {
if (s) {
r(i);
return
}
n(i)
})
})
}
__init3() {
this._resolve = e => {
this._setResult(En.RESOLVED, e)
}
}
__init4() {
this._reject = e => {
this._setResult(En.REJECTED, e)
}
}
__init5() {
this._setResult = (e, n) => {
if (this._state === En.PENDING) {
if (_u(n)) {
n.then(this._resolve, this._reject);
return
}
this._state = e, this._value = n, this._executeHandlers()
}
}
}
__init6() {
this._executeHandlers = () => {
if (this._state !== En.PENDING) {
var e = this._handlers.slice();
this._handlers = [], e.forEach(n => {
n[0] || (this._state === En.RESOLVED && n[1](this._value), this._state === En.REJECTED && n[2](this._value), n[0] = !0)
})
}
}
}
}
function iC(t) {
var e = [];
function n() {
return t === void 0 || e.length < t
}
function r(d) {
return e.splice(e.indexOf(d), 1)[0]
}
function i(d) {
if (!n()) return Fu(new dt("Not adding Promise because buffer limit was reached."));
var a = d();
return e.indexOf(a) === -1 && e.push(a), a.then(() => r(a)).then(null, () => r(a).then(null, () => {})), a
}
function s(d) {
return new _t((a, o) => {
let c = e.length;
if (!c) return a(!0);
var h = setTimeout(() => {
d && d > 0 && a(!1)
}, d);
e.forEach(l => {
Br(l).then(() => {
--c || (clearTimeout(h), a(!0))
}, o)
})
})
}
return {
$: e,
add: i,
drain: s
}
}
function zu(t) {
if (!t) return {};
var e = t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
if (!e) return {};
var n = e[6] || "",
r = e[8] || "";
return {
host: e[4],
path: e[5],
protocol: e[2],
relative: e[5] + n + r
}
}
var oC = ["fatal", "error", "warning", "log", "info", "debug"];
function sC(t) {
return t === "warn" ? "warning" : oC.includes(t) ? t : "log"
}
var Nu = {
nowSeconds: () => Date.now() / 1e3
};
function aC() {
const {
performance: t
} = Xe();
if (!(!t || !t.now)) {
var e = Date.now() - t.now();
return {
now: () => t.now(),
timeOrigin: e
}
}
}
function lC() {
try {
var t = eC(module, "perf_hooks");
return t.performance
} catch {
return
}
}
var ju = sm() ? lC() : aC(),
lm = ju === void 0 ? Nu : {
nowSeconds: () => (ju.timeOrigin + ju.now()) / 1e3
},
Pa = Nu.nowSeconds.bind(Nu),
cm = lm.nowSeconds.bind(lm);
(() => {
const {
performance: t
} = Xe();
if (!(!t || !t.now)) {
var e = 3600 * 1e3,
n = t.now(),
r = Date.now(),
i = t.timeOrigin ? Math.abs(t.timeOrigin + n - r) : e,
s = i < e,
d = t.timing && t.timing.navigationStart,
a = typeof d == "number",
o = a ? Math.abs(d + n - r) : e,
c = o < e;
return s || c ? i <= o ? t.timeOrigin : d : r
}
})();
function Ma(t, e = []) {
return [t, e]
}
function cC(t, e) {
const [n, r] = t;
return [n, [...r, e]]
}
function um(t, e) {
var n = t[1];
n.forEach(r => {
var i = r[0].type;
e(r, i)
})
}
function Bu(t, e) {
var n = e || new TextEncoder;
return n.encode(t)
}
function fm(t, e) {
const [n, r] = t;
let i = JSON.stringify(n);
function s(a) {
typeof i == "string" ? i = typeof a == "string" ? i + a : [Bu(i, e), a] : i.push(typeof a == "string" ? Bu(a, e) : a)
}
for (var d of r) {
const [a, o] = d;
s(`
${JSON.stringify(a)}
`), s(typeof o == "string" || o instanceof Uint8Array ? o : JSON.stringify(o))
}
return typeof i == "string" ? i : uC(i)
}
function uC(t) {
var e = t.reduce((s, d) => s + d.length, 0),
n = new Uint8Array(e);
let r = 0;
for (var i of t) n.set(i, r), r += i.length;
return n
}
function fC(t, e) {
var n = typeof t.data == "string" ? Bu(t.data, e) : t.data;
return [Ou({
type: "attachment",
length: n.length,
filename: t.filename,
content_type: t.contentType,
attachment_type: t.attachmentType
}), n]
}
var hC = {
session: "session",
sessions: "session",
attachment: "attachment",
transaction: "transaction",
event: "error",
client_report: "internal",
user_report: "default"
};
function hm(t) {
return hC[t]
}
function dC(t, e, n) {
var r = [{
type: "client_report"
}, {
timestamp: n || Pa(),
discarded_events: t
}];
return Ma(e ? {
dsn: e
} : {}, [r])
}
var pC = 60 * 1e3;
function gC(t, e = Date.now()) {
var n = parseInt(`${t}`, 10);
if (!isNaN(n)) return n * 1e3;
var r = Date.parse(`${t}`);
return isNaN(r) ? pC : r - e
}
function mC(t, e) {
return t[e] || t.all || 0
}
function vC(t, e, n = Date.now()) {
return mC(t, e) > n
}
function yC(t, {
statusCode: e,
headers: n
}, r = Date.now()) {
var i = {
...t
},
s = n && n["x-sentry-rate-limits"],
d = n && n["retry-after"];
if (s)
for (var a of s.trim().split(",")) {
const [l, u] = a.split(":", 2);
var o = parseInt(l, 10),
c = (isNaN(o) ? 60 : o) * 1e3;
if (!u) i.all = r + c;
else
for (var h of u.split(";")) i[h] = r + c
} else d ? i.all = r + gC(d, r) : e === 429 && (i.all = r + 60 * 1e3);
return i
}
function bC(t) {
var e = cm(),
n = {
sid: Mi(),
init: !0,
timestamp: e,
started: e,
duration: 0,
status: "ok",
errors: 0,
ignoreDuration: !1,
toJSON: () => xC(n)
};
return t && Ai(n, t), n
}
function Ai(t, e = {}) {
if (e.user && (!t.ipAddress && e.user.ip_address && (t.ipAddress = e.user.ip_address), !t.did && !e.did && (t.did = e.user.id || e.user.email || e.user.username)), t.timestamp = e.timestamp || cm(), e.ignoreDuration && (t.ignoreDuration = e.ignoreDuration), e.sid && (t.sid = e.sid.length === 32 ? e.sid : Mi()), e.init !== void 0 && (t.init = e.init), !t.did && e.did && (t.did = `${e.did}`), typeof e.started == "number" && (t.started = e.started), t.ignoreDuration) t.duration = void 0;
else if (typeof e.duration == "number") t.duration = e.duration;
else {
var n = t.timestamp - t.started;
t.duration = n >= 0 ? n : 0
}
e.release && (t.release = e.release), e.environment && (t.environment = e.environment), !t.ipAddress && e.ipAddress && (t.ipAddress = e.ipAddress), !t.userAgent && e.userAgent && (t.userAgent = e.userAgent), typeof e.errors == "number" && (t.errors = e.errors), e.status && (t.status = e.status)
}
function wC(t, e) {
let n = {};
e ? n = {
status: e
} : t.status === "ok" && (n = {
status: "exited"
}), Ai(t, n)
}
function xC(t) {
return Ou({
sid: `${t.sid}`,
init: t.init,
started: new Date(t.started * 1e3).toISOString(),
timestamp: new Date(t.timestamp * 1e3).toISOString(),
status: t.status,
errors: t.errors,
did: typeof t.did == "number" || typeof t.did == "string" ? `${t.did}` : void 0,
duration: t.duration,
attrs: {
release: t.release,
environment: t.environment,
ip_address: t.ipAddress,
user_agent: t.userAgent
}
})
}
var dm = 100;
class er {
constructor() {
this._notifyingListeners = !1, this._scopeListeners = [], this._eventProcessors = [], this._breadcrumbs = [], this._attachments = [], this._user = {}, this._tags = {}, this._extra = {}, this._contexts = {}, this._sdkProcessingMetadata = {}
}
static clone(e) {
var n = new er;
return e && (n._breadcrumbs = [...e._breadcrumbs], n._tags = {
...e._tags
}, n._extra = {
...e._extra
}, n._contexts = {
...e._contexts
}, n._user = e._user, n._level = e._level, n._span = e._span, n._session = e._session, n._transactionName = e._transactionName, n._fingerprint = e._fingerprint, n._eventProcessors = [...e._eventProcessors], n._requestSession = e._requestSession, n._attachments = [...e._attachments]), n
}
addScopeListener(e) {
this._scopeListeners.push(e)
}
addEventProcessor(e) {
return this._eventProcessors.push(e), this
}
setUser(e) {
return this._user = e || {}, this._session && Ai(this._session, {
user: e
}), this._notifyScopeListeners(), this
}
getUser() {
return this._user
}
getRequestSession() {
return this._requestSession
}
setRequestSession(e) {
return this._requestSession = e, this
}
setTags(e) {
return this._tags = {
...this._tags,
...e
}, this._notifyScopeListeners(), this
}
setTag(e, n) {
return this._tags = {
...this._tags,
[e]: n
}, this._notifyScopeListeners(), this
}
setExtras(e) {
return this._extra = {
...this._extra,
...e
}, this._notifyScopeListeners(), this
}
setExtra(e, n) {
return this._extra = {
...this._extra,
[e]: n
}, this._notifyScopeListeners(), this
}
setFingerprint(e) {
return this._fingerprint = e, this._notifyScopeListeners(), this
}
setLevel(e) {
return this._level = e, this._notifyScopeListeners(), this
}
setTransactionName(e) {
return this._transactionName = e, this._notifyScopeListeners(), this
}
setContext(e, n) {
return n === null ? delete this._contexts[e] : this._contexts = {
...this._contexts,
[e]: n
}, this._notifyScopeListeners(), this
}
setSpan(e) {
return this._span = e, this._notifyScopeListeners(), this
}
getSpan() {
return this._span
}
getTransaction() {
var e = this.getSpan();
return e && e.transaction
}
setSession(e) {
return e ? this._session = e : delete this._session, this._notifyScopeListeners(), this
}
getSession() {
return this._session
}
update(e) {
if (!e) return this;
if (typeof e == "function") {
var n = e(this);
return n instanceof er ? n : this
}
return e instanceof er ? (this._tags = {
...this._tags,
...e._tags
}, this._extra = {
...this._extra,
...e._extra
}, this._contexts = {
...this._contexts,
...e._contexts
}, e._user && Object.keys(e._user).length && (this._user = e._user), e._level && (this._level = e._level), e._fingerprint && (this._fingerprint = e._fingerprint), e._requestSession && (this._requestSession = e._requestSession)) : Pi(e) && (e = e, this._tags = {
...this._tags,
...e.tags
}, this._extra = {
...this._extra,
...e.extra
}, this._contexts = {
...this._contexts,
...e.contexts
}, e.user && (this._user = e.user), e.level && (this._level = e.level), e.fingerprint && (this._fingerprint = e.fingerprint), e.requestSession && (this._requestSession = e.requestSession)), this
}
clear() {
return this._breadcrumbs = [], this._tags = {}, this._extra = {}, this._user = {}, this._contexts = {}, this._level = void 0, this._transactionName = void 0, this._fingerprint = void 0, this._requestSession = void 0, this._span = void 0, this._session = void 0, this._notifyScopeListeners(), this._attachments = [], this
}
addBreadcrumb(e, n) {
var r = typeof n == "number" ? Math.min(n, dm) : dm;
if (r <= 0) return this;
var i = {
timestamp: Pa(),
...e
};
return this._breadcrumbs = [...this._breadcrumbs, i].slice(-r), this._notifyScopeListeners(), this
}
clearBreadcrumbs() {
return this._breadcrumbs = [], this._notifyScopeListeners(), this
}
addAttachment(e) {
return this._attachments.push(e), this
}
getAttachments() {
return this._attachments
}
clearAttachments() {
return this._attachments = [], this
}
applyToEvent(e, n = {}) {
if (this._extra && Object.keys(this._extra).length && (e.extra = {
...this._extra,
...e.extra
}), this._tags && Object.keys(this._tags).length && (e.tags = {
...this._tags,
...e.tags
}), this._user && Object.keys(this._user).length && (e.user = {
...this._user,
...e.user
}), this._contexts && Object.keys(this._contexts).length && (e.contexts = {
...this._contexts,
...e.contexts
}), this._level && (e.level = this._level), this._transactionName && (e.transaction = this._transactionName), this._span) {
e.contexts = {
trace: this._span.getTraceContext(),
...e.contexts
};
var r = this._span.transaction && this._span.transaction.name;
r && (e.tags = {
transaction: r,
...e.tags
})
}
return this._applyFingerprint(e), e.breadcrumbs = [...e.breadcrumbs || [], ...this._breadcrumbs], e.breadcrumbs = e.breadcrumbs.length > 0 ? e.breadcrumbs : void 0, e.sdkProcessingMetadata = {
...e.sdkProcessingMetadata,
...this._sdkProcessingMetadata
}, this._notifyEventProcessors([...pm(), ...this._eventProcessors], e, n)
}
setSDKProcessingMetadata(e) {
return this._sdkProcessingMetadata = {
...this._sdkProcessingMetadata,
...e
}, this
}
_notifyEventProcessors(e, n, r, i = 0) {
return new _t((s, d) => {
var a = e[i];
if (n === null || typeof a != "function") s(n);
else {
var o = a({
...n
}, r);
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && a.id && o === null && Te.log(`Event processor "${a.id}" dropped event`), _u(o) ? o.then(c => this._notifyEventProcessors(e, c, r, i + 1).then(s)).then(null, d) : this._notifyEventProcessors(e, o, r, i + 1).then(s).then(null, d)
}
})
}
_notifyScopeListeners() {
this._notifyingListeners || (this._notifyingListeners = !0, this._scopeListeners.forEach(e => {
e(this)
}), this._notifyingListeners = !1)
}
_applyFingerprint(e) {
e.fingerprint = e.fingerprint ? om(e.fingerprint) : [], this._fingerprint && (e.fingerprint = e.fingerprint.concat(this._fingerprint)), e.fingerprint && !e.fingerprint.length && delete e.fingerprint
}
}
function pm() {
return wu("globalEventProcessors", () => [])
}
function $u(t) {
pm().push(t)
}
var Vu = 4,
_C = 100;
class Bo {
__init() {
this._stack = [{}]
}
constructor(e, n = new er, r = Vu) {
this._version = r, Bo.prototype.__init.call(this), this.getStackTop().scope = n, e && this.bindClient(e)
}
isOlderThan(e) {
return this._version < e
}
bindClient(e) {
var n = this.getStackTop();
n.client = e, e && e.setupIntegrations && e.setupIntegrations()
}
pushScope() {
var e = er.clone(this.getScope());
return this.getStack().push({
client: this.getClient(),
scope: e
}), e
}
popScope() {
return this.getStack().length <= 1 ? !1 : !!this.getStack().pop()
}
withScope(e) {
var n = this.pushScope();
try {
e(n)
} finally {
this.popScope()
}
}
getClient() {
return this.getStackTop().client
}
getScope() {
return this.getStackTop().scope
}
getStack() {
return this._stack
}
getStackTop() {
return this._stack[this._stack.length - 1]
}
captureException(e, n) {
var r = this._lastEventId = n && n.event_id ? n.event_id : Mi(),
i = new Error("Sentry syntheticException");
return this._withClient((s, d) => {
s.captureException(e, {
originalException: e,
syntheticException: i,
...n,
event_id: r
}, d)
}), r
}
captureMessage(e, n, r) {
var i = this._lastEventId = r && r.event_id ? r.event_id : Mi(),
s = new Error(e);
return this._withClient((d, a) => {
d.captureMessage(e, n, {
originalException: e,
syntheticException: s,
...r,
event_id: i
}, a)
}), i
}
captureEvent(e, n) {
var r = n && n.event_id ? n.event_id : Mi();
return e.type !== "transaction" && (this._lastEventId = r), this._withClient((i, s) => {
i.captureEvent(e, {
...n,
event_id: r
}, s)
}), r
}
lastEventId() {
return this._lastEventId
}
addBreadcrumb(e, n) {
const {
scope: r,
client: i
} = this.getStackTop();
if (!r || !i) return;
const {
beforeBreadcrumb: s = null,
maxBreadcrumbs: d = _C
} = i.getOptions && i.getOptions() || {};
if (!(d <= 0)) {
var a = Pa(),
o = {
timestamp: a,
...e
},
c = s ? Yg(() => s(o, n)) : o;
c !== null && r.addBreadcrumb(c, d)
}
}
setUser(e) {
var n = this.getScope();
n && n.setUser(e)
}
setTags(e) {
var n = this.getScope();
n && n.setTags(e)
}
setExtras(e) {
var n = this.getScope();
n && n.setExtras(e)
}
setTag(e, n) {
var r = this.getScope();
r && r.setTag(e, n)
}
setExtra(e, n) {
var r = this.getScope();
r && r.setExtra(e, n)
}
setContext(e, n) {
var r = this.getScope();
r && r.setContext(e, n)
}
configureScope(e) {
const {
scope: n,
client: r
} = this.getStackTop();
n && r && e(n)
}
run(e) {
var n = gm(this);
try {
e(this)
} finally {
gm(n)
}
}
getIntegration(e) {
var n = this.getClient();
if (!n) return null;
try {
return n.getIntegration(e)
} catch {
return (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn(`Cannot retrieve integration ${e.id} from the current Hub`), null
}
}
startTransaction(e, n) {
return this._callExtensionMethod("startTransaction", e, n)
}
traceHeaders() {
return this._callExtensionMethod("traceHeaders")
}
captureSession(e = !1) {
if (e) return this.endSession();
this._sendSessionUpdate()
}
endSession() {
var e = this.getStackTop(),
n = e && e.scope,
r = n && n.getSession();
r && wC(r), this._sendSessionUpdate(), n && n.setSession()
}
startSession(e) {
const {
scope: n,
client: r
} = this.getStackTop(), {
release: i,
environment: s
} = r && r.getOptions() || {};
var d = Xe();
const {
userAgent: a
} = d.navigator || {};
var o = bC({
release: i,
environment: s,
...n && {
user: n.getUser()
},
...a && {
userAgent: a
},
...e
});
if (n) {
var c = n.getSession && n.getSession();
c && c.status === "ok" && Ai(c, {
status: "exited"
}), this.endSession(), n.setSession(o)
}
return o
}
shouldSendDefaultPii() {
var e = this.getClient(),
n = e && e.getOptions();
return Boolean(n && n.sendDefaultPii)
}
_sendSessionUpdate() {
const {
scope: e,
client: n
} = this.getStackTop();
if (!!e) {
var r = e.getSession();
r && n && n.captureSession && n.captureSession(r)
}
}
_withClient(e) {
const {
scope: n,
client: r
} = this.getStackTop();
r && e(r, n)
}
_callExtensionMethod(e, ...n) {
var r = Aa(),
i = r.__SENTRY__;
if (i && i.extensions && typeof i.extensions[e] == "function") return i.extensions[e].apply(this, n);
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn(`Extension method ${e} couldn't be found, doing nothing.`)
}
}
function Aa() {
var t = Xe();
return t.__SENTRY__ = t.__SENTRY__ || {
extensions: {},
hub: void 0
}, t
}
function gm(t) {
var e = Aa(),
n = tr(e);
return Hu(e, t), n
}
function ot() {
var t = Aa();
return (!mm(t) || tr(t).isOlderThan(Vu)) && Hu(t, new Bo), sm() ? SC(t) : tr(t)
}
function SC(t) {
try {
var e = Aa().__SENTRY__,
n = e && e.extensions && e.extensions.domain && e.extensions.domain.active;
if (!n) return tr(t);
if (!mm(n) || tr(n).isOlderThan(Vu)) {
var r = tr(t).getStackTop();
Hu(n, new Bo(r.client, er.clone(r.scope)))
}
return tr(n)
} catch {
return tr(t)
}
}
function mm(t) {
return !!(t && t.__SENTRY__ && t.__SENTRY__.hub)
}
function tr(t) {
return wu("hub", () => new Bo, t)
}
function Hu(t, e) {
if (!t) return !1;
var n = t.__SENTRY__ = t.__SENTRY__ || {};
return n.hub = e, !0
}
function CC(t, e) {
return ot().captureException(t, {
captureContext: e
})
}
function TC(t) {
ot().withScope(t)
}
var kC = "7";
function EC(t) {
var e = t.protocol ? `${t.protocol}:` : "",
n = t.port ? `:${t.port}` : "";
return `${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`
}
function OC(t) {
return `${EC(t)}${t.projectId}/envelope/`
}
function PC(t, e) {
return DS({
sentry_key: t.publicKey,
sentry_version: kC,
...e && {
sentry_client: `${e.name}/${e.version}`
}
})
}
function vm(t, e = {}) {
var n = typeof e == "string" ? e : e.tunnel,
r = typeof e == "string" || !e._metadata ? void 0 : e._metadata.sdk;
return n || `${OC(t)}?${PC(t,r)}`
}
function ym(t) {
if (!t || !t.sdk) return;
const {
name: e,
version: n
} = t.sdk;
return {
name: e,
version: n
}
}
function MC(t, e) {
return e && (t.sdk = t.sdk || {}, t.sdk.name = t.sdk.name || e.name, t.sdk.version = t.sdk.version || e.version, t.sdk.integrations = [...t.sdk.integrations || [], ...e.integrations || []], t.sdk.packages = [...t.sdk.packages || [], ...e.packages || []]), t
}
function AC(t, e, n, r) {
var i = ym(n),
s = {
sent_at: new Date().toISOString(),
...i && {
sdk: i
},
...!!r && {
dsn: Cu(e)
}
},
d = "aggregates" in t ? [{
type: "sessions"
}, t] : [{
type: "session"
}, t];
return Ma(s, [d])
}
function DC(t, e, n, r) {
var i = ym(n),
s = t.type || "event";
MC(t, n && n.sdk);
var d = RC(t, i, r, e);
delete t.sdkProcessingMetadata;
var a = [{
type: s
}, t];
return Ma(d, [a])
}
function RC(t, e, n, r) {
var i = t.sdkProcessingMetadata && t.sdkProcessingMetadata.dynamicSamplingContext;
return {
event_id: t.event_id,
sent_at: new Date().toISOString(),
...e && {
sdk: e
},
...!!n && {
dsn: Cu(r)
},
...t.type === "transaction" && i && {
trace: Ou({
...i
})
}
}
}
var bm = [];
function IC(t) {
var e = {};
return t.forEach(n => {
const {
name: r
} = n;
var i = e[r];
i && !i.isDefaultInstance && n.isDefaultInstance || (e[r] = n)
}), Object.values(e)
}
function LC(t) {
var e = t.defaultIntegrations || [],
n = t.integrations;
e.forEach(d => {
d.isDefaultInstance = !0
});
let r;
Array.isArray(n) ? r = [...e, ...n] : typeof n == "function" ? r = om(n(e)) : r = e;
var i = IC(r),
s = i.findIndex(d => d.name === "Debug");
if (s !== -1) {
const [d] = i.splice(s, 1);
i.push(d)
}
return i
}
function FC(t) {
var e = {};
return t.forEach(n => {
e[n.name] = n, bm.indexOf(n.name) === -1 && (n.setupOnce($u, ot), bm.push(n.name), (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.log(`Integration installed: ${n.name}`))
}), e
}
var wm = "Not capturing exception because it's already been captured.";
class Di {
__init() {
this._integrations = {}
}
__init2() {
this._integrationsInitialized = !1
}
__init3() {
this._numProcessing = 0
}
__init4() {
this._outcomes = {}
}
constructor(e) {
if (Di.prototype.__init.call(this), Di.prototype.__init2.call(this), Di.prototype.__init3.call(this), Di.prototype.__init4.call(this), this._options = e, e.dsn) {
this._dsn = PS(e.dsn);
var n = vm(this._dsn, e);
this._transport = e.transport({
recordDroppedEvent: this.recordDroppedEvent.bind(this),
...e.transportOptions,
url: n
})
} else(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn("No DSN provided, client will not do anything.")
}
captureException(e, n, r) {
if (im(e)) {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.log(wm);
return
}
let i = n && n.event_id;
return this._process(this.eventFromException(e, n).then(s => this._captureEvent(s, n, r)).then(s => {
i = s
})), i
}
captureMessage(e, n, r, i) {
let s = r && r.event_id;
var d = Ug(e) ? this.eventFromMessage(String(e), n, r) : this.eventFromException(e, r);
return this._process(d.then(a => this._captureEvent(a, r, i)).then(a => {
s = a
})), s
}
captureEvent(e, n, r) {
if (n && n.originalException && im(n.originalException)) {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.log(wm);
return
}
let i = n && n.event_id;
return this._process(this._captureEvent(e, n, r).then(s => {
i = s
})), i
}
captureSession(e) {
if (!this._isEnabled()) {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn("SDK not enabled, will not capture session.");
return
}
typeof e.release != "string" ? (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn("Discarded session because of missing or non-string release") : (this.sendSession(e), Ai(e, {
init: !1
}))
}
getDsn() {
return this._dsn
}
getOptions() {
return this._options
}
getTransport() {
return this._transport
}
flush(e) {
var n = this._transport;
return n ? this._isClientDoneProcessing(e).then(r => n.flush(e).then(i => r && i)) : Br(!0)
}
close(e) {
return this.flush(e).then(n => (this.getOptions().enabled = !1, n))
}
setupIntegrations() {
this._isEnabled() && !this._integrationsInitialized && (this._integrations = FC(this._options.integrations), this._integrationsInitialized = !0)
}
getIntegrationById(e) {
return this._integrations[e]
}
getIntegration(e) {
try {
return this._integrations[e.id] || null
} catch {
return (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn(`Cannot retrieve integration ${e.id} from the current Client`), null
}
}
sendEvent(e, n = {}) {
if (this._dsn) {
let i = DC(e, this._dsn, this._options._metadata, this._options.tunnel);
for (var r of n.attachments || []) i = cC(i, fC(r, this._options.transportOptions && this._options.transportOptions.textEncoder));
this._sendEnvelope(i)
}
}
sendSession(e) {
if (this._dsn) {
var n = AC(e, this._dsn, this._options._metadata, this._options.tunnel);
this._sendEnvelope(n)
}
}
recordDroppedEvent(e, n) {
if (this._options.sendClientReports) {
var r = `${e}:${n}`;
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.log(`Adding outcome: "${r}"`), this._outcomes[r] = this._outcomes[r] + 1 || 1
}
}
_updateSessionFromEvent(e, n) {
let r = !1,
i = !1;
var s = n.exception && n.exception.values;
if (s) {
i = !0;
for (var d of s) {
var a = d.mechanism;
if (a && a.handled === !1) {
r = !0;
break
}
}
}
var o = e.status === "ok",
c = o && e.errors === 0 || o && r;
c && (Ai(e, {
...r && {
status: "crashed"
},
errors: e.errors || Number(i || r)
}), this.captureSession(e))
}
_isClientDoneProcessing(e) {
return new _t(n => {
let r = 0;
var i = 1,
s = setInterval(() => {
this._numProcessing == 0 ? (clearInterval(s), n(!0)) : (r += i, e && r >= e && (clearInterval(s), n(!1)))
}, i)
})
}
_isEnabled() {
return this.getOptions().enabled !== !1 && this._dsn !== void 0
}
_prepareEvent(e, n, r) {
const {
normalizeDepth: i = 3,
normalizeMaxBreadth: s = 1e3
} = this.getOptions();
var d = {
...e,
event_id: e.event_id || n.event_id || Mi(),
timestamp: e.timestamp || Pa()
};
this._applyClientOptions(d), this._applyIntegrationsMetadata(d);
let a = r;
n.captureContext && (a = er.clone(a).update(n.captureContext));
let o = Br(d);
if (a) {
var c = [...n.attachments || [], ...a.getAttachments()];
c.length && (n.attachments = c), o = a.applyToEvent(d, n)
}
return o.then(h => typeof i == "number" && i > 0 ? this._normalizeEvent(h, i, s) : h)
}
_normalizeEvent(e, n, r) {
if (!e) return null;
var i = {
...e,
...e.breadcrumbs && {
breadcrumbs: e.breadcrumbs.map(s => ({
...s,
...s.data && {
data: jr(s.data, n, r)
}
}))
},
...e.user && {
user: jr(e.user, n, r)
},
...e.contexts && {
contexts: jr(e.contexts, n, r)
},
...e.extra && {
extra: jr(e.extra, n, r)
}
};
return e.contexts && e.contexts.trace && i.contexts && (i.contexts.trace = e.contexts.trace, e.contexts.trace.data && (i.contexts.trace.data = jr(e.contexts.trace.data, n, r))), e.spans && (i.spans = e.spans.map(s => (s.data && (s.data = jr(s.data, n, r)), s))), i
}
_applyClientOptions(e) {
var n = this.getOptions();
const {
environment: r,
release: i,
dist: s,
maxValueLength: d = 250
} = n;
"environment" in e || (e.environment = "environment" in n ? r : "production"), e.release === void 0 && i !== void 0 && (e.release = i), e.dist === void 0 && s !== void 0 && (e.dist = s), e.message && (e.message = zo(e.message, d));
var a = e.exception && e.exception.values && e.exception.values[0];
a && a.value && (a.value = zo(a.value, d));
var o = e.request;
o && o.url && (o.url = zo(o.url, d))
}
_applyIntegrationsMetadata(e) {
var n = Object.keys(this._integrations);
n.length > 0 && (e.sdk = e.sdk || {}, e.sdk.integrations = [...e.sdk.integrations || [], ...n])
}
_captureEvent(e, n = {}, r) {
return this._processEvent(e, n, r).then(i => i.event_id, i => {
if (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) {
var s = i;
s.logLevel === "log" ? Te.log(s.message) : Te.warn(s)
}
})
}
_processEvent(e, n, r) {
const {
beforeSend: i,
sampleRate: s
} = this.getOptions();
if (!this._isEnabled()) return Fu(new dt("SDK not enabled, will not capture event.", "log"));
var d = e.type === "transaction";
return !d && typeof s == "number" && Math.random() > s ? (this.recordDroppedEvent("sample_rate", "error"), Fu(new dt(`Discarding event because it's not included in the random sample (sampling rate = ${s})`, "log"))) : this._prepareEvent(e, n, r).then(a => {
if (a === null) throw this.recordDroppedEvent("event_processor", e.type || "error"), new dt("An event processor returned null, will not send event.", "log");
var o = n.data && n.data.__sentry__ === !0;
if (o || d || !i) return a;
var c = i(a, n);
return zC(c)
}).then(a => {
if (a === null) throw this.recordDroppedEvent("before_send", e.type || "error"), new dt("`beforeSend` returned `null`, will not send event.", "log");
var o = r && r.getSession();
!d && o && this._updateSessionFromEvent(o, a);
var c = a.transaction_info;
if (d && c && a.transaction !== e.transaction) {
var h = "custom";
a.transaction_info = {
...c,
source: h,
changes: [...c.changes, {
source: h,
timestamp: a.timestamp,
propagations: c.propagations
}]
}
}
return this.sendEvent(a, n), a
}).then(null, a => {
throw a instanceof dt ? a : (this.captureException(a, {
data: {
__sentry__: !0
},
originalException: a
}), new dt(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
Reason: ${a}`))
})
}
_process(e) {
this._numProcessing += 1, e.then(n => (this._numProcessing -= 1, n), n => (this._numProcessing -= 1, n))
}
_sendEnvelope(e) {
this._transport && this._dsn ? this._transport.send(e).then(null, n => {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.error("Error while sending event:", n)
}) : (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.error("Transport disabled")
}
_clearOutcomes() {
var e = this._outcomes;
return this._outcomes = {}, Object.keys(e).map(n => {
const [r, i] = n.split(":");
return {
reason: r,
category: i,
quantity: e[n]
}
})
}
}
function zC(t) {
var e = "`beforeSend` method has to return `null` or a valid event.";
if (_u(t)) return t.then(n => {
if (!(Pi(n) || n === null)) throw new dt(e);
return n
}, n => {
throw new dt(`beforeSend rejected with ${n}`)
});
if (!(Pi(t) || t === null)) throw new dt(e);
return t
}
function NC(t, e) {
e.debug === !0 && (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__ ? Te.enable() : console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle."));
var n = ot(),
r = n.getScope();
r && r.update(e.initialScope);
var i = new t(e);
n.bindClient(i)
}
var jC = 30;
function xm(t, e, n = iC(t.bufferSize || jC)) {
let r = {};
var i = d => n.drain(d);
function s(d) {
var a = [];
if (um(d, (l, u) => {
var f = hm(u);
vC(r, f) ? t.recordDroppedEvent("ratelimit_backoff", f) : a.push(l)
}), a.length === 0) return Br();
var o = Ma(d[0], a),
c = l => {
um(o, (u, f) => {
t.recordDroppedEvent(l, hm(f))
})
},
h = () => e({
body: fm(o, t.textEncoder)
}).then(l => {
l.statusCode !== void 0 && (l.statusCode < 200 || l.statusCode >= 300) && (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn(`Sentry responded with status code ${l.statusCode} to sent event.`), r = yC(r, l)
}, l => {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.error("Failed while sending event:", l), c("network_error")
});
return n.add(h).then(l => l, l => {
if (l instanceof dt) return (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.error("Skipped sending event because buffer is full."), c("queue_overflow"), Br();
throw l
})
}
return {
send: s,
flush: i
}
}
var Da = "7.14.0";
let _m;
class $o {
constructor() {
$o.prototype.__init.call(this)
}
static __initStatic() {
this.id = "FunctionToString"
}
__init() {
this.name = $o.id
}
setupOnce() {
_m = Function.prototype.toString, Function.prototype.toString = function(...e) {
var n = Eu(this) || this;
return _m.apply(n, e)
}
}
}
$o.__initStatic();
var BC = [/^Script error\.?$/, /^Javascript error: Script error\.? on line 0$/];
class Ri {
static __initStatic() {
this.id = "InboundFilters"
}
__init() {
this.name = Ri.id
}
constructor(e = {}) {
this._options = e, Ri.prototype.__init.call(this)
}
setupOnce(e, n) {
var r = i => {
var s = n();
if (s) {
var d = s.getIntegration(Ri);
if (d) {
var a = s.getClient(),
o = a ? a.getOptions() : {},
c = $C(d._options, o);
return VC(i, c) ? null : i
}
}
return i
};
r.id = this.name, e(r)
}
}
Ri.__initStatic();
function $C(t = {}, e = {}) {
return {
allowUrls: [...t.allowUrls || [], ...e.allowUrls || []],
denyUrls: [...t.denyUrls || [], ...e.denyUrls || []],
ignoreErrors: [...t.ignoreErrors || [], ...e.ignoreErrors || [], ...BC],
ignoreInternal: t.ignoreInternal !== void 0 ? t.ignoreInternal : !0
}
}
function VC(t, e) {
return e.ignoreInternal && XC(t) ? ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn(`Event dropped due to being internal Sentry Error.
Event: ${Nr(t)}`), !0) : HC(t, e.ignoreErrors) ? ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
Event: ${Nr(t)}`), !0) : UC(t, e.denyUrls) ? ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn(`Event dropped due to being matched by \`denyUrls\` option.
Event: ${Nr(t)}.
Url: ${Ra(t)}`), !0) : WC(t, e.allowUrls) ? !1 : ((typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn(`Event dropped due to not being matched by \`allowUrls\` option.
Event: ${Nr(t)}.
Url: ${Ra(t)}`), !0)
}
function HC(t, e) {
return !e || !e.length ? !1 : YC(t).some(n => e.some(r => Tu(n, r)))
}
function UC(t, e) {
if (!e || !e.length) return !1;
var n = Ra(t);
return n ? e.some(r => Tu(n, r)) : !1
}
function WC(t, e) {
if (!e || !e.length) return !0;
var n = Ra(t);
return n ? e.some(r => Tu(n, r)) : !0
}
function YC(t) {
if (t.message) return [t.message];
if (t.exception) try {
const {
type: e = "",
value: n = ""
} = t.exception.values && t.exception.values[0] || {};
return [`${n}`, `${e}: ${n}`]
} catch {
return (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.error(`Cannot extract message for event ${Nr(t)}`), []
}
return []
}
function XC(t) {
try {
return t.exception.values[0].type === "SentryError"
} catch {}
return !1
}
function GC(t = []) {
for (let n = t.length - 1; n >= 0; n--) {
var e = t[n];
if (e && e.filename !== "<anonymous>" && e.filename !== "[native code]") return e.filename || null
}
return null
}
function Ra(t) {
try {
let e;
try {
e = t.exception.values[0].stacktrace.frames
} catch {}
return e ? GC(e) : null
} catch {
return (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.error(`Cannot extract url for event ${Nr(t)}`), null
}
}
function Sm(t, e) {
var n = Wu(t, e),
r = {
type: e && e.name,
value: QC(e)
};
return n.length && (r.stacktrace = {
frames: n
}), r.type === void 0 && r.value === "" && (r.value = "Unrecoverable error caught"), r
}
function KC(t, e, n, r) {
var i = ot(),
s = i.getClient(),
d = s && s.getOptions().normalizeDepth,
a = {
exception: {
values: [{
type: xu(e) ? e.constructor.name : r ? "UnhandledRejection" : "Error",
value: `Non-Error ${r?"promise rejection":"exception"} captured with keys: ${RS(e)}`
}]
},
extra: {
__serialized__: am(e, d)
}
};
if (n) {
var o = Wu(t, n);
o.length && (a.exception.values[0].stacktrace = {
frames: o
})
}
return a
}
function Uu(t, e) {
return {
exception: {
values: [Sm(t, e)]
}
}
}
function Wu(t, e) {
var n = e.stacktrace || e.stack || "",
r = ZC(e);
try {
return t(n, r)
} catch {}
return []
}
var qC = /Minified React error #\d+;/i;
function ZC(t) {
if (t) {
if (typeof t.framesToPop == "number") return t.framesToPop;
if (qC.test(t.message)) return 1
}
return 0
}
function QC(t) {
var e = t && t.message;
return e ? e.error && typeof e.error.message == "string" ? e.error.message : e : "No error message"
}
function JC(t, e, n, r) {
var i = n && n.syntheticException || void 0,
s = Yu(t, e, i, r);
return jo(s), s.level = "error", n && n.event_id && (s.event_id = n.event_id), Br(s)
}
function eT(t, e, n = "info", r, i) {
var s = r && r.syntheticException || void 0,
d = Xu(t, e, s, i);
return d.level = n, r && r.event_id && (d.event_id = r.event_id), Br(d)
}
function Yu(t, e, n, r, i) {
let s;
if (Vg(e) && e.error) {
var d = e;
return Uu(t, d.error)
}
if (Hg(e) || yS(e)) {
var a = e;
if ("stack" in e) s = Uu(t, e);
else {
var o = a.name || (Hg(a) ? "DOMError" : "DOMException"),
c = a.message ? `${o}: ${a.message}` : o;
s = Xu(t, c, n, r), Iu(s, c)
}
return "code" in a && (s.tags = {
...s.tags,
"DOMException.code": `${a.code}`
}), s
}
if ($g(e)) return Uu(t, e);
if (Pi(e) || xu(e)) {
var h = e;
return s = KC(t, h, n, i), jo(s, {
synthetic: !0
}), s
}
return s = Xu(t, e, n, r), Iu(s, `${e}`, void 0), jo(s, {
synthetic: !0
}), s
}
function Xu(t, e, n, r) {
var i = {
message: e
};
if (r && n) {
var s = Wu(t, n);
s.length && (i.exception = {
values: [{
value: e,
stacktrace: {
frames: s
}
}]
})
}
return i
}
var Cm = "Breadcrumbs";
class Vo {
static __initStatic() {
this.id = Cm
}
__init() {
this.name = Vo.id
}
constructor(e) {
Vo.prototype.__init.call(this), this.options = {
console: !0,
dom: !0,
fetch: !0,
history: !0,
sentry: !0,
xhr: !0,
...e
}
}
setupOnce() {
this.options.console && Jn("console", nT), this.options.dom && Jn("dom", tT(this.options.dom)), this.options.xhr && Jn("xhr", rT), this.options.fetch && Jn("fetch", iT), this.options.history && Jn("history", oT)
}
}
Vo.__initStatic();
function tT(t) {
function e(n) {
let r, i = typeof t == "object" ? t.serializeAttribute : void 0;
typeof i == "string" && (i = [i]);
try {
r = n.event.target ? Su(n.event.target, i) : Su(n.event, i)
} catch {
r = "<unknown>"
}
r.length !== 0 && ot().addBreadcrumb({
category: `ui.${n.name}`,
message: r
}, {
event: n.event,
name: n.name,
global: n.global
})
}
return e
}
function nT(t) {
var e = {
category: "console",
data: {
arguments: t.args,
logger: "console"
},
level: sC(t.level),
message: Gg(t.args, " ")
};
if (t.level === "assert")
if (t.args[0] === !1) e.message = `Assertion failed: ${Gg(t.args.slice(1)," ")||"console.assert"}`, e.data.arguments = t.args.slice(1);
else return;
ot().addBreadcrumb(e, {
input: t.args,
level: t.level
})
}
function rT(t) {
if (t.endTimestamp) {
if (t.xhr.__sentry_own_request__) return;
const {
method: e,
url: n,
status_code: r,
body: i
} = t.xhr.__sentry_xhr__ || {};
ot().addBreadcrumb({
category: "xhr",
data: {
method: e,
url: n,
status_code: r
},
type: "http"
}, {
xhr: t.xhr,
input: i
});
return
}
}
function iT(t) {
!t.endTimestamp || t.fetchData.url.match(/sentry_key/) && t.fetchData.method === "POST" || (t.error ? ot().addBreadcrumb({
category: "fetch",
data: t.fetchData,
level: "error",
type: "http"
}, {
data: t.error,
input: t.args
}) : ot().addBreadcrumb({
category: "fetch",
data: {
...t.fetchData,
status_code: t.response.status
},
type: "http"
}, {
input: t.args,
response: t.response
}))
}
function oT(t) {
var e = Xe();
let n = t.from,
r = t.to;
var i = zu(e.location.href);
let s = zu(n);
var d = zu(r);
s.path || (s = i), i.protocol === d.protocol && i.host === d.host && (r = d.relative), i.protocol === s.protocol && i.host === s.host && (n = s.relative), ot().addBreadcrumb({
category: "navigation",
data: {
from: n,
to: r
}
})
}
var Gu = Xe();
class sT extends Di {
constructor(e) {
e._metadata = e._metadata || {}, e._metadata.sdk = e._metadata.sdk || {
name: "sentry.javascript.browser",
packages: [{
name: "npm:@sentry/browser",
version: Da
}],
version: Da
}, super(e), e.sendClientReports && Gu.document && Gu.document.addEventListener("visibilitychange", () => {
Gu.document.visibilityState === "hidden" && this._flushOutcomes()
})
}
eventFromException(e, n) {
return JC(this._options.stackParser, e, n, this._options.attachStacktrace)
}
eventFromMessage(e, n = "info", r) {
return eT(this._options.stackParser, e, n, r, this._options.attachStacktrace)
}
sendEvent(e, n) {
var r = this.getIntegrationById(Cm);
r && r.options && r.options.sentry && ot().addBreadcrumb({
category: `sentry.${e.type==="transaction"?"transaction":"event"}`,
event_id: e.event_id,
level: e.level,
message: Nr(e)
}, {
event: e
}), super.sendEvent(e, n)
}
_prepareEvent(e, n, r) {
return e.platform = e.platform || "javascript", super._prepareEvent(e, n, r)
}
_flushOutcomes() {
var e = this._clearOutcomes();
if (e.length === 0) {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.log("No outcomes to send");
return
}
if (!this._dsn) {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.log("No dsn provided, will not send outcomes");
return
}(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.log("Sending outcomes:", e);
var n = vm(this._dsn, this._options),
r = dC(e, this._options.tunnel && Cu(this._dsn));
try {
var i = Xe(),
s = Object.prototype.toString.call(i && i.navigator) === "[object Navigator]",
d = s && typeof i.navigator.sendBeacon == "function";
if (d && !this._options.transportOptions) {
var a = i.navigator.sendBeacon.bind(i.navigator);
a(n, fm(r))
} else this._sendEnvelope(r)
} catch (o) {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.error(o)
}
}
}
var Ii = Xe();
let Ia;
function aT() {
if (Ia) return Ia;
if (Au(Ii.fetch)) return Ia = Ii.fetch.bind(Ii);
var t = Ii.document;
let e = Ii.fetch;
if (t && typeof t.createElement == "function") try {
var n = t.createElement("iframe");
n.hidden = !0, t.head.appendChild(n);
var r = n.contentWindow;
r && r.fetch && (e = r.fetch), t.head.removeChild(n)
} catch (i) {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ", i)
}
return Ia = e.bind(Ii)
}
function lT(t, e = aT()) {
function n(r) {
var i = {
body: r.body,
method: "POST",
referrerPolicy: "origin",
headers: t.headers,
keepalive: r.body.length <= 65536,
...t.fetchOptions
};
return e(t.url, i).then(s => ({
statusCode: s.status,
headers: {
"x-sentry-rate-limits": s.headers.get("X-Sentry-Rate-Limits"),
"retry-after": s.headers.get("Retry-After")
}
}))
}
return xm(t, n)
}
var cT = 4;
function uT(t) {
function e(n) {
return new _t((r, i) => {
var s = new XMLHttpRequest;
s.onerror = i, s.onreadystatechange = () => {
s.readyState === cT && r({
statusCode: s.status,
headers: {
"x-sentry-rate-limits": s.getResponseHeader("X-Sentry-Rate-Limits"),
"retry-after": s.getResponseHeader("Retry-After")
}
})
}, s.open("POST", t.url);
for (var d in t.headers) Object.prototype.hasOwnProperty.call(t.headers, d) && s.setRequestHeader(d, t.headers[d]);
s.send(n.body)
})
}
return xm(t, e)
}
var La = "?",
fT = 30,
hT = 40,
dT = 50;
function Ku(t, e, n, r) {
var i = {
filename: t,
function: e,
in_app: !0
};
return n !== void 0 && (i.lineno = n), r !== void 0 && (i.colno = r), i
}
var pT = /^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,
gT = /\((\S*)(?::(\d+))(?::(\d+))\)/,
mT = t => {
var e = pT.exec(t);
if (e) {
var n = e[2] && e[2].indexOf("eval") === 0;
if (n) {
var r = gT.exec(e[2]);
r && (e[2] = r[1], e[3] = r[2], e[4] = r[3])
}
const [i, s] = Tm(e[1] || La, e[2]);
return Ku(s, i, e[3] ? +e[3] : void 0, e[4] ? +e[4] : void 0)
}
},
vT = [fT, mT],
yT = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,
bT = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i,
wT = t => {
var e = yT.exec(t);
if (e) {
var n = e[3] && e[3].indexOf(" > eval") > -1;
if (n) {
var r = bT.exec(e[3]);
r && (e[1] = e[1] || "eval", e[3] = r[1], e[4] = r[2], e[5] = "")
}
let i = e[3],
s = e[1] || La;
return [s, i] = Tm(s, i), Ku(i, s, e[4] ? +e[4] : void 0, e[5] ? +e[5] : void 0)
}
},
xT = [dT, wT],
_T = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
ST = t => {
var e = _T.exec(t);
return e ? Ku(e[2], e[1] || La, +e[3], e[4] ? +e[4] : void 0) : void 0
},
CT = [hT, ST],
TT = [vT, xT, CT],
kT = Jg(...TT),
Tm = (t, e) => {
var n = t.indexOf("safari-extension") !== -1,
r = t.indexOf("safari-web-extension") !== -1;
return n || r ? [t.indexOf("@") !== -1 ? t.split("@")[0] : La, n ? `safari-extension:${e}` : `safari-web-extension:${e}`] : [t, e]
};
let qu = 0;
function km() {
return qu > 0
}
function ET() {
qu += 1, setTimeout(() => {
qu -= 1
})
}
function Li(t, e = {}, n) {
if (typeof t != "function") return t;
try {
var r = t.__sentry_wrapped__;
if (r) return r;
if (Eu(t)) return t
} catch {
return t
}
var i = function() {
var a = Array.prototype.slice.call(arguments);
try {
n && typeof n == "function" && n.apply(this, arguments);
var o = a.map(c => Li(c, e));
return t.apply(this, o)
} catch (c) {
throw ET(), TC(h => {
h.addEventProcessor(l => (e.mechanism && (Iu(l, void 0, void 0), jo(l, e.mechanism)), l.extra = {
...l.extra,
arguments: a
}, l)), CC(c)
}), c
}
};
try {
for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && (i[s] = t[s])
} catch {}
Kg(i, t), ku(t, "__sentry_wrapped__", i);
try {
var d = Object.getOwnPropertyDescriptor(i, "name");
d.configurable && Object.defineProperty(i, "name", {
get() {
return t.name
}
})
} catch {}
return i
}
class nr {
static __initStatic() {
this.id = "GlobalHandlers"
}
__init() {
this.name = nr.id
}
__init2() {
this._installFunc = {
onerror: OT,
onunhandledrejection: PT
}
}
constructor(e) {
nr.prototype.__init.call(this), nr.prototype.__init2.call(this), this._options = {
onerror: !0,
onunhandledrejection: !0,
...e
}
}
setupOnce() {
Error.stackTraceLimit = 50;
var e = this._options;
for (var n in e) {
var r = this._installFunc[n];
r && e[n] && (DT(n), r(), this._installFunc[n] = void 0)
}
}
}
nr.__initStatic();
function OT() {
Jn("error", t => {
const [e, n, r] = Pm();
if (!e.getIntegration(nr)) return;
const {
msg: i,
url: s,
line: d,
column: a,
error: o
} = t;
if (!(km() || o && o.__sentry_own_request__)) {
var c = o === void 0 && Oi(i) ? AT(i, s, d, a) : Em(Yu(n, o || i, void 0, r, !1), s, d, a);
c.level = "error", Om(e, o, c, "onerror")
}
})
}
function PT() {
Jn("unhandledrejection", t => {
const [e, n, r] = Pm();
if (!e.getIntegration(nr)) return;
let i = t;
try {
"reason" in t ? i = t.reason : "detail" in t && "reason" in t.detail && (i = t.detail.reason)
} catch {}
if (km() || i && i.__sentry_own_request__) return !0;
var s = Ug(i) ? MT(i) : Yu(n, i, void 0, r, !0);
s.level = "error", Om(e, i, s, "onunhandledrejection")
})
}
function MT(t) {
return {
exception: {
values: [{
type: "UnhandledRejection",
value: `Non-Error promise rejection captured with value: ${String(t)}`
}]
}
}
}
function AT(t, e, n, r) {
var i = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
let s = Vg(t) ? t.message : t,
d = "Error";
var a = s.match(i);
a && (d = a[1], s = a[2]);
var o = {
exception: {
values: [{
type: d,
value: s
}]
}
};
return Em(o, e, n, r)
}
function Em(t, e, n, r) {
var i = t.exception = t.exception || {},
s = i.values = i.values || [],
d = s[0] = s[0] || {},
a = d.stacktrace = d.stacktrace || {},
o = a.frames = a.frames || [],
c = isNaN(parseInt(r, 10)) ? void 0 : r,
h = isNaN(parseInt(n, 10)) ? void 0 : n,
l = Oi(e) && e.length > 0 ? e : CS();
return o.length === 0 && o.push({
colno: c,
filename: l,
function: "?",
in_app: !0,
lineno: h
}), t
}
function DT(t) {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.log(`Global Handler attached: ${t}`)
}
function Om(t, e, n, r) {
jo(n, {
handled: !1,
type: r
}), t.captureEvent(n, {
originalException: e
})
}
function Pm() {
var t = ot(),
e = t.getClient(),
n = e && e.getOptions() || {
stackParser: () => [],
attachStacktrace: !1
};
return [t, n.stackParser, n.attachStacktrace]
}
var RT = ["EventTarget", "Window", "Node", "ApplicationCache", "AudioTrackList", "ChannelMergerNode", "CryptoOperation", "EventSource", "FileReader", "HTMLUnknownElement", "IDBDatabase", "IDBRequest", "IDBTransaction", "KeyOperation", "MediaController", "MessagePort", "ModalWindow", "Notification", "SVGElementInstance", "Screen", "TextTrack", "TextTrackCue", "TextTrackList", "WebSocket", "WebSocketWorker", "Worker", "XMLHttpRequest", "XMLHttpRequestEventTarget", "XMLHttpRequestUpload"];
class Ho {
static __initStatic() {
this.id = "TryCatch"
}
__init() {
this.name = Ho.id
}
constructor(e) {
Ho.prototype.__init.call(this), this._options = {
XMLHttpRequest: !0,
eventTarget: !0,
requestAnimationFrame: !0,
setInterval: !0,
setTimeout: !0,
...e
}
}
setupOnce() {
var e = Xe();
this._options.setTimeout && pt(e, "setTimeout", Mm), this._options.setInterval && pt(e, "setInterval", Mm), this._options.requestAnimationFrame && pt(e, "requestAnimationFrame", IT), this._options.XMLHttpRequest && "XMLHttpRequest" in e && pt(XMLHttpRequest.prototype, "send", LT);
var n = this._options.eventTarget;
if (n) {
var r = Array.isArray(n) ? n : RT;
r.forEach(FT)
}
}
}
Ho.__initStatic();
function Mm(t) {
return function(...e) {
var n = e[0];
return e[0] = Li(n, {
mechanism: {
data: {
function: Qn(t)
},
handled: !0,
type: "instrument"
}
}), t.apply(this, e)
}
}
function IT(t) {
return function(e) {
return t.apply(this, [Li(e, {
mechanism: {
data: {
function: "requestAnimationFrame",
handler: Qn(t)
},
handled: !0,
type: "instrument"
}
})])
}
}
function LT(t) {
return function(...e) {
var n = this,
r = ["onload", "onerror", "onprogress", "onreadystatechange"];
return r.forEach(i => {
i in n && typeof n[i] == "function" && pt(n, i, function(s) {
var d = {
mechanism: {
data: {
function: i,
handler: Qn(s)
},
handled: !0,
type: "instrument"
}
},
a = Eu(s);
return a && (d.mechanism.data.handler = Qn(a)), Li(s, d)
})
}), t.apply(this, e)
}
}
function FT(t) {
var e = Xe(),
n = e[t] && e[t].prototype;
!n || !n.hasOwnProperty || !n.hasOwnProperty("addEventListener") || (pt(n, "addEventListener", function(r) {
return function(i, s, d) {
try {
typeof s.handleEvent == "function" && (s.handleEvent = Li(s.handleEvent, {
mechanism: {
data: {
function: "handleEvent",
handler: Qn(s),
target: t
},
handled: !0,
type: "instrument"
}
}))
} catch {}
return r.apply(this, [i, Li(s, {
mechanism: {
data: {
function: "addEventListener",
handler: Qn(s),
target: t
},
handled: !0,
type: "instrument"
}
}), d])
}
}), pt(n, "removeEventListener", function(r) {
return function(i, s, d) {
var a = s;
try {
var o = a && a.__sentry_wrapped__;
o && r.call(this, i, o, d)
} catch {}
return r.call(this, i, a, d)
}
}))
}
var zT = "cause",
NT = 5;
class Fi {
static __initStatic() {
this.id = "LinkedErrors"
}
__init() {
this.name = Fi.id
}
constructor(e = {}) {
Fi.prototype.__init.call(this), this._key = e.key || zT, this._limit = e.limit || NT
}
setupOnce() {
var e = ot().getClient();
!e || $u((n, r) => {
var i = ot().getIntegration(Fi);
return i ? jT(e.getOptions().stackParser, i._key, i._limit, n, r) : n
})
}
}
Fi.__initStatic();
function jT(t, e, n, r, i) {
if (!r.exception || !r.exception.values || !i || !Zn(i.originalException, Error)) return r;
var s = Am(t, n, i.originalException, e);
return r.exception.values = [...s, ...r.exception.values], r
}
function Am(t, e, n, r, i = []) {
if (!Zn(n[r], Error) || i.length + 1 >= e) return i;
var s = Sm(t, n[r]);
return Am(t, e, n[r], r, [s, ...i])
}
var $r = Xe();
class zi {
constructor() {
zi.prototype.__init.call(this)
}
static __initStatic() {
this.id = "HttpContext"
}
__init() {
this.name = zi.id
}
setupOnce() {
$u(e => {
if (ot().getIntegration(zi)) {
if (!$r.navigator && !$r.location && !$r.document) return e;
var n = e.request && e.request.url || $r.location && $r.location.href;
const {
referrer: s
} = $r.document || {}, {
userAgent: d
} = $r.navigator || {};
var r = {
...e.request && e.request.headers,
...s && {
Referer: s
},
...d && {
"User-Agent": d
}
},
i = {
...n && {
url: n
},
headers: r
};
return {
...e,
request: i
}
}
return e
})
}
}
zi.__initStatic();
class Ni {
constructor() {
Ni.prototype.__init.call(this)
}
static __initStatic() {
this.id = "Dedupe"
}
__init() {
this.name = Ni.id
}
setupOnce(e, n) {
var r = i => {
var s = n().getIntegration(Ni);
if (s) {
try {
if (BT(i, s._previousEvent)) return (typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn("Event dropped due to being a duplicate of previously captured event."), null
} catch {
return s._previousEvent = i
}
return s._previousEvent = i
}
return i
};
r.id = this.name, e(r)
}
}
Ni.__initStatic();
function BT(t, e) {
return e ? !!($T(t, e) || VT(t, e)) : !1
}
function $T(t, e) {
var n = t.message,
r = e.message;
return !(!n && !r || n && !r || !n && r || n !== r || !Rm(t, e) || !Dm(t, e))
}
function VT(t, e) {
var n = Im(e),
r = Im(t);
return !(!n || !r || n.type !== r.type || n.value !== r.value || !Rm(t, e) || !Dm(t, e))
}
function Dm(t, e) {
let n = Lm(t),
r = Lm(e);
if (!n && !r) return !0;
if (n && !r || !n && r || (n = n, r = r, r.length !== n.length)) return !1;
for (let d = 0; d < r.length; d++) {
var i = r[d],
s = n[d];
if (i.filename !== s.filename || i.lineno !== s.lineno || i.colno !== s.colno || i.function !== s.function) return !1
}
return !0
}
function Rm(t, e) {
let n = t.fingerprint,
r = e.fingerprint;
if (!n && !r) return !0;
if (n && !r || !n && r) return !1;
n = n, r = r;
try {
return n.join("") === r.join("")
} catch {
return !1
}
}
function Im(t) {
return t.exception && t.exception.values && t.exception.values[0]
}
function Lm(t) {
var e = t.exception;
if (e) try {
return e.values[0].stacktrace.frames
} catch {
return
}
}
var HT = [new Ri, new $o, new Ho, new Vo, new nr, new Fi, new Ni, new zi];
function UT(t = {}) {
if (t.defaultIntegrations === void 0 && (t.defaultIntegrations = HT), t.release === void 0) {
var e = Xe();
e.SENTRY_RELEASE && e.SENTRY_RELEASE.id && (t.release = e.SENTRY_RELEASE.id)
}
t.autoSessionTracking === void 0 && (t.autoSessionTracking = !0), t.sendClientReports === void 0 && (t.sendClientReports = !0);
var n = {
...t,
stackParser: LS(t.stackParser || kT),
integrations: LC(t),
transport: t.transport || (em() ? lT : uT)
};
NC(sT, n), t.autoSessionTracking && WT()
}
function Fm(t) {
t.startSession({
ignoreDuration: !0
}), t.captureSession()
}
function WT() {
var t = Xe(),
e = t.document;
if (typeof e > "u") {
(typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__) && Te.warn("Session tracking in non-browser environment with @sentry/browser is not supported.");
return
}
var n = ot();
!n.captureSession || (Fm(n), Jn("history", ({
from: r,
to: i
}) => {
r === void 0 || r === i || Fm(ot())
}))
}
function YT(t) {
t._metadata = t._metadata || {}, t._metadata.sdk = t._metadata.sdk || {
name: "sentry.javascript.react",
packages: [{
name: "npm:@sentry/react",
version: Da
}],
version: Da
}, UT(t)
}
var Fa = {
exports: {}
},
za = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var XT = E.exports,
GT = Symbol.for("react.element"),
KT = Symbol.for("react.fragment"),
qT = Object.prototype.hasOwnProperty,
ZT = XT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
QT = {
key: !0,
ref: !0,
__self: !0,
__source: !0
};
function zm(t, e, n) {
var r, i = {},
s = null,
d = null;
n !== void 0 && (s = "" + n), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (d = e.ref);
for (r in e) qT.call(e, r) && !QT.hasOwnProperty(r) && (i[r] = e[r]);
if (t && t.defaultProps)
for (r in e = t.defaultProps, e) i[r] === void 0 && (i[r] = e[r]);
return {
$$typeof: GT,
type: t,
key: s,
ref: d,
props: i,
_owner: ZT.current
}
}
za.Fragment = KT, za.jsx = zm, za.jsxs = zm,
function(t) {
t.exports = za
}(Fa);
const Uo = Fa.exports.Fragment,
_ = Fa.exports.jsx,
se = Fa.exports.jsxs;
var Zu = (t => (t.INLINE = "inline", t.OVERLAY = "overlay", t))(Zu || {}),
Nm = (t => (t.TOP = "top", t.BOTTOM = "bottom", t.HIDDEN = "", t))(Nm || {});
const JT = [{
name: "circle",
type: "Circle"
}, {
name: "square",
type: "Rect",
options: {
lockUniScaling: !1
}
}, {
name: "triangle",
type: "Triangle"
}, {
name: "ellipse",
type: "Ellipse",
options: {
lockUniScaling: !1
}
}, {
name: "Arrow #1",
type: "Path",
options: {
path: "M 294.9 16.4 l 15.7 42.2 c -171.4 70.3 -294 242.3 -289.1 437.4 l 14.7 -1 c 9.1 -0.6 18.1 -1.2 27.1 -1.9 l 14.7 -1 c -4.3 -170.1 102.5 -320 252 -381.3 l 15.7 42.2 c 34.7 -40.5 83.1 -76.6 144.8 -99.8 c -58.1 -26.2 -124.9 -39.6 -195.6 -36.8 z"
}
}, {
name: "Arrow #2",
type: "Path",
options: {
path: "M 16 248.4 v 14.9 h 447.5 l -93.2 82.5 l 11.9 10.5 l 113.8 -100.2 l -113.6 -100.4 l -11.8 10.5 l 92.9 82.2 z"
}
}, {
name: "Arrow #3",
type: "Path",
options: {
path: "M 496 256 l -118.6 -66 v 40.8 h -361.4 v 50.4 h 361.4 v 40.8 l 118.6 -66 z"
}
}, {
name: "Line",
type: "Path",
options: {
path: "M 16 256 h 480",
strokeWidth: 10,
stroke: "#000",
padding: 10
}
}, {
name: "Star",
type: "Path",
options: {
path: "M 256 406.3 l 148.3 78 l -28.3 -165.2 l 120 -117 l -165.8 -24.1 l -74.2 -150.3 l -74.2 150.3 l -165.8 24.1 l 120 117 l -28.3 165.2 z"
}
}, {
name: "Polygon",
type: "Path",
options: {
path: "M 256 19.6 l 156.6 57.1 l 83.4 144.3 l -28.9 164.2 l -127.7 107.2 h -166.8 l -127.7 -107.2 l -28.9 -164.2 l 83.4 -144.3 z"
}
}, {
name: "Badge",
type: "Path",
options: {
path: "M 257.3 16.2 s -148 58.2 -204.4 81.4 c 0 75.7 -16.8 303.5 204.4 398.2 c 218.7 -94.6 201.9 -322.4 201.9 -398.2 c -62.1 -23.6 -201.9 -81.4 -201.9 -81.4 z"
}
}],
e5 = ["afro-1", "afro", "agent", "alien-1", "alien", "angel", "angry-1", "angry-2", "angry-3", "angry-4", "angry-5", "angry", "arguing", "arrogant", "asian-1", "asian", "avatar", "baby-1", "baby-2", "baby", "bully", "burglar", "businessman", "cheeky-1", "cheeky", "clown", "confused-1", "confused-2", "confused-3", "confused", "creepy", "crying-1", "crying-2", "crying-3", "crying", "dazed-1", "dazed-2", "dazed-3", "dazed", "dead-1", "dead-2", "dead-3", "dead-4", "dead-5", "dead-6", "dead", "desperate-1", "desperate", "detective", "dissapointment", "doctor", "drunk", "dumb", "emo-1", "emo-2", "emo", "emoticon", "evil", "faint-1", "faint", "flirt-1", "flirt-2", "flirt", "flirty", "gangster", "geek-1", "geek", "gentleman-1", "gentleman-2", "gentleman-3", "gentleman-4", "gentleman", "ginger", "girl-1", "girl", "goofy-1", "goofy-2", "goofy-3", "goofy-4", "goofy", "grubby-1", "grubby", "happy-1", "happy-10", "happy-11", "happy-12", "happy-13", "happy-14", "happy-15", "happy-16", "happy-2", "happy-3", "happy-4", "happy-5", "happy-6", "happy-7", "happy-8", "happy-9", "happy", "harry-potter", "heisenberg", "hipster-1", "hipster-2", "hipster", "in-love-1", "in-love-2", "in-love-3", "in-love-4", "in-love-5", "in-love-6", "in-love", "japan", "jew", "joyful-1", "joyful-2", "joyful", "kiss-1", "kiss-2", "kiss-3", "kiss-4", "kiss", "laughing-1", "laughing-2", "laughing-3", "laughing", "listening", "love", "manly", "miserly-1", "miserly", "nerd-1", "nerd-2", "nerd-3", "nerd-4", "nerd", "ninja", "pirate-1", "pirate-2", "pirate", "punk-1", "punk-2", "punk", "rapper", "relieved", "rich-1", "rich-2", "rich", "rockstar", "sad-1", "sad-2", "sad-3", "sad-4", "sad-5", "sad-6", "sad", "scared-1", "scared-2", "scared-3", "scared", "sceptic-1", "sceptic-2", "sceptic-3", "sceptic-4", "sceptic-5", "sceptic-6", "sceptic-7", "sceptic", "secret", "shocked-1", "shocked-2", "shocked-3", "shocked", "sick-1", "sick-2", "sick-3", "sick-4", "sick", "silent", "skeleton", "smile", "smiling-1", "smiling", "smoked", "smug-1", "smug-2", "smug-3", "smug-4", "smug-5", "smug-6", "smug", "sporty", "stunned", "superhero-1", "superhero-2", "superhero-3", "superhero-4", "superhero", "surprised-1", "surprised", "thinking", "tired-1", "tired-2", "tired-3", "tired", "tough-1", "tough", "trendy", "vampire-1", "vampire", "wink-1", "wink-2", "wink", "winking-1", "winking", "yawning-1", "yawning-2", "yawning-3", "yawning", "yelling", "zombie"];
function fe(t, e) {
return {
...e,
message: t
}
}
const t5 = [{
name: "emoticons",
list: e5,
type: "svg",
thumbnailUrl: "images/stickers/categories/emoticon.svg"
}, {
name: "doodles",
items: 100,
type: "svg",
thumbnailUrl: "images/stickers/categories/doodles.svg"
}, {
name: "landmarks",
items: 100,
type: "svg",
thumbnailUrl: "images/stickers/categories/landmark.svg",
invertPreview: !0
}, {
name: "bubbles",
items: 104,
type: "png",
thumbnailUrl: "images/stickers/categories/speech-bubble.svg"
}, {
name: "transportation",
items: 22,
type: "svg",
thumbnailUrl: "images/stickers/categories/transportation.svg",
invertPreview: !0
}, {
name: "beach",
items: 22,
type: "svg",
thumbnailUrl: "images/stickers/categories/beach.svg",
invertPreview: !0
}],
n5 = {
emoticons: fe("Emoticons"),
doodles: fe("Doodles"),
landmarks: fe("Landmarks"),
bubbles: fe("Bubbles"),
transportation: fe("Transportation"),
beach: fe("Beach")
},
Qu = {
fill: "#1565C0",
opacity: 1,
backgroundColor: null,
strokeWidth: .05,
stroke: "#000"
},
r5 = ["PencilBrush", "SprayBrush", "CircleBrush", "DiamondBrush", "VLineBrush", "HLineBrush", "SquareBrush"],
jm = [1, 8, 15, 20, 25];
var Na = (t => (t.DARK = "dark", t.LIGHT = "light", t))(Na || {});
const Ju = [{
name: Na.LIGHT,
colors: {
"--be-foreground-base": "0 0 0",
"--be-primary-light": "191 219 254",
"--be-primary": "59 130 246",
"--be-primary-dark": "37 99 235",
"--be-on-primary": "255 255 255",
"--be-danger": "179 38 30",
"--be-on-danger": "255 255 255",
"--be-background": "255 255 255",
"--be-background-alt": "250 250 250",
"--be-paper": "255 255 255",
"--be-disabled-bg-opacity": "12%",
"--be-disabled-fg-opacity": "26%",
"--be-hover-opacity": "4%",
"--be-focus-opacity": "12%",
"--be-selected-opacity": "8%",
"--be-text-main-opacity": "87%",
"--be-text-muted-opacity": "60%",
"--be-divider-opacity": "12%"
}
}, {
name: Na.DARK,
isDark: !0,
colors: {
"--be-foreground-base": "255 255 255",
"--be-primary-light": "239 246 255",
"--be-primary": "191 219 254",
"--be-primary-dark": "147 197 253",
"--be-on-primary": "56 30 114",
"--be-danger": "242 184 181",
"--be-on-danger": "96 20 16",
"--be-background": "20 21 23",
"--be-background-alt": "26 27 30",
"--be-paper": "44 46 51",
"--be-disabled-bg-opacity": "12%",
"--be-disabled-fg-opacity": "30%",
"--be-hover-opacity": "8%",
"--be-focus-opacity": "12%",
"--be-selected-opacity": "16%",
"--be-text-main-opacity": "100%",
"--be-text-muted-opacity": "70%",
"--be-divider-opacity": "12%"
}
}];
var Me = (t => (t.FILTER = "filter", t.RESIZE = "resize", t.CROP = "crop", t.DRAW = "draw", t.TEXT = "text", t.SHAPES = "shapes", t.STICKERS = "stickers", t.FRAME = "frame", t.CORNERS = "corners", t.MERGE = "merge", t))(Me || {});
function Bm(t) {
var e, n, r = "";
if (typeof t == "string" || typeof t == "number") r += t;
else if (typeof t == "object")
if (Array.isArray(t))
for (e = 0; e < t.length; e++) t[e] && (n = Bm(t[e])) && (r && (r += " "), r += n);
else
for (e in t) t[e] && (r && (r += " "), r += e);
return r
}
function he() {
for (var t, e, n = 0, r = ""; n < arguments.length;)(t = arguments[n++]) && (e = Bm(t)) && (r && (r += " "), r += e);
return r
}
const i5 = E.exports.forwardRef((t, e) => {
const {
attr: n,
size: r,
title: i,
className: s,
color: d,
style: a,
children: o,
viewBox: c,
width: h,
height: l,
...u
} = t;
return se("svg", {
"aria-hidden": !i,
focusable: !1,
xmlns: "http://www.w3.org/2000/svg",
viewBox: c || "0 0 24 24",
...n,
...u,
className: he("svg-icon", s, o5(r)),
style: {
color: d,
...a
},
ref: e,
height: l || "1em",
width: h || "1em",
children: [i && _("title", {
children: i
}), o]
})
});
function o5(t) {
switch (t) {
case "2xs":
return "icon-2xs";
case "xs":
return "icon-xs";
case "sm":
return "icon-sm";
case "md":
return "icon-md";
case "lg":
return "icon-lg";
case "xl":
return "icon-xl";
default:
return ""
}
}
function ye(t, e = "", n) {
const r = (i, s) => _(i5, {
"data-testid": `${e}Icon`,
ref: s,
viewBox: n,
...i,
size: i.size || "md",
children: t
});
return ue.memo(ue.forwardRef(r))
}
function s5(t, e = "") {
const n = $m(t);
return ye(n, e)
}
function $m(t) {
return (t == null ? void 0 : t.map) && t.map((e, n) => ue.createElement(e.tag, {
key: n,
...e.attr
}, $m(e.child)))
}
const Vm = ye(_("path", {
d: "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"
}), "TuneOutlined"),
a5 = ye(_("path", {
d: "M21 15h2v2h-2v-2zm0-4h2v2h-2v-2zm2 8h-2v2c1 0 2-1 2-2zM13 3h2v2h-2V3zm8 4h2v2h-2V7zm0-4v2h2c0-1-1-2-2-2zM1 7h2v2H1V7zm16-4h2v2h-2V3zm0 16h2v2h-2v-2zM3 3C2 3 1 4 1 5h2V3zm6 0h2v2H9V3zM5 3h2v2H5V3zm-4 8v8c0 1.1.9 2 2 2h12V11H1zm2 8 2.5-3.21 1.79 2.15 2.5-3.22L13 19H3z"
}), "PhotoSizeSelectLargeOutlined"),
l5 = ye(_("path", {
d: "M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z"
}), "CropOutlined"),
c5 = ye(_("path", {
d: "M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"
}), "TextFieldsOutlined"),
u5 = ye(_("path", {
d: "M10.5 4.5c.28 0 .5.22.5.5v2h6v6h2c.28 0 .5.22.5.5s-.22.5-.5.5h-2v6h-2.12c-.68-1.75-2.39-3-4.38-3s-3.7 1.25-4.38 3H4v-2.12c1.75-.68 3-2.39 3-4.38 0-1.99-1.24-3.7-2.99-4.38L4 7h6V5c0-.28.22-.5.5-.5m0-2C9.12 2.5 8 3.62 8 5H4c-1.1 0-1.99.9-1.99 2v3.8h.29c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-.3c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7v.3H17c1.1 0 2-.9 2-2v-4c1.38 0 2.5-1.12 2.5-2.5S20.38 11 19 11V7c0-1.1-.9-2-2-2h-4c0-1.38-1.12-2.5-2.5-2.5z"
}), "ExtensionOutlined"),
f5 = ye(_("path", {
d: "M10.25 13c0 .69-.56 1.25-1.25 1.25S7.75 13.69 7.75 13s.56-1.25 1.25-1.25 1.25.56 1.25 1.25zM15 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm7 .25c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2s10 4.48 10 10zM10.66 4.12C12.06 6.44 14.6 8 17.5 8c.46 0 .91-.05 1.34-.12C17.44 5.56 14.9 4 12 4c-.46 0-.91.05-1.34.12zM4.42 9.47c1.71-.97 3.03-2.55 3.66-4.44C6.37 6 5.05 7.58 4.42 9.47zM20 12c0-.78-.12-1.53-.33-2.24-.7.15-1.42.24-2.17.24-3.13 0-5.92-1.44-7.76-3.69C8.69 8.87 6.6 10.88 4 11.86c.01.04 0 .09 0 .14 0 4.41 3.59 8 8 8s8-3.59 8-8z"
}), "FaceOutlined"),
h5 = ye(_("path", {
d: "M20 4h-4l-4-4-4 4H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H4V6h4.52l3.52-3.5L15.52 6H20v14zM6 18h12V8H6v10zm2-8h8v6H8v-6z"
}), "FilterFramesOutlined"),
d5 = ye(_("path", {
d: "M6.41 21 5 19.59l4.83-4.83c.75-.75 1.17-1.77 1.17-2.83v-5.1L9.41 8.41 8 7l4-4 4 4-1.41 1.41L13 6.83v5.1c0 1.06.42 2.08 1.17 2.83L19 19.59 17.59 21 12 15.41 6.41 21z"
}), "MergeOutlined"),
p5 = ye(_("path", {
d: "M19 19h2v2h-2v-2zm0-2h2v-2h-2v2zM3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm0-4h2V3H3v2zm4 0h2V3H7v2zm8 16h2v-2h-2v2zm-4 0h2v-2h-2v2zm4 0h2v-2h-2v2zm-8 0h2v-2H7v2zm-4 0h2v-2H3v2zM21 8c0-2.76-2.24-5-5-5h-5v2h5c1.65 0 3 1.35 3 3v5h2V8z"
}), "RoundedCornerOutlined"),
Hm = ye(_("path", {
d: "M20 4v12H8V4h12m0-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 9.67 1.69 2.26 2.48-3.1L19 15H9zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"
}), "PhotoLibraryOutlined"),
Um = ye(_("path", {
d: "M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.25 2.52.77-1.28-3.52-2.09V8z"
}), "HistoryOutlined"),
g5 = ye([_("path", {
d: "m2.53 19.65 1.34.56v-9.03l-2.43 5.86c-.41 1.02.08 2.19 1.09 2.61zm19.5-3.7L17.07 3.98c-.31-.75-1.04-1.21-1.81-1.23-.26 0-.53.04-.79.15L7.1 5.95c-.75.31-1.21 1.03-1.23 1.8-.01.27.04.54.15.8l4.96 11.97c.31.76 1.05 1.22 1.83 1.23.26 0 .52-.05.77-.15l7.36-3.05c1.02-.42 1.51-1.59 1.09-2.6zm-9.2 3.8L7.87 7.79l7.35-3.04h.01l4.95 11.95-7.35 3.05z"
}, "0"), _("circle", {
cx: "11",
cy: "9",
r: "1"
}, "1"), _("path", {
d: "M5.88 19.75c0 1.1.9 2 2 2h1.45l-3.45-8.34v6.34z"
}, "2")], "StyleOutlined"),
m5 = ye(_("path", {
d: "M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"
}), "DeleteOutlined"),
v5 = ye(_("path", {
d: "M18.85,10.39l1.06-1.06c0.78-0.78,0.78-2.05,0-2.83L18.5,5.09c-0.78-0.78-2.05-0.78-2.83,0l-1.06,1.06L18.85,10.39z M14.61,11.81L7.41,19H6v-1.41l7.19-7.19L14.61,11.81z M13.19,7.56L4,16.76V21h4.24l9.19-9.19L13.19,7.56L13.19,7.56z M19,17.5 c0,2.19-2.54,3.5-5,3.5c-0.55,0-1-0.45-1-1s0.45-1,1-1c1.54,0,3-0.73,3-1.5c0-0.47-0.48-0.87-1.23-1.2l1.48-1.48 C18.32,15.45,19,16.29,19,17.5z M4.58,13.35C3.61,12.79,3,12.06,3,11c0-1.8,1.89-2.63,3.56-3.36C7.59,7.18,9,6.56,9,6 c0-0.41-0.78-1-2-1C5.74,5,5.2,5.61,5.17,5.64C4.82,6.05,4.19,6.1,3.77,5.76C3.36,5.42,3.28,4.81,3.62,4.38C3.73,4.24,4.76,3,7,3 c2.24,0,4,1.32,4,3c0,1.87-1.93,2.72-3.64,3.47C6.42,9.88,5,10.5,5,11c0,0.31,0.43,0.6,1.07,0.86L4.58,13.35z"
}), "Draw"),
y5 = ye(_("path", {
d: "m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3 2 12h3v8h6v-6h2v6h6v-8h3L12 3z"
}), "HomeOutlined"),
rr = {
[Me.FILTER]: {
name: fe("Applied Filters"),
icon: Vm
},
[Me.RESIZE]: {
name: fe("Resized Image"),
icon: a5
},
[Me.CROP]: {
name: fe("Cropped Image"),
icon: l5
},
[Me.DRAW]: {
name: fe("Added Drawing"),
icon: v5
},
[Me.TEXT]: {
name: fe("Added Text"),
icon: c5
},
[Me.SHAPES]: {
name: fe("Added Shape"),
icon: u5
},
[Me.STICKERS]: {
name: fe("Added Sticker"),
icon: f5
},
[Me.FRAME]: {
name: fe("Added Frame"),
icon: h5
},
[Me.MERGE]: {
name: fe("Merged Objects"),
icon: d5
},
[Me.CORNERS]: {
name: fe("Rounded Corner"),
icon: p5
},
bgImage: {
name: fe("Replaced Background Image"),
icon: Hm
},
overlayImage: {
name: fe("Added Image"),
icon: Hm
},
initial: {
name: fe("Initial"),
icon: y5
},
loadedState: {
name: fe("Loaded State"),
icon: Um
},
objectStyle: {
name: fe("Changed Style"),
icon: g5
},
deletedObject: {
name: fe("Deleted object"),
icon: m5
}
},
b5 = Object.values(Me).map(t => ({
name: t,
icon: rr[t].icon,
action: t === Me.MERGE ? e => {
e.tools.merge.apply()
} : t
})),
w5 = {
filter: fe("Filter"),
resize: fe("Resize"),
crop: fe("Crop"),
draw: fe("Draw"),
text: fe("Text"),
shapes: fe("Shapes"),
Stickers: fe("Stickers"),
frame: fe("Frame"),
corners: fe("Corners"),
merge: fe("Merge")
},
x5 = ye(_("path", {
d: "M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"
}), "FileDownloadOutlined"),
_5 = {
name: "pixie",
version: "3.0.3",
main: "dist/pixie.umd.js",
module: "dist/pixie.es.js",
types: "dist/types/src/pixie.d.ts",
private: !0,
exports: {
".": {
import: "./dist/pixie.es.js",
require: "./dist/pixie.umd.js"
}
},
files: ["dist"],
scripts: {
dev: "vite --host",
build: "vite build && npm run build-umd && npm run types && npm run build-cc",
types: "tsc --skipLibCheck --emitDeclarationOnly --noEmit false --declarationMap false",
"build-umd": "vite build --config scripts/vite-umd.config.ts",
"build-cc": "./scripts/build-cc.sh",
serve: "vite preview",
extract: "node ./scripts/extract-translations.js"
},
dependencies: {
"@floating-ui/react-dom": "^1.0.0",
"@internationalized/date": "^3.0.1",
"@internationalized/number": "^3.0.3",
"@react-aria/focus": "3.7.0",
"@react-aria/interactions": "^3.11.0",
"@react-aria/overlays": "^3.10.1",
"@react-aria/ssr": "^3.3.0",
"@react-aria/utils": "^3.13.3",
"@react-stately/color": "^3.1.1",
"@react-stately/utils": "^3.5.1",
"@sentry/react": "^7.13.0",
"@sentry/tracing": "^7.13.0",
"@tanstack/react-query": "^4.3.4",
"@tanstack/react-virtual": "^3.0.0-beta.18",
"@use-gesture/react": "^10.2.20",
axios: "^0.27.2",
"axios-retry": "^3.3.1",
clsx: "^1.2.1",
color: "^4.2.3",
"deep-object-diff": "^1.1.7",
deepmerge: "^4.2.2",
"dot-object": "^2.1.4",
fabric: "^5.2.4",
"file-saver": "^2.0.5",
"framer-motion": "^7.3.6",
immer: "^9.0.15",
"mime-match": "^1.0.2",
"nano-memoize": "^1.3.0",
nanoid: "^4.0.0",
"number-precision": "^1.5.1",
react: ">=18.2.0",
"react-ace": "^10.1.0",
"react-colorful": "^5.6.1",
"react-dom": ">=18.2.0",
"react-hook-form": "^7.36.1",
"react-merge-refs": "^2.0.1",
"react-router-dom": "^6.4.1",
"react-textarea-autosize": "^8.3.3",
"react-use-clipboard": "^1.0.7",
"react-use-cookie": "^1.4.0",
"style-inject": "^0.3.0",
"tus-js-client": "^3.0.1",
zustand: "^4.1.1"
},
peerDependencies: {
react: ">=18.2.0",
"react-dom": ">=18.2.0"
},
devDependencies: {
"@faker-js/faker": "^7.5.0",
"@storybook/addon-actions": "^6.5.11",
"@storybook/addon-essentials": "^6.5.11",
"@storybook/addon-interactions": "^6.5.11",
"@storybook/addon-links": "^6.5.11",
"@storybook/builder-vite": "^0.2.2",
"@storybook/react": "^6.5.12",
"@storybook/testing-library": "^0.0.13",
"@tailwindcss/typography": "^0.5.7",
"@types/color": "^3.0.2",
"@types/dot-object": "^2.1.2",
"@types/fabric": "^4.5.12",
"@types/file-saver": "^2.0.4",
"@types/lodash.debounce": "^4.0.6",
"@types/react": "^18.0.21",
"@types/react-dom": "^18.0.6",
"@types/react-recaptcha-v3": "^1.1.2",
"@types/swagger-ui-react": "^4.11.0",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"@vitejs/plugin-react": "^2.1.0",
autoprefixer: "^10.4.12",
cssnano: "^5.1.13",
eslint: "8.22",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-storybook": "^0.6.3",
"fast-glob": "^3.2.12",
"fast-xml-parser": "^4.0.10",
"fs-extra": "^10.1.0",
postcss: "^8.4.16",
prettier: "^2.7.1",
"rollup-plugin-visualizer": "^5.8.1",
tailwindcss: "^3.1.8",
typescript: "^4.8.3",
"utility-types": "^3.10.0",
vite: "^3.1.3",
"vite-plugin-checker": "^0.5.1",
"vite-tsconfig-paths": "^3.5.0"
}
}.version,
Wm = {
selector: "pixie-editor",
textureSize: 4096,
activeLanguage: "en",
ui: {
visible: !0,
mode: Zu.INLINE,
forceOverlayModeOnMobile: !0,
activeTheme: Na.LIGHT,
themes: Ju,
allowEditorClose: !0,
menubar: {
items: [{
type: "undoWidget",
align: "left"
}, {
type: "zoomWidget",
align: "center",
desktopOnly: !0
}, {
type: "button",
icon: Um,
align: "right",
desktopOnly: !0,
action: t => {
t.togglePanel("history")
}
},
{
type: "button",
icon: "../../editorMe/assets/images/save.png",
label: fe("Save"),
align: "right",
action: (e) => {
var t;
((t = e.state.config.ui) == null ? void 0 : t.showExportPanel) ? e.state.togglePanel("export", !0) : e.tools.export.save("image");
},
} ]
},
nav: {
position: Nm.BOTTOM,
items: [...b5]
},
openImageDialog: {
show: !0,
sampleImages: [{
url: "images/samples/sample1.jpg",
thumbnail: "images/samples/sample1_thumbnail.jpg"
}, {
url: "images/samples/sample2.jpg",
thumbnail: "images/samples/sample2_thumbnail.jpg"
}, {
url: "images/samples/sample3.jpg",
thumbnail: "images/samples/sample3_thumbnail.jpg"
}]
},
colorPresets: {
items: ["rgb(0,0,0)", "rgb(255, 255, 255)", "rgb(242, 38, 19)", "rgb(249, 105, 14)", "rgb(253, 227, 167)", "rgb(4, 147, 114)", "rgb(30, 139, 195)", "rgb(142, 68, 173)"]
}
},
objectDefaults: {
global: {
...Qu
},
sticker: {
fill: void 0
},
text: {
textAlign: "initial",
underline: !1,
linethrough: !1,
fontStyle: "normal",
fontFamily: "Fira Sans",
fontWeight: "normal",
stroke: void 0,
fontSize: 40
}
},
tools: {
filter: {
items: ["grayscale", "blackWhite", "sharpen", "invert", "vintage", "polaroid", "kodachrome", "technicolor", "brownie", "sepia", "removeColor", "brightness", "gamma", "noise", "pixelate", "blur", "emboss", "blendColor"]
},
zoom: {
allowUserZoom: !0,
fitImageToScreen: !0
},
crop: {
allowCustomRatio: !0,
defaultRatio: "1:1",
presets: [{
ratio: null,
name: "Custom"
}, {
ratio: "1:1",
name: "Square"
}, {
ratio: "4:3"
}, {
ratio: "16:9"
}, {
ratio: "5:3"
}, {
ratio: "5:4"
}, {
ratio: "6:4"
}, {
ratio: "7:5"
}, {
ratio: "10:8"
}]
},
text: {
defaultText: "Double click to edit",
items: []
},
draw: {
brushSizes: jm,
brushTypes: r5
},
shapes: {
items: JT.slice()
},
stickers: {
items: t5
},
import: {
validImgExtensions: ["png", "jpg", "jpeg", "svg", "gif"],
fitOverlayToScreen: !0,
openDroppedImageAsBackground: !1
},
export: {
defaultFormat: "png",
defaultQuality: .8,
defaultName: "image"
},
frame: {
items: [{
name: "basic",
mode: "basic",
size: {
min: 1,
max: 35,
default: 10
}
}, {
name: "pine",
mode: "stretch",
size: {
min: 1,
max: 35,
default: 15
}
}, {
name: "oak",
mode: "stretch",
size: {
min: 1,
max: 35,
default: 15
}
}, {
name: "rainbow",
mode: "stretch",
size: {
min: 1,
max: 35,
default: 15
}
}, {
name: "grunge1",
display_name: "grunge #1",
mode: "stretch",
size: {
min: 1,
max: 35,
default: 15
}
}, {
name: "grunge2",
display_name: "grunge #2",
mode: "stretch",
size: {
min: 1,
max: 35,
default: 20
}
}, {
name: "ebony",
mode: "stretch",
size: {
min: 1,
max: 35,
default: 15
}
}, {
name: "art1",
display_name: "Art #1",
mode: "repeat",
size: {
min: 10,
max: 70,
default: 55
}
}, {
name: "art2",
display_name: "Art #2",
mode: "repeat",
size: {
min: 10,
max: 70,
default: 55
}
}]
}
}
},
Ym = t => {
let e;
const n = new Set,
r = (o, c) => {
const h = typeof o == "function" ? o(e) : o;
if (h !== e) {
const l = e;
e = (c != null ? c : typeof h != "object") ? h : Object.assign({}, e, h), n.forEach(u => u(e, l))
}
},
i = () => e,
a = {
setState: r,
getState: i,
subscribe: o => (n.add(o), () => n.delete(o)),
destroy: () => n.clear()
};
return e = t(r, i, a), a
},
S5 = t => t ? Ym(t) : Ym;
var Xm = {
exports: {}
},
Gm = {},
Km = {
exports: {}
},
qm = {};
/**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ji = E.exports;
function C5(t, e) {
return t === e && (t !== 0 || 1 / t === 1 / e) || t !== t && e !== e
}
var T5 = typeof Object.is == "function" ? Object.is : C5,
k5 = ji.useState,
E5 = ji.useEffect,
O5 = ji.useLayoutEffect,
P5 = ji.useDebugValue;
function M5(t, e) {
var n = e(),
r = k5({
inst: {
value: n,
getSnapshot: e
}
}),
i = r[0].inst,
s = r[1];
return O5(function() {
i.value = n, i.getSnapshot = e, ef(i) && s({
inst: i
})
}, [t, n, e]), E5(function() {
return ef(i) && s({
inst: i
}), t(function() {
ef(i) && s({
inst: i
})
})
}, [t]), P5(n), n
}
function ef(t) {
var e = t.getSnapshot;
t = t.value;
try {
var n = e();
return !T5(t, n)
} catch {
return !0
}
}
function A5(t, e) {
return e()
}
var D5 = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? A5 : M5;
qm.useSyncExternalStore = ji.useSyncExternalStore !== void 0 ? ji.useSyncExternalStore : D5,
function(t) {
t.exports = qm
}(Km);
/**
* @license React
* use-sync-external-store-shim/with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ja = E.exports,
R5 = Km.exports;
function I5(t, e) {
return t === e && (t !== 0 || 1 / t === 1 / e) || t !== t && e !== e
}
var L5 = typeof Object.is == "function" ? Object.is : I5,
F5 = R5.useSyncExternalStore,
z5 = ja.useRef,
N5 = ja.useEffect,
j5 = ja.useMemo,
B5 = ja.useDebugValue;
Gm.useSyncExternalStoreWithSelector = function(t, e, n, r, i) {
var s = z5(null);
if (s.current === null) {
var d = {
hasValue: !1,
value: null
};
s.current = d
} else d = s.current;
s = j5(function() {
function o(f) {
if (!c) {
if (c = !0, h = f, f = r(f), i !== void 0 && d.hasValue) {
var p = d.value;
if (i(p, f)) return l = p
}
return l = f
}
if (p = l, L5(h, f)) return p;
var m = r(f);
return i !== void 0 && i(p, m) ? p : (h = f, l = m)
}
var c = !1,
h, l, u = n === void 0 ? null : n;
return [function() {
return o(e())
}, u === null ? void 0 : function() {
return o(u())
}]
}, [e, n, r, i]);
var a = F5(t, s[0], s[1]);
return N5(function() {
d.hasValue = !0, d.value = a
}, [a]), B5(a), a
},
function(t) {
t.exports = Gm
}(Xm);
const $5 = qn(Xm.exports),
{
useSyncExternalStoreWithSelector: V5
} = $5;
function H5(t, e = t.getState, n) {
const r = V5(t.subscribe, t.getState, t.getServerState || t.getState, e, n);
return E.exports.useDebugValue(r), r
}
const Zm = t => {
const e = typeof t == "function" ? S5(t) : t,
n = (r, i) => H5(e, r, i);
return Object.assign(n, e), n
};
var Qm = t => t ? Zm(t) : Zm;
const U5 = t => (e, n, r) => {
const i = r.subscribe;
return r.subscribe = (d, a, o) => {
let c = d;
if (a) {
const h = (o == null ? void 0 : o.equalityFn) || Object.is;
let l = d(r.getState());
c = u => {
const f = d(u);
if (!h(l, f)) {
const p = l;
a(l = f, p)
}
}, o != null && o.fireImmediately && a(l, l)
}
return i(c)
}, t(e, n, r)
};
function nn(t) {
for (var e = arguments.length, n = Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++) n[r - 1] = arguments[r];
throw Error("[Immer] minified error nr: " + t + (n.length ? " " + n.map(function(i) {
return "'" + i + "'"
}).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf")
}
function Bi(t) {
return !!t && !!t[Lt]
}
function Vr(t) {
return !!t && (function(e) {
if (!e || typeof e != "object") return !1;
var n = Object.getPrototypeOf(e);
if (n === null) return !0;
var r = Object.hasOwnProperty.call(n, "constructor") && n.constructor;
return r === Object || typeof r == "function" && Function.toString.call(r) === Q5
}(t) || Array.isArray(t) || !!t[lv] || !!t.constructor[lv] || nf(t) || rf(t))
}
function Wo(t, e, n) {
n === void 0 && (n = !1), $i(t) === 0 ? (n ? Object.keys : mf)(t).forEach(function(r) {
n && typeof r == "symbol" || e(r, t[r], t)
}) : t.forEach(function(r, i) {
return e(i, r, t)
})
}
function $i(t) {
var e = t[Lt];
return e ? e.i > 3 ? e.i - 4 : e.i : Array.isArray(t) ? 1 : nf(t) ? 2 : rf(t) ? 3 : 0
}
function tf(t, e) {
return $i(t) === 2 ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e)
}
function W5(t, e) {
return $i(t) === 2 ? t.get(e) : t[e]
}
function Jm(t, e, n) {
var r = $i(t);
r === 2 ? t.set(e, n) : r === 3 ? (t.delete(e), t.add(n)) : t[e] = n
}
function Y5(t, e) {
return t === e ? t !== 0 || 1 / t == 1 / e : t != t && e != e
}
function nf(t) {
return q5 && t instanceof Map
}
function rf(t) {
return Z5 && t instanceof Set
}
function Hr(t) {
return t.o || t.t
}
function of(t) {
if (Array.isArray(t)) return Array.prototype.slice.call(t);
var e = J5(t);
delete e[Lt];
for (var n = mf(e), r = 0; r < n.length; r++) {
var i = n[r],
s = e[i];
s.writable === !1 && (s.writable = !0, s.configurable = !0), (s.get || s.set) && (e[i] = {
configurable: !0,
writable: !0,
enumerable: s.enumerable,
value: t[i]
})
}
return Object.create(Object.getPrototypeOf(t), e)
}
function sf(t, e) {
return e === void 0 && (e = !1), af(t) || Bi(t) || !Vr(t) || ($i(t) > 1 && (t.set = t.add = t.clear = t.delete = X5), Object.freeze(t), e && Wo(t, function(n, r) {
return sf(r, !0)
}, !0)), t
}
function X5() {
nn(2)
}
function af(t) {
return t == null || typeof t != "object" || Object.isFrozen(t)
}
function gn(t) {
var e = ek[t];
return e || nn(18, t), e
}
function ev() {
return Yo
}
function lf(t, e) {
e && (gn("Patches"), t.u = [], t.s = [], t.v = e)
}
function Ba(t) {
cf(t), t.p.forEach(G5), t.p = null
}
function cf(t) {
t === Yo && (Yo = t.l)
}
function tv(t) {
return Yo = {
p: [],
l: Yo,
h: t,
m: !0,
_: 0
}
}
function G5(t) {
var e = t[Lt];
e.i === 0 || e.i === 1 ? e.j() : e.O = !0
}
function uf(t, e) {
e._ = e.p.length;
var n = e.p[0],
r = t !== void 0 && t !== n;
return e.h.g || gn("ES5").S(e, t, r), r ? (n[Lt].P && (Ba(e), nn(4)), Vr(t) && (t = $a(e, t), e.l || Va(e, t)), e.u && gn("Patches").M(n[Lt].t, t, e.u, e.s)) : t = $a(e, n, []), Ba(e), e.u && e.v(e.u, e.s), t !== av ? t : void 0
}
function $a(t, e, n) {
if (af(e)) return e;
var r = e[Lt];
if (!r) return Wo(e, function(s, d) {
return nv(t, r, e, s, d, n)
}, !0), e;
if (r.A !== t) return e;
if (!r.P) return Va(t, r.t, !0), r.t;
if (!r.I) {
r.I = !0, r.A._--;
var i = r.i === 4 || r.i === 5 ? r.o = of(r.k) : r.o;
Wo(r.i === 3 ? new Set(i) : i, function(s, d) {
return nv(t, r, i, s, d, n)
}), Va(t, i, !1), n && t.u && gn("Patches").R(r, n, t.u, t.s)
}
return r.o
}
function nv(t, e, n, r, i, s) {
if (Bi(i)) {
var d = $a(t, i, s && e && e.i !== 3 && !tf(e.D, r) ? s.concat(r) : void 0);
if (Jm(n, r, d), !Bi(d)) return;
t.m = !1
}
if (Vr(i) && !af(i)) {
if (!t.h.F && t._ < 1) return;
$a(t, i), e && e.A.l || Va(t, i)
}
}
function Va(t, e, n) {
n === void 0 && (n = !1), t.h.F && t.m && sf(e, n)
}
function ff(t, e) {
var n = t[Lt];
return (n ? Hr(n) : t)[e]
}
function rv(t, e) {
if (e in t)
for (var n = Object.getPrototypeOf(t); n;) {
var r = Object.getOwnPropertyDescriptor(n, e);
if (r) return r;
n = Object.getPrototypeOf(n)
}
}
function hf(t) {
t.P || (t.P = !0, t.l && hf(t.l))
}
function df(t) {
t.o || (t.o = of(t.t))
}
function pf(t, e, n) {
var r = nf(e) ? gn("MapSet").N(e, n) : rf(e) ? gn("MapSet").T(e, n) : t.g ? function(i, s) {
var d = Array.isArray(i),
a = {
i: d ? 1 : 0,
A: s ? s.A : ev(),
P: !1,
I: !1,
D: {},
l: s,
t: i,
k: null,
o: null,
j: null,
C: !1
},
o = a,
c = vf;
d && (o = [a], c = Xo);
var h = Proxy.revocable(o, c),
l = h.revoke,
u = h.proxy;
return a.k = u, a.j = l, u
}(e, n) : gn("ES5").J(e, n);
return (n ? n.A : ev()).p.push(r), r
}
function K5(t) {
return Bi(t) || nn(22, t),
function e(n) {
if (!Vr(n)) return n;
var r, i = n[Lt],
s = $i(n);
if (i) {
if (!i.P && (i.i < 4 || !gn("ES5").K(i))) return i.t;
i.I = !0, r = iv(n, s), i.I = !1
} else r = iv(n, s);
return Wo(r, function(d, a) {
i && W5(i.t, d) === a || Jm(r, d, e(a))
}), s === 3 ? new Set(r) : r
}(t)
}
function iv(t, e) {
switch (e) {
case 2:
return new Map(t);
case 3:
return Array.from(t)
}
return of(t)
}
function Oz(t) {
return t
}
var ov, Yo, gf = typeof Symbol < "u" && typeof Symbol("x") == "symbol",
q5 = typeof Map < "u",
Z5 = typeof Set < "u",
sv = typeof Proxy < "u" && Proxy.revocable !== void 0 && typeof Reflect < "u",
av = gf ? Symbol.for("immer-nothing") : ((ov = {})["immer-nothing"] = !0, ov),
lv = gf ? Symbol.for("immer-draftable") : "__$immer_draftable",
Lt = gf ? Symbol.for("immer-state") : "__$immer_state",
Q5 = "" + Object.prototype.constructor,
mf = typeof Reflect < "u" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols !== void 0 ? function(t) {
return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))
} : Object.getOwnPropertyNames,
J5 = Object.getOwnPropertyDescriptors || function(t) {
var e = {};
return mf(t).forEach(function(n) {
e[n] = Object.getOwnPropertyDescriptor(t, n)
}), e
},
ek = {},
vf = {
get: function(t, e) {
if (e === Lt) return t;
var n = Hr(t);
if (!tf(n, e)) return function(i, s, d) {
var a, o = rv(s, d);
return o ? "value" in o ? o.value : (a = o.get) === null || a === void 0 ? void 0 : a.call(i.k) : void 0
}(t, n, e);
var r = n[e];
return t.I || !Vr(r) ? r : r === ff(t.t, e) ? (df(t), t.o[e] = pf(t.A.h, r, t)) : r
},
has: function(t, e) {
return e in Hr(t)
},
ownKeys: function(t) {
return Reflect.ownKeys(Hr(t))
},
set: function(t, e, n) {
var r = rv(Hr(t), e);
if (r != null && r.set) return r.set.call(t.k, n), !0;
if (!t.P) {
var i = ff(Hr(t), e),
s = i == null ? void 0 : i[Lt];
if (s && s.t === n) return t.o[e] = n, t.D[e] = !1, !0;
if (Y5(n, i) && (n !== void 0 || tf(t.t, e))) return !0;
df(t), hf(t)
}
return t.o[e] === n && typeof n != "number" && (n !== void 0 || e in t.o) || (t.o[e] = n, t.D[e] = !0, !0)
},
deleteProperty: function(t, e) {
return ff(t.t, e) !== void 0 || e in t.t ? (t.D[e] = !1, df(t), hf(t)) : delete t.D[e], t.o && delete t.o[e], !0
},
getOwnPropertyDescriptor: function(t, e) {
var n = Hr(t),
r = Reflect.getOwnPropertyDescriptor(n, e);
return r && {
writable: !0,
configurable: t.i !== 1 || e !== "length",
enumerable: r.enumerable,
value: n[e]
}
},
defineProperty: function() {
nn(11)
},
getPrototypeOf: function(t) {
return Object.getPrototypeOf(t.t)
},
setPrototypeOf: function() {
nn(12)
}
},
Xo = {};
Wo(vf, function(t, e) {
Xo[t] = function() {
return arguments[0] = arguments[0][0], e.apply(this, arguments)
}
}), Xo.deleteProperty = function(t, e) {
return Xo.set.call(this, t, e, void 0)
}, Xo.set = function(t, e, n) {
return vf.set.call(this, t[0], e, n, t[0])
};
var tk = function() {
function t(n) {
var r = this;
this.g = sv, this.F = !0, this.produce = function(i, s, d) {
if (typeof i == "function" && typeof s != "function") {
var a = s;
s = i;
var o = r;
return function(m) {
var g = this;
m === void 0 && (m = a);
for (var v = arguments.length, y = Array(v > 1 ? v - 1 : 0), b = 1; b < v; b++) y[b - 1] = arguments[b];
return o.produce(m, function(w) {
var x;
return (x = s).call.apply(x, [g, w].concat(y))
})
}
}
var c;
if (typeof s != "function" && nn(6), d !== void 0 && typeof d != "function" && nn(7), Vr(i)) {
var h = tv(r),
l = pf(r, i, void 0),
u = !0;
try {
c = s(l), u = !1
} finally {
u ? Ba(h) : cf(h)
}
return typeof Promise < "u" && c instanceof Promise ? c.then(function(m) {
return lf(h, d), uf(m, h)
}, function(m) {
throw Ba(h), m
}) : (lf(h, d), uf(c, h))
}
if (!i || typeof i != "object") {
if ((c = s(i)) === void 0 && (c = i), c === av && (c = void 0), r.F && sf(c, !0), d) {
var f = [],
p = [];
gn("Patches").M(i, c, f, p), d(f, p)
}
return c
}
nn(21, i)
}, this.produceWithPatches = function(i, s) {
if (typeof i == "function") return function(c) {
for (var h = arguments.length, l = Array(h > 1 ? h - 1 : 0), u = 1; u < h; u++) l[u - 1] = arguments[u];
return r.produceWithPatches(c, function(f) {
return i.apply(void 0, [f].concat(l))
})
};
var d, a, o = r.produce(i, s, function(c, h) {
d = c, a = h
});
return typeof Promise < "u" && o instanceof Promise ? o.then(function(c) {
return [c, d, a]
}) : [o, d, a]
}, typeof(n == null ? void 0 : n.useProxies) == "boolean" && this.setUseProxies(n.useProxies), typeof(n == null ? void 0 : n.autoFreeze) == "boolean" && this.setAutoFreeze(n.autoFreeze)
}
var e = t.prototype;
return e.createDraft = function(n) {
Vr(n) || nn(8), Bi(n) && (n = K5(n));
var r = tv(this),
i = pf(this, n, void 0);
return i[Lt].C = !0, cf(r), i
}, e.finishDraft = function(n, r) {
var i = n && n[Lt],
s = i.A;
return lf(s, r), uf(void 0, s)
}, e.setAutoFreeze = function(n) {
this.F = n
}, e.setUseProxies = function(n) {
n && !sv && nn(20), this.g = n
}, e.applyPatches = function(n, r) {
var i;
for (i = r.length - 1; i >= 0; i--) {
var s = r[i];
if (s.path.length === 0 && s.op === "replace") {
n = s.value;
break
}
}
i > -1 && (r = r.slice(i + 1));
var d = gn("Patches").$;
return Bi(n) ? d(n, r) : this.produce(n, function(a) {
return d(a, r)
})
}, t
}(),
Ft = new tk,
nk = Ft.produce;
Ft.produceWithPatches.bind(Ft), Ft.setAutoFreeze.bind(Ft), Ft.setUseProxies.bind(Ft), Ft.applyPatches.bind(Ft), Ft.createDraft.bind(Ft), Ft.finishDraft.bind(Ft);
function rk(t) {
return t ? t.charAt(0).toLowerCase() + t.slice(1) : ""
}
function ik(t, e) {
const n = Lg(e, t);
return cv(n, t)
}
function cv(t, e) {
return Object.keys(t).forEach(n => {
if (n.startsWith("replaceDefault") && t[n]) {
const r = rk(n.replace("replaceDefault", "") || "items");
t[r] = e ? e[r] : [], delete t[n]
} else typeof t[n] == "object" && t[n] !== null && cv(t[n], e == null ? void 0 : e[n])
}), t
}
const ok = (t, e) => ({
history: {
...uv,
updatePointerById: n => {
const r = e().history.items.findIndex(i => i.id === n);
e().history.update(r)
},
update: (n, r) => {
t(i => {
i.history.pointer = n, r && (i.history.items = r), i.history.canUndo = i.history.pointer > 0, i.history.canRedo = i.history.items.length > i.history.pointer + 1
})
},
reset: () => {
t({
history: {
...e().history,
...uv
}
})
}
}
}),
uv = {
items: [],
pointer: 0,
canUndo: !1,
canRedo: !1
};
var rn = (t => (t.Filter = "filter", t.Frame = "frame", t.ActiveObject = "activeObj", t.Text = "text", t))(rn || {});
const sk = (t, e) => ({
filter: {
...fv,
select(n, r = !1) {
t(i => {
i.filter.selected = n, i.activeToolOverlay = r ? rn.Filter : null, i.dirty = !0
})
},
deselect(n) {
e().filter.selected === n && t(r => {
r.filter.selected = null, r.activeToolOverlay = null, r.dirty = !0
})
},
reset() {
t({
filter: {
...e().filter,
...fv
}
})
}
}
}),
fv = {
selected: null,
applied: []
},
ak = (t, e) => ({
crop: {
...hv,
setCropzoneRect: n => {
t(r => {
r.crop.zoneRect = n
})
},
setAspectRatio: n => {
t(r => {
r.crop.selectedAspectRatio = n
})
},
setTransformAngle: n => {
t(r => {
r.crop.straightenAngle = n
})
},
apply: async () => {
const n = e().crop.zoneRect;
if (n) {
const r = {
width: Math.ceil(n.width / e().zoom),
height: Math.ceil(n.height / e().zoom),
left: Math.ceil(n.left / e().zoom),
top: Math.ceil(n.top / e().zoom)
};
await e().editor.tools.crop.apply(r)
}
},
reset: () => {
t({
crop: {
...e().crop,
...hv
}
})
}
}
}),
hv = {
zoneRect: null,
selectedAspectRatio: null,
straightenAngle: 0
};
function ir(t) {
return (t == null ? void 0 : t.type) === "i-text"
}
var Ge = (t => (t.Text = "text", t.Shape = "shape", t.Sticker = "sticker", t.Drawing = "drawing", t.Image = "image", t.MainImage = "mainImage", t.StraightenAnchor = "straightenHelper", t))(Ge || {});
const lk = {
text: {
name: fe("Text"),
icon: rr.text.icon
},
shape: {
name: fe("Shape"),
icon: rr.shapes.icon
},
sticker: {
name: fe("Sticker"),
icon: rr.stickers.icon
},
drawing: {
name: fe("Drawing"),
icon: rr.draw.icon
},
image: {
name: fe("Image"),
icon: rr.overlayImage.icon
},
mainImage: {
name: fe("Background Image"),
icon: rr.bgImage.icon
}
};
function ck(t) {
return t.name === Ge.Image
}
const dv = {
isMoving: !1,
editableProps: {},
id: null,
isText: !1,
isImage: !1,
name: null
};
function uk(t) {
if (!t) return {};
const e = {
fill: t.fill,
opacity: t.opacity,
backgroundColor: t.backgroundColor,
stroke: t.stroke,
strokeWidth: t.strokeWidth
},
n = t.shadow;
return n && (e.shadow = {
color: n.color,
blur: n.blur,
offsetX: n.offsetX,
offsetY: n.offsetY
}), ir(t) && (e.textAlign = t.textAlign, e.underline = t.underline, e.linethrough = t.linethrough, e.fontStyle = t.fontStyle, e.fontFamily = t.fontFamily, e.fontWeight = t.fontWeight, e.fontSize = t.fontSize), e
}
const fk = (t, e) => ({
objects: {
...pv,
setActiveIsMoving: n => {
t(r => {
r.objects.active.isMoving = n
})
},
setIsEditingText: n => {
t(r => {
r.objects.isEditingText = n
})
},
setActive: n => {
t(n ? r => {
var i;
r.objects.active.editableProps = uk(n), r.objects.active.id = n.data.id, r.objects.active.name = (i = n.name) != null ? i : null, r.objects.active.isText = ir(n), r.objects.active.isImage = ck(n)
} : r => {
var s, d, a, o, c;
const i = {
...(s = e().config.objectDefaults) == null ? void 0 : s.global,
fontFamily: (a = (d = e().config.objectDefaults) == null ? void 0 : d.text) == null ? void 0 : a.fontFamily,
fontSize: (c = (o = e().config.objectDefaults) == null ? void 0 : o.text) == null ? void 0 : c.fontSize
};
r.objects.active = {
...dv,
editableProps: i
}
})
},
reset() {
t({
objects: {
...e().objects,
...pv
}
})
}
}
}),
pv = {
all: [],
isEditingText: !1,
active: dv
},
hk = (t, e) => ({
frame: {
...gv,
select: n => {
t(r => {
r.frame.active = n
}), e().frame.showOptionsPanel()
},
deselect: () => {
t(n => {
n.frame.active = null, n.activeToolOverlay = null
})
},
showOptionsPanel: () => {
e().activeTool === Me.FRAME && t(n => {
n.activeToolOverlay = rn.Frame
})
},
reset() {
t({
frame: {
...e().frame,
...gv
}
})
}
}
}),
gv = {
active: null
},
dk = (t, e) => ({
resize: {
...mv,
setFormValue: n => {
t(r => {
Object.entries(n).forEach(([i, s]) => {
r.resize.formValue[i] = s
})
})
},
apply() {
const n = e().resize.formValue,
r = e().original;
if (n.width === r.width && n.height === r.height) return !1;
e().editor.tools.resize.apply(n)
},
reset() {
t({
resize: {
...e().resize,
...mv
}
})
}
}
}),
mv = {
formValue: {
width: 1,
height: 1,
maintainAspect: !0,
usePercentages: !1
}
},
pk = (t, e) => ({
corners: {
...vv,
setRadius: n => {
t(r => {
r.corners.radius = n
})
},
apply() {
return e().editor.tools.corners.apply(e().corners.radius)
},
reset() {
t({
corners: {
...e().corners,
...vv
}
})
}
}
}),
vv = {
radius: 50
},
yv = t => (e, n, r) => (r.setState = (i, s, ...d) => {
const a = typeof i == "function" ? nk(i) : i;
return e(a, s, ...d)
}, t(r.setState, n, r));
var bv = {
exports: {}
},
gk = {
aliceblue: [240, 248, 255],
antiquewhite: [250, 235, 215],
aqua: [0, 255, 255],
aquamarine: [127, 255, 212],
azure: [240, 255, 255],
beige: [245, 245, 220],
bisque: [255, 228, 196],
black: [0, 0, 0],
blanchedalmond: [255, 235, 205],
blue: [0, 0, 255],
blueviolet: [138, 43, 226],
brown: [165, 42, 42],
burlywood: [222, 184, 135],
cadetblue: [95, 158, 160],
chartreuse: [127, 255, 0],
chocolate: [210, 105, 30],
coral: [255, 127, 80],
cornflowerblue: [100, 149, 237],
cornsilk: [255, 248, 220],
crimson: [220, 20, 60],
cyan: [0, 255, 255],
darkblue: [0, 0, 139],
darkcyan: [0, 139, 139],
darkgoldenrod: [184, 134, 11],
darkgray: [169, 169, 169],
darkgreen: [0, 100, 0],
darkgrey: [169, 169, 169],
darkkhaki: [189, 183, 107],
darkmagenta: [139, 0, 139],
darkolivegreen: [85, 107, 47],
darkorange: [255, 140, 0],
darkorchid: [153, 50, 204],
darkred: [139, 0, 0],
darksalmon: [233, 150, 122],
darkseagreen: [143, 188, 143],
darkslateblue: [72, 61, 139],
darkslategray: [47, 79, 79],
darkslategrey: [47, 79, 79],
darkturquoise: [0, 206, 209],
darkviolet: [148, 0, 211],
deeppink: [255, 20, 147],
deepskyblue: [0, 191, 255],
dimgray: [105, 105, 105],
dimgrey: [105, 105, 105],
dodgerblue: [30, 144, 255],
firebrick: [178, 34, 34],
floralwhite: [255, 250, 240],
forestgreen: [34, 139, 34],
fuchsia: [255, 0, 255],
gainsboro: [220, 220, 220],
ghostwhite: [248, 248, 255],
gold: [255, 215, 0],
goldenrod: [218, 165, 32],
gray: [128, 128, 128],
green: [0, 128, 0],
greenyellow: [173, 255, 47],
grey: [128, 128, 128],
honeydew: [240, 255, 240],
hotpink: [255, 105, 180],
indianred: [205, 92, 92],
indigo: [75, 0, 130],
ivory: [255, 255, 240],
khaki: [240, 230, 140],
lavender: [230, 230, 250],
lavenderblush: [255, 240, 245],
lawngreen: [124, 252, 0],
lemonchiffon: [255, 250, 205],
lightblue: [173, 216, 230],
lightcoral: [240, 128, 128],
lightcyan: [224, 255, 255],
lightgoldenrodyellow: [250, 250, 210],
lightgray: [211, 211, 211],
lightgreen: [144, 238, 144],
lightgrey: [211, 211, 211],
lightpink: [255, 182, 193],
lightsalmon: [255, 160, 122],
lightseagreen: [32, 178, 170],
lightskyblue: [135, 206, 250],
lightslategray: [119, 136, 153],
lightslategrey: [119, 136, 153],
lightsteelblue: [176, 196, 222],
lightyellow: [255, 255, 224],
lime: [0, 255, 0],
limegreen: [50, 205, 50],
linen: [250, 240, 230],
magenta: [255, 0, 255],
maroon: [128, 0, 0],
mediumaquamarine: [102, 205, 170],
mediumblue: [0, 0, 205],
mediumorchid: [186, 85, 211],
mediumpurple: [147, 112, 219],
mediumseagreen: [60, 179, 113],
mediumslateblue: [123, 104, 238],
mediumspringgreen: [0, 250, 154],
mediumturquoise: [72, 209, 204],
mediumvioletred: [199, 21, 133],
midnightblue: [25, 25, 112],
mintcream: [245, 255, 250],
mistyrose: [255, 228, 225],
moccasin: [255, 228, 181],
navajowhite: [255, 222, 173],
navy: [0, 0, 128],
oldlace: [253, 245, 230],
olive: [128, 128, 0],
olivedrab: [107, 142, 35],
orange: [255, 165, 0],
orangered: [255, 69, 0],
orchid: [218, 112, 214],
palegoldenrod: [238, 232, 170],
palegreen: [152, 251, 152],
paleturquoise: [175, 238, 238],
palevioletred: [219, 112, 147],
papayawhip: [255, 239, 213],
peachpuff: [255, 218, 185],
peru: [205, 133, 63],
pink: [255, 192, 203],
plum: [221, 160, 221],
powderblue: [176, 224, 230],
purple: [128, 0, 128],
rebeccapurple: [102, 51, 153],
red: [255, 0, 0],
rosybrown: [188, 143, 143],
royalblue: [65, 105, 225],
saddlebrown: [139, 69, 19],
salmon: [250, 128, 114],
sandybrown: [244, 164, 96],
seagreen: [46, 139, 87],
seashell: [255, 245, 238],
sienna: [160, 82, 45],
silver: [192, 192, 192],
skyblue: [135, 206, 235],
slateblue: [106, 90, 205],
slategray: [112, 128, 144],
slategrey: [112, 128, 144],
snow: [255, 250, 250],
springgreen: [0, 255, 127],
steelblue: [70, 130, 180],
tan: [210, 180, 140],
teal: [0, 128, 128],
thistle: [216, 191, 216],
tomato: [255, 99, 71],
turquoise: [64, 224, 208],
violet: [238, 130, 238],
wheat: [245, 222, 179],
white: [255, 255, 255],
whitesmoke: [245, 245, 245],
yellow: [255, 255, 0],
yellowgreen: [154, 205, 50]
},
wv = {
exports: {}
},
mk = function(e) {
return !e || typeof e == "string" ? !1 : e instanceof Array || Array.isArray(e) || e.length >= 0 && (e.splice instanceof Function || Object.getOwnPropertyDescriptor(e, e.length - 1) && e.constructor.name !== "String")
},
vk = mk,
yk = Array.prototype.concat,
bk = Array.prototype.slice,
xv = wv.exports = function(e) {
for (var n = [], r = 0, i = e.length; r < i; r++) {
var s = e[r];
vk(s) ? n = yk.call(n, bk.call(s)) : n.push(s)
}
return n
};
xv.wrap = function(t) {
return function() {
return t(xv(arguments))
}
};
var Go = gk,
Ko = wv.exports,
_v = Object.hasOwnProperty,
Sv = Object.create(null);
for (var yf in Go) _v.call(Go, yf) && (Sv[Go[yf]] = yf);
var zt = bv.exports = {
to: {},
get: {}
};
zt.get = function(t) {
var e = t.substring(0, 3).toLowerCase(),
n, r;
switch (e) {
case "hsl":
n = zt.get.hsl(t), r = "hsl";
break;
case "hwb":
n = zt.get.hwb(t), r = "hwb";
break;
default:
n = zt.get.rgb(t), r = "rgb";
break
}
return n ? {
model: r,
value: n
} : null
}, zt.get.rgb = function(t) {
if (!t) return null;
var e = /^#([a-f0-9]{3,4})$/i,
n = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i,
r = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,
i = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,
s = /^(\w+)$/,
d = [0, 0, 0, 1],
a, o, c;
if (a = t.match(n)) {
for (c = a[2], a = a[1], o = 0; o < 3; o++) {
var h = o * 2;
d[o] = parseInt(a.slice(h, h + 2), 16)
}
c && (d[3] = parseInt(c, 16) / 255)
} else if (a = t.match(e)) {
for (a = a[1], c = a[3], o = 0; o < 3; o++) d[o] = parseInt(a[o] + a[o], 16);
c && (d[3] = parseInt(c + c, 16) / 255)
} else if (a = t.match(r)) {
for (o = 0; o < 3; o++) d[o] = parseInt(a[o + 1], 0);
a[4] && (a[5] ? d[3] = parseFloat(a[4]) * .01 : d[3] = parseFloat(a[4]))
} else if (a = t.match(i)) {
for (o = 0; o < 3; o++) d[o] = Math.round(parseFloat(a[o + 1]) * 2.55);
a[4] && (a[5] ? d[3] = parseFloat(a[4]) * .01 : d[3] = parseFloat(a[4]))
} else return (a = t.match(s)) ? a[1] === "transparent" ? [0, 0, 0, 0] : _v.call(Go, a[1]) ? (d = Go[a[1]], d[3] = 1, d) : null : null;
for (o = 0; o < 3; o++) d[o] = or(d[o], 0, 255);
return d[3] = or(d[3], 0, 1), d
}, zt.get.hsl = function(t) {
if (!t) return null;
var e = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,
n = t.match(e);
if (n) {
var r = parseFloat(n[4]),
i = (parseFloat(n[1]) % 360 + 360) % 360,
s = or(parseFloat(n[2]), 0, 100),
d = or(parseFloat(n[3]), 0, 100),
a = or(isNaN(r) ? 1 : r, 0, 1);
return [i, s, d, a]
}
return null
}, zt.get.hwb = function(t) {
if (!t) return null;
var e = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,
n = t.match(e);
if (n) {
var r = parseFloat(n[4]),
i = (parseFloat(n[1]) % 360 + 360) % 360,
s = or(parseFloat(n[2]), 0, 100),
d = or(parseFloat(n[3]), 0, 100),
a = or(isNaN(r) ? 1 : r, 0, 1);
return [i, s, d, a]
}
return null
}, zt.to.hex = function() {
var t = Ko(arguments);
return "#" + Ha(t[0]) + Ha(t[1]) + Ha(t[2]) + (t[3] < 1 ? Ha(Math.round(t[3] * 255)) : "")
}, zt.to.rgb = function() {
var t = Ko(arguments);
return t.length < 4 || t[3] === 1 ? "rgb(" + Math.round(t[0]) + ", " + Math.round(t[1]) + ", " + Math.round(t[2]) + ")" : "rgba(" + Math.round(t[0]) + ", " + Math.round(t[1]) + ", " + Math.round(t[2]) + ", " + t[3] + ")"
}, zt.to.rgb.percent = function() {
var t = Ko(arguments),
e = Math.round(t[0] / 255 * 100),
n = Math.round(t[1] / 255 * 100),
r = Math.round(t[2] / 255 * 100);
return t.length < 4 || t[3] === 1 ? "rgb(" + e + "%, " + n + "%, " + r + "%)" : "rgba(" + e + "%, " + n + "%, " + r + "%, " + t[3] + ")"
}, zt.to.hsl = function() {
var t = Ko(arguments);
return t.length < 4 || t[3] === 1 ? "hsl(" + t[0] + ", " + t[1] + "%, " + t[2] + "%)" : "hsla(" + t[0] + ", " + t[1] + "%, " + t[2] + "%, " + t[3] + ")"
}, zt.to.hwb = function() {
var t = Ko(arguments),
e = "";
return t.length >= 4 && t[3] !== 1 && (e = ", " + t[3]), "hwb(" + t[0] + ", " + t[1] + "%, " + t[2] + "%" + e + ")"
}, zt.to.keyword = function(t) {
return Sv[t.slice(0, 3)]
};
function or(t, e, n) {
return Math.min(Math.max(e, t), n)
}
function Ha(t) {
var e = Math.round(t).toString(16).toUpperCase();
return e.length < 2 ? "0" + e : e
}
var wk = {
aliceblue: [240, 248, 255],
antiquewhite: [250, 235, 215],
aqua: [0, 255, 255],
aquamarine: [127, 255, 212],
azure: [240, 255, 255],
beige: [245, 245, 220],
bisque: [255, 228, 196],
black: [0, 0, 0],
blanchedalmond: [255, 235, 205],
blue: [0, 0, 255],
blueviolet: [138, 43, 226],
brown: [165, 42, 42],
burlywood: [222, 184, 135],
cadetblue: [95, 158, 160],
chartreuse: [127, 255, 0],
chocolate: [210, 105, 30],
coral: [255, 127, 80],
cornflowerblue: [100, 149, 237],
cornsilk: [255, 248, 220],
crimson: [220, 20, 60],
cyan: [0, 255, 255],
darkblue: [0, 0, 139],
darkcyan: [0, 139, 139],
darkgoldenrod: [184, 134, 11],
darkgray: [169, 169, 169],
darkgreen: [0, 100, 0],
darkgrey: [169, 169, 169],
darkkhaki: [189, 183, 107],
darkmagenta: [139, 0, 139],
darkolivegreen: [85, 107, 47],
darkorange: [255, 140, 0],
darkorchid: [153, 50, 204],
darkred: [139, 0, 0],
darksalmon: [233, 150, 122],
darkseagreen: [143, 188, 143],
darkslateblue: [72, 61, 139],
darkslategray: [47, 79, 79],
darkslategrey: [47, 79, 79],
darkturquoise: [0, 206, 209],
darkviolet: [148, 0, 211],
deeppink: [255, 20, 147],
deepskyblue: [0, 191, 255],
dimgray: [105, 105, 105],
dimgrey: [105, 105, 105],
dodgerblue: [30, 144, 255],
firebrick: [178, 34, 34],
floralwhite: [255, 250, 240],
forestgreen: [34, 139, 34],
fuchsia: [255, 0, 255],
gainsboro: [220, 220, 220],
ghostwhite: [248, 248, 255],
gold: [255, 215, 0],
goldenrod: [218, 165, 32],
gray: [128, 128, 128],
green: [0, 128, 0],
greenyellow: [173, 255, 47],
grey: [128, 128, 128],
honeydew: [240, 255, 240],
hotpink: [255, 105, 180],
indianred: [205, 92, 92],
indigo: [75, 0, 130],
ivory: [255, 255, 240],
khaki: [240, 230, 140],
lavender: [230, 230, 250],
lavenderblush: [255, 240, 245],
lawngreen: [124, 252, 0],
lemonchiffon: [255, 250, 205],
lightblue: [173, 216, 230],
lightcoral: [240, 128, 128],
lightcyan: [224, 255, 255],
lightgoldenrodyellow: [250, 250, 210],
lightgray: [211, 211, 211],
lightgreen: [144, 238, 144],
lightgrey: [211, 211, 211],
lightpink: [255, 182, 193],
lightsalmon: [255, 160, 122],
lightseagreen: [32, 178, 170],
lightskyblue: [135, 206, 250],
lightslategray: [119, 136, 153],
lightslategrey: [119, 136, 153],
lightsteelblue: [176, 196, 222],
lightyellow: [255, 255, 224],
lime: [0, 255, 0],
limegreen: [50, 205, 50],
linen: [250, 240, 230],
magenta: [255, 0, 255],
maroon: [128, 0, 0],
mediumaquamarine: [102, 205, 170],
mediumblue: [0, 0, 205],
mediumorchid: [186, 85, 211],
mediumpurple: [147, 112, 219],
mediumseagreen: [60, 179, 113],
mediumslateblue: [123, 104, 238],
mediumspringgreen: [0, 250, 154],
mediumturquoise: [72, 209, 204],
mediumvioletred: [199, 21, 133],
midnightblue: [25, 25, 112],
mintcream: [245, 255, 250],
mistyrose: [255, 228, 225],
moccasin: [255, 228, 181],
navajowhite: [255, 222, 173],
navy: [0, 0, 128],
oldlace: [253, 245, 230],
olive: [128, 128, 0],
olivedrab: [107, 142, 35],
orange: [255, 165, 0],
orangered: [255, 69, 0],
orchid: [218, 112, 214],
palegoldenrod: [238, 232, 170],
palegreen: [152, 251, 152],
paleturquoise: [175, 238, 238],
palevioletred: [219, 112, 147],
papayawhip: [255, 239, 213],
peachpuff: [255, 218, 185],
peru: [205, 133, 63],
pink: [255, 192, 203],
plum: [221, 160, 221],
powderblue: [176, 224, 230],
purple: [128, 0, 128],
rebeccapurple: [102, 51, 153],
red: [255, 0, 0],
rosybrown: [188, 143, 143],
royalblue: [65, 105, 225],
saddlebrown: [139, 69, 19],
salmon: [250, 128, 114],
sandybrown: [244, 164, 96],
seagreen: [46, 139, 87],
seashell: [255, 245, 238],
sienna: [160, 82, 45],
silver: [192, 192, 192],
skyblue: [135, 206, 235],
slateblue: [106, 90, 205],
slategray: [112, 128, 144],
slategrey: [112, 128, 144],
snow: [255, 250, 250],
springgreen: [0, 255, 127],
steelblue: [70, 130, 180],
tan: [210, 180, 140],
teal: [0, 128, 128],
thistle: [216, 191, 216],
tomato: [255, 99, 71],
turquoise: [64, 224, 208],
violet: [238, 130, 238],
wheat: [245, 222, 179],
white: [255, 255, 255],
whitesmoke: [245, 245, 245],
yellow: [255, 255, 0],
yellowgreen: [154, 205, 50]
};
const qo = wk,
Cv = {};
for (const t of Object.keys(qo)) Cv[qo[t]] = t;
const ge = {
rgb: {
channels: 3,
labels: "rgb"
},
hsl: {
channels: 3,
labels: "hsl"
},
hsv: {
channels: 3,
labels: "hsv"
},
hwb: {
channels: 3,
labels: "hwb"
},
cmyk: {
channels: 4,
labels: "cmyk"
},
xyz: {
channels: 3,
labels: "xyz"
},
lab: {
channels: 3,
labels: "lab"
},
lch: {
channels: 3,
labels: "lch"
},
hex: {
channels: 1,
labels: ["hex"]
},
keyword: {
channels: 1,
labels: ["keyword"]
},
ansi16: {
channels: 1,
labels: ["ansi16"]
},
ansi256: {
channels: 1,
labels: ["ansi256"]
},
hcg: {
channels: 3,
labels: ["h", "c", "g"]
},
apple: {
channels: 3,
labels: ["r16", "g16", "b16"]
},
gray: {
channels: 1,
labels: ["gray"]
}
};
var Tv = ge;
for (const t of Object.keys(ge)) {
if (!("channels" in ge[t])) throw new Error("missing channels property: " + t);
if (!("labels" in ge[t])) throw new Error("missing channel labels property: " + t);
if (ge[t].labels.length !== ge[t].channels) throw new Error("channel and label counts mismatch: " + t);
const {
channels: e,
labels: n
} = ge[t];
delete ge[t].channels, delete ge[t].labels, Object.defineProperty(ge[t], "channels", {
value: e
}), Object.defineProperty(ge[t], "labels", {
value: n
})
}
ge.rgb.hsl = function(t) {
const e = t[0] / 255,
n = t[1] / 255,
r = t[2] / 255,
i = Math.min(e, n, r),
s = Math.max(e, n, r),
d = s - i;
let a, o;
s === i ? a = 0 : e === s ? a = (n - r) / d : n === s ? a = 2 + (r - e) / d : r === s && (a = 4 + (e - n) / d), a = Math.min(a * 60, 360), a < 0 && (a += 360);
const c = (i + s) / 2;
return s === i ? o = 0 : c <= .5 ? o = d / (s + i) : o = d / (2 - s - i), [a, o * 100, c * 100]
}, ge.rgb.hsv = function(t) {
let e, n, r, i, s;
const d = t[0] / 255,
a = t[1] / 255,
o = t[2] / 255,
c = Math.max(d, a, o),
h = c - Math.min(d, a, o),
l = function(u) {
return (c - u) / 6 / h + 1 / 2
};
return h === 0 ? (i = 0, s = 0) : (s = h / c, e = l(d), n = l(a), r = l(o), d === c ? i = r - n : a === c ? i = 1 / 3 + e - r : o === c && (i = 2 / 3 + n - e), i < 0 ? i += 1 : i > 1 && (i -= 1)), [i * 360, s * 100, c * 100]
}, ge.rgb.hwb = function(t) {
const e = t[0],
n = t[1];
let r = t[2];
const i = ge.rgb.hsl(t)[0],
s = 1 / 255 * Math.min(e, Math.min(n, r));
return r = 1 - 1 / 255 * Math.max(e, Math.max(n, r)), [i, s * 100, r * 100]
}, ge.rgb.cmyk = function(t) {
const e = t[0] / 255,
n = t[1] / 255,
r = t[2] / 255,
i = Math.min(1 - e, 1 - n, 1 - r),
s = (1 - e - i) / (1 - i) || 0,
d = (1 - n - i) / (1 - i) || 0,
a = (1 - r - i) / (1 - i) || 0;
return [s * 100, d * 100, a * 100, i * 100]
};
function xk(t, e) {
return (t[0] - e[0]) ** 2 + (t[1] - e[1]) ** 2 + (t[2] - e[2]) ** 2
}
ge.rgb.keyword = function(t) {
const e = Cv[t];
if (e) return e;
let n = 1 / 0,
r;
for (const i of Object.keys(qo)) {
const s = qo[i],
d = xk(t, s);
d < n && (n = d, r = i)
}
return r
}, ge.keyword.rgb = function(t) {
return qo[t]
}, ge.rgb.xyz = function(t) {
let e = t[0] / 255,
n = t[1] / 255,
r = t[2] / 255;
e = e > .04045 ? ((e + .055) / 1.055) ** 2.4 : e / 12.92, n = n > .04045 ? ((n + .055) / 1.055) ** 2.4 : n / 12.92, r = r > .04045 ? ((r + .055) / 1.055) ** 2.4 : r / 12.92;
const i = e * .4124 + n * .3576 + r * .1805,
s = e * .2126 + n * .7152 + r * .0722,
d = e * .0193 + n * .1192 + r * .9505;
return [i * 100, s * 100, d * 100]
}, ge.rgb.lab = function(t) {
const e = ge.rgb.xyz(t);
let n = e[0],
r = e[1],
i = e[2];
n /= 95.047, r /= 100, i /= 108.883, n = n > .008856 ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > .008856 ? r ** (1 / 3) : 7.787 * r + 16 / 116, i = i > .008856 ? i ** (1 / 3) : 7.787 * i + 16 / 116;
const s = 116 * r - 16,
d = 500 * (n - r),
a = 200 * (r - i);
return [s, d, a]
}, ge.hsl.rgb = function(t) {
const e = t[0] / 360,
n = t[1] / 100,
r = t[2] / 100;
let i, s, d;
if (n === 0) return d = r * 255, [d, d, d];
r < .5 ? i = r * (1 + n) : i = r + n - r * n;
const a = 2 * r - i,
o = [0, 0, 0];
for (let c = 0; c < 3; c++) s = e + 1 / 3 * -(c - 1), s < 0 && s++, s > 1 && s--, 6 * s < 1 ? d = a + (i - a) * 6 * s : 2 * s < 1 ? d = i : 3 * s < 2 ? d = a + (i - a) * (2 / 3 - s) * 6 : d = a, o[c] = d * 255;
return o
}, ge.hsl.hsv = function(t) {
const e = t[0];
let n = t[1] / 100,
r = t[2] / 100,
i = n;
const s = Math.max(r, .01);
r *= 2, n *= r <= 1 ? r : 2 - r, i *= s <= 1 ? s : 2 - s;
const d = (r + n) / 2,
a = r === 0 ? 2 * i / (s + i) : 2 * n / (r + n);
return [e, a * 100, d * 100]
}, ge.hsv.rgb = function(t) {
const e = t[0] / 60,
n = t[1] / 100;
let r = t[2] / 100;
const i = Math.floor(e) % 6,
s = e - Math.floor(e),
d = 255 * r * (1 - n),
a = 255 * r * (1 - n * s),
o = 255 * r * (1 - n * (1 - s));
switch (r *= 255, i) {
case 0:
return [r, o, d];
case 1:
return [a, r, d];
case 2:
return [d, r, o];
case 3:
return [d, a, r];
case 4:
return [o, d, r];
case 5:
return [r, d, a]
}
}, ge.hsv.hsl = function(t) {
const e = t[0],
n = t[1] / 100,
r = t[2] / 100,
i = Math.max(r, .01);
let s, d;
d = (2 - n) * r;
const a = (2 - n) * i;
return s = n * i, s /= a <= 1 ? a : 2 - a, s = s || 0, d /= 2, [e, s * 100, d * 100]
}, ge.hwb.rgb = function(t) {
const e = t[0] / 360;
let n = t[1] / 100,
r = t[2] / 100;
const i = n + r;
let s;
i > 1 && (n /= i, r /= i);
const d = Math.floor(6 * e),
a = 1 - r;
s = 6 * e - d, (d & 1) !== 0 && (s = 1 - s);
const o = n + s * (a - n);
let c, h, l;
switch (d) {
default:
case 6:
case 0:
c = a, h = o, l = n;
break;
case 1:
c = o, h = a, l = n;
break;
case 2:
c = n, h = a, l = o;
break;
case 3:
c = n, h = o, l = a;
break;
case 4:
c = o, h = n, l = a;
break;
case 5:
c = a, h = n, l = o;
break
}
return [c * 255, h * 255, l * 255]
}, ge.cmyk.rgb = function(t) {
const e = t[0] / 100,
n = t[1] / 100,
r = t[2] / 100,
i = t[3] / 100,
s = 1 - Math.min(1, e * (1 - i) + i),
d = 1 - Math.min(1, n * (1 - i) + i),
a = 1 - Math.min(1, r * (1 - i) + i);
return [s * 255, d * 255, a * 255]
}, ge.xyz.rgb = function(t) {
const e = t[0] / 100,
n = t[1] / 100,
r = t[2] / 100;
let i, s, d;
return i = e * 3.2406 + n * -1.5372 + r * -.4986, s = e * -.9689 + n * 1.8758 + r * .0415, d = e * .0557 + n * -.204 + r * 1.057, i = i > .0031308 ? 1.055 * i ** (1 / 2.4) - .055 : i * 12.92, s = s > .0031308 ? 1.055 * s ** (1 / 2.4) - .055 : s * 12.92, d = d > .0031308 ? 1.055 * d ** (1 / 2.4) - .055 : d * 12.92, i = Math.min(Math.max(0, i), 1), s = Math.min(Math.max(0, s), 1), d = Math.min(Math.max(0, d), 1), [i * 255, s * 255, d * 255]
}, ge.xyz.lab = function(t) {
let e = t[0],
n = t[1],
r = t[2];
e /= 95.047, n /= 100, r /= 108.883, e = e > .008856 ? e ** (1 / 3) : 7.787 * e + 16 / 116, n = n > .008856 ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > .008856 ? r ** (1 / 3) : 7.787 * r + 16 / 116;
const i = 116 * n - 16,
s = 500 * (e - n),
d = 200 * (n - r);
return [i, s, d]
}, ge.lab.xyz = function(t) {
const e = t[0],
n = t[1],
r = t[2];
let i, s, d;
s = (e + 16) / 116, i = n / 500 + s, d = s - r / 200;
const a = s ** 3,
o = i ** 3,
c = d ** 3;
return s = a > .008856 ? a : (s - 16 / 116) / 7.787, i = o > .008856 ? o : (i - 16 / 116) / 7.787, d = c > .008856 ? c : (d - 16 / 116) / 7.787, i *= 95.047, s *= 100, d *= 108.883, [i, s, d]
}, ge.lab.lch = function(t) {
const e = t[0],
n = t[1],
r = t[2];
let i;
i = Math.atan2(r, n) * 360 / 2 / Math.PI, i < 0 && (i += 360);
const d = Math.sqrt(n * n + r * r);
return [e, d, i]
}, ge.lch.lab = function(t) {
const e = t[0],
n = t[1],
i = t[2] / 360 * 2 * Math.PI,
s = n * Math.cos(i),
d = n * Math.sin(i);
return [e, s, d]
}, ge.rgb.ansi16 = function(t, e = null) {
const [n, r, i] = t;
let s = e === null ? ge.rgb.hsv(t)[2] : e;
if (s = Math.round(s / 50), s === 0) return 30;
let d = 30 + (Math.round(i / 255) << 2 | Math.round(r / 255) << 1 | Math.round(n / 255));
return s === 2 && (d += 60), d
}, ge.hsv.ansi16 = function(t) {
return ge.rgb.ansi16(ge.hsv.rgb(t), t[2])
}, ge.rgb.ansi256 = function(t) {
const e = t[0],
n = t[1],
r = t[2];
return e === n && n === r ? e < 8 ? 16 : e > 248 ? 231 : Math.round((e - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(e / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(r / 255 * 5)
}, ge.ansi16.rgb = function(t) {
let e = t % 10;
if (e === 0 || e === 7) return t > 50 && (e += 3.5), e = e / 10.5 * 255, [e, e, e];
const n = (~~(t > 50) + 1) * .5,
r = (e & 1) * n * 255,
i = (e >> 1 & 1) * n * 255,
s = (e >> 2 & 1) * n * 255;
return [r, i, s]
}, ge.ansi256.rgb = function(t) {
if (t >= 232) {
const s = (t - 232) * 10 + 8;
return [s, s, s]
}
t -= 16;
let e;
const n = Math.floor(t / 36) / 5 * 255,
r = Math.floor((e = t % 36) / 6) / 5 * 255,
i = e % 6 / 5 * 255;
return [n, r, i]
}, ge.rgb.hex = function(t) {
const n = (((Math.round(t[0]) & 255) << 16) + ((Math.round(t[1]) & 255) << 8) + (Math.round(t[2]) & 255)).toString(16).toUpperCase();
return "000000".substring(n.length) + n
}, ge.hex.rgb = function(t) {
const e = t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!e) return [0, 0, 0];
let n = e[0];
e[0].length === 3 && (n = n.split("").map(a => a + a).join(""));
const r = parseInt(n, 16),
i = r >> 16 & 255,
s = r >> 8 & 255,
d = r & 255;
return [i, s, d]
}, ge.rgb.hcg = function(t) {
const e = t[0] / 255,
n = t[1] / 255,
r = t[2] / 255,
i = Math.max(Math.max(e, n), r),
s = Math.min(Math.min(e, n), r),
d = i - s;
let a, o;
return d < 1 ? a = s / (1 - d) : a = 0, d <= 0 ? o = 0 : i === e ? o = (n - r) / d % 6 : i === n ? o = 2 + (r - e) / d : o = 4 + (e - n) / d, o /= 6, o %= 1, [o * 360, d * 100, a * 100]
}, ge.hsl.hcg = function(t) {
const e = t[1] / 100,
n = t[2] / 100,
r = n < .5 ? 2 * e * n : 2 * e * (1 - n);
let i = 0;
return r < 1 && (i = (n - .5 * r) / (1 - r)), [t[0], r * 100, i * 100]
}, ge.hsv.hcg = function(t) {
const e = t[1] / 100,
n = t[2] / 100,
r = e * n;
let i = 0;
return r < 1 && (i = (n - r) / (1 - r)), [t[0], r * 100, i * 100]
}, ge.hcg.rgb = function(t) {
const e = t[0] / 360,
n = t[1] / 100,
r = t[2] / 100;
if (n === 0) return [r * 255, r * 255, r * 255];
const i = [0, 0, 0],
s = e % 1 * 6,
d = s % 1,
a = 1 - d;
let o = 0;
switch (Math.floor(s)) {
case 0:
i[0] = 1, i[1] = d, i[2] = 0;
break;
case 1:
i[0] = a, i[1] = 1, i[2] = 0;
break;
case 2:
i[0] = 0, i[1] = 1, i[2] = d;
break;
case 3:
i[0] = 0, i[1] = a, i[2] = 1;
break;
case 4:
i[0] = d, i[1] = 0, i[2] = 1;
break;
default:
i[0] = 1, i[1] = 0, i[2] = a
}
return o = (1 - n) * r, [(n * i[0] + o) * 255, (n * i[1] + o) * 255, (n * i[2] + o) * 255]
}, ge.hcg.hsv = function(t) {
const e = t[1] / 100,
n = t[2] / 100,
r = e + n * (1 - e);
let i = 0;
return r > 0 && (i = e / r), [t[0], i * 100, r * 100]
}, ge.hcg.hsl = function(t) {
const e = t[1] / 100,
r = t[2] / 100 * (1 - e) + .5 * e;
let i = 0;
return r > 0 && r < .5 ? i = e / (2 * r) : r >= .5 && r < 1 && (i = e / (2 * (1 - r))), [t[0], i * 100, r * 100]
}, ge.hcg.hwb = function(t) {
const e = t[1] / 100,
n = t[2] / 100,
r = e + n * (1 - e);
return [t[0], (r - e) * 100, (1 - r) * 100]
}, ge.hwb.hcg = function(t) {
const e = t[1] / 100,
n = t[2] / 100,
r = 1 - n,
i = r - e;
let s = 0;
return i < 1 && (s = (r - i) / (1 - i)), [t[0], i * 100, s * 100]
}, ge.apple.rgb = function(t) {
return [t[0] / 65535 * 255, t[1] / 65535 * 255, t[2] / 65535 * 255]
}, ge.rgb.apple = function(t) {
return [t[0] / 255 * 65535, t[1] / 255 * 65535, t[2] / 255 * 65535]
}, ge.gray.rgb = function(t) {
return [t[0] / 100 * 255, t[0] / 100 * 255, t[0] / 100 * 255]
}, ge.gray.hsl = function(t) {
return [0, 0, t[0]]
}, ge.gray.hsv = ge.gray.hsl, ge.gray.hwb = function(t) {
return [0, 100, t[0]]
}, ge.gray.cmyk = function(t) {
return [0, 0, 0, t[0]]
}, ge.gray.lab = function(t) {
return [t[0], 0, 0]
}, ge.gray.hex = function(t) {
const e = Math.round(t[0] / 100 * 255) & 255,
r = ((e << 16) + (e << 8) + e).toString(16).toUpperCase();
return "000000".substring(r.length) + r
}, ge.rgb.gray = function(t) {
return [(t[0] + t[1] + t[2]) / 3 / 255 * 100]
};
const Ua = Tv;
function _k() {
const t = {},
e = Object.keys(Ua);
for (let n = e.length, r = 0; r < n; r++) t[e[r]] = {
distance: -1,
parent: null
};
return t
}
function Sk(t) {
const e = _k(),
n = [t];
for (e[t].distance = 0; n.length;) {
const r = n.pop(),
i = Object.keys(Ua[r]);
for (let s = i.length, d = 0; d < s; d++) {
const a = i[d],
o = e[a];
o.distance === -1 && (o.distance = e[r].distance + 1, o.parent = r, n.unshift(a))
}
}
return e
}
function Ck(t, e) {
return function(n) {
return e(t(n))
}
}
function Tk(t, e) {
const n = [e[t].parent, t];
let r = Ua[e[t].parent][t],
i = e[t].parent;
for (; e[i].parent;) n.unshift(e[i].parent), r = Ck(Ua[e[i].parent][i], r), i = e[i].parent;
return r.conversion = n, r
}
var kk = function(t) {
const e = Sk(t),
n = {},
r = Object.keys(e);
for (let i = r.length, s = 0; s < i; s++) {
const d = r[s];
e[d].parent !== null && (n[d] = Tk(d, e))
}
return n
};
const bf = Tv,
Ek = kk,
Vi = {},
Ok = Object.keys(bf);
function Pk(t) {
const e = function(...n) {
const r = n[0];
return r == null ? r : (r.length > 1 && (n = r), t(n))
};
return "conversion" in t && (e.conversion = t.conversion), e
}
function Mk(t) {
const e = function(...n) {
const r = n[0];
if (r == null) return r;
r.length > 1 && (n = r);
const i = t(n);
if (typeof i == "object")
for (let s = i.length, d = 0; d < s; d++) i[d] = Math.round(i[d]);
return i
};
return "conversion" in t && (e.conversion = t.conversion), e
}
Ok.forEach(t => {
Vi[t] = {}, Object.defineProperty(Vi[t], "channels", {
value: bf[t].channels
}), Object.defineProperty(Vi[t], "labels", {
value: bf[t].labels
});
const e = Ek(t);
Object.keys(e).forEach(r => {
const i = e[r];
Vi[t][r] = Mk(i), Vi[t][r].raw = Pk(i)
})
});
var Ak = Vi;
const Hi = bv.exports,
Nt = Ak,
kv = ["keyword", "gray", "hex"],
wf = {};
for (const t of Object.keys(Nt)) wf[[...Nt[t].labels].sort().join("")] = t;
const Wa = {};
function st(t, e) {
if (!(this instanceof st)) return new st(t, e);
if (e && e in kv && (e = null), e && !(e in Nt)) throw new Error("Unknown model: " + e);
let n, r;
if (t == null) this.model = "rgb", this.color = [0, 0, 0], this.valpha = 1;
else if (t instanceof st) this.model = t.model, this.color = [...t.color], this.valpha = t.valpha;
else if (typeof t == "string") {
const i = Hi.get(t);
if (i === null) throw new Error("Unable to parse color from string: " + t);
this.model = i.model, r = Nt[this.model].channels, this.color = i.value.slice(0, r), this.valpha = typeof i.value[r] == "number" ? i.value[r] : 1
} else if (t.length > 0) {
this.model = e || "rgb", r = Nt[this.model].channels;
const i = Array.prototype.slice.call(t, 0, r);
this.color = xf(i, r), this.valpha = typeof t[r] == "number" ? t[r] : 1
} else if (typeof t == "number") this.model = "rgb", this.color = [t >> 16 & 255, t >> 8 & 255, t & 255], this.valpha = 1;
else {
this.valpha = 1;
const i = Object.keys(t);
"alpha" in t && (i.splice(i.indexOf("alpha"), 1), this.valpha = typeof t.alpha == "number" ? t.alpha : 0);
const s = i.sort().join("");
if (!(s in wf)) throw new Error("Unable to parse color from object: " + JSON.stringify(t));
this.model = wf[s];
const {
labels: d
} = Nt[this.model], a = [];
for (n = 0; n < d.length; n++) a.push(t[d[n]]);
this.color = xf(a)
}
if (Wa[this.model])
for (r = Nt[this.model].channels, n = 0; n < r; n++) {
const i = Wa[this.model][n];
i && (this.color[n] = i(this.color[n]))
}
this.valpha = Math.max(0, Math.min(1, this.valpha)), Object.freeze && Object.freeze(this)
}
st.prototype = {
toString() {
return this.string()
},
toJSON() {
return this[this.model]()
},
string(t) {
let e = this.model in Hi.to ? this : this.rgb();
e = e.round(typeof t == "number" ? t : 1);
const n = e.valpha === 1 ? e.color : [...e.color, this.valpha];
return Hi.to[e.model](n)
},
percentString(t) {
const e = this.rgb().round(typeof t == "number" ? t : 1),
n = e.valpha === 1 ? e.color : [...e.color, this.valpha];
return Hi.to.rgb.percent(n)
},
array() {
return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha]
},
object() {
const t = {},
{
channels: e
} = Nt[this.model],
{
labels: n
} = Nt[this.model];
for (let r = 0; r < e; r++) t[n[r]] = this.color[r];
return this.valpha !== 1 && (t.alpha = this.valpha), t
},
unitArray() {
const t = this.rgb().color;
return t[0] /= 255, t[1] /= 255, t[2] /= 255, this.valpha !== 1 && t.push(this.valpha), t
},
unitObject() {
const t = this.rgb().object();
return t.r /= 255, t.g /= 255, t.b /= 255, this.valpha !== 1 && (t.alpha = this.valpha), t
},
round(t) {
return t = Math.max(t || 0, 0), new st([...this.color.map(Rk(t)), this.valpha], this.model)
},
alpha(t) {
return t !== void 0 ? new st([...this.color, Math.max(0, Math.min(1, t))], this.model) : this.valpha
},
red: We("rgb", 0, et(255)),
green: We("rgb", 1, et(255)),
blue: We("rgb", 2, et(255)),
hue: We(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, t => (t % 360 + 360) % 360),
saturationl: We("hsl", 1, et(100)),
lightness: We("hsl", 2, et(100)),
saturationv: We("hsv", 1, et(100)),
value: We("hsv", 2, et(100)),
chroma: We("hcg", 1, et(100)),
gray: We("hcg", 2, et(100)),
white: We("hwb", 1, et(100)),
wblack: We("hwb", 2, et(100)),
cyan: We("cmyk", 0, et(100)),
magenta: We("cmyk", 1, et(100)),
yellow: We("cmyk", 2, et(100)),
black: We("cmyk", 3, et(100)),
x: We("xyz", 0, et(95.047)),
y: We("xyz", 1, et(100)),
z: We("xyz", 2, et(108.833)),
l: We("lab", 0, et(100)),
a: We("lab", 1),
b: We("lab", 2),
keyword(t) {
return t !== void 0 ? new st(t) : Nt[this.model].keyword(this.color)
},
hex(t) {
return t !== void 0 ? new st(t) : Hi.to.hex(this.rgb().round().color)
},
hexa(t) {
if (t !== void 0) return new st(t);
const e = this.rgb().round().color;
let n = Math.round(this.valpha * 255).toString(16).toUpperCase();
return n.length === 1 && (n = "0" + n), Hi.to.hex(e) + n
},
rgbNumber() {
const t = this.rgb().color;
return (t[0] & 255) << 16 | (t[1] & 255) << 8 | t[2] & 255
},
luminosity() {
const t = this.rgb().color,
e = [];
for (const [n, r] of t.entries()) {
const i = r / 255;
e[n] = i <= .04045 ? i / 12.92 : ((i + .055) / 1.055) ** 2.4
}
return .2126 * e[0] + .7152 * e[1] + .0722 * e[2]
},
contrast(t) {
const e = this.luminosity(),
n = t.luminosity();
return e > n ? (e + .05) / (n + .05) : (n + .05) / (e + .05)
},
level(t) {
const e = this.contrast(t);
return e >= 7 ? "AAA" : e >= 4.5 ? "AA" : ""
},
isDark() {
const t = this.rgb().color;
return (t[0] * 2126 + t[1] * 7152 + t[2] * 722) / 1e4 < 128
},
isLight() {
return !this.isDark()
},
negate() {
const t = this.rgb();
for (let e = 0; e < 3; e++) t.color[e] = 255 - t.color[e];
return t
},
lighten(t) {
const e = this.hsl();
return e.color[2] += e.color[2] * t, e
},
darken(t) {
const e = this.hsl();
return e.color[2] -= e.color[2] * t, e
},
saturate(t) {
const e = this.hsl();
return e.color[1] += e.color[1] * t, e
},
desaturate(t) {
const e = this.hsl();
return e.color[1] -= e.color[1] * t, e
},
whiten(t) {
const e = this.hwb();
return e.color[1] += e.color[1] * t, e
},
blacken(t) {
const e = this.hwb();
return e.color[2] += e.color[2] * t, e
},
grayscale() {
const t = this.rgb().color,
e = t[0] * .3 + t[1] * .59 + t[2] * .11;
return st.rgb(e, e, e)
},
fade(t) {
return this.alpha(this.valpha - this.valpha * t)
},
opaquer(t) {
return this.alpha(this.valpha + this.valpha * t)
},
rotate(t) {
const e = this.hsl();
let n = e.color[0];
return n = (n + t) % 360, n = n < 0 ? 360 + n : n, e.color[0] = n, e
},
mix(t, e) {
if (!t || !t.rgb) throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof t);
const n = t.rgb(),
r = this.rgb(),
i = e === void 0 ? .5 : e,
s = 2 * i - 1,
d = n.alpha() - r.alpha(),
a = ((s * d === -1 ? s : (s + d) / (1 + s * d)) + 1) / 2,
o = 1 - a;
return st.rgb(a * n.red() + o * r.red(), a * n.green() + o * r.green(), a * n.blue() + o * r.blue(), n.alpha() * i + r.alpha() * (1 - i))
}
};
for (const t of Object.keys(Nt)) {
if (kv.includes(t)) continue;
const {
channels: e
} = Nt[t];
st.prototype[t] = function(...n) {
return this.model === t ? new st(this) : n.length > 0 ? new st(n, t) : new st([...Ik(Nt[this.model][t].raw(this.color)), this.valpha], t)
}, st[t] = function(...n) {
let r = n[0];
return typeof r == "number" && (r = xf(n, e)), new st(r, t)
}
}
function Dk(t, e) {
return Number(t.toFixed(e))
}
function Rk(t) {
return function(e) {
return Dk(e, t)
}
}
function We(t, e, n) {
t = Array.isArray(t) ? t : [t];
for (const r of t)(Wa[r] || (Wa[r] = []))[e] = n;
return t = t[0],
function(r) {
let i;
return r !== void 0 ? (n && (r = n(r)), i = this[t](), i.color[e] = r, i) : (i = this[t]().color[e], n && (i = n(i)), i)
}
}
function et(t) {
return function(e) {
return Math.max(0, Math.min(t, e))
}
}
function Ik(t) {
return Array.isArray(t) ? t : [t]
}
function xf(t, e) {
for (let n = 0; n < e; n++) typeof t[n] != "number" && (t[n] = 0);
return t
}
var Lk = st;
const Fk = Lk;
function zk(t) {
const e = t.isDark ? Ju.find(i => i.isDark) : Ju.find(i => !i.isDark),
n = {
...e,
...t,
colors: {
...e == null ? void 0 : e.colors,
...t.colors
}
},
r = Object.entries(n.colors).map(([i, s]) => [i, Nk(s)]);
return {
id: n.name,
name: n.name,
colors: Object.fromEntries(r),
is_dark: n.isDark
}
}
function Nk(t) {
return t.endsWith("%") || t.split(" ").length === 3 ? t : Fk(t).rgb().array().slice(0, 3).join(" ")
}
let mn = typeof document < "u" ? (F_ = document.getElementById("root")) != null ? F_ : document.body : void 0;
function jk(t) {
mn = t
}
function Bk(t, e) {
mn == null || mn.style.setProperty(t, e)
}
function $k(t) {
Object.entries(t.colors).forEach(([e, n]) => {
Bk(e, n)
}), t.is_dark ? mn.classList.add("dark") : mn.classList.remove("dark")
}
const Ev = {
top: 0,
right: 0,
bottom: 0,
left: 0,
width: 0,
height: 0
},
ae = Qm()(U5(yv((t, e) => ({
editor: null,
fabric: null,
bootstrapData: {},
config: Wm,
zoom: 1,
dirty: !1,
original: {
width: 1,
height: 1
},
stageSize: Ev,
canvasSize: Ev,
canvasRef: null,
activeTool: null,
activeToolOverlay: null,
loading: !1,
openPanels: {
newImage: !1,
history: !1,
objects: !1,
export: !1
},
...ok(t, e),
...fk(t, e),
...sk(t, e),
...ak(t, e),
...hk(t, e),
...dk(t, e),
...pk(t, e),
setZoom: n => t(r => {
r.zoom = n
}),
setOriginal: (n, r) => t(i => {
i.original = {
width: n,
height: r
}
}),
setDirty: n => t(r => {
r.dirty = n
}),
toggleLoading: n => t(r => {
r.loading = n
}),
setStageSize: n => t(r => {
r.stageSize = n
}),
setCanvasSize: n => t(r => {
r.canvasSize = n
}),
setActiveTool: (n, r) => {
t(i => {
i.activeTool = n, i.activeToolOverlay = r
})
},
setConfig: n => t(r => {
var c, h;
const i = ik(n, e().config);
r.config = i;
const s = i.activeLanguage || "en",
d = (c = i.languages) == null ? void 0 : c[s],
a = (((h = i.ui) == null ? void 0 : h.themes) || []).map(l => zk(l)),
o = a.find(l => {
var u;
return l.id === ((u = i.ui) == null ? void 0 : u.activeTheme)
});
o && $k(o), r.bootstrapData = {
i18n: {
language: s,
name: s,
id: 0,
lines: d
},
themes: {
all: a
}
}
}),
togglePanel: (n, r) => t(i => {
i.openPanels[n] = r != null ? r : !i.openPanels[n]
}),
applyChanges: async () => {
var s;
const n = e().activeTool;
if (!n) return;
const r = e()[n],
i = await ((s = r == null ? void 0 : r.apply) == null ? void 0 : s.call(r));
t(d => {
d.dirty = !1, d.activeTool = null, d.activeToolOverlay = null
}), i !== !1 && e().editor.tools.history.addHistoryItem({
name: n
}), r == null || r.reset()
},
cancelChanges: async () => {
const n = e().activeTool;
if (!n) return;
const r = e().dirty;
t(s => {
s.dirty = !1, s.activeTool = null, s.activeToolOverlay = null
}), r && await e().editor.tools.history.reload();
const i = e()[n];
i == null || i.reset()
},
reset: () => {
e().editor.tools.transform.resetStraightenAnchor(), t({
activeTool: null,
activeToolOverlay: null,
zoom: 1,
dirty: !1,
loading: !1,
openPanels: {
newImage: !1,
history: !1,
objects: !1,
export: !1
}
}), e().history.reset(), e().objects.reset(), e().filter.reset(), e().crop.reset(), e().frame.reset(), e().resize.reset(), e().corners.reset()
}
}))));
function A() {
return ae.getState()
}
function L() {
return A().editor.tools
}
function de() {
return A().fabric
}
function _f(t) {
return L().canvas.clear(), L().frame.remove(), A().setConfig({
image: void 0,
blankCanvasSize: void 0,
...t
}), A().reset(), new Promise(e => setTimeout(e))
}
async function Ya(t) {
return (await fetch(t)).json()
}
const Ur = {
selectable: !1,
evented: !1,
lockMovementX: !0,
lockMovementY: !0,
lockRotation: !0,
lockScalingX: !0,
lockScalingY: !0,
lockUniScaling: !0,
hasControls: !1,
hasBorders: !1,
hasRotatingPoint: !1,
strokeWidth: 0
};
function Xa(t = []) {
var r;
t = [...Object.keys(Ur), "crossOrigin", "name", "displayName", "data", ...t];
const e = de().toJSON(t);
e.objects = e.objects.filter(i => !i.data.pixieInternal).map(i => (i.type === "image" && A().config.crossOrigin && (i.crossOrigin = "anonymous"), ir(i) && (i.selectable = !0, i.lockMovementX = !1, i.lockMovementY = !1, i.lockUniScaling = !1), {
...i,
data: i.data ? {
...i.data
} : {}
}));
const n = L().frame.active.config ? {
name: L().frame.active.config.name,
sizePercent: L().frame.active.currentSizeInPercent
} : null;
return {
canvas: e,
editor: {
frame: n,
zoom: A().zoom,
activeObjectId: ((r = A().objects.active) == null ? void 0 : r.id) || null
},
canvasWidth: A().original.width,
canvasHeight: A().original.height
}
}
function Sf(t = null) {
if (A().dirty) return;
L().zoom.fitToScreen();
const [e, n] = Ov(de().getActiveObject());
t ? A().setActiveTool(t, e === t ? n : null) : A().setActiveTool(e, n)
}
function Ov(t) {
switch (t == null ? void 0 : t.name) {
case Ge.Text:
return [Me.TEXT, rn.Text];
case Ge.Sticker:
case Ge.Image:
return [Me.STICKERS, rn.ActiveObject];
case Ge.Shape:
return [Me.SHAPES, rn.ActiveObject];
default:
return [null, null]
}
}
function Cf() {
return !A().config.image && !A().config.blankCanvasSize && (!de() || de().getObjects().length === 0)
}
const Vk = `/*! tailwindcss v3.1.8 | MIT License | https://tailwindcss.com*/.pi *,.pi :after,.pi :before{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity));border-style:solid;border-width:0;box-sizing:border-box}.pi :after,.pi :before{--tw-content:""}.pi hr{border-top-width:1px;color:inherit;height:0}.pi abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6{font-size:inherit;font-weight:inherit}.pi a{color:inherit;text-decoration:inherit}.pi b,.pi strong{font-weight:bolder}.pi code,.pi kbd,.pi pre,.pi samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}.pi small{font-size:80%}.pi sub,.pi sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.pi sub{bottom:-.25em}.pi sup{top:-.5em}.pi table{border-collapse:collapse;border-color:inherit;text-indent:0}.pi button,.pi input,.pi optgroup,.pi select,.pi textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}.pi button,.pi select{text-transform:none}.pi [type=button],.pi [type=reset],.pi [type=submit],.pi button{-webkit-appearance:button;background-color:transparent;background-image:none}.pi :-moz-focusring{outline:auto}.pi :-moz-ui-invalid{box-shadow:none}.pi progress{vertical-align:baseline}.pi ::-webkit-inner-spin-button,.pi ::-webkit-outer-spin-button{height:auto}.pi [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.pi ::-webkit-search-decoration{-webkit-appearance:none}.pi ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.pi summary{display:list-item}.pi blockquote,.pi dd,.pi dl,.pi figure,.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6,.pi hr,.pi p,.pi pre{margin:0}.pi fieldset{margin:0;padding:0}.pi legend{padding:0}.pi menu,.pi ol,.pi ul{list-style:none;margin:0;padding:0}.pi textarea{resize:vertical}.pi input::-moz-placeholder,.pi textarea::-moz-placeholder{color:#9ca3af;opacity:1}.pi input::placeholder,.pi textarea::placeholder{color:#9ca3af;opacity:1}.pi [role=button],.pi button{cursor:pointer}.pi :disabled{cursor:default}.pi audio,.pi canvas,.pi embed,.pi iframe,.pi img,.pi object,.pi svg,.pi video{display:block;vertical-align:middle}.pi img,.pi video{height:auto;max-width:100%}.pi *,.pi :after,.pi :before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi ::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi .container{width:100%}.pi .\\!container{width:100%!important}@media (min-width:640px){.pi .container{max-width:640px}.pi .\\!container{max-width:640px!important}}@media (min-width:768px){.pi .container{max-width:768px}.pi .\\!container{max-width:768px!important}}@media (min-width:1024px){.pi .container{max-width:1024px}.pi .\\!container{max-width:1024px!important}}@media (min-width:1280px){.pi .container{max-width:1280px}.pi .\\!container{max-width:1280px!important}}@media (min-width:1536px){.pi .container{max-width:1536px}.pi .\\!container{max-width:1536px!important}}.pi .sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.pi .pointer-events-none{pointer-events:none}.pi .pointer-events-auto{pointer-events:auto}.pi .visible{visibility:visible}.pi .\\!visible{visibility:visible!important}.pi .invisible{visibility:hidden}.pi .static{position:static}.pi .fixed{position:fixed}.pi .absolute{position:absolute}.pi .relative{position:relative}.pi .sticky{position:sticky}.pi .inset-0{bottom:0;top:0}.pi .inset-0,.pi .inset-x-0{left:0;right:0}.pi .right-2{right:2px}.pi .top-2{top:2px}.pi .top-0{top:0}.pi .left-0{left:0}.pi .left-16{left:16px}.pi .top-26{top:26px}.pi .-left-5{left:-5px}.pi .-top-5{top:-5px}.pi .bottom-0{bottom:0}.pi .-bottom-5{bottom:-5px}.pi .right-0{right:0}.pi .-right-5{right:-5px}.pi .bottom-20{bottom:20px}.pi .right-20{right:20px}.pi .top-24{top:24px}.pi .-bottom-14{bottom:-14px}.pi .left-30{left:30px}.pi .right-4{right:4px}.pi .top-1\\/2{top:50%}.pi .-bottom-20{bottom:-20px}.pi .left-1\\/2{left:50%}.pi .-bottom-10{bottom:-10px}.pi .-left-8{left:-8px}.pi .-left-80{left:-80px}.pi .-bottom-2{bottom:-2px}.pi .-right-2{right:-2px}.pi .isolate{isolation:isolate}.pi .z-20{z-index:20}.pi .z-modal{z-index:110}.pi .z-10{z-index:10}.pi .z-obj-box{z-index:20}.pi .z-navbar{z-index:40}.pi .z-tool-overlay{z-index:30}.pi .z-50,.pi .z-loading-indicator{z-index:50}.pi .z-popover{z-index:130}.pi .z-tray{z-index:120}.pi .z-toast{z-index:160}.pi .z-tooltip{z-index:150}.pi .z-cropzone{z-index:10}.pi .col-auto{grid-column:auto}.pi .m-auto{margin:auto}.pi .m-10{margin:10px}.pi .my-20{margin-bottom:20px;margin-top:20px}.pi .my-12{margin-bottom:12px;margin-top:12px}.pi .mx-auto{margin-left:auto;margin-right:auto}.pi .my-50{margin-bottom:50px;margin-top:50px}.pi .mx-14{margin-left:14px;margin-right:14px}.pi .my-30{margin-bottom:30px;margin-top:30px}.pi .my-24{margin-bottom:24px;margin-top:24px}.pi .my-80{margin-bottom:80px;margin-top:80px}.pi .my-32{margin-bottom:32px;margin-top:32px}.pi .my-40{margin-bottom:40px;margin-top:40px}.pi .my-8{margin-bottom:8px;margin-top:8px}.pi .my-10{margin-bottom:10px;margin-top:10px}.pi .my-100{margin-bottom:6.25rem;margin-top:6.25rem}.pi .mx-4{margin-left:4px;margin-right:4px}.pi .my-4{margin-bottom:4px;margin-top:4px}.pi .mx-8{margin-left:8px;margin-right:8px}.pi .mx-20{margin-left:20px;margin-right:20px}.pi .my-auto{margin-bottom:auto;margin-top:auto}.pi .mr-5{margin-right:5px}.pi .ml-auto{margin-left:auto}.pi .mr-20{margin-right:20px}.pi .mb-16{margin-bottom:16px}.pi .mr-10{margin-right:10px}.pi .mt-auto{margin-top:auto}.pi .mt-80{margin-top:80px}.pi .mt-30{margin-top:30px}.pi .mt-4{margin-top:4px}.pi .mb-30{margin-bottom:30px}.pi .mb-20{margin-bottom:20px}.pi .mr-auto{margin-right:auto}.pi .mr-24{margin-right:24px}.pi .mb-24{margin-bottom:24px}.pi .mb-14{margin-bottom:14px}.pi .mt-6{margin-top:6px}.pi .mt-12{margin-top:12px}.pi .mb-4{margin-bottom:4px}.pi .mt-14{margin-top:14px}.pi .ml-6{margin-left:6px}.pi .mr-14{margin-right:14px}.pi .mt-8{margin-top:8px}.pi .mb-10{margin-bottom:10px}.pi .mb-8{margin-bottom:8px}.pi .mt-20{margin-top:20px}.pi .mb-1{margin-bottom:1px}.pi .ml-10{margin-left:10px}.pi .mt-10{margin-top:10px}.pi .mt-2{margin-top:2px}.pi .mb-12{margin-bottom:12px}.pi .mb-40{margin-bottom:40px}.pi .mt-40{margin-top:40px}.pi .mb-32{margin-bottom:32px}.pi .mb-64{margin-bottom:64px}.pi .mt-32{margin-top:32px}.pi .mb-48{margin-bottom:48px}.pi .mt-50{margin-top:50px}.pi .mb-6{margin-bottom:6px}.pi .mt-60{margin-top:60px}.pi .-ml-1{margin-left:-1px}.pi .-ml-4{margin-left:-4px}.pi .mr-8{margin-right:8px}.pi .-mr-4{margin-right:-4px}.pi .ml-8{margin-left:8px}.pi .mt-16{margin-top:16px}.pi .mb-2{margin-bottom:2px}.pi .mt-24{margin-top:24px}.pi .-mt-2{margin-top:-2px}.pi .mt-36{margin-top:36px}.pi .mb-110{margin-bottom:110px}.pi .mt-18{margin-top:18px}.pi .mr-6{margin-right:6px}.pi .mr-16{margin-right:16px}.pi .ml-12{margin-left:12px}.pi .mr-4{margin-right:4px}.pi .mr-12{margin-right:12px}.pi .mr-2{margin-right:2px}.pi .mb-18{margin-bottom:18px}.pi .-ml-3{margin-left:-3px}.pi .-ml-12{margin-left:-12px}.pi .-ml-6{margin-left:-6px}.pi .box-content{box-sizing:content-box}.pi .block{display:block}.pi .inline-block{display:inline-block}.pi .inline{display:inline}.pi .flex{display:flex}.pi .inline-flex{display:inline-flex}.pi .table{display:table}.pi .table-cell{display:table-cell}.pi .table-row{display:table-row}.pi .grid{display:grid}.pi .\\!grid{display:grid!important}.pi .contents{display:contents}.pi .hidden{display:none}.pi .aspect-square{aspect-ratio:1/1}.pi .h-2\\/4{height:50%}.pi .h-full{height:100%}.pi .h-font{height:1em}.pi .h-1{height:1px}.pi .h-80{height:80px}.pi .h-400{height:25rem}.pi .h-50{height:50px}.pi .h-42{height:42px}.pi .h-54{height:3.375rem}.pi .h-8{height:8px}.pi .h-24{height:24px}.pi .h-36{height:36px}.pi .h-40{height:40px}.pi .h-20{height:20px}.pi .h-30{height:30px}.pi .h-84{height:84px}.pi .h-68{height:68px}.pi .h-32{height:32px}.pi .h-\\[54px\\]{height:54px}.pi .h-\\[186px\\]{height:186px}.pi .h-60{height:60px}.pi .h-18{height:18px}.pi .h-12{height:12px}.pi .h-26{height:26px}.pi .h-90{height:5.625rem}.pi .h-128{height:128px}.pi .h-6{height:6px}.pi .h-4{height:4px}.pi .h-48{height:48px}.pi .h-2{height:2px}.pi .h-16{height:16px}.pi .h-56{height:56px}.pi .h-64{height:64px}.pi .h-144{height:144px}.pi .h-100{height:6.25rem}.pi .h-max{height:-moz-max-content;height:max-content}.pi .h-px{height:1px}.pi .h-28{height:28px}.pi .h-92{height:92px}.pi .h-14{height:14px}.pi .h-38{height:2.375rem}.pi .h-22{height:22px}.pi .max-h-\\[calc\\(100vh-90px\\)\\]{max-height:calc(100vh - 90px)}.pi .max-h-\\[calc\\(100\\%-40px\\)\\]{max-height:calc(100% - 40px)}.pi .max-h-620{max-height:38.75rem}.pi .max-h-100{max-height:6.25rem}.pi .max-h-\\[36px\\]{max-height:36px}.pi .max-h-8{max-height:8px}.pi .max-h-tray{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .max-h-\\[calc\\(100\\%-30px\\)\\]{max-height:calc(100% - 30px)}.pi .max-h-40{max-height:40px}.pi .max-h-inherit{max-height:inherit}.pi .max-h-\\[583px\\]{max-height:583px}.pi .max-h-full{max-height:100%}.pi .max-h-26{max-height:26px}.pi .max-h-36{max-height:36px}.pi .max-h-dialog{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .max-h-240{max-height:240px}.pi .min-h-440{min-height:27.5rem}.pi .min-h-full{min-height:100%}.pi .min-h-\\[238px\\]{min-height:238px}.pi .min-h-86{min-height:86px}.pi .min-h-90{min-height:5.625rem}.pi .min-h-36{min-height:36px}.pi .min-h-42{min-height:42px}.pi .min-h-dialog{min-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .min-h-50{min-height:50px}.pi .min-h-\\[228px\\]{min-height:228px}.pi .min-h-30{min-height:30px}.pi .min-h-60{min-height:60px}.pi .w-max{width:-moz-max-content;width:max-content}.pi .w-full{width:100%}.pi .w-font{width:1em}.pi .w-80{width:80px}.pi .w-50{width:50px}.pi .w-8{width:8px}.pi .w-24{width:24px}.pi .w-36{width:36px}.pi .w-20{width:20px}.pi .w-30{width:30px}.pi .w-224{width:224px}.pi .w-68{width:68px}.pi .w-96{width:96px}.pi .w-144{width:144px}.pi .w-auto{width:auto}.pi .w-1{width:1px}.pi .w-240{width:240px}.pi .w-\\[168px\\]{width:168px}.pi .w-1\\/2{width:50%}.pi .w-384{width:384px}.pi .w-min{width:-moz-min-content;width:min-content}.pi .w-256{width:256px}.pi .w-18{width:18px}.pi .w-12{width:12px}.pi .w-42{width:42px}.pi .w-60{width:60px}.pi .\\!w-auto{width:auto!important}.pi .w-26{width:26px}.pi .w-32{width:32px}.pi .w-850{width:53.125rem}.pi .w-288{width:288px}.pi .w-320{width:320px}.pi .w-440{width:27.5rem}.pi .w-40{width:40px}.pi .w-64{width:64px}.pi .w-1\\/3{width:33.333333%}.pi .w-16{width:16px}.pi .w-56{width:56px}.pi .w-2{width:2px}.pi .w-110{width:110px}.pi .w-\\[4ch\\]{width:4ch}.pi .w-\\[233px\\]{width:233px}.pi .w-46{width:2.875rem}.pi .w-38{width:2.375rem}.pi .w-\\[210px\\]{width:210px}.pi .w-100{width:6.25rem}.pi .w-620{width:38.75rem}.pi .w-780{width:48.75rem}.pi .w-\\[calc\\(100\\%-40px\\)\\]{width:calc(100% - 40px)}.pi .w-px{width:1px}.pi .w-28{width:28px}.pi .w-90{width:5.625rem}.pi .w-14{width:14px}.pi .w-22{width:22px}.pi .w-280{width:17.5rem}.pi .min-w-0{min-width:0}.pi .min-w-320{min-width:320px}.pi .min-w-80{min-width:80px}.pi .min-w-224{min-width:224px}.pi .min-w-288{min-width:288px}.pi .min-w-240{min-width:240px}.pi .min-w-42{min-width:42px}.pi .min-w-90{min-width:5.625rem}.pi .min-w-180{min-width:11.25rem}.pi .min-w-128{min-width:128px}.pi .min-w-4{min-width:4px}.pi .min-w-192{min-width:192px}.pi .max-w-\\[calc\\(100vw-90px\\)\\]{max-width:calc(100vw - 90px)}.pi .max-w-max{max-width:-moz-max-content;max-width:max-content}.pi .max-w-280{max-width:17.5rem}.pi .max-w-620{max-width:38.75rem}.pi .max-w-440{max-width:27.5rem}.pi .max-w-\\[calc\\(100\\%-40px\\)\\]{max-width:calc(100% - 40px)}.pi .max-w-\\[90\\%\\]{max-width:90%}.pi .max-w-full{max-width:100%}.pi .max-w-500{max-width:31.25rem}.pi .max-w-\\[464px\\]{max-width:464px}.pi .max-w-180{max-width:11.25rem}.pi .max-w-400{max-width:25rem}.pi .max-w-780{max-width:48.75rem}.pi .max-w-375{max-width:375px}.pi .max-w-240{max-width:240px}.pi .max-w-320{max-width:320px}.pi .max-w-288{max-width:288px}.pi .max-w-112{max-width:112px}.pi .max-w-80{max-width:80px}.pi .max-w-850{max-width:53.125rem}.pi .max-w-580{max-width:36.25rem}.pi .max-w-dialog{max-width:calc(var(--be-viewport-width, 100vw)*.9)}.pi .max-w-950{max-width:59.375rem}.pi .flex-auto{flex:1 1 auto}.pi .flex-shrink-0,.pi .shrink-0{flex-shrink:0}.pi .flex-grow-0{flex-grow:0}.pi .origin-\\[100\\%\\]{transform-origin:100%}.pi .-translate-y-1\\/2{--tw-translate-y:-50%}.pi .-translate-x-1\\/2,.pi .-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .-translate-x-1\\/2{--tw-translate-x:-50%}.pi .rotate-180{--tw-rotate:180deg}.pi .rotate-0,.pi .rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-0{--tw-rotate:0deg}.pi .rotate-45{--tw-rotate:45deg}.pi .rotate-45,.pi .rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-90{--tw-rotate:90deg}.pi .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .cursor-pointer{cursor:pointer}.pi .cursor-nwse-resize{cursor:nwse-resize}.pi .cursor-nesw-resize{cursor:nesw-resize}.pi .cursor-se-resize{cursor:se-resize}.pi .cursor-sw-resize{cursor:sw-resize}.pi .cursor-zoom-in{cursor:zoom-in}.pi .cursor-default{cursor:default}.pi .cursor-move{cursor:move}.pi .cursor-not-allowed{cursor:not-allowed}.pi .touch-none{touch-action:none}.pi .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.pi .resize-none{resize:none}.pi .resize{resize:both}.pi .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.pi .break-inside-avoid{-moz-column-break-inside:avoid;break-inside:avoid}.pi .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.pi .grid-cols-5-min-content{grid-template-columns:repeat(5,min-content)}.pi .flex-row{flex-direction:row}.pi .flex-col{flex-direction:column}.pi .flex-col-reverse{flex-direction:column-reverse}.pi .flex-wrap{flex-wrap:wrap}.pi .flex-nowrap{flex-wrap:nowrap}.pi .items-start{align-items:flex-start}.pi .items-center{align-items:center}.pi .items-stretch{align-items:stretch}.pi .justify-start{justify-content:flex-start}.pi .justify-end{justify-content:flex-end}.pi .justify-center{justify-content:center}.pi .justify-between{justify-content:space-between}.pi .gap-16{gap:16px}.pi .gap-20{gap:20px}.pi .gap-8{gap:8px}.pi .gap-14{gap:14px}.pi .gap-24{gap:24px}.pi .gap-6{gap:6px}.pi .gap-30{gap:30px}.pi .gap-10{gap:10px}.pi .gap-12{gap:12px}.pi .gap-4{gap:4px}.pi .gap-18{gap:18px}.pi .gap-32{gap:32px}.pi .gap-40{gap:40px}.pi .gap-64{gap:64px}.pi .gap-36{gap:36px}.pi .gap-x-10{-moz-column-gap:10px;column-gap:10px}.pi .space-y-10>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(10px*var(--tw-space-y-reverse));margin-top:calc(10px*(1 - var(--tw-space-y-reverse)))}.pi .self-stretch{align-self:stretch}.pi .overflow-auto{overflow:auto}.pi .overflow-hidden{overflow:hidden}.pi .overflow-visible{overflow:visible}.pi .overflow-scroll{overflow:scroll}.pi .overflow-x-auto{overflow-x:auto}.pi .overflow-y-auto{overflow-y:auto}.pi .overflow-x-hidden{overflow-x:hidden}.pi .overflow-y-hidden{overflow-y:hidden}.pi .truncate{overflow:hidden;white-space:nowrap}.pi .overflow-ellipsis,.pi .text-ellipsis,.pi .truncate{text-overflow:ellipsis}.pi .whitespace-normal{white-space:normal}.pi .whitespace-nowrap{white-space:nowrap}.pi .whitespace-pre-wrap{white-space:pre-wrap}.pi .break-words{overflow-wrap:break-word}.pi .rounded{border-radius:4px}.pi .rounded-md{border-radius:6px}.pi .rounded-full{border-radius:9999px}.pi .rounded-lg{border-radius:8px}.pi .rounded-none{border-radius:0}.pi .rounded-2xl{border-radius:16px}.pi .rounded-sm{border-radius:2px}.pi .rounded-\\[16px\\]{border-radius:16px}.pi .rounded-\\[64px\\]{border-radius:64px}.pi .rounded-\\[32px\\]{border-radius:32px}.pi .rounded-3xl{border-radius:24px}.pi .rounded-xl{border-radius:12px}.pi .rounded-t{border-top-left-radius:4px;border-top-right-radius:4px}.pi .rounded-l{border-bottom-left-radius:4px;border-top-left-radius:4px}.pi .rounded-r-md{border-bottom-right-radius:6px;border-top-right-radius:6px}.pi .rounded-l-md{border-bottom-left-radius:6px;border-top-left-radius:6px}.pi .rounded-r{border-bottom-right-radius:4px;border-top-right-radius:4px}.pi .rounded-l-none{border-bottom-left-radius:0;border-top-left-radius:0}.pi .rounded-r-none{border-bottom-right-radius:0;border-top-right-radius:0}.pi .rounded-l-full{border-bottom-left-radius:9999px;border-top-left-radius:9999px}.pi .rounded-r-full{border-bottom-right-radius:9999px;border-top-right-radius:9999px}.pi .rounded-tr-none{border-top-right-radius:0}.pi .rounded-br-none{border-bottom-right-radius:0}.pi .rounded-tl-none{border-top-left-radius:0}.pi .rounded-bl-none{border-bottom-left-radius:0}.pi .border{border-width:1px}.pi .border-2{border-width:2px}.pi .border-4{border-width:4px}.pi .border-\\[3px\\]{border-width:3px}.pi .border-y{border-bottom-width:1px;border-top-width:1px}.pi .border-r{border-right-width:1px}.pi .border-l-4{border-left-width:4px}.pi .border-b{border-bottom-width:1px}.pi .border-t-4{border-top-width:4px}.pi .border-r-4{border-right-width:4px}.pi .border-b-4{border-bottom-width:4px}.pi .border-t{border-top-width:1px}.pi .border-l{border-left-width:1px}.pi .border-dotted{border-style:dotted}.pi .border-none{border-style:none}.pi .border-divider{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .border-primary\\/50{border-color:rgb(var(--be-primary)/.5)}.pi .border-danger\\/50{border-color:#ef444480}.pi .border-transparent{border-color:transparent}.pi .border-primary{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .border-danger{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .border-chip{--tw-border-opacity:1;border-color:rgb(var(--be-background-chip)/var(--tw-border-opacity))}.pi .border-paper{--tw-border-opacity:1;border-color:rgb(var(--be-paper)/var(--tw-border-opacity))}.pi .border-background{--tw-border-opacity:1;border-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-text-muted{border-color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .border-white\\/50{border-color:#ffffff80}.pi .border-l-primary{--tw-border-opacity:1;border-left-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .border-l-transparent{border-left-color:transparent}.pi .border-l-positive{--tw-border-opacity:1;border-left-color:rgb(34 197 94/var(--tw-border-opacity))}.pi .border-l-warning{--tw-border-opacity:1;border-left-color:rgb(243 164 50/var(--tw-border-opacity))}.pi .border-l-danger{--tw-border-opacity:1;border-left-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .border-r-transparent{border-right-color:transparent}.pi .border-r-primary-light{--tw-border-opacity:1;border-right-color:rgb(var(--be-primary-light)/var(--tw-border-opacity))}.pi .border-b-primary{--tw-border-opacity:1;border-bottom-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .bg-background{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-divider{background-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .bg-paper{--tw-bg-opacity:1;background-color:rgb(var(--be-paper)/var(--tw-bg-opacity))}.pi .bg{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-alt{--tw-bg-opacity:1;background-color:rgb(var(--be-background-alt)/var(--tw-bg-opacity))}.pi .bg-primary\\/hover{background-color:rgb(var(--be-primary)/var(--be-hover-opacity))}.pi .bg-primary{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .bg-positive\\/focus{background-color:rgb(34 197 94/var(--be-focus-opacity))}.pi .bg-warning\\/focus{background-color:rgb(243 164 50/var(--be-focus-opacity))}.pi .bg-danger\\/focus{background-color:rgb(239 68 68/var(--be-focus-opacity))}.pi .bg-primary\\/focus{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .bg-primary\\/5{background-color:rgb(var(--be-primary)/.05)}.pi .bg-controls{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-chip{--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi .bg-primary-light\\/20{background-color:rgb(var(--be-primary-light)/.2)}.pi .bg-primary\\/selected{background-color:rgb(var(--be-primary)/var(--be-selected-opacity))}.pi .bg-warning{--tw-bg-opacity:1;background-color:rgb(243 164 50/var(--tw-bg-opacity))}.pi .bg-transparent{background-color:transparent}.pi .bg-danger{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .bg-toast{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-focus{background-color:rgb(var(--be-foreground-base)/var(--be-focus-opacity))}.pi .bg-black\\/30{background-color:#0000004d}.pi .bg-primary-light{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-light)/var(--tw-bg-opacity))}.pi .bg-fg-base\\/4{background-color:rgb(var(--be-foreground-base)/4%)}.pi .bg-positive{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity))}.pi .bg-inherit{background-color:inherit}.pi .bg-background\\/70{background-color:rgb(var(--be-background)/.7)}.pi .bg-envato{--tw-bg-opacity:1;background-color:rgb(108 161 43/var(--tw-bg-opacity))}.pi .bg-disabled{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .bg-disabled-fg{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .bg-slider-disabled{--tw-bg-opacity:1;background-color:rgb(189 189 189/var(--tw-bg-opacity))}.pi .bg-primary-dark{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .bg-white\\/50{background-color:#ffffff80}.pi .bg-black\\/50{background-color:#00000080}.pi .bg-primary-light\\/40{background-color:rgb(var(--be-primary-light)/.4)}.pi .bg-positive-lighter{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.pi .bg-danger-lighter{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.pi .bg-opacity-95{--tw-bg-opacity:.95}.pi .bg-no-repeat{background-repeat:no-repeat}.pi .fill-current{fill:currentColor}.pi .fill-transparent{fill:transparent}.pi .stroke-current{stroke:currentColor}.pi .object-contain{-o-object-fit:contain;object-fit:contain}.pi .object-cover{-o-object-fit:cover;object-fit:cover}.pi .p-0{padding:0}.pi .p-14{padding:14px}.pi .p-16{padding:16px}.pi .p-24{padding:24px}.pi .p-10{padding:10px}.pi .p-8{padding:8px}.pi .p-6{padding:6px}.pi .p-12{padding:12px}.pi .p-20{padding:20px}.pi .p-4{padding:4px}.pi .p-18{padding:18px}.pi .p-40{padding:40px}.pi .p-2{padding:2px}.pi .px-24{padding-left:24px;padding-right:24px}.pi .py-20{padding-bottom:20px;padding-top:20px}.pi .px-6{padding-left:6px;padding-right:6px}.pi .px-8{padding-left:8px;padding-right:8px}.pi .py-12{padding-bottom:12px;padding-top:12px}.pi .px-16{padding-left:16px;padding-right:16px}.pi .py-14{padding-bottom:14px;padding-top:14px}.pi .px-14{padding-left:14px;padding-right:14px}.pi .px-20{padding-left:20px;padding-right:20px}.pi .px-32{padding-left:32px;padding-right:32px}.pi .py-10{padding-bottom:10px;padding-top:10px}.pi .px-4{padding-left:4px;padding-right:4px}.pi .px-10{padding-left:10px;padding-right:10px}.pi .py-2{padding-bottom:2px;padding-top:2px}.pi .px-5vw{padding-left:5vw;padding-right:5vw}.pi .px-12{padding-left:12px;padding-right:12px}.pi .py-\\[9px\\]{padding-bottom:9px;padding-top:9px}.pi .px-40{padding-left:40px;padding-right:40px}.pi .py-32{padding-bottom:32px;padding-top:32px}.pi .px-28{padding-left:28px;padding-right:28px}.pi .py-56{padding-bottom:56px;padding-top:56px}.pi .py-28{padding-bottom:28px;padding-top:28px}.pi .py-90{padding-bottom:5.625rem;padding-top:5.625rem}.pi .py-4{padding-bottom:4px;padding-top:4px}.pi .px-18{padding-left:18px;padding-right:18px}.pi .px-22{padding-left:22px;padding-right:22px}.pi .px-26{padding-left:26px;padding-right:26px}.pi .py-8{padding-bottom:8px;padding-top:8px}.pi .py-96{padding-bottom:96px;padding-top:96px}.pi .py-6{padding-bottom:6px;padding-top:6px}.pi .py-3{padding-bottom:3px;padding-top:3px}.pi .py-5{padding-bottom:5px;padding-top:5px}.pi .py-40{padding-bottom:40px;padding-top:40px}.pi .pt-14{padding-top:14px}.pi .pt-24{padding-top:24px}.pi .pb-12{padding-bottom:12px}.pi .pt-26{padding-top:26px}.pi .pb-16{padding-bottom:16px}.pi .pb-24{padding-bottom:24px}.pi .pt-50{padding-top:50px}.pi .pt-20{padding-top:20px}.pi .pb-10{padding-bottom:10px}.pi .pb-4{padding-bottom:4px}.pi .pr-10{padding-right:10px}.pi .pl-10{padding-left:10px}.pi .pb-20{padding-bottom:20px}.pi .pb-30{padding-bottom:30px}.pi .pt-30{padding-top:30px}.pi .pl-8{padding-left:8px}.pi .pb-14{padding-bottom:14px}.pi .pl-14{padding-left:14px}.pi .pt-54{padding-top:3.375rem}.pi .pb-28{padding-bottom:28px}.pi .pb-48{padding-bottom:48px}.pi .pb-safe-area{padding-bottom:env(safe-area-inset-bottom)}.pi .pl-24{padding-left:24px}.pi .pr-16{padding-right:16px}.pi .pr-24{padding-right:24px}.pi .pl-16{padding-left:16px}.pi .pr-6{padding-right:6px}.pi .pb-18{padding-bottom:18px}.pi .pt-6{padding-top:6px}.pi .pt-16{padding-top:16px}.pi .pt-10{padding-top:10px}.pi .pl-12{padding-left:12px}.pi .pr-12{padding-right:12px}.pi .pb-6{padding-bottom:6px}.pi .pt-42{padding-top:42px}.pi .pb-32{padding-bottom:32px}.pi .pt-70{padding-top:70px}.pi .pt-40{padding-top:40px}.pi .pr-8{padding-right:8px}.pi .pl-46{padding-left:2.875rem}.pi .pr-46{padding-right:2.875rem}.pi .pl-6{padding-left:6px}.pi .pl-18{padding-left:18px}.pi .pr-18{padding-right:18px}.pi .text-left{text-align:left}.pi .text-center{text-align:center}.pi .text-right{text-align:right}.pi .align-top{vertical-align:top}.pi .align-middle{vertical-align:middle}.pi .text-sm{font-size:14px;line-height:20px}.pi .text-xs{font-size:12px;line-height:16px}.pi .text-xl{font-size:20px;line-height:28px}.pi .text-6xl{font-size:60px;line-height:1}.pi .text-2xl{font-size:24px;line-height:32px}.pi .text-3xl{font-size:30px;line-height:36px}.pi .text-base{font-size:16px;line-height:24px}.pi .text-lg{font-size:18px;line-height:28px}.pi .text-4xl{font-size:36px;line-height:40px}.pi .font-medium{font-weight:500}.pi .font-semibold{font-weight:600}.pi .font-light{font-weight:300}.pi .font-bold{font-weight:700}.pi .font-normal{font-weight:400}.pi .uppercase{text-transform:uppercase}.pi .capitalize{text-transform:capitalize}.pi .italic{font-style:italic}.pi .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.pi .leading-none{line-height:1}.pi .leading-5{line-height:1.25rem}.pi .tracking-wide{letter-spacing:.025em}.pi .text,.pi .text-main{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.pi .text-muted{color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .text-positive{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.pi .text-danger{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.pi .text-primary{--tw-text-opacity:1;color:rgb(var(--be-primary)/var(--tw-text-opacity))}.pi .\\!text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))!important}.pi .text-facebook{--tw-text-opacity:1;color:rgb(59 89 152/var(--tw-text-opacity))}.pi .text-twitter{--tw-text-opacity:1;color:rgb(29 161 242/var(--tw-text-opacity))}.pi .text-positive-darker{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity))}.pi .text-disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .text-on-primary{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .text-primary-light{--tw-text-opacity:1;color:rgb(var(--be-primary-light)/var(--tw-text-opacity))}.pi .text-primary\\/40{color:rgb(var(--be-primary)/.4)}.pi .text-black\\/30{color:#0000004d}.pi .text-danger-darker{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity))}.pi .underline{text-decoration-line:underline}.pi .no-underline{text-decoration-line:none}.pi .caret-transparent{caret-color:transparent}.pi .opacity-0{opacity:0}.pi .opacity-100{opacity:1}.pi .opacity-80{opacity:.8}.pi .opacity-90{opacity:.9}.pi .shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.pi .shadow,.pi .shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.pi .shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}.pi .shadow-\\[15px_0_30px_0_rgb\\(0_0_0_\\/_18\\%\\)\\],.pi .shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-\\[15px_0_30px_0_rgb\\(0_0_0_\\/_18\\%\\)\\]{--tw-shadow:15px 0 30px 0 rgba(0,0,0,.18);--tw-shadow-colored:15px 0 30px 0 var(--tw-shadow-color)}.pi .shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.pi .shadow-md,.pi .shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.pi .shadow-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .outline-none{outline:2px solid transparent;outline-offset:2px}.pi .outline{outline-color:rgb(var(--be-primary-lighter)/1);outline-style:solid;outline-width:2px}.pi .ring{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .ring-inset{--tw-ring-inset:inset}.pi .ring-offset-4{--tw-ring-offset-width:4px}.pi .blur{--tw-blur:blur(8px)}.pi .blur,.pi .grayscale{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .grayscale{--tw-grayscale:grayscale(100%)}.pi .invert{--tw-invert:invert(100%)}.pi .invert,.pi .sepia{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .sepia{--tw-sepia:sepia(100%)}.pi .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-shadow{transition-duration:.15s;transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-bg-color{transition-duration:.15s;transition-property:background-color;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-button{transition-duration:.15s;transition-property:background-color,box-shadow,border-color,color;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-width{transition-duration:.15s;transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .duration-200{transition-duration:.2s}.pi .duration-100{transition-duration:.1s}.pi .will-change-\\[width\\]{will-change:width}.pi .will-change-transform{will-change:transform}.pi .icon-2xs{font-size:.75rem}.pi .icon-xs{font-size:1rem}.pi .icon-sm{font-size:1.25rem}.pi .icon-md{font-size:1.5rem}.pi .icon-lg{font-size:2.1875rem}.pi .icon-xl{font-size:2.6875rem}.pi .col-w-1{flex:1 0 0px}.pi .col-w-2{flex:2 0 0px}.pi .col-w-3{flex:3 0 0px}.pi .no-tap-highlight{-webkit-tap-highlight-color:transparent}@media only screen and (min-device-width:768px){.pi .tiny-scrollbar{scrollbar-color:rgba(0,0,0,.2) transparent;scrollbar-width:thin}.pi .tiny-scrollbar::-webkit-scrollbar{background-color:transparent;height:6px;width:6px}.pi .tiny-scrollbar::-webkit-scrollbar-thumb{background-color:rgb(var(--be-foreground-base)/.2);border-radius:10px}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:start{background:transparent}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:end{background:transparent}}.pi .hide-scrollbar{scrollbar-width:none}.pi .hide-scrollbar::-webkit-scrollbar{background:transparent;height:0;width:0}.pi .svg-icon{fill:currentColor;display:inline-block;flex-shrink:0;transition-duration:.15s;transition-property:transform,fill;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none}.pi .cropzone:not(.moving) .cropzone-transition{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .first-letter\\:capitalize:first-letter{text-transform:capitalize}.pi .file\\:mr-10::file-selector-button{margin-right:10px}.pi .file\\:h-24::file-selector-button{height:24px}.pi .file\\:rounded::file-selector-button{border-radius:4px}.pi .file\\:border-none::file-selector-button{border-style:none}.pi .file\\:bg-primary::file-selector-button{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .file\\:px-10::file-selector-button{padding-left:10px;padding-right:10px}.pi .file\\:text-sm::file-selector-button{font-size:14px;line-height:20px}.pi .file\\:font-semibold::file-selector-button{font-weight:600}.pi .file\\:text-on-primary::file-selector-button{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .before\\:absolute:before{content:var(--tw-content);position:absolute}.pi .before\\:left-0:before{content:var(--tw-content);left:0}.pi .before\\:top-1\\/2:before{content:var(--tw-content);top:50%}.pi .before\\:z-10:before{content:var(--tw-content);z-index:10}.pi .before\\:block:before{content:var(--tw-content);display:block}.pi .before\\:h-1:before{content:var(--tw-content);height:1px}.pi .before\\:h-full:before{content:var(--tw-content);height:100%}.pi .before\\:h-28:before{content:var(--tw-content);height:28px}.pi .before\\:h-22:before{content:var(--tw-content);height:22px}.pi .before\\:h-18:before{content:var(--tw-content);height:18px}.pi .before\\:h-12:before{content:var(--tw-content);height:12px}.pi .before\\:h-14:before{content:var(--tw-content);height:14px}.pi .before\\:w-full:before{content:var(--tw-content);width:100%}.pi .before\\:w-28:before{content:var(--tw-content);width:28px}.pi .before\\:w-22:before{content:var(--tw-content);width:22px}.pi .before\\:w-18:before{content:var(--tw-content);width:18px}.pi .before\\:w-12:before{content:var(--tw-content);width:12px}.pi .before\\:w-14:before{content:var(--tw-content);width:14px}.pi .before\\:-translate-y-1\\/2:before{--tw-translate-y:-50%}.pi .before\\:-translate-y-1\\/2:before,.pi .before\\:translate-x-2:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .before\\:translate-x-2:before{--tw-translate-x:2px}.pi .before\\:scale-10:before{--tw-scale-x:.1;--tw-scale-y:.1;content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .before\\:rounded-full:before{border-radius:9999px;content:var(--tw-content)}.pi .before\\:rounded-3xl:before{border-radius:24px;content:var(--tw-content)}.pi .before\\:border:before{border-width:1px;content:var(--tw-content)}.pi .before\\:bg-divider:before{background-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity));content:var(--tw-content)}.pi .before\\:bg-primary:before{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity));content:var(--tw-content)}.pi .before\\:bg-white:before{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity));content:var(--tw-content)}.pi .before\\:opacity-0:before{content:var(--tw-content);opacity:0}.pi .before\\:transition:before{content:var(--tw-content);transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:transition-transform:before{content:var(--tw-content);transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:duration-200:before{content:var(--tw-content);transition-duration:.2s}.pi .before\\:content-\\[\\\\\\\\00a0\\]:before{--tw-content:\\\\00a0;content:var(--tw-content)}.pi .after\\:pointer-events-none:after{content:var(--tw-content);pointer-events:none}.pi .after\\:absolute:after{content:var(--tw-content);position:absolute}.pi .after\\:inset-0:after{bottom:0;content:var(--tw-content);left:0;right:0;top:0}.pi .first\\:capitalize:first-child{text-transform:capitalize}.pi .checked\\:border-primary:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .checked\\:border-danger:checked{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .checked\\:bg-primary:checked{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .checked\\:bg-danger:checked{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .checked\\:before\\:translate-x-36:checked:before{--tw-translate-x:36px}.pi .checked\\:before\\:translate-x-30:checked:before,.pi .checked\\:before\\:translate-x-36:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-30:checked:before{--tw-translate-x:30px}.pi .checked\\:before\\:translate-x-24:checked:before{--tw-translate-x:24px}.pi .checked\\:before\\:translate-x-16:checked:before,.pi .checked\\:before\\:translate-x-24:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-16:checked:before{--tw-translate-x:16px}.pi .checked\\:before\\:translate-x-20:checked:before{--tw-translate-x:20px}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before,.pi .checked\\:before\\:translate-x-20:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before{--tw-scale-x:.65;--tw-scale-y:.65}.pi .checked\\:before\\:border-white:checked:before{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity));content:var(--tw-content)}.pi .checked\\:before\\:opacity-100:checked:before{content:var(--tw-content);opacity:1}.pi .focus-within\\:border-primary\\/60:focus-within{border-color:rgb(var(--be-primary)/.6)}.pi .focus-within\\:ring:focus-within{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-within\\:ring-primary\\/focus:focus-within{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus-within\\:ring-primary-light:focus-within{--tw-ring-opacity:1;--tw-ring-color:rgb(var(--be-primary-light)/var(--tw-ring-opacity))}.pi .hover\\:scale-105:hover{--tw-scale-x:1.05;--tw-scale-y:1.05}.pi .hover\\:scale-105:hover,.pi .hover\\:scale-110:hover{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .hover\\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1}.pi .hover\\:cursor-move:hover{cursor:move}.pi .hover\\:border-primary:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .hover\\:border-danger:hover{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .hover\\:border-primary-dark:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .hover\\:border-danger\\/90:hover{border-color:#ef4444e6}.pi .hover\\:border-chip\\/90:hover{border-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:bg-hover:hover{background-color:rgb(var(--be-foreground-base)/var(--be-hover-opacity))}.pi .hover\\:bg-primary\\/10:hover{background-color:rgb(var(--be-primary)/.1)}.pi .hover\\:bg-white\\/hover:hover{background-color:rgb(255 255 255/var(--be-hover-opacity))}.pi .hover\\:bg-primary\\/hover:hover{background-color:rgb(var(--be-primary)/var(--be-hover-opacity))}.pi .hover\\:bg-danger\\/4:hover{background-color:#ef44440a}.pi .hover\\:bg-primary\\/4:hover{background-color:rgb(var(--be-primary)/4%)}.pi .hover\\:bg-primary-dark:hover{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:bg-danger\\/90:hover{background-color:#ef4444e6}.pi .hover\\:bg-chip\\/90:hover{background-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:bg-paper\\/90:hover{background-color:rgb(var(--be-paper)/.9)}.pi .hover\\:bg-primary\\/focus:hover{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:bg-fg-base\\/15:hover{background-color:rgb(var(--be-foreground-base)/15%)}.pi .hover\\:text-primary-dark:hover{--tw-text-opacity:1;color:rgb(var(--be-primary-dark)/var(--tw-text-opacity))}.pi .hover\\:text-main:hover{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .hover\\:text-fg-base:hover{--tw-text-opacity:1;color:rgb(var(--be-foreground-base)/var(--tw-text-opacity))}.pi .hover\\:underline:hover{text-decoration-line:underline}.pi .hover\\:opacity-100:hover{opacity:1}.pi .hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .before\\:hover\\:bg-primary-dark:hover:before{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity));content:var(--tw-content)}.pi .hover\\:after\\:bg-black\\/5:hover:after{background-color:#0000000d;content:var(--tw-content)}.pi .checked\\:hover\\:border-primary-dark:hover:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .focus\\:border-danger\\/60:focus{border-color:#ef444499}.pi .focus\\:border-primary\\/60:focus{border-color:rgb(var(--be-primary)/.6)}.pi .focus\\:bg-primary:focus{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .focus\\:text-on-primary:focus{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.pi .focus\\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.pi .focus\\:ring-2:focus,.pi .focus\\:ring:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus\\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.pi .focus\\:ring-danger\\/focus:focus{--tw-ring-color:rgb(239 68 68/var(--be-focus-opacity))}.pi .focus\\:ring-primary\\/focus:focus{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px}.pi .focus\\:after\\:bg-black\\/10:focus:after{background-color:#0000001a;content:var(--tw-content)}.pi .focus-visible\\:bg-primary\\/focus:focus-visible{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus-visible\\:bg-focus:focus-visible{background-color:rgb(var(--be-foreground-base)/var(--be-focus-opacity))}.pi .focus-visible\\:outline:focus-visible{outline-style:solid;outline-width:2px}.pi .focus-visible\\:outline-offset-2:focus-visible{outline-offset:2px}.pi .focus-visible\\:outline:focus-visible{outline-color:rgb(var(--be-primary-lighter)/1)}.pi .focus-visible\\:outline-primary-light:focus-visible{outline-color:rgb(var(--be-primary-light)/1)}.pi .focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-visible\\:ring:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .disabled\\:pointer-events-none:disabled{pointer-events:none}.pi .disabled\\:cursor-default:disabled{cursor:default}.pi .disabled\\:border-disabled-bg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:border-transparent:disabled{border-color:transparent}.pi .disabled\\:border-disabled-fg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:border-r-transparent:disabled{border-right-color:transparent}.pi .disabled\\:bg-transparent:disabled{background-color:transparent}.pi .disabled\\:bg-disabled:disabled{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:text-disabled:disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:shadow-none:disabled{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .disabled\\:before\\:bg-disabled-fg:disabled:before{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity));content:var(--tw-content)}.pi .dark .dark\\:bg-alt{--tw-bg-opacity:1;background-color:rgb(var(--be-background-alt)/var(--tw-bg-opacity))}.pi .dark .dark\\:bg-none{background-image:none}.pi .dark .dark\\:text-white\\/50{color:#ffffff80}.pi .dark .dark\\:opacity-5{opacity:.05}.pi .dark .dark\\:opacity-80{opacity:.8}.pi .dark .dark\\:checked\\:border-primary-dark:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .dark .dark\\:checked\\:bg-primary-dark:checked{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}@media (min-width:640px){.pi .sm\\:justify-start{justify-content:flex-start}.pi .sm\\:text-sm{font-size:14px;line-height:20px}}@media (min-width:768px){.pi .md\\:invisible{visibility:hidden}.pi .md\\:my-24{margin-bottom:24px;margin-top:24px}.pi .md\\:mx-40{margin-left:40px;margin-right:40px}.pi .md\\:my-64{margin-bottom:64px;margin-top:64px}.pi .md\\:my-100{margin-bottom:6.25rem;margin-top:6.25rem}.pi .md\\:mr-0{margin-right:0}.pi .md\\:mb-0{margin-bottom:0}.pi .md\\:mr-10{margin-right:10px}.pi .md\\:mb-40{margin-bottom:40px}.pi .md\\:mb-24{margin-bottom:24px}.pi .md\\:mt-60{margin-top:60px}.pi .md\\:mb-70{margin-bottom:70px}.pi .md\\:mt-0{margin-top:0}.pi .md\\:mr-24{margin-right:24px}.pi .md\\:mr-80{margin-right:80px}.pi .md\\:block{display:block}.pi .md\\:flex{display:flex}.pi .md\\:h-0{height:0}.pi .md\\:w-min{width:-moz-min-content;width:min-content}.pi .md\\:w-320{width:320px}.pi .md\\:w-400{width:25rem}.pi .md\\:min-w-440{min-width:27.5rem}.pi .md\\:max-w-950{max-width:59.375rem}.pi .md\\:max-w-350{max-width:21.875rem}.pi .md\\:flex-row{flex-direction:row}.pi .md\\:items-start{align-items:flex-start}.pi .md\\:gap-12{gap:12px}.pi .md\\:gap-24{gap:24px}.pi .md\\:gap-80{gap:80px}.pi .md\\:gap-112{gap:112px}.pi .md\\:overflow-hidden{overflow:hidden}.pi .md\\:p-24{padding:24px}.pi .md\\:px-24{padding-left:24px;padding-right:24px}.pi .md\\:px-30{padding-left:30px;padding-right:30px}.pi .md\\:px-0{padding-left:0;padding-right:0}.pi .md\\:px-20{padding-left:20px;padding-right:20px}.pi .md\\:py-80{padding-bottom:80px;padding-top:80px}.pi .md\\:px-176{padding-left:176px;padding-right:176px}.pi .md\\:px-10vw{padding-left:10vw;padding-right:10vw}.pi .md\\:pt-128{padding-top:128px}.pi .md\\:pl-20{padding-left:20px}.pi .md\\:pb-0{padding-bottom:0}.pi .md\\:pb-54{padding-bottom:3.375rem}.pi .md\\:text-left{text-align:left}.pi .md\\:text-3xl{font-size:30px;line-height:36px}.pi .md\\:text-4xl{font-size:36px;line-height:40px}.pi .md\\:text-lg{font-size:18px;line-height:28px}.pi .md\\:text-base{font-size:16px;line-height:24px}.pi .md\\:font-medium{font-weight:500}.pi .md\\:font-normal{font-weight:400}.pi .md\\:shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}}@media (min-width:1024px){.pi .lg\\:min-w-500{min-width:31.25rem}.pi .lg\\:flex-row{flex-direction:row}.pi .lg\\:items-center{align-items:center}.pi .lg\\:px-96{padding-left:96px;padding-right:96px}.pi .lg\\:py-96{padding-bottom:96px;padding-top:96px}.pi .lg\\:pb-0{padding-bottom:0}}@media (min-width:1280px){.pi .xl\\:w-1\\/2{width:50%}.pi .xl\\:pt-96{padding-top:96px}}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-2:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-inset:focus-visible>.tree-label{--tw-ring-inset:inset}
`;
let Pv = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, n) => (n &= 63, n < 36 ? e += n.toString(36) : n < 62 ? e += (n - 26).toString(36).toUpperCase() : n > 62 ? e += "-" : e += "_", e), "");
class Hk {
constructor(e, n) {
Ce(this, "timerId");
Ce(this, "createdAt", 0);
this.callback = e, this.remaining = n, this.resume()
}
pause() {
clearTimeout(this.timerId), this.remaining -= Date.now() - this.createdAt
}
resume() {
this.createdAt = Date.now(), this.timerId && clearTimeout(this.timerId), this.timerId = setTimeout(this.callback, this.remaining)
}
clear() {
clearTimeout(this.timerId)
}
}
const Uk = 1;
function Wk(t) {
switch (t) {
case "danger":
return 8e3;
default:
return 3e3
}
}
const Mv = Qm()(yv((t, e) => ({
toasts: [],
add: (n, r) => {
var h;
const i = e().toasts.length + 1 - Uk;
i > 0 && t(l => {
l.toasts.splice(0, i)
});
const s = (r == null ? void 0 : r.id) || Pv(6),
d = (r == null ? void 0 : r.type) || "positive",
a = (h = r == null ? void 0 : r.duration) != null ? h : Wk(d),
o = {
timer: a > 0 ? new Hk(() => e().remove(s), a) : null,
message: n,
...r,
id: s,
type: d,
position: (r == null ? void 0 : r.position) || "bottom-center",
duration: a
},
c = e().toasts.findIndex(l => l.id === o.id);
c > -1 ? t(l => {
l.toasts[c] = o
}) : t(l => {
l.toasts.push(o)
})
},
remove: n => {
const r = e().toasts.filter(i => {
var s;
return n === i.id ? ((s = i.timer) == null || s.clear(), !1) : !0
});
t(i => {
i.toasts = r
})
}
})));
function Zo() {
return Mv.getState()
}
function Qo(t, e) {
Zo().add(t, e)
}
Qo.danger = (t, e) => {
Zo().add(t, {
...e,
type: "danger"
})
}, Qo.positive = (t, e) => {
Zo().add(t, {
...e,
type: "positive"
})
};
var Jo = {
exports: {}
},
jt = {},
Av = {
exports: {}
},
Dv = {};
/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
(function(t) {
function e(V, C) {
var k = V.length;
V.push(C);
e: for (; 0 < k;) {
var M = k - 1 >>> 1,
D = V[M];
if (0 < i(D, C)) V[M] = C, V[k] = D, k = M;
else break e
}
}
function n(V) {
return V.length === 0 ? null : V[0]
}
function r(V) {
if (V.length === 0) return null;
var C = V[0],
k = V.pop();
if (k !== C) {
V[0] = k;
e: for (var M = 0, D = V.length, $ = D >>> 1; M < $;) {
var R = 2 * (M + 1) - 1,
O = V[R],
F = R + 1,
N = V[F];
if (0 > i(O, k)) F < D && 0 > i(N, O) ? (V[M] = N, V[F] = k, M = F) : (V[M] = O, V[R] = k, M = R);
else if (F < D && 0 > i(N, k)) V[M] = N, V[F] = k, M = F;
else break e
}
}
return C
}
function i(V, C) {
var k = V.sortIndex - C.sortIndex;
return k !== 0 ? k : V.id - C.id
}
if (typeof performance == "object" && typeof performance.now == "function") {
var s = performance;
t.unstable_now = function() {
return s.now()
}
} else {
var d = Date,
a = d.now();
t.unstable_now = function() {
return d.now() - a
}
}
var o = [],
c = [],
h = 1,
l = null,
u = 3,
f = !1,
p = !1,
m = !1,
g = typeof setTimeout == "function" ? setTimeout : null,
v = typeof clearTimeout == "function" ? clearTimeout : null,
y = typeof setImmediate < "u" ? setImmediate : null;
typeof navigator < "u" && navigator.scheduling !== void 0 && navigator.scheduling.isInputPending !== void 0 && navigator.scheduling.isInputPending.bind(navigator.scheduling);
function b(V) {
for (var C = n(c); C !== null;) {
if (C.callback === null) r(c);
else if (C.startTime <= V) r(c), C.sortIndex = C.expirationTime, e(o, C);
else break;
C = n(c)
}
}
function w(V) {
if (m = !1, b(V), !p)
if (n(o) !== null) p = !0, ie(x);
else {
var C = n(c);
C !== null && ce(w, C.startTime - V)
}
}
function x(V, C) {
p = !1, m && (m = !1, v(P), P = -1), f = !0;
var k = u;
try {
for (b(C), l = n(o); l !== null && (!(l.expirationTime > C) || V && !H());) {
var M = l.callback;
if (typeof M == "function") {
l.callback = null, u = l.priorityLevel;
var D = M(l.expirationTime <= C);
C = t.unstable_now(), typeof D == "function" ? l.callback = D : l === n(o) && r(o), b(C)
} else r(o);
l = n(o)
}
if (l !== null) var $ = !0;
else {
var R = n(c);
R !== null && ce(w, R.startTime - C), $ = !1
}
return $
} finally {
l = null, u = k, f = !1
}
}
var S = !1,
T = null,
P = -1,
I = 5,
z = -1;
function H() {
return !(t.unstable_now() - z < I)
}
function ee() {
if (T !== null) {
var V = t.unstable_now();
z = V;
var C = !0;
try {
C = T(!0, V)
} finally {
C ? te() : (S = !1, T = null)
}
} else S = !1
}
var te;
if (typeof y == "function") te = function() {
y(ee)
};
else if (typeof MessageChannel < "u") {
var ne = new MessageChannel,
Z = ne.port2;
ne.port1.onmessage = ee, te = function() {
Z.postMessage(null)
}
} else te = function() {
g(ee, 0)
};
function ie(V) {
T = V, S || (S = !0, te())
}
function ce(V, C) {
P = g(function() {
V(t.unstable_now())
}, C)
}
t.unstable_IdlePriority = 5, t.unstable_ImmediatePriority = 1, t.unstable_LowPriority = 4, t.unstable_NormalPriority = 3, t.unstable_Profiling = null, t.unstable_UserBlockingPriority = 2, t.unstable_cancelCallback = function(V) {
V.callback = null
}, t.unstable_continueExecution = function() {
p || f || (p = !0, ie(x))
}, t.unstable_forceFrameRate = function(V) {
0 > V || 125 < V ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : I = 0 < V ? Math.floor(1e3 / V) : 5
}, t.unstable_getCurrentPriorityLevel = function() {
return u
}, t.unstable_getFirstCallbackNode = function() {
return n(o)
}, t.unstable_next = function(V) {
switch (u) {
case 1:
case 2:
case 3:
var C = 3;
break;
default:
C = u
}
var k = u;
u = C;
try {
return V()
} finally {
u = k
}
}, t.unstable_pauseExecution = function() {}, t.unstable_requestPaint = function() {}, t.unstable_runWithPriority = function(V, C) {
switch (V) {
case 1:
case 2:
case 3:
case 4:
case 5:
break;
default:
V = 3
}
var k = u;
u = V;
try {
return C()
} finally {
u = k
}
}, t.unstable_scheduleCallback = function(V, C, k) {
var M = t.unstable_now();
switch (typeof k == "object" && k !== null ? (k = k.delay, k = typeof k == "number" && 0 < k ? M + k : M) : k = M, V) {
case 1:
var D = -1;
break;
case 2:
D = 250;
break;
case 5:
D = 1073741823;
break;
case 4:
D = 1e4;
break;
default:
D = 5e3
}
return D = k + D, V = {
id: h++,
callback: C,
priorityLevel: V,
startTime: k,
expirationTime: D,
sortIndex: -1
}, k > M ? (V.sortIndex = k, e(c, V), n(o) === null && V === n(c) && (m ? (v(P), P = -1) : m = !0, ce(w, k - M))) : (V.sortIndex = D, e(o, V), p || f || (p = !0, ie(x))), V
}, t.unstable_shouldYield = H, t.unstable_wrapCallback = function(V) {
var C = u;
return function() {
var k = u;
u = C;
try {
return V.apply(this, arguments)
} finally {
u = k
}
}
}
})(Dv),
function(t) {
t.exports = Dv
}(Av);
/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Rv = E.exports,
Bt = Av.exports;
function oe(t) {
for (var e = "https://reactjs.org/docs/error-decoder.html?invariant=" + t, n = 1; n < arguments.length; n++) e += "&args[]=" + encodeURIComponent(arguments[n]);
return "Minified React error #" + t + "; visit " + e + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."
}
var Iv = new Set,
es = {};
function Wr(t, e) {
Ui(t, e), Ui(t + "Capture", e)
}
function Ui(t, e) {
for (es[t] = e, t = 0; t < e.length; t++) Iv.add(e[t])
}
var On = !(typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u"),
Tf = Object.prototype.hasOwnProperty,
Yk = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,
Lv = {},
Fv = {};
function Xk(t) {
return Tf.call(Fv, t) ? !0 : Tf.call(Lv, t) ? !1 : Yk.test(t) ? Fv[t] = !0 : (Lv[t] = !0, !1)
}
function Gk(t, e, n, r) {
if (n !== null && n.type === 0) return !1;
switch (typeof e) {
case "function":
case "symbol":
return !0;
case "boolean":
return r ? !1 : n !== null ? !n.acceptsBooleans : (t = t.toLowerCase().slice(0, 5), t !== "data-" && t !== "aria-");
default:
return !1
}
}
function Kk(t, e, n, r) {
if (e === null || typeof e > "u" || Gk(t, e, n, r)) return !0;
if (r) return !1;
if (n !== null) switch (n.type) {
case 3:
return !e;
case 4:
return e === !1;
case 5:
return isNaN(e);
case 6:
return isNaN(e) || 1 > e
}
return !1
}
function St(t, e, n, r, i, s, d) {
this.acceptsBooleans = e === 2 || e === 3 || e === 4, this.attributeName = r, this.attributeNamespace = i, this.mustUseProperty = n, this.propertyName = t, this.type = e, this.sanitizeURL = s, this.removeEmptyString = d
}
var ct = {};
"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t) {
ct[t] = new St(t, 0, !1, t, null, !1, !1)
}), [
["acceptCharset", "accept-charset"],
["className", "class"],
["htmlFor", "for"],
["httpEquiv", "http-equiv"]
].forEach(function(t) {
var e = t[0];
ct[e] = new St(e, 1, !1, t[1], null, !1, !1)
}), ["contentEditable", "draggable", "spellCheck", "value"].forEach(function(t) {
ct[t] = new St(t, 2, !1, t.toLowerCase(), null, !1, !1)
}), ["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(t) {
ct[t] = new St(t, 2, !1, t, null, !1, !1)
}), "allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t) {
ct[t] = new St(t, 3, !1, t.toLowerCase(), null, !1, !1)
}), ["checked", "multiple", "muted", "selected"].forEach(function(t) {
ct[t] = new St(t, 3, !0, t, null, !1, !1)
}), ["capture", "download"].forEach(function(t) {
ct[t] = new St(t, 4, !1, t, null, !1, !1)
}), ["cols", "rows", "size", "span"].forEach(function(t) {
ct[t] = new St(t, 6, !1, t, null, !1, !1)
}), ["rowSpan", "start"].forEach(function(t) {
ct[t] = new St(t, 5, !1, t.toLowerCase(), null, !1, !1)
});
var kf = /[\-:]([a-z])/g;
function Ef(t) {
return t[1].toUpperCase()
}
"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t) {
var e = t.replace(kf, Ef);
ct[e] = new St(e, 1, !1, t, null, !1, !1)
}), "xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t) {
var e = t.replace(kf, Ef);
ct[e] = new St(e, 1, !1, t, "http://www.w3.org/1999/xlink", !1, !1)
}), ["xml:base", "xml:lang", "xml:space"].forEach(function(t) {
var e = t.replace(kf, Ef);
ct[e] = new St(e, 1, !1, t, "http://www.w3.org/XML/1998/namespace", !1, !1)
}), ["tabIndex", "crossOrigin"].forEach(function(t) {
ct[t] = new St(t, 1, !1, t.toLowerCase(), null, !1, !1)
}), ct.xlinkHref = new St("xlinkHref", 1, !1, "xlink:href", "http://www.w3.org/1999/xlink", !0, !1), ["src", "href", "action", "formAction"].forEach(function(t) {
ct[t] = new St(t, 1, !1, t.toLowerCase(), null, !0, !0)
});
function Of(t, e, n, r) {
var i = ct.hasOwnProperty(e) ? ct[e] : null;
(i !== null ? i.type !== 0 : r || !(2 < e.length) || e[0] !== "o" && e[0] !== "O" || e[1] !== "n" && e[1] !== "N") && (Kk(e, n, i, r) && (n = null), r || i === null ? Xk(e) && (n === null ? t.removeAttribute(e) : t.setAttribute(e, "" + n)) : i.mustUseProperty ? t[i.propertyName] = n === null ? i.type === 3 ? !1 : "" : n : (e = i.attributeName, r = i.attributeNamespace, n === null ? t.removeAttribute(e) : (i = i.type, n = i === 3 || i === 4 && n === !0 ? "" : "" + n, r ? t.setAttributeNS(r, e, n) : t.setAttribute(e, n))))
}
var Pn = Rv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
Ga = Symbol.for("react.element"),
Wi = Symbol.for("react.portal"),
Yi = Symbol.for("react.fragment"),
Pf = Symbol.for("react.strict_mode"),
Mf = Symbol.for("react.profiler"),
zv = Symbol.for("react.provider"),
Nv = Symbol.for("react.context"),
Af = Symbol.for("react.forward_ref"),
Df = Symbol.for("react.suspense"),
Rf = Symbol.for("react.suspense_list"),
If = Symbol.for("react.memo"),
sr = Symbol.for("react.lazy"),
jv = Symbol.for("react.offscreen"),
Bv = Symbol.iterator;
function ts(t) {
return t === null || typeof t != "object" ? null : (t = Bv && t[Bv] || t["@@iterator"], typeof t == "function" ? t : null)
}
var $e = Object.assign,
Lf;
function ns(t) {
if (Lf === void 0) try {
throw Error()
} catch (n) {
var e = n.stack.trim().match(/\n( *(at )?)/);
Lf = e && e[1] || ""
}
return `
` + Lf + t
}
var Ff = !1;
function zf(t, e) {
if (!t || Ff) return "";
Ff = !0;
var n = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
try {
if (e)
if (e = function() {
throw Error()
}, Object.defineProperty(e.prototype, "props", {
set: function() {
throw Error()
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(e, [])
} catch (c) {
var r = c
}
Reflect.construct(t, [], e)
} else {
try {
e.call()
} catch (c) {
r = c
}
t.call(e.prototype)
}
else {
try {
throw Error()
} catch (c) {
r = c
}
t()
}
} catch (c) {
if (c && r && typeof c.stack == "string") {
for (var i = c.stack.split(`
`), s = r.stack.split(`
`), d = i.length - 1, a = s.length - 1; 1 <= d && 0 <= a && i[d] !== s[a];) a--;
for (; 1 <= d && 0 <= a; d--, a--)
if (i[d] !== s[a]) {
if (d !== 1 || a !== 1)
do
if (d--, a--, 0 > a || i[d] !== s[a]) {
var o = `
` + i[d].replace(" at new ", " at ");
return t.displayName && o.includes("<anonymous>") && (o = o.replace("<anonymous>", t.displayName)), o
} while (1 <= d && 0 <= a);
break
}
}
} finally {
Ff = !1, Error.prepareStackTrace = n
}
return (t = t ? t.displayName || t.name : "") ? ns(t) : ""
}
function qk(t) {
switch (t.tag) {
case 5:
return ns(t.type);
case 16:
return ns("Lazy");
case 13:
return ns("Suspense");
case 19:
return ns("SuspenseList");
case 0:
case 2:
case 15:
return t = zf(t.type, !1), t;
case 11:
return t = zf(t.type.render, !1), t;
case 1:
return t = zf(t.type, !0), t;
default:
return ""
}
}
function Nf(t) {
if (t == null) return null;
if (typeof t == "function") return t.displayName || t.name || null;
if (typeof t == "string") return t;
switch (t) {
case Yi:
return "Fragment";
case Wi:
return "Portal";
case Mf:
return "Profiler";
case Pf:
return "StrictMode";
case Df:
return "Suspense";
case Rf:
return "SuspenseList"
}
if (typeof t == "object") switch (t.$$typeof) {
case Nv:
return (t.displayName || "Context") + ".Consumer";
case zv:
return (t._context.displayName || "Context") + ".Provider";
case Af:
var e = t.render;
return t = t.displayName, t || (t = e.displayName || e.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
case If:
return e = t.displayName || null, e !== null ? e : Nf(t.type) || "Memo";
case sr:
e = t._payload, t = t._init;
try {
return Nf(t(e))
} catch {}
}
return null
}
function Zk(t) {
var e = t.type;
switch (t.tag) {
case 24:
return "Cache";
case 9:
return (e.displayName || "Context") + ".Consumer";
case 10:
return (e._context.displayName || "Context") + ".Provider";
case 18:
return "DehydratedFragment";
case 11:
return t = e.render, t = t.displayName || t.name || "", e.displayName || (t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef");
case 7:
return "Fragment";
case 5:
return e;
case 4:
return "Portal";
case 3:
return "Root";
case 6:
return "Text";
case 16:
return Nf(e);
case 8:
return e === Pf ? "StrictMode" : "Mode";
case 22:
return "Offscreen";
case 12:
return "Profiler";
case 21:
return "Scope";
case 13:
return "Suspense";
case 19:
return "SuspenseList";
case 25:
return "TracingMarker";
case 1:
case 0:
case 17:
case 2:
case 14:
case 15:
if (typeof e == "function") return e.displayName || e.name || null;
if (typeof e == "string") return e
}
return null
}
function ar(t) {
switch (typeof t) {
case "boolean":
case "number":
case "string":
case "undefined":
return t;
case "object":
return t;
default:
return ""
}
}
function $v(t) {
var e = t.type;
return (t = t.nodeName) && t.toLowerCase() === "input" && (e === "checkbox" || e === "radio")
}
function Qk(t) {
var e = $v(t) ? "checked" : "value",
n = Object.getOwnPropertyDescriptor(t.constructor.prototype, e),
r = "" + t[e];
if (!t.hasOwnProperty(e) && typeof n < "u" && typeof n.get == "function" && typeof n.set == "function") {
var i = n.get,
s = n.set;
return Object.defineProperty(t, e, {
configurable: !0,
get: function() {
return i.call(this)
},
set: function(d) {
r = "" + d, s.call(this, d)
}
}), Object.defineProperty(t, e, {
enumerable: n.enumerable
}), {
getValue: function() {
return r
},
setValue: function(d) {
r = "" + d
},
stopTracking: function() {
t._valueTracker = null, delete t[e]
}
}
}
}
function Ka(t) {
t._valueTracker || (t._valueTracker = Qk(t))
}
function Vv(t) {
if (!t) return !1;
var e = t._valueTracker;
if (!e) return !0;
var n = e.getValue(),
r = "";
return t && (r = $v(t) ? t.checked ? "true" : "false" : t.value), t = r, t !== n ? (e.setValue(t), !0) : !1
}
function qa(t) {
if (t = t || (typeof document < "u" ? document : void 0), typeof t > "u") return null;
try {
return t.activeElement || t.body
} catch {
return t.body
}
}
function jf(t, e) {
var n = e.checked;
return $e({}, e, {
defaultChecked: void 0,
defaultValue: void 0,
value: void 0,
checked: n != null ? n : t._wrapperState.initialChecked
})
}
function Hv(t, e) {
var n = e.defaultValue == null ? "" : e.defaultValue,
r = e.checked != null ? e.checked : e.defaultChecked;
n = ar(e.value != null ? e.value : n), t._wrapperState = {
initialChecked: r,
initialValue: n,
controlled: e.type === "checkbox" || e.type === "radio" ? e.checked != null : e.value != null
}
}
function Uv(t, e) {
e = e.checked, e != null && Of(t, "checked", e, !1)
}
function Bf(t, e) {
Uv(t, e);
var n = ar(e.value),
r = e.type;
if (n != null) r === "number" ? (n === 0 && t.value === "" || t.value != n) && (t.value = "" + n) : t.value !== "" + n && (t.value = "" + n);
else if (r === "submit" || r === "reset") {
t.removeAttribute("value");
return
}
e.hasOwnProperty("value") ? $f(t, e.type, n) : e.hasOwnProperty("defaultValue") && $f(t, e.type, ar(e.defaultValue)), e.checked == null && e.defaultChecked != null && (t.defaultChecked = !!e.defaultChecked)
}
function Wv(t, e, n) {
if (e.hasOwnProperty("value") || e.hasOwnProperty("defaultValue")) {
var r = e.type;
if (!(r !== "submit" && r !== "reset" || e.value !== void 0 && e.value !== null)) return;
e = "" + t._wrapperState.initialValue, n || e === t.value || (t.value = e), t.defaultValue = e
}
n = t.name, n !== "" && (t.name = ""), t.defaultChecked = !!t._wrapperState.initialChecked, n !== "" && (t.name = n)
}
function $f(t, e, n) {
(e !== "number" || qa(t.ownerDocument) !== t) && (n == null ? t.defaultValue = "" + t._wrapperState.initialValue : t.defaultValue !== "" + n && (t.defaultValue = "" + n))
}
var rs = Array.isArray;
function Xi(t, e, n, r) {
if (t = t.options, e) {
e = {};
for (var i = 0; i < n.length; i++) e["$" + n[i]] = !0;
for (n = 0; n < t.length; n++) i = e.hasOwnProperty("$" + t[n].value), t[n].selected !== i && (t[n].selected = i), i && r && (t[n].defaultSelected = !0)
} else {
for (n = "" + ar(n), e = null, i = 0; i < t.length; i++) {
if (t[i].value === n) {
t[i].selected = !0, r && (t[i].defaultSelected = !0);
return
}
e !== null || t[i].disabled || (e = t[i])
}
e !== null && (e.selected = !0)
}
}
function Vf(t, e) {
if (e.dangerouslySetInnerHTML != null) throw Error(oe(91));
return $e({}, e, {
value: void 0,
defaultValue: void 0,
children: "" + t._wrapperState.initialValue
})
}
function Yv(t, e) {
var n = e.value;
if (n == null) {
if (n = e.children, e = e.defaultValue, n != null) {
if (e != null) throw Error(oe(92));
if (rs(n)) {
if (1 < n.length) throw Error(oe(93));
n = n[0]
}
e = n
}
e == null && (e = ""), n = e
}
t._wrapperState = {
initialValue: ar(n)
}
}
function Xv(t, e) {
var n = ar(e.value),
r = ar(e.defaultValue);
n != null && (n = "" + n, n !== t.value && (t.value = n), e.defaultValue == null && t.defaultValue !== n && (t.defaultValue = n)), r != null && (t.defaultValue = "" + r)
}
function Gv(t) {
var e = t.textContent;
e === t._wrapperState.initialValue && e !== "" && e !== null && (t.value = e)
}
function Kv(t) {
switch (t) {
case "svg":
return "http://www.w3.org/2000/svg";
case "math":
return "http://www.w3.org/1998/Math/MathML";
default:
return "http://www.w3.org/1999/xhtml"
}
}
function Hf(t, e) {
return t == null || t === "http://www.w3.org/1999/xhtml" ? Kv(e) : t === "http://www.w3.org/2000/svg" && e === "foreignObject" ? "http://www.w3.org/1999/xhtml" : t
}
var Za, qv = function(t) {
return typeof MSApp < "u" && MSApp.execUnsafeLocalFunction ? function(e, n, r, i) {
MSApp.execUnsafeLocalFunction(function() {
return t(e, n, r, i)
})
} : t
}(function(t, e) {
if (t.namespaceURI !== "http://www.w3.org/2000/svg" || "innerHTML" in t) t.innerHTML = e;
else {
for (Za = Za || document.createElement("div"), Za.innerHTML = "<svg>" + e.valueOf().toString() + "</svg>", e = Za.firstChild; t.firstChild;) t.removeChild(t.firstChild);
for (; e.firstChild;) t.appendChild(e.firstChild)
}
});
function is(t, e) {
if (e) {
var n = t.firstChild;
if (n && n === t.lastChild && n.nodeType === 3) {
n.nodeValue = e;
return
}
}
t.textContent = e
}
var os = {
animationIterationCount: !0,
aspectRatio: !0,
borderImageOutset: !0,
borderImageSlice: !0,
borderImageWidth: !0,
boxFlex: !0,
boxFlexGroup: !0,
boxOrdinalGroup: !0,
columnCount: !0,
columns: !0,
flex: !0,
flexGrow: !0,
flexPositive: !0,
flexShrink: !0,
flexNegative: !0,
flexOrder: !0,
gridArea: !0,
gridRow: !0,
gridRowEnd: !0,
gridRowSpan: !0,
gridRowStart: !0,
gridColumn: !0,
gridColumnEnd: !0,
gridColumnSpan: !0,
gridColumnStart: !0,
fontWeight: !0,
lineClamp: !0,
lineHeight: !0,
opacity: !0,
order: !0,
orphans: !0,
tabSize: !0,
widows: !0,
zIndex: !0,
zoom: !0,
fillOpacity: !0,
floodOpacity: !0,
stopOpacity: !0,
strokeDasharray: !0,
strokeDashoffset: !0,
strokeMiterlimit: !0,
strokeOpacity: !0,
strokeWidth: !0
},
Jk = ["Webkit", "ms", "Moz", "O"];
Object.keys(os).forEach(function(t) {
Jk.forEach(function(e) {
e = e + t.charAt(0).toUpperCase() + t.substring(1), os[e] = os[t]
})
});
function Zv(t, e, n) {
return e == null || typeof e == "boolean" || e === "" ? "" : n || typeof e != "number" || e === 0 || os.hasOwnProperty(t) && os[t] ? ("" + e).trim() : e + "px"
}
function Qv(t, e) {
t = t.style;
for (var n in e)
if (e.hasOwnProperty(n)) {
var r = n.indexOf("--") === 0,
i = Zv(n, e[n], r);
n === "float" && (n = "cssFloat"), r ? t.setProperty(n, i) : t[n] = i
}
}
var eE = $e({
menuitem: !0
}, {
area: !0,
base: !0,
br: !0,
col: !0,
embed: !0,
hr: !0,
img: !0,
input: !0,
keygen: !0,
link: !0,
meta: !0,
param: !0,
source: !0,
track: !0,
wbr: !0
});
function Uf(t, e) {
if (e) {
if (eE[t] && (e.children != null || e.dangerouslySetInnerHTML != null)) throw Error(oe(137, t));
if (e.dangerouslySetInnerHTML != null) {
if (e.children != null) throw Error(oe(60));
if (typeof e.dangerouslySetInnerHTML != "object" || !("__html" in e.dangerouslySetInnerHTML)) throw Error(oe(61))
}
if (e.style != null && typeof e.style != "object") throw Error(oe(62))
}
}
function Wf(t, e) {
if (t.indexOf("-") === -1) return typeof e.is == "string";
switch (t) {
case "annotation-xml":
case "color-profile":
case "font-face":
case "font-face-src":
case "font-face-uri":
case "font-face-format":
case "font-face-name":
case "missing-glyph":
return !1;
default:
return !0
}
}
var Yf = null;
function Xf(t) {
return t = t.target || t.srcElement || window, t.correspondingUseElement && (t = t.correspondingUseElement), t.nodeType === 3 ? t.parentNode : t
}
var Gf = null,
Gi = null,
Ki = null;
function Jv(t) {
if (t = Es(t)) {
if (typeof Gf != "function") throw Error(oe(280));
var e = t.stateNode;
e && (e = wl(e), Gf(t.stateNode, t.type, e))
}
}
function e0(t) {
Gi ? Ki ? Ki.push(t) : Ki = [t] : Gi = t
}
function t0() {
if (Gi) {
var t = Gi,
e = Ki;
if (Ki = Gi = null, Jv(t), e)
for (t = 0; t < e.length; t++) Jv(e[t])
}
}
function n0(t, e) {
return t(e)
}
function r0() {}
var Kf = !1;
function i0(t, e, n) {
if (Kf) return t(e, n);
Kf = !0;
try {
return n0(t, e, n)
} finally {
Kf = !1, (Gi !== null || Ki !== null) && (r0(), t0())
}
}
function ss(t, e) {
var n = t.stateNode;
if (n === null) return null;
var r = wl(n);
if (r === null) return null;
n = r[e];
e: switch (e) {
case "onClick":
case "onClickCapture":
case "onDoubleClick":
case "onDoubleClickCapture":
case "onMouseDown":
case "onMouseDownCapture":
case "onMouseMove":
case "onMouseMoveCapture":
case "onMouseUp":
case "onMouseUpCapture":
case "onMouseEnter":
(r = !r.disabled) || (t = t.type, r = !(t === "button" || t === "input" || t === "select" || t === "textarea")), t = !r;
break e;
default:
t = !1
}
if (t) return null;
if (n && typeof n != "function") throw Error(oe(231, e, typeof n));
return n
}
var qf = !1;
if (On) try {
var as = {};
Object.defineProperty(as, "passive", {
get: function() {
qf = !0
}
}), window.addEventListener("test", as, as), window.removeEventListener("test", as, as)
} catch {
qf = !1
}
function tE(t, e, n, r, i, s, d, a, o) {
var c = Array.prototype.slice.call(arguments, 3);
try {
e.apply(n, c)
} catch (h) {
this.onError(h)
}
}
var ls = !1,
Qa = null,
Ja = !1,
Zf = null,
nE = {
onError: function(t) {
ls = !0, Qa = t
}
};
function rE(t, e, n, r, i, s, d, a, o) {
ls = !1, Qa = null, tE.apply(nE, arguments)
}
function iE(t, e, n, r, i, s, d, a, o) {
if (rE.apply(this, arguments), ls) {
if (ls) {
var c = Qa;
ls = !1, Qa = null
} else throw Error(oe(198));
Ja || (Ja = !0, Zf = c)
}
}
function Yr(t) {
var e = t,
n = t;
if (t.alternate)
for (; e.return;) e = e.return;
else {
t = e;
do e = t, (e.flags & 4098) !== 0 && (n = e.return), t = e.return; while (t)
}
return e.tag === 3 ? n : null
}
function o0(t) {
if (t.tag === 13) {
var e = t.memoizedState;
if (e === null && (t = t.alternate, t !== null && (e = t.memoizedState)), e !== null) return e.dehydrated
}
return null
}
function s0(t) {
if (Yr(t) !== t) throw Error(oe(188))
}
function oE(t) {
var e = t.alternate;
if (!e) {
if (e = Yr(t), e === null) throw Error(oe(188));
return e !== t ? null : t
}
for (var n = t, r = e;;) {
var i = n.return;
if (i === null) break;
var s = i.alternate;
if (s === null) {
if (r = i.return, r !== null) {
n = r;
continue
}
break
}
if (i.child === s.child) {
for (s = i.child; s;) {
if (s === n) return s0(i), t;
if (s === r) return s0(i), e;
s = s.sibling
}
throw Error(oe(188))
}
if (n.return !== r.return) n = i, r = s;
else {
for (var d = !1, a = i.child; a;) {
if (a === n) {
d = !0, n = i, r = s;
break
}
if (a === r) {
d = !0, r = i, n = s;
break
}
a = a.sibling
}
if (!d) {
for (a = s.child; a;) {
if (a === n) {
d = !0, n = s, r = i;
break
}
if (a === r) {
d = !0, r = s, n = i;
break
}
a = a.sibling
}
if (!d) throw Error(oe(189))
}
}
if (n.alternate !== r) throw Error(oe(190))
}
if (n.tag !== 3) throw Error(oe(188));
return n.stateNode.current === n ? t : e
}
function a0(t) {
return t = oE(t), t !== null ? l0(t) : null
}
function l0(t) {
if (t.tag === 5 || t.tag === 6) return t;
for (t = t.child; t !== null;) {
var e = l0(t);
if (e !== null) return e;
t = t.sibling
}
return null
}
var c0 = Bt.unstable_scheduleCallback,
u0 = Bt.unstable_cancelCallback,
sE = Bt.unstable_shouldYield,
aE = Bt.unstable_requestPaint,
Ke = Bt.unstable_now,
lE = Bt.unstable_getCurrentPriorityLevel,
Qf = Bt.unstable_ImmediatePriority,
f0 = Bt.unstable_UserBlockingPriority,
el = Bt.unstable_NormalPriority,
cE = Bt.unstable_LowPriority,
h0 = Bt.unstable_IdlePriority,
tl = null,
vn = null;
function uE(t) {
if (vn && typeof vn.onCommitFiberRoot == "function") try {
vn.onCommitFiberRoot(tl, t, void 0, (t.current.flags & 128) === 128)
} catch {}
}
var on = Math.clz32 ? Math.clz32 : dE,
fE = Math.log,
hE = Math.LN2;
function dE(t) {
return t >>>= 0, t === 0 ? 32 : 31 - (fE(t) / hE | 0) | 0
}
var nl = 64,
rl = 4194304;
function cs(t) {
switch (t & -t) {
case 1:
return 1;
case 2:
return 2;
case 4:
return 4;
case 8:
return 8;
case 16:
return 16;
case 32:
return 32;
case 64:
case 128:
case 256:
case 512:
case 1024:
case 2048:
case 4096:
case 8192:
case 16384:
case 32768:
case 65536:
case 131072:
case 262144:
case 524288:
case 1048576:
case 2097152:
return t & 4194240;
case 4194304:
case 8388608:
case 16777216:
case 33554432:
case 67108864:
return t & 130023424;
case 134217728:
return 134217728;
case 268435456:
return 268435456;
case 536870912:
return 536870912;
case 1073741824:
return 1073741824;
default:
return t
}
}
function il(t, e) {
var n = t.pendingLanes;
if (n === 0) return 0;
var r = 0,
i = t.suspendedLanes,
s = t.pingedLanes,
d = n & 268435455;
if (d !== 0) {
var a = d & ~i;
a !== 0 ? r = cs(a) : (s &= d, s !== 0 && (r = cs(s)))
} else d = n & ~i, d !== 0 ? r = cs(d) : s !== 0 && (r = cs(s));
if (r === 0) return 0;
if (e !== 0 && e !== r && (e & i) === 0 && (i = r & -r, s = e & -e, i >= s || i === 16 && (s & 4194240) !== 0)) return e;
if ((r & 4) !== 0 && (r |= n & 16), e = t.entangledLanes, e !== 0)
for (t = t.entanglements, e &= r; 0 < e;) n = 31 - on(e), i = 1 << n, r |= t[n], e &= ~i;
return r
}
function pE(t, e) {
switch (t) {
case 1:
case 2:
case 4:
return e + 250;
case 8:
case 16:
case 32:
case 64:
case 128:
case 256:
case 512:
case 1024:
case 2048:
case 4096:
case 8192:
case 16384:
case 32768:
case 65536:
case 131072:
case 262144:
case 524288:
case 1048576:
case 2097152:
return e + 5e3;
case 4194304:
case 8388608:
case 16777216:
case 33554432:
case 67108864:
return -1;
case 134217728:
case 268435456:
case 536870912:
case 1073741824:
return -1;
default:
return -1
}
}
function gE(t, e) {
for (var n = t.suspendedLanes, r = t.pingedLanes, i = t.expirationTimes, s = t.pendingLanes; 0 < s;) {
var d = 31 - on(s),
a = 1 << d,
o = i[d];
o === -1 ? ((a & n) === 0 || (a & r) !== 0) && (i[d] = pE(a, e)) : o <= e && (t.expiredLanes |= a), s &= ~a
}
}
function Jf(t) {
return t = t.pendingLanes & -1073741825, t !== 0 ? t : t & 1073741824 ? 1073741824 : 0
}
function d0() {
var t = nl;
return nl <<= 1, (nl & 4194240) === 0 && (nl = 64), t
}
function eh(t) {
for (var e = [], n = 0; 31 > n; n++) e.push(t);
return e
}
function us(t, e, n) {
t.pendingLanes |= e, e !== 536870912 && (t.suspendedLanes = 0, t.pingedLanes = 0), t = t.eventTimes, e = 31 - on(e), t[e] = n
}
function mE(t, e) {
var n = t.pendingLanes & ~e;
t.pendingLanes = e, t.suspendedLanes = 0, t.pingedLanes = 0, t.expiredLanes &= e, t.mutableReadLanes &= e, t.entangledLanes &= e, e = t.entanglements;
var r = t.eventTimes;
for (t = t.expirationTimes; 0 < n;) {
var i = 31 - on(n),
s = 1 << i;
e[i] = 0, r[i] = -1, t[i] = -1, n &= ~s
}
}
function th(t, e) {
var n = t.entangledLanes |= e;
for (t = t.entanglements; n;) {
var r = 31 - on(n),
i = 1 << r;
i & e | t[r] & e && (t[r] |= e), n &= ~i
}
}
var Ae = 0;
function p0(t) {
return t &= -t, 1 < t ? 4 < t ? (t & 268435455) !== 0 ? 16 : 536870912 : 4 : 1
}
var g0, nh, m0, v0, y0, rh = !1,
ol = [],
lr = null,
cr = null,
ur = null,
fs = new Map,
hs = new Map,
fr = [],
vE = "mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");
function b0(t, e) {
switch (t) {
case "focusin":
case "focusout":
lr = null;
break;
case "dragenter":
case "dragleave":
cr = null;
break;
case "mouseover":
case "mouseout":
ur = null;
break;
case "pointerover":
case "pointerout":
fs.delete(e.pointerId);
break;
case "gotpointercapture":
case "lostpointercapture":
hs.delete(e.pointerId)
}
}
function ds(t, e, n, r, i, s) {
return t === null || t.nativeEvent !== s ? (t = {
blockedOn: e,
domEventName: n,
eventSystemFlags: r,
nativeEvent: s,
targetContainers: [i]
}, e !== null && (e = Es(e), e !== null && nh(e)), t) : (t.eventSystemFlags |= r, e = t.targetContainers, i !== null && e.indexOf(i) === -1 && e.push(i), t)
}
function yE(t, e, n, r, i) {
switch (e) {
case "focusin":
return lr = ds(lr, t, e, n, r, i), !0;
case "dragenter":
return cr = ds(cr, t, e, n, r, i), !0;
case "mouseover":
return ur = ds(ur, t, e, n, r, i), !0;
case "pointerover":
var s = i.pointerId;
return fs.set(s, ds(fs.get(s) || null, t, e, n, r, i)), !0;
case "gotpointercapture":
return s = i.pointerId, hs.set(s, ds(hs.get(s) || null, t, e, n, r, i)), !0
}
return !1
}
function w0(t) {
var e = Xr(t.target);
if (e !== null) {
var n = Yr(e);
if (n !== null) {
if (e = n.tag, e === 13) {
if (e = o0(n), e !== null) {
t.blockedOn = e, y0(t.priority, function() {
m0(n)
});
return
}
} else if (e === 3 && n.stateNode.current.memoizedState.isDehydrated) {
t.blockedOn = n.tag === 3 ? n.stateNode.containerInfo : null;
return
}
}
}
t.blockedOn = null
}
function sl(t) {
if (t.blockedOn !== null) return !1;
for (var e = t.targetContainers; 0 < e.length;) {
var n = oh(t.domEventName, t.eventSystemFlags, e[0], t.nativeEvent);
if (n === null) {
n = t.nativeEvent;
var r = new n.constructor(n.type, n);
Yf = r, n.target.dispatchEvent(r), Yf = null
} else return e = Es(n), e !== null && nh(e), t.blockedOn = n, !1;
e.shift()
}
return !0
}
function x0(t, e, n) {
sl(t) && n.delete(e)
}
function bE() {
rh = !1, lr !== null && sl(lr) && (lr = null), cr !== null && sl(cr) && (cr = null), ur !== null && sl(ur) && (ur = null), fs.forEach(x0), hs.forEach(x0)
}
function ps(t, e) {
t.blockedOn === e && (t.blockedOn = null, rh || (rh = !0, Bt.unstable_scheduleCallback(Bt.unstable_NormalPriority, bE)))
}
function gs(t) {
function e(i) {
return ps(i, t)
}
if (0 < ol.length) {
ps(ol[0], t);
for (var n = 1; n < ol.length; n++) {
var r = ol[n];
r.blockedOn === t && (r.blockedOn = null)
}
}
for (lr !== null && ps(lr, t), cr !== null && ps(cr, t), ur !== null && ps(ur, t), fs.forEach(e), hs.forEach(e), n = 0; n < fr.length; n++) r = fr[n], r.blockedOn === t && (r.blockedOn = null);
for (; 0 < fr.length && (n = fr[0], n.blockedOn === null);) w0(n), n.blockedOn === null && fr.shift()
}
var qi = Pn.ReactCurrentBatchConfig,
al = !0;
function wE(t, e, n, r) {
var i = Ae,
s = qi.transition;
qi.transition = null;
try {
Ae = 1, ih(t, e, n, r)
} finally {
Ae = i, qi.transition = s
}
}
function xE(t, e, n, r) {
var i = Ae,
s = qi.transition;
qi.transition = null;
try {
Ae = 4, ih(t, e, n, r)
} finally {
Ae = i, qi.transition = s
}
}
function ih(t, e, n, r) {
if (al) {
var i = oh(t, e, n, r);
if (i === null) _h(t, e, r, ll, n), b0(t, r);
else if (yE(i, t, e, n, r)) r.stopPropagation();
else if (b0(t, r), e & 4 && -1 < vE.indexOf(t)) {
for (; i !== null;) {
var s = Es(i);
if (s !== null && g0(s), s = oh(t, e, n, r), s === null && _h(t, e, r, ll, n), s === i) break;
i = s
}
i !== null && r.stopPropagation()
} else _h(t, e, r, null, n)
}
}
var ll = null;
function oh(t, e, n, r) {
if (ll = null, t = Xf(r), t = Xr(t), t !== null)
if (e = Yr(t), e === null) t = null;
else if (n = e.tag, n === 13) {
if (t = o0(e), t !== null) return t;
t = null
} else if (n === 3) {
if (e.stateNode.current.memoizedState.isDehydrated) return e.tag === 3 ? e.stateNode.containerInfo : null;
t = null
} else e !== t && (t = null);
return ll = t, null
}
function _0(t) {
switch (t) {
case "cancel":
case "click":
case "close":
case "contextmenu":
case "copy":
case "cut":
case "auxclick":
case "dblclick":
case "dragend":
case "dragstart":
case "drop":
case "focusin":
case "focusout":
case "input":
case "invalid":
case "keydown":
case "keypress":
case "keyup":
case "mousedown":
case "mouseup":
case "paste":
case "pause":
case "play":
case "pointercancel":
case "pointerdown":
case "pointerup":
case "ratechange":
case "reset":
case "resize":
case "seeked":
case "submit":
case "touchcancel":
case "touchend":
case "touchstart":
case "volumechange":
case "change":
case "selectionchange":
case "textInput":
case "compositionstart":
case "compositionend":
case "compositionupdate":
case "beforeblur":
case "afterblur":
case "beforeinput":
case "blur":
case "fullscreenchange":
case "focus":
case "hashchange":
case "popstate":
case "select":
case "selectstart":
return 1;
case "drag":
case "dragenter":
case "dragexit":
case "dragleave":
case "dragover":
case "mousemove":
case "mouseout":
case "mouseover":
case "pointermove":
case "pointerout":
case "pointerover":
case "scroll":
case "toggle":
case "touchmove":
case "wheel":
case "mouseenter":
case "mouseleave":
case "pointerenter":
case "pointerleave":
return 4;
case "message":
switch (lE()) {
case Qf:
return 1;
case f0:
return 4;
case el:
case cE:
return 16;
case h0:
return 536870912;
default:
return 16
}
default:
return 16
}
}
var hr = null,
sh = null,
cl = null;
function S0() {
if (cl) return cl;
var t, e = sh,
n = e.length,
r, i = "value" in hr ? hr.value : hr.textContent,
s = i.length;
for (t = 0; t < n && e[t] === i[t]; t++);
var d = n - t;
for (r = 1; r <= d && e[n - r] === i[s - r]; r++);
return cl = i.slice(t, 1 < r ? 1 - r : void 0)
}
function ul(t) {
var e = t.keyCode;
return "charCode" in t ? (t = t.charCode, t === 0 && e === 13 && (t = 13)) : t = e, t === 10 && (t = 13), 32 <= t || t === 13 ? t : 0
}
function fl() {
return !0
}
function C0() {
return !1
}
function $t(t) {
function e(n, r, i, s, d) {
this._reactName = n, this._targetInst = i, this.type = r, this.nativeEvent = s, this.target = d, this.currentTarget = null;
for (var a in t) t.hasOwnProperty(a) && (n = t[a], this[a] = n ? n(s) : s[a]);
return this.isDefaultPrevented = (s.defaultPrevented != null ? s.defaultPrevented : s.returnValue === !1) ? fl : C0, this.isPropagationStopped = C0, this
}
return $e(e.prototype, {
preventDefault: function() {
this.defaultPrevented = !0;
var n = this.nativeEvent;
n && (n.preventDefault ? n.preventDefault() : typeof n.returnValue != "unknown" && (n.returnValue = !1), this.isDefaultPrevented = fl)
},
stopPropagation: function() {
var n = this.nativeEvent;
n && (n.stopPropagation ? n.stopPropagation() : typeof n.cancelBubble != "unknown" && (n.cancelBubble = !0), this.isPropagationStopped = fl)
},
persist: function() {},
isPersistent: fl
}), e
}
var Zi = {
eventPhase: 0,
bubbles: 0,
cancelable: 0,
timeStamp: function(t) {
return t.timeStamp || Date.now()
},
defaultPrevented: 0,
isTrusted: 0
},
ah = $t(Zi),
ms = $e({}, Zi, {
view: 0,
detail: 0
}),
_E = $t(ms),
lh, ch, vs, hl = $e({}, ms, {
screenX: 0,
screenY: 0,
clientX: 0,
clientY: 0,
pageX: 0,
pageY: 0,
ctrlKey: 0,
shiftKey: 0,
altKey: 0,
metaKey: 0,
getModifierState: fh,
button: 0,
buttons: 0,
relatedTarget: function(t) {
return t.relatedTarget === void 0 ? t.fromElement === t.srcElement ? t.toElement : t.fromElement : t.relatedTarget
},
movementX: function(t) {
return "movementX" in t ? t.movementX : (t !== vs && (vs && t.type === "mousemove" ? (lh = t.screenX - vs.screenX, ch = t.screenY - vs.screenY) : ch = lh = 0, vs = t), lh)
},
movementY: function(t) {
return "movementY" in t ? t.movementY : ch
}
}),
T0 = $t(hl),
SE = $e({}, hl, {
dataTransfer: 0
}),
CE = $t(SE),
TE = $e({}, ms, {
relatedTarget: 0
}),
uh = $t(TE),
kE = $e({}, Zi, {
animationName: 0,
elapsedTime: 0,
pseudoElement: 0
}),
EE = $t(kE),
OE = $e({}, Zi, {
clipboardData: function(t) {
return "clipboardData" in t ? t.clipboardData : window.clipboardData
}
}),
PE = $t(OE),
ME = $e({}, Zi, {
data: 0
}),
k0 = $t(ME),
AE = {
Esc: "Escape",
Spacebar: " ",
Left: "ArrowLeft",
Up: "ArrowUp",
Right: "ArrowRight",
Down: "ArrowDown",
Del: "Delete",
Win: "OS",
Menu: "ContextMenu",
Apps: "ContextMenu",
Scroll: "ScrollLock",
MozPrintableKey: "Unidentified"
},
DE = {
8: "Backspace",
9: "Tab",
12: "Clear",
13: "Enter",
16: "Shift",
17: "Control",
18: "Alt",
19: "Pause",
20: "CapsLock",
27: "Escape",
32: " ",
33: "PageUp",
34: "PageDown",
35: "End",
36: "Home",
37: "ArrowLeft",
38: "ArrowUp",
39: "ArrowRight",
40: "ArrowDown",
45: "Insert",
46: "Delete",
112: "F1",
113: "F2",
114: "F3",
115: "F4",
116: "F5",
117: "F6",
118: "F7",
119: "F8",
120: "F9",
121: "F10",
122: "F11",
123: "F12",
144: "NumLock",
145: "ScrollLock",
224: "Meta"
},
RE = {
Alt: "altKey",
Control: "ctrlKey",
Meta: "metaKey",
Shift: "shiftKey"
};
function IE(t) {
var e = this.nativeEvent;
return e.getModifierState ? e.getModifierState(t) : (t = RE[t]) ? !!e[t] : !1
}
function fh() {
return IE
}
var LE = $e({}, ms, {
key: function(t) {
if (t.key) {
var e = AE[t.key] || t.key;
if (e !== "Unidentified") return e
}
return t.type === "keypress" ? (t = ul(t), t === 13 ? "Enter" : String.fromCharCode(t)) : t.type === "keydown" || t.type === "keyup" ? DE[t.keyCode] || "Unidentified" : ""
},
code: 0,
location: 0,
ctrlKey: 0,
shiftKey: 0,
altKey: 0,
metaKey: 0,
repeat: 0,
locale: 0,
getModifierState: fh,
charCode: function(t) {
return t.type === "keypress" ? ul(t) : 0
},
keyCode: function(t) {
return t.type === "keydown" || t.type === "keyup" ? t.keyCode : 0
},
which: function(t) {
return t.type === "keypress" ? ul(t) : t.type === "keydown" || t.type === "keyup" ? t.keyCode : 0
}
}),
FE = $t(LE),
zE = $e({}, hl, {
pointerId: 0,
width: 0,
height: 0,
pressure: 0,
tangentialPressure: 0,
tiltX: 0,
tiltY: 0,
twist: 0,
pointerType: 0,
isPrimary: 0
}),
E0 = $t(zE),
NE = $e({}, ms, {
touches: 0,
targetTouches: 0,
changedTouches: 0,
altKey: 0,
metaKey: 0,
ctrlKey: 0,
shiftKey: 0,
getModifierState: fh
}),
jE = $t(NE),
BE = $e({}, Zi, {
propertyName: 0,
elapsedTime: 0,
pseudoElement: 0
}),
$E = $t(BE),
VE = $e({}, hl, {
deltaX: function(t) {
return "deltaX" in t ? t.deltaX : "wheelDeltaX" in t ? -t.wheelDeltaX : 0
},
deltaY: function(t) {
return "deltaY" in t ? t.deltaY : "wheelDeltaY" in t ? -t.wheelDeltaY : "wheelDelta" in t ? -t.wheelDelta : 0
},
deltaZ: 0,
deltaMode: 0
}),
HE = $t(VE),
UE = [9, 13, 27, 32],
hh = On && "CompositionEvent" in window,
ys = null;
On && "documentMode" in document && (ys = document.documentMode);
var WE = On && "TextEvent" in window && !ys,
O0 = On && (!hh || ys && 8 < ys && 11 >= ys),
P0 = String.fromCharCode(32),
M0 = !1;
function A0(t, e) {
switch (t) {
case "keyup":
return UE.indexOf(e.keyCode) !== -1;
case "keydown":
return e.keyCode !== 229;
case "keypress":
case "mousedown":
case "focusout":
return !0;
default:
return !1
}
}
function D0(t) {
return t = t.detail, typeof t == "object" && "data" in t ? t.data : null
}
var Qi = !1;
function YE(t, e) {
switch (t) {
case "compositionend":
return D0(e);
case "keypress":
return e.which !== 32 ? null : (M0 = !0, P0);
case "textInput":
return t = e.data, t === P0 && M0 ? null : t;
default:
return null
}
}
function XE(t, e) {
if (Qi) return t === "compositionend" || !hh && A0(t, e) ? (t = S0(), cl = sh = hr = null, Qi = !1, t) : null;
switch (t) {
case "paste":
return null;
case "keypress":
if (!(e.ctrlKey || e.altKey || e.metaKey) || e.ctrlKey && e.altKey) {
if (e.char && 1 < e.char.length) return e.char;
if (e.which) return String.fromCharCode(e.which)
}
return null;
case "compositionend":
return O0 && e.locale !== "ko" ? null : e.data;
default:
return null
}
}
var GE = {
color: !0,
date: !0,
datetime: !0,
"datetime-local": !0,
email: !0,
month: !0,
number: !0,
password: !0,
range: !0,
search: !0,
tel: !0,
text: !0,
time: !0,
url: !0,
week: !0
};
function R0(t) {
var e = t && t.nodeName && t.nodeName.toLowerCase();
return e === "input" ? !!GE[t.type] : e === "textarea"
}
function I0(t, e, n, r) {
e0(r), e = vl(e, "onChange"), 0 < e.length && (n = new ah("onChange", "change", null, n, r), t.push({
event: n,
listeners: e
}))
}
var bs = null,
ws = null;
function KE(t) {
Q0(t, 0)
}
function dl(t) {
var e = ro(t);
if (Vv(e)) return t
}
function qE(t, e) {
if (t === "change") return e
}
var L0 = !1;
if (On) {
var dh;
if (On) {
var ph = "oninput" in document;
if (!ph) {
var F0 = document.createElement("div");
F0.setAttribute("oninput", "return;"), ph = typeof F0.oninput == "function"
}
dh = ph
} else dh = !1;
L0 = dh && (!document.documentMode || 9 < document.documentMode)
}
function z0() {
bs && (bs.detachEvent("onpropertychange", N0), ws = bs = null)
}
function N0(t) {
if (t.propertyName === "value" && dl(ws)) {
var e = [];
I0(e, ws, t, Xf(t)), i0(KE, e)
}
}
function ZE(t, e, n) {
t === "focusin" ? (z0(), bs = e, ws = n, bs.attachEvent("onpropertychange", N0)) : t === "focusout" && z0()
}
function QE(t) {
if (t === "selectionchange" || t === "keyup" || t === "keydown") return dl(ws)
}
function JE(t, e) {
if (t === "click") return dl(e)
}
function eO(t, e) {
if (t === "input" || t === "change") return dl(e)
}
function tO(t, e) {
return t === e && (t !== 0 || 1 / t === 1 / e) || t !== t && e !== e
}
var sn = typeof Object.is == "function" ? Object.is : tO;
function xs(t, e) {
if (sn(t, e)) return !0;
if (typeof t != "object" || t === null || typeof e != "object" || e === null) return !1;
var n = Object.keys(t),
r = Object.keys(e);
if (n.length !== r.length) return !1;
for (r = 0; r < n.length; r++) {
var i = n[r];
if (!Tf.call(e, i) || !sn(t[i], e[i])) return !1
}
return !0
}
function j0(t) {
for (; t && t.firstChild;) t = t.firstChild;
return t
}
function B0(t, e) {
var n = j0(t);
t = 0;
for (var r; n;) {
if (n.nodeType === 3) {
if (r = t + n.textContent.length, t <= e && r >= e) return {
node: n,
offset: e - t
};
t = r
}
e: {
for (; n;) {
if (n.nextSibling) {
n = n.nextSibling;
break e
}
n = n.parentNode
}
n = void 0
}
n = j0(n)
}
}
function $0(t, e) {
return t && e ? t === e ? !0 : t && t.nodeType === 3 ? !1 : e && e.nodeType === 3 ? $0(t, e.parentNode) : "contains" in t ? t.contains(e) : t.compareDocumentPosition ? !!(t.compareDocumentPosition(e) & 16) : !1 : !1
}
function V0() {
for (var t = window, e = qa(); e instanceof t.HTMLIFrameElement;) {
try {
var n = typeof e.contentWindow.location.href == "string"
} catch {
n = !1
}
if (n) t = e.contentWindow;
else break;
e = qa(t.document)
}
return e
}
function gh(t) {
var e = t && t.nodeName && t.nodeName.toLowerCase();
return e && (e === "input" && (t.type === "text" || t.type === "search" || t.type === "tel" || t.type === "url" || t.type === "password") || e === "textarea" || t.contentEditable === "true")
}
function nO(t) {
var e = V0(),
n = t.focusedElem,
r = t.selectionRange;
if (e !== n && n && n.ownerDocument && $0(n.ownerDocument.documentElement, n)) {
if (r !== null && gh(n)) {
if (e = r.start, t = r.end, t === void 0 && (t = e), "selectionStart" in n) n.selectionStart = e, n.selectionEnd = Math.min(t, n.value.length);
else if (t = (e = n.ownerDocument || document) && e.defaultView || window, t.getSelection) {
t = t.getSelection();
var i = n.textContent.length,
s = Math.min(r.start, i);
r = r.end === void 0 ? s : Math.min(r.end, i), !t.extend && s > r && (i = r, r = s, s = i), i = B0(n, s);
var d = B0(n, r);
i && d && (t.rangeCount !== 1 || t.anchorNode !== i.node || t.anchorOffset !== i.offset || t.focusNode !== d.node || t.focusOffset !== d.offset) && (e = e.createRange(), e.setStart(i.node, i.offset), t.removeAllRanges(), s > r ? (t.addRange(e), t.extend(d.node, d.offset)) : (e.setEnd(d.node, d.offset), t.addRange(e)))
}
}
for (e = [], t = n; t = t.parentNode;) t.nodeType === 1 && e.push({
element: t,
left: t.scrollLeft,
top: t.scrollTop
});
for (typeof n.focus == "function" && n.focus(), n = 0; n < e.length; n++) t = e[n], t.element.scrollLeft = t.left, t.element.scrollTop = t.top
}
}
var rO = On && "documentMode" in document && 11 >= document.documentMode,
Ji = null,
mh = null,
_s = null,
vh = !1;
function H0(t, e, n) {
var r = n.window === n ? n.document : n.nodeType === 9 ? n : n.ownerDocument;
vh || Ji == null || Ji !== qa(r) || (r = Ji, "selectionStart" in r && gh(r) ? r = {
start: r.selectionStart,
end: r.selectionEnd
} : (r = (r.ownerDocument && r.ownerDocument.defaultView || window).getSelection(), r = {
anchorNode: r.anchorNode,
anchorOffset: r.anchorOffset,
focusNode: r.focusNode,
focusOffset: r.focusOffset
}), _s && xs(_s, r) || (_s = r, r = vl(mh, "onSelect"), 0 < r.length && (e = new ah("onSelect", "select", null, e, n), t.push({
event: e,
listeners: r
}), e.target = Ji)))
}
function pl(t, e) {
var n = {};
return n[t.toLowerCase()] = e.toLowerCase(), n["Webkit" + t] = "webkit" + e, n["Moz" + t] = "moz" + e, n
}
var eo = {
animationend: pl("Animation", "AnimationEnd"),
animationiteration: pl("Animation", "AnimationIteration"),
animationstart: pl("Animation", "AnimationStart"),
transitionend: pl("Transition", "TransitionEnd")
},
yh = {},
U0 = {};
On && (U0 = document.createElement("div").style, "AnimationEvent" in window || (delete eo.animationend.animation, delete eo.animationiteration.animation, delete eo.animationstart.animation), "TransitionEvent" in window || delete eo.transitionend.transition);
function gl(t) {
if (yh[t]) return yh[t];
if (!eo[t]) return t;
var e = eo[t],
n;
for (n in e)
if (e.hasOwnProperty(n) && n in U0) return yh[t] = e[n];
return t
}
var W0 = gl("animationend"),
Y0 = gl("animationiteration"),
X0 = gl("animationstart"),
G0 = gl("transitionend"),
K0 = new Map,
q0 = "abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");
function dr(t, e) {
K0.set(t, e), Wr(e, [t])
}
for (var bh = 0; bh < q0.length; bh++) {
var wh = q0[bh],
iO = wh.toLowerCase(),
oO = wh[0].toUpperCase() + wh.slice(1);
dr(iO, "on" + oO)
}
dr(W0, "onAnimationEnd"), dr(Y0, "onAnimationIteration"), dr(X0, "onAnimationStart"), dr("dblclick", "onDoubleClick"), dr("focusin", "onFocus"), dr("focusout", "onBlur"), dr(G0, "onTransitionEnd"), Ui("onMouseEnter", ["mouseout", "mouseover"]), Ui("onMouseLeave", ["mouseout", "mouseover"]), Ui("onPointerEnter", ["pointerout", "pointerover"]), Ui("onPointerLeave", ["pointerout", "pointerover"]), Wr("onChange", "change click focusin focusout input keydown keyup selectionchange".split(" ")), Wr("onSelect", "focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")), Wr("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]), Wr("onCompositionEnd", "compositionend focusout keydown keypress keyup mousedown".split(" ")), Wr("onCompositionStart", "compositionstart focusout keydown keypress keyup mousedown".split(" ")), Wr("onCompositionUpdate", "compositionupdate focusout keydown keypress keyup mousedown".split(" "));
var Ss = "abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),
sO = new Set("cancel close invalid load scroll toggle".split(" ").concat(Ss));
function Z0(t, e, n) {
var r = t.type || "unknown-event";
t.currentTarget = n, iE(r, e, void 0, t), t.currentTarget = null
}
function Q0(t, e) {
e = (e & 4) !== 0;
for (var n = 0; n < t.length; n++) {
var r = t[n],
i = r.event;
r = r.listeners;
e: {
var s = void 0;
if (e)
for (var d = r.length - 1; 0 <= d; d--) {
var a = r[d],
o = a.instance,
c = a.currentTarget;
if (a = a.listener, o !== s && i.isPropagationStopped()) break e;
Z0(i, a, c), s = o
} else
for (d = 0; d < r.length; d++) {
if (a = r[d], o = a.instance, c = a.currentTarget, a = a.listener, o !== s && i.isPropagationStopped()) break e;
Z0(i, a, c), s = o
}
}
}
if (Ja) throw t = Zf, Ja = !1, Zf = null, t
}
function Le(t, e) {
var n = e[Oh];
n === void 0 && (n = e[Oh] = new Set);
var r = t + "__bubble";
n.has(r) || (J0(e, t, 2, !1), n.add(r))
}
function xh(t, e, n) {
var r = 0;
e && (r |= 4), J0(n, t, r, e)
}
var ml = "_reactListening" + Math.random().toString(36).slice(2);
function Cs(t) {
if (!t[ml]) {
t[ml] = !0, Iv.forEach(function(n) {
n !== "selectionchange" && (sO.has(n) || xh(n, !1, t), xh(n, !0, t))
});
var e = t.nodeType === 9 ? t : t.ownerDocument;
e === null || e[ml] || (e[ml] = !0, xh("selectionchange", !1, e))
}
}
function J0(t, e, n, r) {
switch (_0(e)) {
case 1:
var i = wE;
break;
case 4:
i = xE;
break;
default:
i = ih
}
n = i.bind(null, e, n, t), i = void 0, !qf || e !== "touchstart" && e !== "touchmove" && e !== "wheel" || (i = !0), r ? i !== void 0 ? t.addEventListener(e, n, {
capture: !0,
passive: i
}) : t.addEventListener(e, n, !0) : i !== void 0 ? t.addEventListener(e, n, {
passive: i
}) : t.addEventListener(e, n, !1)
}
function _h(t, e, n, r, i) {
var s = r;
if ((e & 1) === 0 && (e & 2) === 0 && r !== null) e: for (;;) {
if (r === null) return;
var d = r.tag;
if (d === 3 || d === 4) {
var a = r.stateNode.containerInfo;
if (a === i || a.nodeType === 8 && a.parentNode === i) break;
if (d === 4)
for (d = r.return; d !== null;) {
var o = d.tag;
if ((o === 3 || o === 4) && (o = d.stateNode.containerInfo, o === i || o.nodeType === 8 && o.parentNode === i)) return;
d = d.return
}
for (; a !== null;) {
if (d = Xr(a), d === null) return;
if (o = d.tag, o === 5 || o === 6) {
r = s = d;
continue e
}
a = a.parentNode
}
}
r = r.return
}
i0(function() {
var c = s,
h = Xf(n),
l = [];
e: {
var u = K0.get(t);
if (u !== void 0) {
var f = ah,
p = t;
switch (t) {
case "keypress":
if (ul(n) === 0) break e;
case "keydown":
case "keyup":
f = FE;
break;
case "focusin":
p = "focus", f = uh;
break;
case "focusout":
p = "blur", f = uh;
break;
case "beforeblur":
case "afterblur":
f = uh;
break;
case "click":
if (n.button === 2) break e;
case "auxclick":
case "dblclick":
case "mousedown":
case "mousemove":
case "mouseup":
case "mouseout":
case "mouseover":
case "contextmenu":
f = T0;
break;
case "drag":
case "dragend":
case "dragenter":
case "dragexit":
case "dragleave":
case "dragover":
case "dragstart":
case "drop":
f = CE;
break;
case "touchcancel":
case "touchend":
case "touchmove":
case "touchstart":
f = jE;
break;
case W0:
case Y0:
case X0:
f = EE;
break;
case G0:
f = $E;
break;
case "scroll":
f = _E;
break;
case "wheel":
f = HE;
break;
case "copy":
case "cut":
case "paste":
f = PE;
break;
case "gotpointercapture":
case "lostpointercapture":
case "pointercancel":
case "pointerdown":
case "pointermove":
case "pointerout":
case "pointerover":
case "pointerup":
f = E0
}
var m = (e & 4) !== 0,
g = !m && t === "scroll",
v = m ? u !== null ? u + "Capture" : null : u;
m = [];
for (var y = c, b; y !== null;) {
b = y;
var w = b.stateNode;
if (b.tag === 5 && w !== null && (b = w, v !== null && (w = ss(y, v), w != null && m.push(Ts(y, w, b)))), g) break;
y = y.return
}
0 < m.length && (u = new f(u, p, null, n, h), l.push({
event: u,
listeners: m
}))
}
}
if ((e & 7) === 0) {
e: {
if (u = t === "mouseover" || t === "pointerover", f = t === "mouseout" || t === "pointerout", u && n !== Yf && (p = n.relatedTarget || n.fromElement) && (Xr(p) || p[Mn])) break e;
if ((f || u) && (u = h.window === h ? h : (u = h.ownerDocument) ? u.defaultView || u.parentWindow : window, f ? (p = n.relatedTarget || n.toElement, f = c, p = p ? Xr(p) : null, p !== null && (g = Yr(p), p !== g || p.tag !== 5 && p.tag !== 6) && (p = null)) : (f = null, p = c), f !== p)) {
if (m = T0, w = "onMouseLeave", v = "onMouseEnter", y = "mouse", (t === "pointerout" || t === "pointerover") && (m = E0, w = "onPointerLeave", v = "onPointerEnter", y = "pointer"), g = f == null ? u : ro(f), b = p == null ? u : ro(p), u = new m(w, y + "leave", f, n, h), u.target = g, u.relatedTarget = b, w = null, Xr(h) === c && (m = new m(v, y + "enter", p, n, h), m.target = b, m.relatedTarget = g, w = m), g = w, f && p) t: {
for (m = f, v = p, y = 0, b = m; b; b = to(b)) y++;
for (b = 0, w = v; w; w = to(w)) b++;
for (; 0 < y - b;) m = to(m),
y--;
for (; 0 < b - y;) v = to(v),
b--;
for (; y--;) {
if (m === v || v !== null && m === v.alternate) break t;
m = to(m), v = to(v)
}
m = null
}
else m = null;
f !== null && e1(l, u, f, m, !1), p !== null && g !== null && e1(l, g, p, m, !0)
}
}
e: {
if (u = c ? ro(c) : window, f = u.nodeName && u.nodeName.toLowerCase(), f === "select" || f === "input" && u.type === "file") var x = qE;
else if (R0(u))
if (L0) x = eO;
else {
x = QE;
var S = ZE
}
else(f = u.nodeName) && f.toLowerCase() === "input" && (u.type === "checkbox" || u.type === "radio") && (x = JE);
if (x && (x = x(t, c))) {
I0(l, x, n, h);
break e
}
S && S(t, u, c),
t === "focusout" && (S = u._wrapperState) && S.controlled && u.type === "number" && $f(u, "number", u.value)
}
switch (S = c ? ro(c) : window, t) {
case "focusin":
(R0(S) || S.contentEditable === "true") && (Ji = S, mh = c, _s = null);
break;
case "focusout":
_s = mh = Ji = null;
break;
case "mousedown":
vh = !0;
break;
case "contextmenu":
case "mouseup":
case "dragend":
vh = !1, H0(l, n, h);
break;
case "selectionchange":
if (rO) break;
case "keydown":
case "keyup":
H0(l, n, h)
}
var T;
if (hh) e: {
switch (t) {
case "compositionstart":
var P = "onCompositionStart";
break e;
case "compositionend":
P = "onCompositionEnd";
break e;
case "compositionupdate":
P = "onCompositionUpdate";
break e
}
P = void 0
}
else Qi ? A0(t, n) && (P = "onCompositionEnd") : t === "keydown" && n.keyCode === 229 && (P = "onCompositionStart");P && (O0 && n.locale !== "ko" && (Qi || P !== "onCompositionStart" ? P === "onCompositionEnd" && Qi && (T = S0()) : (hr = h, sh = "value" in hr ? hr.value : hr.textContent, Qi = !0)), S = vl(c, P), 0 < S.length && (P = new k0(P, t, null, n, h), l.push({
event: P,
listeners: S
}), T ? P.data = T : (T = D0(n), T !== null && (P.data = T)))),
(T = WE ? YE(t, n) : XE(t, n)) && (c = vl(c, "onBeforeInput"), 0 < c.length && (h = new k0("onBeforeInput", "beforeinput", null, n, h), l.push({
event: h,
listeners: c
}), h.data = T))
}
Q0(l, e)
})
}
function Ts(t, e, n) {
return {
instance: t,
listener: e,
currentTarget: n
}
}
function vl(t, e) {
for (var n = e + "Capture", r = []; t !== null;) {
var i = t,
s = i.stateNode;
i.tag === 5 && s !== null && (i = s, s = ss(t, n), s != null && r.unshift(Ts(t, s, i)), s = ss(t, e), s != null && r.push(Ts(t, s, i))), t = t.return
}
return r
}
function to(t) {
if (t === null) return null;
do t = t.return; while (t && t.tag !== 5);
return t || null
}
function e1(t, e, n, r, i) {
for (var s = e._reactName, d = []; n !== null && n !== r;) {
var a = n,
o = a.alternate,
c = a.stateNode;
if (o !== null && o === r) break;
a.tag === 5 && c !== null && (a = c, i ? (o = ss(n, s), o != null && d.unshift(Ts(n, o, a))) : i || (o = ss(n, s), o != null && d.push(Ts(n, o, a)))), n = n.return
}
d.length !== 0 && t.push({
event: e,
listeners: d
})
}
var aO = /\r\n?/g,
lO = /\u0000|\uFFFD/g;
function t1(t) {
return (typeof t == "string" ? t : "" + t).replace(aO, `
`).replace(lO, "")
}
function yl(t, e, n) {
if (e = t1(e), t1(t) !== e && n) throw Error(oe(425))
}
function bl() {}
var Sh = null,
Ch = null;
function Th(t, e) {
return t === "textarea" || t === "noscript" || typeof e.children == "string" || typeof e.children == "number" || typeof e.dangerouslySetInnerHTML == "object" && e.dangerouslySetInnerHTML !== null && e.dangerouslySetInnerHTML.__html != null
}
var kh = typeof setTimeout == "function" ? setTimeout : void 0,
cO = typeof clearTimeout == "function" ? clearTimeout : void 0,
n1 = typeof Promise == "function" ? Promise : void 0,
uO = typeof queueMicrotask == "function" ? queueMicrotask : typeof n1 < "u" ? function(t) {
return n1.resolve(null).then(t).catch(fO)
} : kh;
function fO(t) {
setTimeout(function() {
throw t
})
}
function Eh(t, e) {
var n = e,
r = 0;
do {
var i = n.nextSibling;
if (t.removeChild(n), i && i.nodeType === 8)
if (n = i.data, n === "/$") {
if (r === 0) {
t.removeChild(i), gs(e);
return
}
r--
} else n !== "$" && n !== "$?" && n !== "$!" || r++;
n = i
} while (n);
gs(e)
}
function pr(t) {
for (; t != null; t = t.nextSibling) {
var e = t.nodeType;
if (e === 1 || e === 3) break;
if (e === 8) {
if (e = t.data, e === "$" || e === "$!" || e === "$?") break;
if (e === "/$") return null
}
}
return t
}
function r1(t) {
t = t.previousSibling;
for (var e = 0; t;) {
if (t.nodeType === 8) {
var n = t.data;
if (n === "$" || n === "$!" || n === "$?") {
if (e === 0) return t;
e--
} else n === "/$" && e++
}
t = t.previousSibling
}
return null
}
var no = Math.random().toString(36).slice(2),
yn = "__reactFiber$" + no,
ks = "__reactProps$" + no,
Mn = "__reactContainer$" + no,
Oh = "__reactEvents$" + no,
hO = "__reactListeners$" + no,
dO = "__reactHandles$" + no;
function Xr(t) {
var e = t[yn];
if (e) return e;
for (var n = t.parentNode; n;) {
if (e = n[Mn] || n[yn]) {
if (n = e.alternate, e.child !== null || n !== null && n.child !== null)
for (t = r1(t); t !== null;) {
if (n = t[yn]) return n;
t = r1(t)
}
return e
}
t = n, n = t.parentNode
}
return null
}
function Es(t) {
return t = t[yn] || t[Mn], !t || t.tag !== 5 && t.tag !== 6 && t.tag !== 13 && t.tag !== 3 ? null : t
}
function ro(t) {
if (t.tag === 5 || t.tag === 6) return t.stateNode;
throw Error(oe(33))
}
function wl(t) {
return t[ks] || null
}
var Ph = [],
io = -1;
function gr(t) {
return {
current: t
}
}
function Fe(t) {
0 > io || (t.current = Ph[io], Ph[io] = null, io--)
}
function Ie(t, e) {
io++, Ph[io] = t.current, t.current = e
}
var mr = {},
gt = gr(mr),
Mt = gr(!1),
Gr = mr;
function oo(t, e) {
var n = t.type.contextTypes;
if (!n) return mr;
var r = t.stateNode;
if (r && r.__reactInternalMemoizedUnmaskedChildContext === e) return r.__reactInternalMemoizedMaskedChildContext;
var i = {},
s;
for (s in n) i[s] = e[s];
return r && (t = t.stateNode, t.__reactInternalMemoizedUnmaskedChildContext = e, t.__reactInternalMemoizedMaskedChildContext = i), i
}
function At(t) {
return t = t.childContextTypes, t != null
}
function xl() {
Fe(Mt), Fe(gt)
}
function i1(t, e, n) {
if (gt.current !== mr) throw Error(oe(168));
Ie(gt, e), Ie(Mt, n)
}
function o1(t, e, n) {
var r = t.stateNode;
if (e = e.childContextTypes, typeof r.getChildContext != "function") return n;
r = r.getChildContext();
for (var i in r)
if (!(i in e)) throw Error(oe(108, Zk(t) || "Unknown", i));
return $e({}, n, r)
}
function _l(t) {
return t = (t = t.stateNode) && t.__reactInternalMemoizedMergedChildContext || mr, Gr = gt.current, Ie(gt, t), Ie(Mt, Mt.current), !0
}
function s1(t, e, n) {
var r = t.stateNode;
if (!r) throw Error(oe(169));
n ? (t = o1(t, e, Gr), r.__reactInternalMemoizedMergedChildContext = t, Fe(Mt), Fe(gt), Ie(gt, t)) : Fe(Mt), Ie(Mt, n)
}
var An = null,
Sl = !1,
Mh = !1;
function a1(t) {
An === null ? An = [t] : An.push(t)
}
function pO(t) {
Sl = !0, a1(t)
}
function vr() {
if (!Mh && An !== null) {
Mh = !0;
var t = 0,
e = Ae;
try {
var n = An;
for (Ae = 1; t < n.length; t++) {
var r = n[t];
do r = r(!0); while (r !== null)
}
An = null, Sl = !1
} catch (i) {
throw An !== null && (An = An.slice(t + 1)), c0(Qf, vr), i
} finally {
Ae = e, Mh = !1
}
}
return null
}
var so = [],
ao = 0,
Cl = null,
Tl = 0,
Xt = [],
Gt = 0,
Kr = null,
Dn = 1,
Rn = "";
function qr(t, e) {
so[ao++] = Tl, so[ao++] = Cl, Cl = t, Tl = e
}
function l1(t, e, n) {
Xt[Gt++] = Dn, Xt[Gt++] = Rn, Xt[Gt++] = Kr, Kr = t;
var r = Dn;
t = Rn;
var i = 32 - on(r) - 1;
r &= ~(1 << i), n += 1;
var s = 32 - on(e) + i;
if (30 < s) {
var d = i - i % 5;
s = (r & (1 << d) - 1).toString(32), r >>= d, i -= d, Dn = 1 << 32 - on(e) + i | n << i | r, Rn = s + t
} else Dn = 1 << s | n << i | r, Rn = t
}
function Ah(t) {
t.return !== null && (qr(t, 1), l1(t, 1, 0))
}
function Dh(t) {
for (; t === Cl;) Cl = so[--ao], so[ao] = null, Tl = so[--ao], so[ao] = null;
for (; t === Kr;) Kr = Xt[--Gt], Xt[Gt] = null, Rn = Xt[--Gt], Xt[Gt] = null, Dn = Xt[--Gt], Xt[Gt] = null
}
var Vt = null,
Ht = null,
Ne = !1,
an = null;
function c1(t, e) {
var n = Qt(5, null, null, 0);
n.elementType = "DELETED", n.stateNode = e, n.return = t, e = t.deletions, e === null ? (t.deletions = [n], t.flags |= 16) : e.push(n)
}
function u1(t, e) {
switch (t.tag) {
case 5:
var n = t.type;
return e = e.nodeType !== 1 || n.toLowerCase() !== e.nodeName.toLowerCase() ? null : e, e !== null ? (t.stateNode = e, Vt = t, Ht = pr(e.firstChild), !0) : !1;
case 6:
return e = t.pendingProps === "" || e.nodeType !== 3 ? null : e, e !== null ? (t.stateNode = e, Vt = t, Ht = null, !0) : !1;
case 13:
return e = e.nodeType !== 8 ? null : e, e !== null ? (n = Kr !== null ? {
id: Dn,
overflow: Rn
} : null, t.memoizedState = {
dehydrated: e,
treeContext: n,
retryLane: 1073741824
}, n = Qt(18, null, null, 0), n.stateNode = e, n.return = t, t.child = n, Vt = t, Ht = null, !0) : !1;
default:
return !1
}
}
function Rh(t) {
return (t.mode & 1) !== 0 && (t.flags & 128) === 0
}
function Ih(t) {
if (Ne) {
var e = Ht;
if (e) {
var n = e;
if (!u1(t, e)) {
if (Rh(t)) throw Error(oe(418));
e = pr(n.nextSibling);
var r = Vt;
e && u1(t, e) ? c1(r, n) : (t.flags = t.flags & -4097 | 2, Ne = !1, Vt = t)
}
} else {
if (Rh(t)) throw Error(oe(418));
t.flags = t.flags & -4097 | 2, Ne = !1, Vt = t
}
}
}
function f1(t) {
for (t = t.return; t !== null && t.tag !== 5 && t.tag !== 3 && t.tag !== 13;) t = t.return;
Vt = t
}
function kl(t) {
if (t !== Vt) return !1;
if (!Ne) return f1(t), Ne = !0, !1;
var e;
if ((e = t.tag !== 3) && !(e = t.tag !== 5) && (e = t.type, e = e !== "head" && e !== "body" && !Th(t.type, t.memoizedProps)), e && (e = Ht)) {
if (Rh(t)) throw h1(), Error(oe(418));
for (; e;) c1(t, e), e = pr(e.nextSibling)
}
if (f1(t), t.tag === 13) {
if (t = t.memoizedState, t = t !== null ? t.dehydrated : null, !t) throw Error(oe(317));
e: {
for (t = t.nextSibling, e = 0; t;) {
if (t.nodeType === 8) {
var n = t.data;
if (n === "/$") {
if (e === 0) {
Ht = pr(t.nextSibling);
break e
}
e--
} else n !== "$" && n !== "$!" && n !== "$?" || e++
}
t = t.nextSibling
}
Ht = null
}
} else Ht = Vt ? pr(t.stateNode.nextSibling) : null;
return !0
}
function h1() {
for (var t = Ht; t;) t = pr(t.nextSibling)
}
function lo() {
Ht = Vt = null, Ne = !1
}
function Lh(t) {
an === null ? an = [t] : an.push(t)
}
var gO = Pn.ReactCurrentBatchConfig;
function ln(t, e) {
if (t && t.defaultProps) {
e = $e({}, e), t = t.defaultProps;
for (var n in t) e[n] === void 0 && (e[n] = t[n]);
return e
}
return e
}
var El = gr(null),
Ol = null,
co = null,
Fh = null;
function zh() {
Fh = co = Ol = null
}
function Nh(t) {
var e = El.current;
Fe(El), t._currentValue = e
}
function jh(t, e, n) {
for (; t !== null;) {
var r = t.alternate;
if ((t.childLanes & e) !== e ? (t.childLanes |= e, r !== null && (r.childLanes |= e)) : r !== null && (r.childLanes & e) !== e && (r.childLanes |= e), t === n) break;
t = t.return
}
}
function uo(t, e) {
Ol = t, Fh = co = null, t = t.dependencies, t !== null && t.firstContext !== null && ((t.lanes & e) !== 0 && (Dt = !0), t.firstContext = null)
}
function Kt(t) {
var e = t._currentValue;
if (Fh !== t)
if (t = {
context: t,
memoizedValue: e,
next: null
}, co === null) {
if (Ol === null) throw Error(oe(308));
co = t, Ol.dependencies = {
lanes: 0,
firstContext: t
}
} else co = co.next = t;
return e
}
var Zr = null;
function Bh(t) {
Zr === null ? Zr = [t] : Zr.push(t)
}
function d1(t, e, n, r) {
var i = e.interleaved;
return i === null ? (n.next = n, Bh(e)) : (n.next = i.next, i.next = n), e.interleaved = n, In(t, r)
}
function In(t, e) {
t.lanes |= e;
var n = t.alternate;
for (n !== null && (n.lanes |= e), n = t, t = t.return; t !== null;) t.childLanes |= e, n = t.alternate, n !== null && (n.childLanes |= e), n = t, t = t.return;
return n.tag === 3 ? n.stateNode : null
}
var yr = !1;
function $h(t) {
t.updateQueue = {
baseState: t.memoizedState,
firstBaseUpdate: null,
lastBaseUpdate: null,
shared: {
pending: null,
interleaved: null,
lanes: 0
},
effects: null
}
}
function p1(t, e) {
t = t.updateQueue, e.updateQueue === t && (e.updateQueue = {
baseState: t.baseState,
firstBaseUpdate: t.firstBaseUpdate,
lastBaseUpdate: t.lastBaseUpdate,
shared: t.shared,
effects: t.effects
})
}
function Ln(t, e) {
return {
eventTime: t,
lane: e,
tag: 0,
payload: null,
callback: null,
next: null
}
}
function br(t, e, n) {
var r = t.updateQueue;
if (r === null) return null;
if (r = r.shared, (Oe & 2) !== 0) {
var i = r.pending;
return i === null ? e.next = e : (e.next = i.next, i.next = e), r.pending = e, In(t, n)
}
return i = r.interleaved, i === null ? (e.next = e, Bh(r)) : (e.next = i.next, i.next = e), r.interleaved = e, In(t, n)
}
function Pl(t, e, n) {
if (e = e.updateQueue, e !== null && (e = e.shared, (n & 4194240) !== 0)) {
var r = e.lanes;
r &= t.pendingLanes, n |= r, e.lanes = n, th(t, n)
}
}
function g1(t, e) {
var n = t.updateQueue,
r = t.alternate;
if (r !== null && (r = r.updateQueue, n === r)) {
var i = null,
s = null;
if (n = n.firstBaseUpdate, n !== null) {
do {
var d = {
eventTime: n.eventTime,
lane: n.lane,
tag: n.tag,
payload: n.payload,
callback: n.callback,
next: null
};
s === null ? i = s = d : s = s.next = d, n = n.next
} while (n !== null);
s === null ? i = s = e : s = s.next = e
} else i = s = e;
n = {
baseState: r.baseState,
firstBaseUpdate: i,
lastBaseUpdate: s,
shared: r.shared,
effects: r.effects
}, t.updateQueue = n;
return
}
t = n.lastBaseUpdate, t === null ? n.firstBaseUpdate = e : t.next = e, n.lastBaseUpdate = e
}
function Ml(t, e, n, r) {
var i = t.updateQueue;
yr = !1;
var s = i.firstBaseUpdate,
d = i.lastBaseUpdate,
a = i.shared.pending;
if (a !== null) {
i.shared.pending = null;
var o = a,
c = o.next;
o.next = null, d === null ? s = c : d.next = c, d = o;
var h = t.alternate;
h !== null && (h = h.updateQueue, a = h.lastBaseUpdate, a !== d && (a === null ? h.firstBaseUpdate = c : a.next = c, h.lastBaseUpdate = o))
}
if (s !== null) {
var l = i.baseState;
d = 0, h = c = o = null, a = s;
do {
var u = a.lane,
f = a.eventTime;
if ((r & u) === u) {
h !== null && (h = h.next = {
eventTime: f,
lane: 0,
tag: a.tag,
payload: a.payload,
callback: a.callback,
next: null
});
e: {
var p = t,
m = a;
switch (u = e, f = n, m.tag) {
case 1:
if (p = m.payload, typeof p == "function") {
l = p.call(f, l, u);
break e
}
l = p;
break e;
case 3:
p.flags = p.flags & -65537 | 128;
case 0:
if (p = m.payload, u = typeof p == "function" ? p.call(f, l, u) : p, u == null) break e;
l = $e({}, l, u);
break e;
case 2:
yr = !0
}
}
a.callback !== null && a.lane !== 0 && (t.flags |= 64, u = i.effects, u === null ? i.effects = [a] : u.push(a))
} else f = {
eventTime: f,
lane: u,
tag: a.tag,
payload: a.payload,
callback: a.callback,
next: null
}, h === null ? (c = h = f, o = l) : h = h.next = f, d |= u;
if (a = a.next, a === null) {
if (a = i.shared.pending, a === null) break;
u = a, a = u.next, u.next = null, i.lastBaseUpdate = u, i.shared.pending = null
}
} while (1);
if (h === null && (o = l), i.baseState = o, i.firstBaseUpdate = c, i.lastBaseUpdate = h, e = i.shared.interleaved, e !== null) {
i = e;
do d |= i.lane, i = i.next; while (i !== e)
} else s === null && (i.shared.lanes = 0);
ei |= d, t.lanes = d, t.memoizedState = l
}
}
function m1(t, e, n) {
if (t = e.effects, e.effects = null, t !== null)
for (e = 0; e < t.length; e++) {
var r = t[e],
i = r.callback;
if (i !== null) {
if (r.callback = null, r = n, typeof i != "function") throw Error(oe(191, i));
i.call(r)
}
}
}
var v1 = new Rv.Component().refs;
function Vh(t, e, n, r) {
e = t.memoizedState, n = n(r, e), n = n == null ? e : $e({}, e, n), t.memoizedState = n, t.lanes === 0 && (t.updateQueue.baseState = n)
}
var Al = {
isMounted: function(t) {
return (t = t._reactInternals) ? Yr(t) === t : !1
},
enqueueSetState: function(t, e, n) {
t = t._reactInternals;
var r = Tt(),
i = Sr(t),
s = Ln(r, i);
s.payload = e, n != null && (s.callback = n), e = br(t, s, i), e !== null && (fn(e, t, i, r), Pl(e, t, i))
},
enqueueReplaceState: function(t, e, n) {
t = t._reactInternals;
var r = Tt(),
i = Sr(t),
s = Ln(r, i);
s.tag = 1, s.payload = e, n != null && (s.callback = n), e = br(t, s, i), e !== null && (fn(e, t, i, r), Pl(e, t, i))
},
enqueueForceUpdate: function(t, e) {
t = t._reactInternals;
var n = Tt(),
r = Sr(t),
i = Ln(n, r);
i.tag = 2, e != null && (i.callback = e), e = br(t, i, r), e !== null && (fn(e, t, r, n), Pl(e, t, r))
}
};
function y1(t, e, n, r, i, s, d) {
return t = t.stateNode, typeof t.shouldComponentUpdate == "function" ? t.shouldComponentUpdate(r, s, d) : e.prototype && e.prototype.isPureReactComponent ? !xs(n, r) || !xs(i, s) : !0
}
function b1(t, e, n) {
var r = !1,
i = mr,
s = e.contextType;
return typeof s == "object" && s !== null ? s = Kt(s) : (i = At(e) ? Gr : gt.current, r = e.contextTypes, s = (r = r != null) ? oo(t, i) : mr), e = new e(n, s), t.memoizedState = e.state !== null && e.state !== void 0 ? e.state : null, e.updater = Al, t.stateNode = e, e._reactInternals = t, r && (t = t.stateNode, t.__reactInternalMemoizedUnmaskedChildContext = i, t.__reactInternalMemoizedMaskedChildContext = s), e
}
function w1(t, e, n, r) {
t = e.state, typeof e.componentWillReceiveProps == "function" && e.componentWillReceiveProps(n, r), typeof e.UNSAFE_componentWillReceiveProps == "function" && e.UNSAFE_componentWillReceiveProps(n, r), e.state !== t && Al.enqueueReplaceState(e, e.state, null)
}
function Hh(t, e, n, r) {
var i = t.stateNode;
i.props = n, i.state = t.memoizedState, i.refs = v1, $h(t);
var s = e.contextType;
typeof s == "object" && s !== null ? i.context = Kt(s) : (s = At(e) ? Gr : gt.current, i.context = oo(t, s)), i.state = t.memoizedState, s = e.getDerivedStateFromProps, typeof s == "function" && (Vh(t, e, s, n), i.state = t.memoizedState), typeof e.getDerivedStateFromProps == "function" || typeof i.getSnapshotBeforeUpdate == "function" || typeof i.UNSAFE_componentWillMount != "function" && typeof i.componentWillMount != "function" || (e = i.state, typeof i.componentWillMount == "function" && i.componentWillMount(), typeof i.UNSAFE_componentWillMount == "function" && i.UNSAFE_componentWillMount(), e !== i.state && Al.enqueueReplaceState(i, i.state, null), Ml(t, n, i, r), i.state = t.memoizedState), typeof i.componentDidMount == "function" && (t.flags |= 4194308)
}
function Os(t, e, n) {
if (t = n.ref, t !== null && typeof t != "function" && typeof t != "object") {
if (n._owner) {
if (n = n._owner, n) {
if (n.tag !== 1) throw Error(oe(309));
var r = n.stateNode
}
if (!r) throw Error(oe(147, t));
var i = r,
s = "" + t;
return e !== null && e.ref !== null && typeof e.ref == "function" && e.ref._stringRef === s ? e.ref : (e = function(d) {
var a = i.refs;
a === v1 && (a = i.refs = {}), d === null ? delete a[s] : a[s] = d
}, e._stringRef = s, e)
}
if (typeof t != "string") throw Error(oe(284));
if (!n._owner) throw Error(oe(290, t))
}
return t
}
function Dl(t, e) {
throw t = Object.prototype.toString.call(e), Error(oe(31, t === "[object Object]" ? "object with keys {" + Object.keys(e).join(", ") + "}" : t))
}
function x1(t) {
var e = t._init;
return e(t._payload)
}
function _1(t) {
function e(v, y) {
if (t) {
var b = v.deletions;
b === null ? (v.deletions = [y], v.flags |= 16) : b.push(y)
}
}
function n(v, y) {
if (!t) return null;
for (; y !== null;) e(v, y), y = y.sibling;
return null
}
function r(v, y) {
for (v = new Map; y !== null;) y.key !== null ? v.set(y.key, y) : v.set(y.index, y), y = y.sibling;
return v
}
function i(v, y) {
return v = Tr(v, y), v.index = 0, v.sibling = null, v
}
function s(v, y, b) {
return v.index = b, t ? (b = v.alternate, b !== null ? (b = b.index, b < y ? (v.flags |= 2, y) : b) : (v.flags |= 2, y)) : (v.flags |= 1048576, y)
}
function d(v) {
return t && v.alternate === null && (v.flags |= 2), v
}
function a(v, y, b, w) {
return y === null || y.tag !== 6 ? (y = kd(b, v.mode, w), y.return = v, y) : (y = i(y, b), y.return = v, y)
}
function o(v, y, b, w) {
var x = b.type;
return x === Yi ? h(v, y, b.props.children, w, b.key) : y !== null && (y.elementType === x || typeof x == "object" && x !== null && x.$$typeof === sr && x1(x) === y.type) ? (w = i(y, b.props), w.ref = Os(v, y, b), w.return = v, w) : (w = Zl(b.type, b.key, b.props, null, v.mode, w), w.ref = Os(v, y, b), w.return = v, w)
}
function c(v, y, b, w) {
return y === null || y.tag !== 4 || y.stateNode.containerInfo !== b.containerInfo || y.stateNode.implementation !== b.implementation ? (y = Ed(b, v.mode, w), y.return = v, y) : (y = i(y, b.children || []), y.return = v, y)
}
function h(v, y, b, w, x) {
return y === null || y.tag !== 7 ? (y = ii(b, v.mode, w, x), y.return = v, y) : (y = i(y, b), y.return = v, y)
}
function l(v, y, b) {
if (typeof y == "string" && y !== "" || typeof y == "number") return y = kd("" + y, v.mode, b), y.return = v, y;
if (typeof y == "object" && y !== null) {
switch (y.$$typeof) {
case Ga:
return b = Zl(y.type, y.key, y.props, null, v.mode, b), b.ref = Os(v, null, y), b.return = v, b;
case Wi:
return y = Ed(y, v.mode, b), y.return = v, y;
case sr:
var w = y._init;
return l(v, w(y._payload), b)
}
if (rs(y) || ts(y)) return y = ii(y, v.mode, b, null), y.return = v, y;
Dl(v, y)
}
return null
}
function u(v, y, b, w) {
var x = y !== null ? y.key : null;
if (typeof b == "string" && b !== "" || typeof b == "number") return x !== null ? null : a(v, y, "" + b, w);
if (typeof b == "object" && b !== null) {
switch (b.$$typeof) {
case Ga:
return b.key === x ? o(v, y, b, w) : null;
case Wi:
return b.key === x ? c(v, y, b, w) : null;
case sr:
return x = b._init, u(v, y, x(b._payload), w)
}
if (rs(b) || ts(b)) return x !== null ? null : h(v, y, b, w, null);
Dl(v, b)
}
return null
}
function f(v, y, b, w, x) {
if (typeof w == "string" && w !== "" || typeof w == "number") return v = v.get(b) || null, a(y, v, "" + w, x);
if (typeof w == "object" && w !== null) {
switch (w.$$typeof) {
case Ga:
return v = v.get(w.key === null ? b : w.key) || null, o(y, v, w, x);
case Wi:
return v = v.get(w.key === null ? b : w.key) || null, c(y, v, w, x);
case sr:
var S = w._init;
return f(v, y, b, S(w._payload), x)
}
if (rs(w) || ts(w)) return v = v.get(b) || null, h(y, v, w, x, null);
Dl(y, w)
}
return null
}
function p(v, y, b, w) {
for (var x = null, S = null, T = y, P = y = 0, I = null; T !== null && P < b.length; P++) {
T.index > P ? (I = T, T = null) : I = T.sibling;
var z = u(v, T, b[P], w);
if (z === null) {
T === null && (T = I);
break
}
t && T && z.alternate === null && e(v, T), y = s(z, y, P), S === null ? x = z : S.sibling = z, S = z, T = I
}
if (P === b.length) return n(v, T), Ne && qr(v, P), x;
if (T === null) {
for (; P < b.length; P++) T = l(v, b[P], w), T !== null && (y = s(T, y, P), S === null ? x = T : S.sibling = T, S = T);
return Ne && qr(v, P), x
}
for (T = r(v, T); P < b.length; P++) I = f(T, v, P, b[P], w), I !== null && (t && I.alternate !== null && T.delete(I.key === null ? P : I.key), y = s(I, y, P), S === null ? x = I : S.sibling = I, S = I);
return t && T.forEach(function(H) {
return e(v, H)
}), Ne && qr(v, P), x
}
function m(v, y, b, w) {
var x = ts(b);
if (typeof x != "function") throw Error(oe(150));
if (b = x.call(b), b == null) throw Error(oe(151));
for (var S = x = null, T = y, P = y = 0, I = null, z = b.next(); T !== null && !z.done; P++, z = b.next()) {
T.index > P ? (I = T, T = null) : I = T.sibling;
var H = u(v, T, z.value, w);
if (H === null) {
T === null && (T = I);
break
}
t && T && H.alternate === null && e(v, T), y = s(H, y, P), S === null ? x = H : S.sibling = H, S = H, T = I
}
if (z.done) return n(v, T), Ne && qr(v, P), x;
if (T === null) {
for (; !z.done; P++, z = b.next()) z = l(v, z.value, w), z !== null && (y = s(z, y, P), S === null ? x = z : S.sibling = z, S = z);
return Ne && qr(v, P), x
}
for (T = r(v, T); !z.done; P++, z = b.next()) z = f(T, v, P, z.value, w), z !== null && (t && z.alternate !== null && T.delete(z.key === null ? P : z.key), y = s(z, y, P), S === null ? x = z : S.sibling = z, S = z);
return t && T.forEach(function(ee) {
return e(v, ee)
}), Ne && qr(v, P), x
}
function g(v, y, b, w) {
if (typeof b == "object" && b !== null && b.type === Yi && b.key === null && (b = b.props.children), typeof b == "object" && b !== null) {
switch (b.$$typeof) {
case Ga:
e: {
for (var x = b.key, S = y; S !== null;) {
if (S.key === x) {
if (x = b.type, x === Yi) {
if (S.tag === 7) {
n(v, S.sibling), y = i(S, b.props.children), y.return = v, v = y;
break e
}
} else if (S.elementType === x || typeof x == "object" && x !== null && x.$$typeof === sr && x1(x) === S.type) {
n(v, S.sibling), y = i(S, b.props), y.ref = Os(v, S, b), y.return = v, v = y;
break e
}
n(v, S);
break
} else e(v, S);
S = S.sibling
}
b.type === Yi ? (y = ii(b.props.children, v.mode, w, b.key), y.return = v, v = y) : (w = Zl(b.type, b.key, b.props, null, v.mode, w), w.ref = Os(v, y, b), w.return = v, v = w)
}
return d(v);
case Wi:
e: {
for (S = b.key; y !== null;) {
if (y.key === S)
if (y.tag === 4 && y.stateNode.containerInfo === b.containerInfo && y.stateNode.implementation === b.implementation) {
n(v, y.sibling), y = i(y, b.children || []), y.return = v, v = y;
break e
} else {
n(v, y);
break
}
else e(v, y);
y = y.sibling
}
y = Ed(b, v.mode, w),
y.return = v,
v = y
}
return d(v);
case sr:
return S = b._init, g(v, y, S(b._payload), w)
}
if (rs(b)) return p(v, y, b, w);
if (ts(b)) return m(v, y, b, w);
Dl(v, b)
}
return typeof b == "string" && b !== "" || typeof b == "number" ? (b = "" + b, y !== null && y.tag === 6 ? (n(v, y.sibling), y = i(y, b), y.return = v, v = y) : (n(v, y), y = kd(b, v.mode, w), y.return = v, v = y), d(v)) : n(v, y)
}
return g
}
var fo = _1(!0),
S1 = _1(!1),
Ps = {},
bn = gr(Ps),
Ms = gr(Ps),
As = gr(Ps);
function Qr(t) {
if (t === Ps) throw Error(oe(174));
return t
}
function Uh(t, e) {
switch (Ie(As, e), Ie(Ms, t), Ie(bn, Ps), t = e.nodeType, t) {
case 9:
case 11:
e = (e = e.documentElement) ? e.namespaceURI : Hf(null, "");
break;
default:
t = t === 8 ? e.parentNode : e, e = t.namespaceURI || null, t = t.tagName, e = Hf(e, t)
}
Fe(bn), Ie(bn, e)
}
function ho() {
Fe(bn), Fe(Ms), Fe(As)
}
function C1(t) {
Qr(As.current);
var e = Qr(bn.current),
n = Hf(e, t.type);
e !== n && (Ie(Ms, t), Ie(bn, n))
}
function Wh(t) {
Ms.current === t && (Fe(bn), Fe(Ms))
}
var Ve = gr(0);
function Rl(t) {
for (var e = t; e !== null;) {
if (e.tag === 13) {
var n = e.memoizedState;
if (n !== null && (n = n.dehydrated, n === null || n.data === "$?" || n.data === "$!")) return e
} else if (e.tag === 19 && e.memoizedProps.revealOrder !== void 0) {
if ((e.flags & 128) !== 0) return e
} else if (e.child !== null) {
e.child.return = e, e = e.child;
continue
}
if (e === t) break;
for (; e.sibling === null;) {
if (e.return === null || e.return === t) return null;
e = e.return
}
e.sibling.return = e.return, e = e.sibling
}
return null
}
var Yh = [];
function Xh() {
for (var t = 0; t < Yh.length; t++) Yh[t]._workInProgressVersionPrimary = null;
Yh.length = 0
}
var Il = Pn.ReactCurrentDispatcher,
Gh = Pn.ReactCurrentBatchConfig,
Jr = 0,
He = null,
tt = null,
at = null,
Ll = !1,
Ds = !1,
Rs = 0,
mO = 0;
function mt() {
throw Error(oe(321))
}
function Kh(t, e) {
if (e === null) return !1;
for (var n = 0; n < e.length && n < t.length; n++)
if (!sn(t[n], e[n])) return !1;
return !0
}
function qh(t, e, n, r, i, s) {
if (Jr = s, He = e, e.memoizedState = null, e.updateQueue = null, e.lanes = 0, Il.current = t === null || t.memoizedState === null ? wO : xO, t = n(r, i), Ds) {
s = 0;
do {
if (Ds = !1, Rs = 0, 25 <= s) throw Error(oe(301));
s += 1, at = tt = null, e.updateQueue = null, Il.current = _O, t = n(r, i)
} while (Ds)
}
if (Il.current = Nl, e = tt !== null && tt.next !== null, Jr = 0, at = tt = He = null, Ll = !1, e) throw Error(oe(300));
return t
}
function Zh() {
var t = Rs !== 0;
return Rs = 0, t
}
function wn() {
var t = {
memoizedState: null,
baseState: null,
baseQueue: null,
queue: null,
next: null
};
return at === null ? He.memoizedState = at = t : at = at.next = t, at
}
function qt() {
if (tt === null) {
var t = He.alternate;
t = t !== null ? t.memoizedState : null
} else t = tt.next;
var e = at === null ? He.memoizedState : at.next;
if (e !== null) at = e, tt = t;
else {
if (t === null) throw Error(oe(310));
tt = t, t = {
memoizedState: tt.memoizedState,
baseState: tt.baseState,
baseQueue: tt.baseQueue,
queue: tt.queue,
next: null
}, at === null ? He.memoizedState = at = t : at = at.next = t
}
return at
}
function Is(t, e) {
return typeof e == "function" ? e(t) : e
}
function Qh(t) {
var e = qt(),
n = e.queue;
if (n === null) throw Error(oe(311));
n.lastRenderedReducer = t;
var r = tt,
i = r.baseQueue,
s = n.pending;
if (s !== null) {
if (i !== null) {
var d = i.next;
i.next = s.next, s.next = d
}
r.baseQueue = i = s, n.pending = null
}
if (i !== null) {
s = i.next, r = r.baseState;
var a = d = null,
o = null,
c = s;
do {
var h = c.lane;
if ((Jr & h) === h) o !== null && (o = o.next = {
lane: 0,
action: c.action,
hasEagerState: c.hasEagerState,
eagerState: c.eagerState,
next: null
}), r = c.hasEagerState ? c.eagerState : t(r, c.action);
else {
var l = {
lane: h,
action: c.action,
hasEagerState: c.hasEagerState,
eagerState: c.eagerState,
next: null
};
o === null ? (a = o = l, d = r) : o = o.next = l, He.lanes |= h, ei |= h
}
c = c.next
} while (c !== null && c !== s);
o === null ? d = r : o.next = a, sn(r, e.memoizedState) || (Dt = !0), e.memoizedState = r, e.baseState = d, e.baseQueue = o, n.lastRenderedState = r
}
if (t = n.interleaved, t !== null) {
i = t;
do s = i.lane, He.lanes |= s, ei |= s, i = i.next; while (i !== t)
} else i === null && (n.lanes = 0);
return [e.memoizedState, n.dispatch]
}
function Jh(t) {
var e = qt(),
n = e.queue;
if (n === null) throw Error(oe(311));
n.lastRenderedReducer = t;
var r = n.dispatch,
i = n.pending,
s = e.memoizedState;
if (i !== null) {
n.pending = null;
var d = i = i.next;
do s = t(s, d.action), d = d.next; while (d !== i);
sn(s, e.memoizedState) || (Dt = !0), e.memoizedState = s, e.baseQueue === null && (e.baseState = s), n.lastRenderedState = s
}
return [s, r]
}
function T1() {}
function k1(t, e) {
var n = He,
r = qt(),
i = e(),
s = !sn(r.memoizedState, i);
if (s && (r.memoizedState = i, Dt = !0), r = r.queue, ed(P1.bind(null, n, r, t), [t]), r.getSnapshot !== e || s || at !== null && at.memoizedState.tag & 1) {
if (n.flags |= 2048, Ls(9, O1.bind(null, n, r, i, e), void 0, null), lt === null) throw Error(oe(349));
(Jr & 30) !== 0 || E1(n, e, i)
}
return i
}
function E1(t, e, n) {
t.flags |= 16384, t = {
getSnapshot: e,
value: n
}, e = He.updateQueue, e === null ? (e = {
lastEffect: null,
stores: null
}, He.updateQueue = e, e.stores = [t]) : (n = e.stores, n === null ? e.stores = [t] : n.push(t))
}
function O1(t, e, n, r) {
e.value = n, e.getSnapshot = r, M1(e) && A1(t)
}
function P1(t, e, n) {
return n(function() {
M1(e) && A1(t)
})
}
function M1(t) {
var e = t.getSnapshot;
t = t.value;
try {
var n = e();
return !sn(t, n)
} catch {
return !0
}
}
function A1(t) {
var e = In(t, 1);
e !== null && fn(e, t, 1, -1)
}
function D1(t) {
var e = wn();
return typeof t == "function" && (t = t()), e.memoizedState = e.baseState = t, t = {
pending: null,
interleaved: null,
lanes: 0,
dispatch: null,
lastRenderedReducer: Is,
lastRenderedState: t
}, e.queue = t, t = t.dispatch = bO.bind(null, He, t), [e.memoizedState, t]
}
function Ls(t, e, n, r) {
return t = {
tag: t,
create: e,
destroy: n,
deps: r,
next: null
}, e = He.updateQueue, e === null ? (e = {
lastEffect: null,
stores: null
}, He.updateQueue = e, e.lastEffect = t.next = t) : (n = e.lastEffect, n === null ? e.lastEffect = t.next = t : (r = n.next, n.next = t, t.next = r, e.lastEffect = t)), t
}
function R1() {
return qt().memoizedState
}
function Fl(t, e, n, r) {
var i = wn();
He.flags |= t, i.memoizedState = Ls(1 | e, n, void 0, r === void 0 ? null : r)
}
function zl(t, e, n, r) {
var i = qt();
r = r === void 0 ? null : r;
var s = void 0;
if (tt !== null) {
var d = tt.memoizedState;
if (s = d.destroy, r !== null && Kh(r, d.deps)) {
i.memoizedState = Ls(e, n, s, r);
return
}
}
He.flags |= t, i.memoizedState = Ls(1 | e, n, s, r)
}
function I1(t, e) {
return Fl(8390656, 8, t, e)
}
function ed(t, e) {
return zl(2048, 8, t, e)
}
function L1(t, e) {
return zl(4, 2, t, e)
}
function F1(t, e) {
return zl(4, 4, t, e)
}
function z1(t, e) {
if (typeof e == "function") return t = t(), e(t),
function() {
e(null)
};
if (e != null) return t = t(), e.current = t,
function() {
e.current = null
}
}
function N1(t, e, n) {
return n = n != null ? n.concat([t]) : null, zl(4, 4, z1.bind(null, e, t), n)
}
function td() {}
function j1(t, e) {
var n = qt();
e = e === void 0 ? null : e;
var r = n.memoizedState;
return r !== null && e !== null && Kh(e, r[1]) ? r[0] : (n.memoizedState = [t, e], t)
}
function B1(t, e) {
var n = qt();
e = e === void 0 ? null : e;
var r = n.memoizedState;
return r !== null && e !== null && Kh(e, r[1]) ? r[0] : (t = t(), n.memoizedState = [t, e], t)
}
function $1(t, e, n) {
return (Jr & 21) === 0 ? (t.baseState && (t.baseState = !1, Dt = !0), t.memoizedState = n) : (sn(n, e) || (n = d0(), He.lanes |= n, ei |= n, t.baseState = !0), e)
}
function vO(t, e) {
var n = Ae;
Ae = n !== 0 && 4 > n ? n : 4, t(!0);
var r = Gh.transition;
Gh.transition = {};
try {
t(!1), e()
} finally {
Ae = n, Gh.transition = r
}
}
function V1() {
return qt().memoizedState
}
function yO(t, e, n) {
var r = Sr(t);
if (n = {
lane: r,
action: n,
hasEagerState: !1,
eagerState: null,
next: null
}, H1(t)) U1(e, n);
else if (n = d1(t, e, n, r), n !== null) {
var i = Tt();
fn(n, t, r, i), W1(n, e, r)
}
}
function bO(t, e, n) {
var r = Sr(t),
i = {
lane: r,
action: n,
hasEagerState: !1,
eagerState: null,
next: null
};
if (H1(t)) U1(e, i);
else {
var s = t.alternate;
if (t.lanes === 0 && (s === null || s.lanes === 0) && (s = e.lastRenderedReducer, s !== null)) try {
var d = e.lastRenderedState,
a = s(d, n);
if (i.hasEagerState = !0, i.eagerState = a, sn(a, d)) {
var o = e.interleaved;
o === null ? (i.next = i, Bh(e)) : (i.next = o.next, o.next = i), e.interleaved = i;
return
}
} catch {} finally {}
n = d1(t, e, i, r), n !== null && (i = Tt(), fn(n, t, r, i), W1(n, e, r))
}
}
function H1(t) {
var e = t.alternate;
return t === He || e !== null && e === He
}
function U1(t, e) {
Ds = Ll = !0;
var n = t.pending;
n === null ? e.next = e : (e.next = n.next, n.next = e), t.pending = e
}
function W1(t, e, n) {
if ((n & 4194240) !== 0) {
var r = e.lanes;
r &= t.pendingLanes, n |= r, e.lanes = n, th(t, n)
}
}
var Nl = {
readContext: Kt,
useCallback: mt,
useContext: mt,
useEffect: mt,
useImperativeHandle: mt,
useInsertionEffect: mt,
useLayoutEffect: mt,
useMemo: mt,
useReducer: mt,
useRef: mt,
useState: mt,
useDebugValue: mt,
useDeferredValue: mt,
useTransition: mt,
useMutableSource: mt,
useSyncExternalStore: mt,
useId: mt,
unstable_isNewReconciler: !1
},
wO = {
readContext: Kt,
useCallback: function(t, e) {
return wn().memoizedState = [t, e === void 0 ? null : e], t
},
useContext: Kt,
useEffect: I1,
useImperativeHandle: function(t, e, n) {
return n = n != null ? n.concat([t]) : null, Fl(4194308, 4, z1.bind(null, e, t), n)
},
useLayoutEffect: function(t, e) {
return Fl(4194308, 4, t, e)
},
useInsertionEffect: function(t, e) {
return Fl(4, 2, t, e)
},
useMemo: function(t, e) {
var n = wn();
return e = e === void 0 ? null : e, t = t(), n.memoizedState = [t, e], t
},
useReducer: function(t, e, n) {
var r = wn();
return e = n !== void 0 ? n(e) : e, r.memoizedState = r.baseState = e, t = {
pending: null,
interleaved: null,
lanes: 0,
dispatch: null,
lastRenderedReducer: t,
lastRenderedState: e
}, r.queue = t, t = t.dispatch = yO.bind(null, He, t), [r.memoizedState, t]
},
useRef: function(t) {
var e = wn();
return t = {
current: t
}, e.memoizedState = t
},
useState: D1,
useDebugValue: td,
useDeferredValue: function(t) {
return wn().memoizedState = t
},
useTransition: function() {
var t = D1(!1),
e = t[0];
return t = vO.bind(null, t[1]), wn().memoizedState = t, [e, t]
},
useMutableSource: function() {},
useSyncExternalStore: function(t, e, n) {
var r = He,
i = wn();
if (Ne) {
if (n === void 0) throw Error(oe(407));
n = n()
} else {
if (n = e(), lt === null) throw Error(oe(349));
(Jr & 30) !== 0 || E1(r, e, n)
}
i.memoizedState = n;
var s = {
value: n,
getSnapshot: e
};
return i.queue = s, I1(P1.bind(null, r, s, t), [t]), r.flags |= 2048, Ls(9, O1.bind(null, r, s, n, e), void 0, null), n
},
useId: function() {
var t = wn(),
e = lt.identifierPrefix;
if (Ne) {
var n = Rn,
r = Dn;
n = (r & ~(1 << 32 - on(r) - 1)).toString(32) + n, e = ":" + e + "R" + n, n = Rs++, 0 < n && (e += "H" + n.toString(32)), e += ":"
} else n = mO++, e = ":" + e + "r" + n.toString(32) + ":";
return t.memoizedState = e
},
unstable_isNewReconciler: !1
},
xO = {
readContext: Kt,
useCallback: j1,
useContext: Kt,
useEffect: ed,
useImperativeHandle: N1,
useInsertionEffect: L1,
useLayoutEffect: F1,
useMemo: B1,
useReducer: Qh,
useRef: R1,
useState: function() {
return Qh(Is)
},
useDebugValue: td,
useDeferredValue: function(t) {
var e = qt();
return $1(e, tt.memoizedState, t)
},
useTransition: function() {
var t = Qh(Is)[0],
e = qt().memoizedState;
return [t, e]
},
useMutableSource: T1,
useSyncExternalStore: k1,
useId: V1,
unstable_isNewReconciler: !1
},
_O = {
readContext: Kt,
useCallback: j1,
useContext: Kt,
useEffect: ed,
useImperativeHandle: N1,
useInsertionEffect: L1,
useLayoutEffect: F1,
useMemo: B1,
useReducer: Jh,
useRef: R1,
useState: function() {
return Jh(Is)
},
useDebugValue: td,
useDeferredValue: function(t) {
var e = qt();
return tt === null ? e.memoizedState = t : $1(e, tt.memoizedState, t)
},
useTransition: function() {
var t = Jh(Is)[0],
e = qt().memoizedState;
return [t, e]
},
useMutableSource: T1,
useSyncExternalStore: k1,
useId: V1,
unstable_isNewReconciler: !1
};
function po(t, e) {
try {
var n = "",
r = e;
do n += qk(r), r = r.return; while (r);
var i = n
} catch (s) {
i = `
Error generating stack: ` + s.message + `
` + s.stack
}
return {
value: t,
source: e,
stack: i,
digest: null
}
}
function nd(t, e, n) {
return {
value: t,
source: null,
stack: n != null ? n : null,
digest: e != null ? e : null
}
}
function rd(t, e) {
try {
console.error(e.value)
} catch (n) {
setTimeout(function() {
throw n
})
}
}
var SO = typeof WeakMap == "function" ? WeakMap : Map;
function Y1(t, e, n) {
n = Ln(-1, n), n.tag = 3, n.payload = {
element: null
};
var r = e.value;
return n.callback = function() {
Wl || (Wl = !0, yd = r), rd(t, e)
}, n
}
function X1(t, e, n) {
n = Ln(-1, n), n.tag = 3;
var r = t.type.getDerivedStateFromError;
if (typeof r == "function") {
var i = e.value;
n.payload = function() {
return r(i)
}, n.callback = function() {
rd(t, e)
}
}
var s = t.stateNode;
return s !== null && typeof s.componentDidCatch == "function" && (n.callback = function() {
rd(t, e), typeof r != "function" && (xr === null ? xr = new Set([this]) : xr.add(this));
var d = e.stack;
this.componentDidCatch(e.value, {
componentStack: d !== null ? d : ""
})
}), n
}
function G1(t, e, n) {
var r = t.pingCache;
if (r === null) {
r = t.pingCache = new SO;
var i = new Set;
r.set(e, i)
} else i = r.get(e), i === void 0 && (i = new Set, r.set(e, i));
i.has(n) || (i.add(n), t = zO.bind(null, t, e, n), e.then(t, t))
}
function K1(t) {
do {
var e;
if ((e = t.tag === 13) && (e = t.memoizedState, e = e !== null ? e.dehydrated !== null : !0), e) return t;
t = t.return
} while (t !== null);
return null
}
function q1(t, e, n, r, i) {
return (t.mode & 1) === 0 ? (t === e ? t.flags |= 65536 : (t.flags |= 128, n.flags |= 131072, n.flags &= -52805, n.tag === 1 && (n.alternate === null ? n.tag = 17 : (e = Ln(-1, 1), e.tag = 2, br(n, e, 1))), n.lanes |= 1), t) : (t.flags |= 65536, t.lanes = i, t)
}
var CO = Pn.ReactCurrentOwner,
Dt = !1;
function Ct(t, e, n, r) {
e.child = t === null ? S1(e, null, n, r) : fo(e, t.child, n, r)
}
function Z1(t, e, n, r, i) {
n = n.render;
var s = e.ref;
return uo(e, i), r = qh(t, e, n, r, s, i), n = Zh(), t !== null && !Dt ? (e.updateQueue = t.updateQueue, e.flags &= -2053, t.lanes &= ~i, Fn(t, e, i)) : (Ne && n && Ah(e), e.flags |= 1, Ct(t, e, r, i), e.child)
}
function Q1(t, e, n, r, i) {
if (t === null) {
var s = n.type;
return typeof s == "function" && !Td(s) && s.defaultProps === void 0 && n.compare === null && n.defaultProps === void 0 ? (e.tag = 15, e.type = s, J1(t, e, s, r, i)) : (t = Zl(n.type, null, r, e, e.mode, i), t.ref = e.ref, t.return = e, e.child = t)
}
if (s = t.child, (t.lanes & i) === 0) {
var d = s.memoizedProps;
if (n = n.compare, n = n !== null ? n : xs, n(d, r) && t.ref === e.ref) return Fn(t, e, i)
}
return e.flags |= 1, t = Tr(s, r), t.ref = e.ref, t.return = e, e.child = t
}
function J1(t, e, n, r, i) {
if (t !== null) {
var s = t.memoizedProps;
if (xs(s, r) && t.ref === e.ref)
if (Dt = !1, e.pendingProps = r = s, (t.lanes & i) !== 0)(t.flags & 131072) !== 0 && (Dt = !0);
else return e.lanes = t.lanes, Fn(t, e, i)
}
return id(t, e, n, r, i)
}
function ey(t, e, n) {
var r = e.pendingProps,
i = r.children,
s = t !== null ? t.memoizedState : null;
if (r.mode === "hidden")
if ((e.mode & 1) === 0) e.memoizedState = {
baseLanes: 0,
cachePool: null,
transitions: null
}, Ie(mo, Ut), Ut |= n;
else {
if ((n & 1073741824) === 0) return t = s !== null ? s.baseLanes | n : n, e.lanes = e.childLanes = 1073741824, e.memoizedState = {
baseLanes: t,
cachePool: null,
transitions: null
}, e.updateQueue = null, Ie(mo, Ut), Ut |= t, null;
e.memoizedState = {
baseLanes: 0,
cachePool: null,
transitions: null
}, r = s !== null ? s.baseLanes : n, Ie(mo, Ut), Ut |= r
}
else s !== null ? (r = s.baseLanes | n, e.memoizedState = null) : r = n, Ie(mo, Ut), Ut |= r;
return Ct(t, e, i, n), e.child
}
function ty(t, e) {
var n = e.ref;
(t === null && n !== null || t !== null && t.ref !== n) && (e.flags |= 512, e.flags |= 2097152)
}
function id(t, e, n, r, i) {
var s = At(n) ? Gr : gt.current;
return s = oo(e, s), uo(e, i), n = qh(t, e, n, r, s, i), r = Zh(), t !== null && !Dt ? (e.updateQueue = t.updateQueue, e.flags &= -2053, t.lanes &= ~i, Fn(t, e, i)) : (Ne && r && Ah(e), e.flags |= 1, Ct(t, e, n, i), e.child)
}
function ny(t, e, n, r, i) {
if (At(n)) {
var s = !0;
_l(e)
} else s = !1;
if (uo(e, i), e.stateNode === null) Bl(t, e), b1(e, n, r), Hh(e, n, r, i), r = !0;
else if (t === null) {
var d = e.stateNode,
a = e.memoizedProps;
d.props = a;
var o = d.context,
c = n.contextType;
typeof c == "object" && c !== null ? c = Kt(c) : (c = At(n) ? Gr : gt.current, c = oo(e, c));
var h = n.getDerivedStateFromProps,
l = typeof h == "function" || typeof d.getSnapshotBeforeUpdate == "function";
l || typeof d.UNSAFE_componentWillReceiveProps != "function" && typeof d.componentWillReceiveProps != "function" || (a !== r || o !== c) && w1(e, d, r, c), yr = !1;
var u = e.memoizedState;
d.state = u, Ml(e, r, d, i), o = e.memoizedState, a !== r || u !== o || Mt.current || yr ? (typeof h == "function" && (Vh(e, n, h, r), o = e.memoizedState), (a = yr || y1(e, n, a, r, u, o, c)) ? (l || typeof d.UNSAFE_componentWillMount != "function" && typeof d.componentWillMount != "function" || (typeof d.componentWillMount == "function" && d.componentWillMount(), typeof d.UNSAFE_componentWillMount == "function" && d.UNSAFE_componentWillMount()), typeof d.componentDidMount == "function" && (e.flags |= 4194308)) : (typeof d.componentDidMount == "function" && (e.flags |= 4194308), e.memoizedProps = r, e.memoizedState = o), d.props = r, d.state = o, d.context = c, r = a) : (typeof d.componentDidMount == "function" && (e.flags |= 4194308), r = !1)
} else {
d = e.stateNode, p1(t, e), a = e.memoizedProps, c = e.type === e.elementType ? a : ln(e.type, a), d.props = c, l = e.pendingProps, u = d.context, o = n.contextType, typeof o == "object" && o !== null ? o = Kt(o) : (o = At(n) ? Gr : gt.current, o = oo(e, o));
var f = n.getDerivedStateFromProps;
(h = typeof f == "function" || typeof d.getSnapshotBeforeUpdate == "function") || typeof d.UNSAFE_componentWillReceiveProps != "function" && typeof d.componentWillReceiveProps != "function" || (a !== l || u !== o) && w1(e, d, r, o), yr = !1, u = e.memoizedState, d.state = u, Ml(e, r, d, i);
var p = e.memoizedState;
a !== l || u !== p || Mt.current || yr ? (typeof f == "function" && (Vh(e, n, f, r), p = e.memoizedState), (c = yr || y1(e, n, c, r, u, p, o) || !1) ? (h || typeof d.UNSAFE_componentWillUpdate != "function" && typeof d.componentWillUpdate != "function" || (typeof d.componentWillUpdate == "function" && d.componentWillUpdate(r, p, o), typeof d.UNSAFE_componentWillUpdate == "function" && d.UNSAFE_componentWillUpdate(r, p, o)), typeof d.componentDidUpdate == "function" && (e.flags |= 4), typeof d.getSnapshotBeforeUpdate == "function" && (e.flags |= 1024)) : (typeof d.componentDidUpdate != "function" || a === t.memoizedProps && u === t.memoizedState || (e.flags |= 4), typeof d.getSnapshotBeforeUpdate != "function" || a === t.memoizedProps && u === t.memoizedState || (e.flags |= 1024), e.memoizedProps = r, e.memoizedState = p), d.props = r, d.state = p, d.context = o, r = c) : (typeof d.componentDidUpdate != "function" || a === t.memoizedProps && u === t.memoizedState || (e.flags |= 4), typeof d.getSnapshotBeforeUpdate != "function" || a === t.memoizedProps && u === t.memoizedState || (e.flags |= 1024), r = !1)
}
return od(t, e, n, r, s, i)
}
function od(t, e, n, r, i, s) {
ty(t, e);
var d = (e.flags & 128) !== 0;
if (!r && !d) return i && s1(e, n, !1), Fn(t, e, s);
r = e.stateNode, CO.current = e;
var a = d && typeof n.getDerivedStateFromError != "function" ? null : r.render();
return e.flags |= 1, t !== null && d ? (e.child = fo(e, t.child, null, s), e.child = fo(e, null, a, s)) : Ct(t, e, a, s), e.memoizedState = r.state, i && s1(e, n, !0), e.child
}
function ry(t) {
var e = t.stateNode;
e.pendingContext ? i1(t, e.pendingContext, e.pendingContext !== e.context) : e.context && i1(t, e.context, !1), Uh(t, e.containerInfo)
}
function iy(t, e, n, r, i) {
return lo(), Lh(i), e.flags |= 256, Ct(t, e, n, r), e.child
}
var sd = {
dehydrated: null,
treeContext: null,
retryLane: 0
};
function ad(t) {
return {
baseLanes: t,
cachePool: null,
transitions: null
}
}
function oy(t, e, n) {
var r = e.pendingProps,
i = Ve.current,
s = !1,
d = (e.flags & 128) !== 0,
a;
if ((a = d) || (a = t !== null && t.memoizedState === null ? !1 : (i & 2) !== 0), a ? (s = !0, e.flags &= -129) : (t === null || t.memoizedState !== null) && (i |= 1), Ie(Ve, i & 1), t === null) return Ih(e), t = e.memoizedState, t !== null && (t = t.dehydrated, t !== null) ? ((e.mode & 1) === 0 ? e.lanes = 1 : t.data === "$!" ? e.lanes = 8 : e.lanes = 1073741824, null) : (d = r.children, t = r.fallback, s ? (r = e.mode, s = e.child, d = {
mode: "hidden",
children: d
}, (r & 1) === 0 && s !== null ? (s.childLanes = 0, s.pendingProps = d) : s = Ql(d, r, 0, null), t = ii(t, r, n, null), s.return = e, t.return = e, s.sibling = t, e.child = s, e.child.memoizedState = ad(n), e.memoizedState = sd, t) : ld(e, d));
if (i = t.memoizedState, i !== null && (a = i.dehydrated, a !== null)) return TO(t, e, d, r, a, i, n);
if (s) {
s = r.fallback, d = e.mode, i = t.child, a = i.sibling;
var o = {
mode: "hidden",
children: r.children
};
return (d & 1) === 0 && e.child !== i ? (r = e.child, r.childLanes = 0, r.pendingProps = o, e.deletions = null) : (r = Tr(i, o), r.subtreeFlags = i.subtreeFlags & 14680064), a !== null ? s = Tr(a, s) : (s = ii(s, d, n, null), s.flags |= 2), s.return = e, r.return = e, r.sibling = s, e.child = r, r = s, s = e.child, d = t.child.memoizedState, d = d === null ? ad(n) : {
baseLanes: d.baseLanes | n,
cachePool: null,
transitions: d.transitions
}, s.memoizedState = d, s.childLanes = t.childLanes & ~n, e.memoizedState = sd, r
}
return s = t.child, t = s.sibling, r = Tr(s, {
mode: "visible",
children: r.children
}), (e.mode & 1) === 0 && (r.lanes = n), r.return = e, r.sibling = null, t !== null && (n = e.deletions, n === null ? (e.deletions = [t], e.flags |= 16) : n.push(t)), e.child = r, e.memoizedState = null, r
}
function ld(t, e) {
return e = Ql({
mode: "visible",
children: e
}, t.mode, 0, null), e.return = t, t.child = e
}
function jl(t, e, n, r) {
return r !== null && Lh(r), fo(e, t.child, null, n), t = ld(e, e.pendingProps.children), t.flags |= 2, e.memoizedState = null, t
}
function TO(t, e, n, r, i, s, d) {
if (n) return e.flags & 256 ? (e.flags &= -257, r = nd(Error(oe(422))), jl(t, e, d, r)) : e.memoizedState !== null ? (e.child = t.child, e.flags |= 128, null) : (s = r.fallback, i = e.mode, r = Ql({
mode: "visible",
children: r.children
}, i, 0, null), s = ii(s, i, d, null), s.flags |= 2, r.return = e, s.return = e, r.sibling = s, e.child = r, (e.mode & 1) !== 0 && fo(e, t.child, null, d), e.child.memoizedState = ad(d), e.memoizedState = sd, s);
if ((e.mode & 1) === 0) return jl(t, e, d, null);
if (i.data === "$!") {
if (r = i.nextSibling && i.nextSibling.dataset, r) var a = r.dgst;
return r = a, s = Error(oe(419)), r = nd(s, r, void 0), jl(t, e, d, r)
}
if (a = (d & t.childLanes) !== 0, Dt || a) {
if (r = lt, r !== null) {
switch (d & -d) {
case 4:
i = 2;
break;
case 16:
i = 8;
break;
case 64:
case 128:
case 256:
case 512:
case 1024:
case 2048:
case 4096:
case 8192:
case 16384:
case 32768:
case 65536:
case 131072:
case 262144:
case 524288:
case 1048576:
case 2097152:
case 4194304:
case 8388608:
case 16777216:
case 33554432:
case 67108864:
i = 32;
break;
case 536870912:
i = 268435456;
break;
default:
i = 0
}
i = (i & (r.suspendedLanes | d)) !== 0 ? 0 : i, i !== 0 && i !== s.retryLane && (s.retryLane = i, In(t, i), fn(r, t, i, -1))
}
return Cd(), r = nd(Error(oe(421))), jl(t, e, d, r)
}
return i.data === "$?" ? (e.flags |= 128, e.child = t.child, e = NO.bind(null, t), i._reactRetry = e, null) : (t = s.treeContext, Ht = pr(i.nextSibling), Vt = e, Ne = !0, an = null, t !== null && (Xt[Gt++] = Dn, Xt[Gt++] = Rn, Xt[Gt++] = Kr, Dn = t.id, Rn = t.overflow, Kr = e), e = ld(e, r.children), e.flags |= 4096, e)
}
function sy(t, e, n) {
t.lanes |= e;
var r = t.alternate;
r !== null && (r.lanes |= e), jh(t.return, e, n)
}
function cd(t, e, n, r, i) {
var s = t.memoizedState;
s === null ? t.memoizedState = {
isBackwards: e,
rendering: null,
renderingStartTime: 0,
last: r,
tail: n,
tailMode: i
} : (s.isBackwards = e, s.rendering = null, s.renderingStartTime = 0, s.last = r, s.tail = n, s.tailMode = i)
}
function ay(t, e, n) {
var r = e.pendingProps,
i = r.revealOrder,
s = r.tail;
if (Ct(t, e, r.children, n), r = Ve.current, (r & 2) !== 0) r = r & 1 | 2, e.flags |= 128;
else {
if (t !== null && (t.flags & 128) !== 0) e: for (t = e.child; t !== null;) {
if (t.tag === 13) t.memoizedState !== null && sy(t, n, e);
else if (t.tag === 19) sy(t, n, e);
else if (t.child !== null) {
t.child.return = t, t = t.child;
continue
}
if (t === e) break e;
for (; t.sibling === null;) {
if (t.return === null || t.return === e) break e;
t = t.return
}
t.sibling.return = t.return, t = t.sibling
}
r &= 1
}
if (Ie(Ve, r), (e.mode & 1) === 0) e.memoizedState = null;
else switch (i) {
case "forwards":
for (n = e.child, i = null; n !== null;) t = n.alternate, t !== null && Rl(t) === null && (i = n), n = n.sibling;
n = i, n === null ? (i = e.child, e.child = null) : (i = n.sibling, n.sibling = null), cd(e, !1, i, n, s);
break;
case "backwards":
for (n = null, i = e.child, e.child = null; i !== null;) {
if (t = i.alternate, t !== null && Rl(t) === null) {
e.child = i;
break
}
t = i.sibling, i.sibling = n, n = i, i = t
}
cd(e, !0, n, null, s);
break;
case "together":
cd(e, !1, null, null, void 0);
break;
default:
e.memoizedState = null
}
return e.child
}
function Bl(t, e) {
(e.mode & 1) === 0 && t !== null && (t.alternate = null, e.alternate = null, e.flags |= 2)
}
function Fn(t, e, n) {
if (t !== null && (e.dependencies = t.dependencies), ei |= e.lanes, (n & e.childLanes) === 0) return null;
if (t !== null && e.child !== t.child) throw Error(oe(153));
if (e.child !== null) {
for (t = e.child, n = Tr(t, t.pendingProps), e.child = n, n.return = e; t.sibling !== null;) t = t.sibling, n = n.sibling = Tr(t, t.pendingProps), n.return = e;
n.sibling = null
}
return e.child
}
function kO(t, e, n) {
switch (e.tag) {
case 3:
ry(e), lo();
break;
case 5:
C1(e);
break;
case 1:
At(e.type) && _l(e);
break;
case 4:
Uh(e, e.stateNode.containerInfo);
break;
case 10:
var r = e.type._context,
i = e.memoizedProps.value;
Ie(El, r._currentValue), r._currentValue = i;
break;
case 13:
if (r = e.memoizedState, r !== null) return r.dehydrated !== null ? (Ie(Ve, Ve.current & 1), e.flags |= 128, null) : (n & e.child.childLanes) !== 0 ? oy(t, e, n) : (Ie(Ve, Ve.current & 1), t = Fn(t, e, n), t !== null ? t.sibling : null);
Ie(Ve, Ve.current & 1);
break;
case 19:
if (r = (n & e.childLanes) !== 0, (t.flags & 128) !== 0) {
if (r) return ay(t, e, n);
e.flags |= 128
}
if (i = e.memoizedState, i !== null && (i.rendering = null, i.tail = null, i.lastEffect = null), Ie(Ve, Ve.current), r) break;
return null;
case 22:
case 23:
return e.lanes = 0, ey(t, e, n)
}
return Fn(t, e, n)
}
var ly, ud, cy, uy;
ly = function(t, e) {
for (var n = e.child; n !== null;) {
if (n.tag === 5 || n.tag === 6) t.appendChild(n.stateNode);
else if (n.tag !== 4 && n.child !== null) {
n.child.return = n, n = n.child;
continue
}
if (n === e) break;
for (; n.sibling === null;) {
if (n.return === null || n.return === e) return;
n = n.return
}
n.sibling.return = n.return, n = n.sibling
}
}, ud = function() {}, cy = function(t, e, n, r) {
var i = t.memoizedProps;
if (i !== r) {
t = e.stateNode, Qr(bn.current);
var s = null;
switch (n) {
case "input":
i = jf(t, i), r = jf(t, r), s = [];
break;
case "select":
i = $e({}, i, {
value: void 0
}), r = $e({}, r, {
value: void 0
}), s = [];
break;
case "textarea":
i = Vf(t, i), r = Vf(t, r), s = [];
break;
default:
typeof i.onClick != "function" && typeof r.onClick == "function" && (t.onclick = bl)
}
Uf(n, r);
var d;
n = null;
for (c in i)
if (!r.hasOwnProperty(c) && i.hasOwnProperty(c) && i[c] != null)
if (c === "style") {
var a = i[c];
for (d in a) a.hasOwnProperty(d) && (n || (n = {}), n[d] = "")
} else c !== "dangerouslySetInnerHTML" && c !== "children" && c !== "suppressContentEditableWarning" && c !== "suppressHydrationWarning" && c !== "autoFocus" && (es.hasOwnProperty(c) ? s || (s = []) : (s = s || []).push(c, null));
for (c in r) {
var o = r[c];
if (a = i != null ? i[c] : void 0, r.hasOwnProperty(c) && o !== a && (o != null || a != null))
if (c === "style")
if (a) {
for (d in a) !a.hasOwnProperty(d) || o && o.hasOwnProperty(d) || (n || (n = {}), n[d] = "");
for (d in o) o.hasOwnProperty(d) && a[d] !== o[d] && (n || (n = {}), n[d] = o[d])
} else n || (s || (s = []), s.push(c, n)), n = o;
else c === "dangerouslySetInnerHTML" ? (o = o ? o.__html : void 0, a = a ? a.__html : void 0, o != null && a !== o && (s = s || []).push(c, o)) : c === "children" ? typeof o != "string" && typeof o != "number" || (s = s || []).push(c, "" + o) : c !== "suppressContentEditableWarning" && c !== "suppressHydrationWarning" && (es.hasOwnProperty(c) ? (o != null && c === "onScroll" && Le("scroll", t), s || a === o || (s = [])) : (s = s || []).push(c, o))
}
n && (s = s || []).push("style", n);
var c = s;
(e.updateQueue = c) && (e.flags |= 4)
}
}, uy = function(t, e, n, r) {
n !== r && (e.flags |= 4)
};
function Fs(t, e) {
if (!Ne) switch (t.tailMode) {
case "hidden":
e = t.tail;
for (var n = null; e !== null;) e.alternate !== null && (n = e), e = e.sibling;
n === null ? t.tail = null : n.sibling = null;
break;
case "collapsed":
n = t.tail;
for (var r = null; n !== null;) n.alternate !== null && (r = n), n = n.sibling;
r === null ? e || t.tail === null ? t.tail = null : t.tail.sibling = null : r.sibling = null
}
}
function vt(t) {
var e = t.alternate !== null && t.alternate.child === t.child,
n = 0,
r = 0;
if (e)
for (var i = t.child; i !== null;) n |= i.lanes | i.childLanes, r |= i.subtreeFlags & 14680064, r |= i.flags & 14680064, i.return = t, i = i.sibling;
else
for (i = t.child; i !== null;) n |= i.lanes | i.childLanes, r |= i.subtreeFlags, r |= i.flags, i.return = t, i = i.sibling;
return t.subtreeFlags |= r, t.childLanes = n, e
}
function EO(t, e, n) {
var r = e.pendingProps;
switch (Dh(e), e.tag) {
case 2:
case 16:
case 15:
case 0:
case 11:
case 7:
case 8:
case 12:
case 9:
case 14:
return vt(e), null;
case 1:
return At(e.type) && xl(), vt(e), null;
case 3:
return r = e.stateNode, ho(), Fe(Mt), Fe(gt), Xh(), r.pendingContext && (r.context = r.pendingContext, r.pendingContext = null), (t === null || t.child === null) && (kl(e) ? e.flags |= 4 : t === null || t.memoizedState.isDehydrated && (e.flags & 256) === 0 || (e.flags |= 1024, an !== null && (xd(an), an = null))), ud(t, e), vt(e), null;
case 5:
Wh(e);
var i = Qr(As.current);
if (n = e.type, t !== null && e.stateNode != null) cy(t, e, n, r, i), t.ref !== e.ref && (e.flags |= 512, e.flags |= 2097152);
else {
if (!r) {
if (e.stateNode === null) throw Error(oe(166));
return vt(e), null
}
if (t = Qr(bn.current), kl(e)) {
r = e.stateNode, n = e.type;
var s = e.memoizedProps;
switch (r[yn] = e, r[ks] = s, t = (e.mode & 1) !== 0, n) {
case "dialog":
Le("cancel", r), Le("close", r);
break;
case "iframe":
case "object":
case "embed":
Le("load", r);
break;
case "video":
case "audio":
for (i = 0; i < Ss.length; i++) Le(Ss[i], r);
break;
case "source":
Le("error", r);
break;
case "img":
case "image":
case "link":
Le("error", r), Le("load", r);
break;
case "details":
Le("toggle", r);
break;
case "input":
Hv(r, s), Le("invalid", r);
break;
case "select":
r._wrapperState = {
wasMultiple: !!s.multiple
}, Le("invalid", r);
break;
case "textarea":
Yv(r, s), Le("invalid", r)
}
Uf(n, s), i = null;
for (var d in s)
if (s.hasOwnProperty(d)) {
var a = s[d];
d === "children" ? typeof a == "string" ? r.textContent !== a && (s.suppressHydrationWarning !== !0 && yl(r.textContent, a, t), i = ["children", a]) : typeof a == "number" && r.textContent !== "" + a && (s.suppressHydrationWarning !== !0 && yl(r.textContent, a, t), i = ["children", "" + a]) : es.hasOwnProperty(d) && a != null && d === "onScroll" && Le("scroll", r)
} switch (n) {
case "input":
Ka(r), Wv(r, s, !0);
break;
case "textarea":
Ka(r), Gv(r);
break;
case "select":
case "option":
break;
default:
typeof s.onClick == "function" && (r.onclick = bl)
}
r = i, e.updateQueue = r, r !== null && (e.flags |= 4)
} else {
d = i.nodeType === 9 ? i : i.ownerDocument, t === "http://www.w3.org/1999/xhtml" && (t = Kv(n)), t === "http://www.w3.org/1999/xhtml" ? n === "script" ? (t = d.createElement("div"), t.innerHTML = "<script><\/script>", t = t.removeChild(t.firstChild)) : typeof r.is == "string" ? t = d.createElement(n, {
is: r.is
}) : (t = d.createElement(n), n === "select" && (d = t, r.multiple ? d.multiple = !0 : r.size && (d.size = r.size))) : t = d.createElementNS(t, n), t[yn] = e, t[ks] = r, ly(t, e, !1, !1), e.stateNode = t;
e: {
switch (d = Wf(n, r), n) {
case "dialog":
Le("cancel", t), Le("close", t), i = r;
break;
case "iframe":
case "object":
case "embed":
Le("load", t), i = r;
break;
case "video":
case "audio":
for (i = 0; i < Ss.length; i++) Le(Ss[i], t);
i = r;
break;
case "source":
Le("error", t), i = r;
break;
case "img":
case "image":
case "link":
Le("error", t), Le("load", t), i = r;
break;
case "details":
Le("toggle", t), i = r;
break;
case "input":
Hv(t, r), i = jf(t, r), Le("invalid", t);
break;
case "option":
i = r;
break;
case "select":
t._wrapperState = {
wasMultiple: !!r.multiple
}, i = $e({}, r, {
value: void 0
}), Le("invalid", t);
break;
case "textarea":
Yv(t, r), i = Vf(t, r), Le("invalid", t);
break;
default:
i = r
}
Uf(n, i),
a = i;
for (s in a)
if (a.hasOwnProperty(s)) {
var o = a[s];
s === "style" ? Qv(t, o) : s === "dangerouslySetInnerHTML" ? (o = o ? o.__html : void 0, o != null && qv(t, o)) : s === "children" ? typeof o == "string" ? (n !== "textarea" || o !== "") && is(t, o) : typeof o == "number" && is(t, "" + o) : s !== "suppressContentEditableWarning" && s !== "suppressHydrationWarning" && s !== "autoFocus" && (es.hasOwnProperty(s) ? o != null && s === "onScroll" && Le("scroll", t) : o != null && Of(t, s, o, d))
} switch (n) {
case "input":
Ka(t), Wv(t, r, !1);
break;
case "textarea":
Ka(t), Gv(t);
break;
case "option":
r.value != null && t.setAttribute("value", "" + ar(r.value));
break;
case "select":
t.multiple = !!r.multiple, s = r.value, s != null ? Xi(t, !!r.multiple, s, !1) : r.defaultValue != null && Xi(t, !!r.multiple, r.defaultValue, !0);
break;
default:
typeof i.onClick == "function" && (t.onclick = bl)
}
switch (n) {
case "button":
case "input":
case "select":
case "textarea":
r = !!r.autoFocus;
break e;
case "img":
r = !0;
break e;
default:
r = !1
}
}
r && (e.flags |= 4)
}
e.ref !== null && (e.flags |= 512, e.flags |= 2097152)
}
return vt(e), null;
case 6:
if (t && e.stateNode != null) uy(t, e, t.memoizedProps, r);
else {
if (typeof r != "string" && e.stateNode === null) throw Error(oe(166));
if (n = Qr(As.current), Qr(bn.current), kl(e)) {
if (r = e.stateNode, n = e.memoizedProps, r[yn] = e, (s = r.nodeValue !== n) && (t = Vt, t !== null)) switch (t.tag) {
case 3:
yl(r.nodeValue, n, (t.mode & 1) !== 0);
break;
case 5:
t.memoizedProps.suppressHydrationWarning !== !0 && yl(r.nodeValue, n, (t.mode & 1) !== 0)
}
s && (e.flags |= 4)
} else r = (n.nodeType === 9 ? n : n.ownerDocument).createTextNode(r), r[yn] = e, e.stateNode = r
}
return vt(e), null;
case 13:
if (Fe(Ve), r = e.memoizedState, t === null || t.memoizedState !== null && t.memoizedState.dehydrated !== null) {
if (Ne && Ht !== null && (e.mode & 1) !== 0 && (e.flags & 128) === 0) h1(), lo(), e.flags |= 98560, s = !1;
else if (s = kl(e), r !== null && r.dehydrated !== null) {
if (t === null) {
if (!s) throw Error(oe(318));
if (s = e.memoizedState, s = s !== null ? s.dehydrated : null, !s) throw Error(oe(317));
s[yn] = e
} else lo(), (e.flags & 128) === 0 && (e.memoizedState = null), e.flags |= 4;
vt(e), s = !1
} else an !== null && (xd(an), an = null), s = !0;
if (!s) return e.flags & 65536 ? e : null
}
return (e.flags & 128) !== 0 ? (e.lanes = n, e) : (r = r !== null, r !== (t !== null && t.memoizedState !== null) && r && (e.child.flags |= 8192, (e.mode & 1) !== 0 && (t === null || (Ve.current & 1) !== 0 ? nt === 0 && (nt = 3) : Cd())), e.updateQueue !== null && (e.flags |= 4), vt(e), null);
case 4:
return ho(), ud(t, e), t === null && Cs(e.stateNode.containerInfo), vt(e), null;
case 10:
return Nh(e.type._context), vt(e), null;
case 17:
return At(e.type) && xl(), vt(e), null;
case 19:
if (Fe(Ve), s = e.memoizedState, s === null) return vt(e), null;
if (r = (e.flags & 128) !== 0, d = s.rendering, d === null)
if (r) Fs(s, !1);
else {
if (nt !== 0 || t !== null && (t.flags & 128) !== 0)
for (t = e.child; t !== null;) {
if (d = Rl(t), d !== null) {
for (e.flags |= 128, Fs(s, !1), r = d.updateQueue, r !== null && (e.updateQueue = r, e.flags |= 4), e.subtreeFlags = 0, r = n, n = e.child; n !== null;) s = n, t = r, s.flags &= 14680066, d = s.alternate, d === null ? (s.childLanes = 0, s.lanes = t, s.child = null, s.subtreeFlags = 0, s.memoizedProps = null, s.memoizedState = null, s.updateQueue = null, s.dependencies = null, s.stateNode = null) : (s.childLanes = d.childLanes, s.lanes = d.lanes, s.child = d.child, s.subtreeFlags = 0, s.deletions = null, s.memoizedProps = d.memoizedProps, s.memoizedState = d.memoizedState, s.updateQueue = d.updateQueue, s.type = d.type, t = d.dependencies, s.dependencies = t === null ? null : {
lanes: t.lanes,
firstContext: t.firstContext
}), n = n.sibling;
return Ie(Ve, Ve.current & 1 | 2), e.child
}
t = t.sibling
}
s.tail !== null && Ke() > vo && (e.flags |= 128, r = !0, Fs(s, !1), e.lanes = 4194304)
}
else {
if (!r)
if (t = Rl(d), t !== null) {
if (e.flags |= 128, r = !0, n = t.updateQueue, n !== null && (e.updateQueue = n, e.flags |= 4), Fs(s, !0), s.tail === null && s.tailMode === "hidden" && !d.alternate && !Ne) return vt(e), null
} else 2 * Ke() - s.renderingStartTime > vo && n !== 1073741824 && (e.flags |= 128, r = !0, Fs(s, !1), e.lanes = 4194304);
s.isBackwards ? (d.sibling = e.child, e.child = d) : (n = s.last, n !== null ? n.sibling = d : e.child = d, s.last = d)
}
return s.tail !== null ? (e = s.tail, s.rendering = e, s.tail = e.sibling, s.renderingStartTime = Ke(), e.sibling = null, n = Ve.current, Ie(Ve, r ? n & 1 | 2 : n & 1), e) : (vt(e), null);
case 22:
case 23:
return Sd(), r = e.memoizedState !== null, t !== null && t.memoizedState !== null !== r && (e.flags |= 8192), r && (e.mode & 1) !== 0 ? (Ut & 1073741824) !== 0 && (vt(e), e.subtreeFlags & 6 && (e.flags |= 8192)) : vt(e), null;
case 24:
return null;
case 25:
return null
}
throw Error(oe(156, e.tag))
}
function OO(t, e) {
switch (Dh(e), e.tag) {
case 1:
return At(e.type) && xl(), t = e.flags, t & 65536 ? (e.flags = t & -65537 | 128, e) : null;
case 3:
return ho(), Fe(Mt), Fe(gt), Xh(), t = e.flags, (t & 65536) !== 0 && (t & 128) === 0 ? (e.flags = t & -65537 | 128, e) : null;
case 5:
return Wh(e), null;
case 13:
if (Fe(Ve), t = e.memoizedState, t !== null && t.dehydrated !== null) {
if (e.alternate === null) throw Error(oe(340));
lo()
}
return t = e.flags, t & 65536 ? (e.flags = t & -65537 | 128, e) : null;
case 19:
return Fe(Ve), null;
case 4:
return ho(), null;
case 10:
return Nh(e.type._context), null;
case 22:
case 23:
return Sd(), null;
case 24:
return null;
default:
return null
}
}
var $l = !1,
yt = !1,
PO = typeof WeakSet == "function" ? WeakSet : Set,
pe = null;
function go(t, e) {
var n = t.ref;
if (n !== null)
if (typeof n == "function") try {
n(null)
} catch (r) {
Ye(t, e, r)
} else n.current = null
}
function fd(t, e, n) {
try {
n()
} catch (r) {
Ye(t, e, r)
}
}
var fy = !1;
function MO(t, e) {
if (Sh = al, t = V0(), gh(t)) {
if ("selectionStart" in t) var n = {
start: t.selectionStart,
end: t.selectionEnd
};
else e: {
n = (n = t.ownerDocument) && n.defaultView || window;
var r = n.getSelection && n.getSelection();
if (r && r.rangeCount !== 0) {
n = r.anchorNode;
var i = r.anchorOffset,
s = r.focusNode;
r = r.focusOffset;
try {
n.nodeType, s.nodeType
} catch {
n = null;
break e
}
var d = 0,
a = -1,
o = -1,
c = 0,
h = 0,
l = t,
u = null;
t: for (;;) {
for (var f; l !== n || i !== 0 && l.nodeType !== 3 || (a = d + i), l !== s || r !== 0 && l.nodeType !== 3 || (o = d + r), l.nodeType === 3 && (d += l.nodeValue.length), (f = l.firstChild) !== null;) u = l, l = f;
for (;;) {
if (l === t) break t;
if (u === n && ++c === i && (a = d), u === s && ++h === r && (o = d), (f = l.nextSibling) !== null) break;
l = u, u = l.parentNode
}
l = f
}
n = a === -1 || o === -1 ? null : {
start: a,
end: o
}
} else n = null
}
n = n || {
start: 0,
end: 0
}
} else n = null;
for (Ch = {
focusedElem: t,
selectionRange: n
}, al = !1, pe = e; pe !== null;)
if (e = pe, t = e.child, (e.subtreeFlags & 1028) !== 0 && t !== null) t.return = e, pe = t;
else
for (; pe !== null;) {
e = pe;
try {
var p = e.alternate;
if ((e.flags & 1024) !== 0) switch (e.tag) {
case 0:
case 11:
case 15:
break;
case 1:
if (p !== null) {
var m = p.memoizedProps,
g = p.memoizedState,
v = e.stateNode,
y = v.getSnapshotBeforeUpdate(e.elementType === e.type ? m : ln(e.type, m), g);
v.__reactInternalSnapshotBeforeUpdate = y
}
break;
case 3:
var b = e.stateNode.containerInfo;
b.nodeType === 1 ? b.textContent = "" : b.nodeType === 9 && b.documentElement && b.removeChild(b.documentElement);
break;
case 5:
case 6:
case 4:
case 17:
break;
default:
throw Error(oe(163))
}
} catch (w) {
Ye(e, e.return, w)
}
if (t = e.sibling, t !== null) {
t.return = e.return, pe = t;
break
}
pe = e.return
}
return p = fy, fy = !1, p
}
function zs(t, e, n) {
var r = e.updateQueue;
if (r = r !== null ? r.lastEffect : null, r !== null) {
var i = r = r.next;
do {
if ((i.tag & t) === t) {
var s = i.destroy;
i.destroy = void 0, s !== void 0 && fd(e, n, s)
}
i = i.next
} while (i !== r)
}
}
function Vl(t, e) {
if (e = e.updateQueue, e = e !== null ? e.lastEffect : null, e !== null) {
var n = e = e.next;
do {
if ((n.tag & t) === t) {
var r = n.create;
n.destroy = r()
}
n = n.next
} while (n !== e)
}
}
function hd(t) {
var e = t.ref;
if (e !== null) {
var n = t.stateNode;
switch (t.tag) {
case 5:
t = n;
break;
default:
t = n
}
typeof e == "function" ? e(t) : e.current = t
}
}
function hy(t) {
var e = t.alternate;
e !== null && (t.alternate = null, hy(e)), t.child = null, t.deletions = null, t.sibling = null, t.tag === 5 && (e = t.stateNode, e !== null && (delete e[yn], delete e[ks], delete e[Oh], delete e[hO], delete e[dO])), t.stateNode = null, t.return = null, t.dependencies = null, t.memoizedProps = null, t.memoizedState = null, t.pendingProps = null, t.stateNode = null, t.updateQueue = null
}
function dy(t) {
return t.tag === 5 || t.tag === 3 || t.tag === 4
}
function py(t) {
e: for (;;) {
for (; t.sibling === null;) {
if (t.return === null || dy(t.return)) return null;
t = t.return
}
for (t.sibling.return = t.return, t = t.sibling; t.tag !== 5 && t.tag !== 6 && t.tag !== 18;) {
if (t.flags & 2 || t.child === null || t.tag === 4) continue e;
t.child.return = t, t = t.child
}
if (!(t.flags & 2)) return t.stateNode
}
}
function dd(t, e, n) {
var r = t.tag;
if (r === 5 || r === 6) t = t.stateNode, e ? n.nodeType === 8 ? n.parentNode.insertBefore(t, e) : n.insertBefore(t, e) : (n.nodeType === 8 ? (e = n.parentNode, e.insertBefore(t, n)) : (e = n, e.appendChild(t)), n = n._reactRootContainer, n != null || e.onclick !== null || (e.onclick = bl));
else if (r !== 4 && (t = t.child, t !== null))
for (dd(t, e, n), t = t.sibling; t !== null;) dd(t, e, n), t = t.sibling
}
function pd(t, e, n) {
var r = t.tag;
if (r === 5 || r === 6) t = t.stateNode, e ? n.insertBefore(t, e) : n.appendChild(t);
else if (r !== 4 && (t = t.child, t !== null))
for (pd(t, e, n), t = t.sibling; t !== null;) pd(t, e, n), t = t.sibling
}
var ut = null,
cn = !1;
function wr(t, e, n) {
for (n = n.child; n !== null;) gy(t, e, n), n = n.sibling
}
function gy(t, e, n) {
if (vn && typeof vn.onCommitFiberUnmount == "function") try {
vn.onCommitFiberUnmount(tl, n)
} catch {}
switch (n.tag) {
case 5:
yt || go(n, e);
case 6:
var r = ut,
i = cn;
ut = null, wr(t, e, n), ut = r, cn = i, ut !== null && (cn ? (t = ut, n = n.stateNode, t.nodeType === 8 ? t.parentNode.removeChild(n) : t.removeChild(n)) : ut.removeChild(n.stateNode));
break;
case 18:
ut !== null && (cn ? (t = ut, n = n.stateNode, t.nodeType === 8 ? Eh(t.parentNode, n) : t.nodeType === 1 && Eh(t, n), gs(t)) : Eh(ut, n.stateNode));
break;
case 4:
r = ut, i = cn, ut = n.stateNode.containerInfo, cn = !0, wr(t, e, n), ut = r, cn = i;
break;
case 0:
case 11:
case 14:
case 15:
if (!yt && (r = n.updateQueue, r !== null && (r = r.lastEffect, r !== null))) {
i = r = r.next;
do {
var s = i,
d = s.destroy;
s = s.tag, d !== void 0 && ((s & 2) !== 0 || (s & 4) !== 0) && fd(n, e, d), i = i.next
} while (i !== r)
}
wr(t, e, n);
break;
case 1:
if (!yt && (go(n, e), r = n.stateNode, typeof r.componentWillUnmount == "function")) try {
r.props = n.memoizedProps, r.state = n.memoizedState, r.componentWillUnmount()
} catch (a) {
Ye(n, e, a)
}
wr(t, e, n);
break;
case 21:
wr(t, e, n);
break;
case 22:
n.mode & 1 ? (yt = (r = yt) || n.memoizedState !== null, wr(t, e, n), yt = r) : wr(t, e, n);
break;
default:
wr(t, e, n)
}
}
function my(t) {
var e = t.updateQueue;
if (e !== null) {
t.updateQueue = null;
var n = t.stateNode;
n === null && (n = t.stateNode = new PO), e.forEach(function(r) {
var i = jO.bind(null, t, r);
n.has(r) || (n.add(r), r.then(i, i))
})
}
}
function un(t, e) {
var n = e.deletions;
if (n !== null)
for (var r = 0; r < n.length; r++) {
var i = n[r];
try {
var s = t,
d = e,
a = d;
e: for (; a !== null;) {
switch (a.tag) {
case 5:
ut = a.stateNode, cn = !1;
break e;
case 3:
ut = a.stateNode.containerInfo, cn = !0;
break e;
case 4:
ut = a.stateNode.containerInfo, cn = !0;
break e
}
a = a.return
}
if (ut === null) throw Error(oe(160));
gy(s, d, i), ut = null, cn = !1;
var o = i.alternate;
o !== null && (o.return = null), i.return = null
} catch (c) {
Ye(i, e, c)
}
}
if (e.subtreeFlags & 12854)
for (e = e.child; e !== null;) vy(e, t), e = e.sibling
}
function vy(t, e) {
var n = t.alternate,
r = t.flags;
switch (t.tag) {
case 0:
case 11:
case 14:
case 15:
if (un(e, t), xn(t), r & 4) {
try {
zs(3, t, t.return), Vl(3, t)
} catch (m) {
Ye(t, t.return, m)
}
try {
zs(5, t, t.return)
} catch (m) {
Ye(t, t.return, m)
}
}
break;
case 1:
un(e, t), xn(t), r & 512 && n !== null && go(n, n.return);
break;
case 5:
if (un(e, t), xn(t), r & 512 && n !== null && go(n, n.return), t.flags & 32) {
var i = t.stateNode;
try {
is(i, "")
} catch (m) {
Ye(t, t.return, m)
}
}
if (r & 4 && (i = t.stateNode, i != null)) {
var s = t.memoizedProps,
d = n !== null ? n.memoizedProps : s,
a = t.type,
o = t.updateQueue;
if (t.updateQueue = null, o !== null) try {
a === "input" && s.type === "radio" && s.name != null && Uv(i, s), Wf(a, d);
var c = Wf(a, s);
for (d = 0; d < o.length; d += 2) {
var h = o[d],
l = o[d + 1];
h === "style" ? Qv(i, l) : h === "dangerouslySetInnerHTML" ? qv(i, l) : h === "children" ? is(i, l) : Of(i, h, l, c)
}
switch (a) {
case "input":
Bf(i, s);
break;
case "textarea":
Xv(i, s);
break;
case "select":
var u = i._wrapperState.wasMultiple;
i._wrapperState.wasMultiple = !!s.multiple;
var f = s.value;
f != null ? Xi(i, !!s.multiple, f, !1) : u !== !!s.multiple && (s.defaultValue != null ? Xi(i, !!s.multiple, s.defaultValue, !0) : Xi(i, !!s.multiple, s.multiple ? [] : "", !1))
}
i[ks] = s
} catch (m) {
Ye(t, t.return, m)
}
}
break;
case 6:
if (un(e, t), xn(t), r & 4) {
if (t.stateNode === null) throw Error(oe(162));
i = t.stateNode, s = t.memoizedProps;
try {
i.nodeValue = s
} catch (m) {
Ye(t, t.return, m)
}
}
break;
case 3:
if (un(e, t), xn(t), r & 4 && n !== null && n.memoizedState.isDehydrated) try {
gs(e.containerInfo)
} catch (m) {
Ye(t, t.return, m)
}
break;
case 4:
un(e, t), xn(t);
break;
case 13:
un(e, t), xn(t), i = t.child, i.flags & 8192 && (s = i.memoizedState !== null, i.stateNode.isHidden = s, !s || i.alternate !== null && i.alternate.memoizedState !== null || (vd = Ke())), r & 4 && my(t);
break;
case 22:
if (h = n !== null && n.memoizedState !== null, t.mode & 1 ? (yt = (c = yt) || h, un(e, t), yt = c) : un(e, t), xn(t), r & 8192) {
if (c = t.memoizedState !== null, (t.stateNode.isHidden = c) && !h && (t.mode & 1) !== 0)
for (pe = t, h = t.child; h !== null;) {
for (l = pe = h; pe !== null;) {
switch (u = pe, f = u.child, u.tag) {
case 0:
case 11:
case 14:
case 15:
zs(4, u, u.return);
break;
case 1:
go(u, u.return);
var p = u.stateNode;
if (typeof p.componentWillUnmount == "function") {
r = u, n = u.return;
try {
e = r, p.props = e.memoizedProps, p.state = e.memoizedState, p.componentWillUnmount()
} catch (m) {
Ye(r, n, m)
}
}
break;
case 5:
go(u, u.return);
break;
case 22:
if (u.memoizedState !== null) {
wy(l);
continue
}
}
f !== null ? (f.return = u, pe = f) : wy(l)
}
h = h.sibling
}
e: for (h = null, l = t;;) {
if (l.tag === 5) {
if (h === null) {
h = l;
try {
i = l.stateNode, c ? (s = i.style, typeof s.setProperty == "function" ? s.setProperty("display", "none", "important") : s.display = "none") : (a = l.stateNode, o = l.memoizedProps.style, d = o != null && o.hasOwnProperty("display") ? o.display : null, a.style.display = Zv("display", d))
} catch (m) {
Ye(t, t.return, m)
}
}
} else if (l.tag === 6) {
if (h === null) try {
l.stateNode.nodeValue = c ? "" : l.memoizedProps
} catch (m) {
Ye(t, t.return, m)
}
} else if ((l.tag !== 22 && l.tag !== 23 || l.memoizedState === null || l === t) && l.child !== null) {
l.child.return = l, l = l.child;
continue
}
if (l === t) break e;
for (; l.sibling === null;) {
if (l.return === null || l.return === t) break e;
h === l && (h = null), l = l.return
}
h === l && (h = null), l.sibling.return = l.return, l = l.sibling
}
}
break;
case 19:
un(e, t), xn(t), r & 4 && my(t);
break;
case 21:
break;
default:
un(e, t), xn(t)
}
}
function xn(t) {
var e = t.flags;
if (e & 2) {
try {
e: {
for (var n = t.return; n !== null;) {
if (dy(n)) {
var r = n;
break e
}
n = n.return
}
throw Error(oe(160))
}
switch (r.tag) {
case 5:
var i = r.stateNode;
r.flags & 32 && (is(i, ""), r.flags &= -33);
var s = py(t);
pd(t, s, i);
break;
case 3:
case 4:
var d = r.stateNode.containerInfo,
a = py(t);
dd(t, a, d);
break;
default:
throw Error(oe(161))
}
}
catch (o) {
Ye(t, t.return, o)
}
t.flags &= -3
}
e & 4096 && (t.flags &= -4097)
}
function AO(t, e, n) {
pe = t, yy(t)
}
function yy(t, e, n) {
for (var r = (t.mode & 1) !== 0; pe !== null;) {
var i = pe,
s = i.child;
if (i.tag === 22 && r) {
var d = i.memoizedState !== null || $l;
if (!d) {
var a = i.alternate,
o = a !== null && a.memoizedState !== null || yt;
a = $l;
var c = yt;
if ($l = d, (yt = o) && !c)
for (pe = i; pe !== null;) d = pe, o = d.child, d.tag === 22 && d.memoizedState !== null ? xy(i) : o !== null ? (o.return = d, pe = o) : xy(i);
for (; s !== null;) pe = s, yy(s), s = s.sibling;
pe = i, $l = a, yt = c
}
by(t)
} else(i.subtreeFlags & 8772) !== 0 && s !== null ? (s.return = i, pe = s) : by(t)
}
}
function by(t) {
for (; pe !== null;) {
var e = pe;
if ((e.flags & 8772) !== 0) {
var n = e.alternate;
try {
if ((e.flags & 8772) !== 0) switch (e.tag) {
case 0:
case 11:
case 15:
yt || Vl(5, e);
break;
case 1:
var r = e.stateNode;
if (e.flags & 4 && !yt)
if (n === null) r.componentDidMount();
else {
var i = e.elementType === e.type ? n.memoizedProps : ln(e.type, n.memoizedProps);
r.componentDidUpdate(i, n.memoizedState, r.__reactInternalSnapshotBeforeUpdate)
} var s = e.updateQueue;
s !== null && m1(e, s, r);
break;
case 3:
var d = e.updateQueue;
if (d !== null) {
if (n = null, e.child !== null) switch (e.child.tag) {
case 5:
n = e.child.stateNode;
break;
case 1:
n = e.child.stateNode
}
m1(e, d, n)
}
break;
case 5:
var a = e.stateNode;
if (n === null && e.flags & 4) {
n = a;
var o = e.memoizedProps;
switch (e.type) {
case "button":
case "input":
case "select":
case "textarea":
o.autoFocus && n.focus();
break;
case "img":
o.src && (n.src = o.src)
}
}
break;
case 6:
break;
case 4:
break;
case 12:
break;
case 13:
if (e.memoizedState === null) {
var c = e.alternate;
if (c !== null) {
var h = c.memoizedState;
if (h !== null) {
var l = h.dehydrated;
l !== null && gs(l)
}
}
}
break;
case 19:
case 17:
case 21:
case 22:
case 23:
case 25:
break;
default:
throw Error(oe(163))
}
yt || e.flags & 512 && hd(e)
} catch (u) {
Ye(e, e.return, u)
}
}
if (e === t) {
pe = null;
break
}
if (n = e.sibling, n !== null) {
n.return = e.return, pe = n;
break
}
pe = e.return
}
}
function wy(t) {
for (; pe !== null;) {
var e = pe;
if (e === t) {
pe = null;
break
}
var n = e.sibling;
if (n !== null) {
n.return = e.return, pe = n;
break
}
pe = e.return
}
}
function xy(t) {
for (; pe !== null;) {
var e = pe;
try {
switch (e.tag) {
case 0:
case 11:
case 15:
var n = e.return;
try {
Vl(4, e)
} catch (o) {
Ye(e, n, o)
}
break;
case 1:
var r = e.stateNode;
if (typeof r.componentDidMount == "function") {
var i = e.return;
try {
r.componentDidMount()
} catch (o) {
Ye(e, i, o)
}
}
var s = e.return;
try {
hd(e)
} catch (o) {
Ye(e, s, o)
}
break;
case 5:
var d = e.return;
try {
hd(e)
} catch (o) {
Ye(e, d, o)
}
}
} catch (o) {
Ye(e, e.return, o)
}
if (e === t) {
pe = null;
break
}
var a = e.sibling;
if (a !== null) {
a.return = e.return, pe = a;
break
}
pe = e.return
}
}
var DO = Math.ceil,
Hl = Pn.ReactCurrentDispatcher,
gd = Pn.ReactCurrentOwner,
Zt = Pn.ReactCurrentBatchConfig,
Oe = 0,
lt = null,
Ze = null,
ft = 0,
Ut = 0,
mo = gr(0),
nt = 0,
Ns = null,
ei = 0,
Ul = 0,
md = 0,
js = null,
Rt = null,
vd = 0,
vo = 1 / 0,
zn = null,
Wl = !1,
yd = null,
xr = null,
Yl = !1,
_r = null,
Xl = 0,
Bs = 0,
bd = null,
Gl = -1,
Kl = 0;
function Tt() {
return (Oe & 6) !== 0 ? Ke() : Gl !== -1 ? Gl : Gl = Ke()
}
function Sr(t) {
return (t.mode & 1) === 0 ? 1 : (Oe & 2) !== 0 && ft !== 0 ? ft & -ft : gO.transition !== null ? (Kl === 0 && (Kl = d0()), Kl) : (t = Ae, t !== 0 || (t = window.event, t = t === void 0 ? 16 : _0(t.type)), t)
}
function fn(t, e, n, r) {
if (50 < Bs) throw Bs = 0, bd = null, Error(oe(185));
us(t, n, r), ((Oe & 2) === 0 || t !== lt) && (t === lt && ((Oe & 2) === 0 && (Ul |= n), nt === 4 && Cr(t, ft)), It(t, r), n === 1 && Oe === 0 && (e.mode & 1) === 0 && (vo = Ke() + 500, Sl && vr()))
}
function It(t, e) {
var n = t.callbackNode;
gE(t, e);
var r = il(t, t === lt ? ft : 0);
if (r === 0) n !== null && u0(n), t.callbackNode = null, t.callbackPriority = 0;
else if (e = r & -r, t.callbackPriority !== e) {
if (n != null && u0(n), e === 1) t.tag === 0 ? pO(Sy.bind(null, t)) : a1(Sy.bind(null, t)), uO(function() {
(Oe & 6) === 0 && vr()
}), n = null;
else {
switch (p0(r)) {
case 1:
n = Qf;
break;
case 4:
n = f0;
break;
case 16:
n = el;
break;
case 536870912:
n = h0;
break;
default:
n = el
}
n = Ay(n, _y.bind(null, t))
}
t.callbackPriority = e, t.callbackNode = n
}
}
function _y(t, e) {
if (Gl = -1, Kl = 0, (Oe & 6) !== 0) throw Error(oe(327));
var n = t.callbackNode;
if (yo() && t.callbackNode !== n) return null;
var r = il(t, t === lt ? ft : 0);
if (r === 0) return null;
if ((r & 30) !== 0 || (r & t.expiredLanes) !== 0 || e) e = ql(t, r);
else {
e = r;
var i = Oe;
Oe |= 2;
var s = Ty();
(lt !== t || ft !== e) && (zn = null, vo = Ke() + 500, ni(t, e));
do try {
LO();
break
} catch (a) {
Cy(t, a)
}
while (1);
zh(), Hl.current = s, Oe = i, Ze !== null ? e = 0 : (lt = null, ft = 0, e = nt)
}
if (e !== 0) {
if (e === 2 && (i = Jf(t), i !== 0 && (r = i, e = wd(t, i))), e === 1) throw n = Ns, ni(t, 0), Cr(t, r), It(t, Ke()), n;
if (e === 6) Cr(t, r);
else {
if (i = t.current.alternate, (r & 30) === 0 && !RO(i) && (e = ql(t, r), e === 2 && (s = Jf(t), s !== 0 && (r = s, e = wd(t, s))), e === 1)) throw n = Ns, ni(t, 0), Cr(t, r), It(t, Ke()), n;
switch (t.finishedWork = i, t.finishedLanes = r, e) {
case 0:
case 1:
throw Error(oe(345));
case 2:
ri(t, Rt, zn);
break;
case 3:
if (Cr(t, r), (r & 130023424) === r && (e = vd + 500 - Ke(), 10 < e)) {
if (il(t, 0) !== 0) break;
if (i = t.suspendedLanes, (i & r) !== r) {
Tt(), t.pingedLanes |= t.suspendedLanes & i;
break
}
t.timeoutHandle = kh(ri.bind(null, t, Rt, zn), e);
break
}
ri(t, Rt, zn);
break;
case 4:
if (Cr(t, r), (r & 4194240) === r) break;
for (e = t.eventTimes, i = -1; 0 < r;) {
var d = 31 - on(r);
s = 1 << d, d = e[d], d > i && (i = d), r &= ~s
}
if (r = i, r = Ke() - r, r = (120 > r ? 120 : 480 > r ? 480 : 1080 > r ? 1080 : 1920 > r ? 1920 : 3e3 > r ? 3e3 : 4320 > r ? 4320 : 1960 * DO(r / 1960)) - r, 10 < r) {
t.timeoutHandle = kh(ri.bind(null, t, Rt, zn), r);
break
}
ri(t, Rt, zn);
break;
case 5:
ri(t, Rt, zn);
break;
default:
throw Error(oe(329))
}
}
}
return It(t, Ke()), t.callbackNode === n ? _y.bind(null, t) : null
}
function wd(t, e) {
var n = js;
return t.current.memoizedState.isDehydrated && (ni(t, e).flags |= 256), t = ql(t, e), t !== 2 && (e = Rt, Rt = n, e !== null && xd(e)), t
}
function xd(t) {
Rt === null ? Rt = t : Rt.push.apply(Rt, t)
}
function RO(t) {
for (var e = t;;) {
if (e.flags & 16384) {
var n = e.updateQueue;
if (n !== null && (n = n.stores, n !== null))
for (var r = 0; r < n.length; r++) {
var i = n[r],
s = i.getSnapshot;
i = i.value;
try {
if (!sn(s(), i)) return !1
} catch {
return !1
}
}
}
if (n = e.child, e.subtreeFlags & 16384 && n !== null) n.return = e, e = n;
else {
if (e === t) break;
for (; e.sibling === null;) {
if (e.return === null || e.return === t) return !0;
e = e.return
}
e.sibling.return = e.return, e = e.sibling
}
}
return !0
}
function Cr(t, e) {
for (e &= ~md, e &= ~Ul, t.suspendedLanes |= e, t.pingedLanes &= ~e, t = t.expirationTimes; 0 < e;) {
var n = 31 - on(e),
r = 1 << n;
t[n] = -1, e &= ~r
}
}
function Sy(t) {
if ((Oe & 6) !== 0) throw Error(oe(327));
yo();
var e = il(t, 0);
if ((e & 1) === 0) return It(t, Ke()), null;
var n = ql(t, e);
if (t.tag !== 0 && n === 2) {
var r = Jf(t);
r !== 0 && (e = r, n = wd(t, r))
}
if (n === 1) throw n = Ns, ni(t, 0), Cr(t, e), It(t, Ke()), n;
if (n === 6) throw Error(oe(345));
return t.finishedWork = t.current.alternate, t.finishedLanes = e, ri(t, Rt, zn), It(t, Ke()), null
}
function _d(t, e) {
var n = Oe;
Oe |= 1;
try {
return t(e)
} finally {
Oe = n, Oe === 0 && (vo = Ke() + 500, Sl && vr())
}
}
function ti(t) {
_r !== null && _r.tag === 0 && (Oe & 6) === 0 && yo();
var e = Oe;
Oe |= 1;
var n = Zt.transition,
r = Ae;
try {
if (Zt.transition = null, Ae = 1, t) return t()
} finally {
Ae = r, Zt.transition = n, Oe = e, (Oe & 6) === 0 && vr()
}
}
function Sd() {
Ut = mo.current, Fe(mo)
}
function ni(t, e) {
t.finishedWork = null, t.finishedLanes = 0;
var n = t.timeoutHandle;
if (n !== -1 && (t.timeoutHandle = -1, cO(n)), Ze !== null)
for (n = Ze.return; n !== null;) {
var r = n;
switch (Dh(r), r.tag) {
case 1:
r = r.type.childContextTypes, r != null && xl();
break;
case 3:
ho(), Fe(Mt), Fe(gt), Xh();
break;
case 5:
Wh(r);
break;
case 4:
ho();
break;
case 13:
Fe(Ve);
break;
case 19:
Fe(Ve);
break;
case 10:
Nh(r.type._context);
break;
case 22:
case 23:
Sd()
}
n = n.return
}
if (lt = t, Ze = t = Tr(t.current, null), ft = Ut = e, nt = 0, Ns = null, md = Ul = ei = 0, Rt = js = null, Zr !== null) {
for (e = 0; e < Zr.length; e++)
if (n = Zr[e], r = n.interleaved, r !== null) {
n.interleaved = null;
var i = r.next,
s = n.pending;
if (s !== null) {
var d = s.next;
s.next = i, r.next = d
}
n.pending = r
} Zr = null
}
return t
}
function Cy(t, e) {
do {
var n = Ze;
try {
if (zh(), Il.current = Nl, Ll) {
for (var r = He.memoizedState; r !== null;) {
var i = r.queue;
i !== null && (i.pending = null), r = r.next
}
Ll = !1
}
if (Jr = 0, at = tt = He = null, Ds = !1, Rs = 0, gd.current = null, n === null || n.return === null) {
nt = 1, Ns = e, Ze = null;
break
}
e: {
var s = t,
d = n.return,
a = n,
o = e;
if (e = ft, a.flags |= 32768, o !== null && typeof o == "object" && typeof o.then == "function") {
var c = o,
h = a,
l = h.tag;
if ((h.mode & 1) === 0 && (l === 0 || l === 11 || l === 15)) {
var u = h.alternate;
u ? (h.updateQueue = u.updateQueue, h.memoizedState = u.memoizedState, h.lanes = u.lanes) : (h.updateQueue = null, h.memoizedState = null)
}
var f = K1(d);
if (f !== null) {
f.flags &= -257, q1(f, d, a, s, e), f.mode & 1 && G1(s, c, e), e = f, o = c;
var p = e.updateQueue;
if (p === null) {
var m = new Set;
m.add(o), e.updateQueue = m
} else p.add(o);
break e
} else {
if ((e & 1) === 0) {
G1(s, c, e), Cd();
break e
}
o = Error(oe(426))
}
} else if (Ne && a.mode & 1) {
var g = K1(d);
if (g !== null) {
(g.flags & 65536) === 0 && (g.flags |= 256), q1(g, d, a, s, e), Lh(po(o, a));
break e
}
}
s = o = po(o, a),
nt !== 4 && (nt = 2),
js === null ? js = [s] : js.push(s),
s = d;do {
switch (s.tag) {
case 3:
s.flags |= 65536, e &= -e, s.lanes |= e;
var v = Y1(s, o, e);
g1(s, v);
break e;
case 1:
a = o;
var y = s.type,
b = s.stateNode;
if ((s.flags & 128) === 0 && (typeof y.getDerivedStateFromError == "function" || b !== null && typeof b.componentDidCatch == "function" && (xr === null || !xr.has(b)))) {
s.flags |= 65536, e &= -e, s.lanes |= e;
var w = X1(s, a, e);
g1(s, w);
break e
}
}
s = s.return
} while (s !== null)
}
Ey(n)
} catch (x) {
e = x, Ze === n && n !== null && (Ze = n = n.return);
continue
}
break
} while (1)
}
function Ty() {
var t = Hl.current;
return Hl.current = Nl, t === null ? Nl : t
}
function Cd() {
(nt === 0 || nt === 3 || nt === 2) && (nt = 4), lt === null || (ei & 268435455) === 0 && (Ul & 268435455) === 0 || Cr(lt, ft)
}
function ql(t, e) {
var n = Oe;
Oe |= 2;
var r = Ty();
(lt !== t || ft !== e) && (zn = null, ni(t, e));
do try {
IO();
break
} catch (i) {
Cy(t, i)
}
while (1);
if (zh(), Oe = n, Hl.current = r, Ze !== null) throw Error(oe(261));
return lt = null, ft = 0, nt
}
function IO() {
for (; Ze !== null;) ky(Ze)
}
function LO() {
for (; Ze !== null && !sE();) ky(Ze)
}
function ky(t) {
var e = My(t.alternate, t, Ut);
t.memoizedProps = t.pendingProps, e === null ? Ey(t) : Ze = e, gd.current = null
}
function Ey(t) {
var e = t;
do {
var n = e.alternate;
if (t = e.return, (e.flags & 32768) === 0) {
if (n = EO(n, e, Ut), n !== null) {
Ze = n;
return
}
} else {
if (n = OO(n, e), n !== null) {
n.flags &= 32767, Ze = n;
return
}
if (t !== null) t.flags |= 32768, t.subtreeFlags = 0, t.deletions = null;
else {
nt = 6, Ze = null;
return
}
}
if (e = e.sibling, e !== null) {
Ze = e;
return
}
Ze = e = t
} while (e !== null);
nt === 0 && (nt = 5)
}
function ri(t, e, n) {
var r = Ae,
i = Zt.transition;
try {
Zt.transition = null, Ae = 1, FO(t, e, n, r)
} finally {
Zt.transition = i, Ae = r
}
return null
}
function FO(t, e, n, r) {
do yo(); while (_r !== null);
if ((Oe & 6) !== 0) throw Error(oe(327));
n = t.finishedWork;
var i = t.finishedLanes;
if (n === null) return null;
if (t.finishedWork = null, t.finishedLanes = 0, n === t.current) throw Error(oe(177));
t.callbackNode = null, t.callbackPriority = 0;
var s = n.lanes | n.childLanes;
if (mE(t, s), t === lt && (Ze = lt = null, ft = 0), (n.subtreeFlags & 2064) === 0 && (n.flags & 2064) === 0 || Yl || (Yl = !0, Ay(el, function() {
return yo(), null
})), s = (n.flags & 15990) !== 0, (n.subtreeFlags & 15990) !== 0 || s) {
s = Zt.transition, Zt.transition = null;
var d = Ae;
Ae = 1;
var a = Oe;
Oe |= 4, gd.current = null, MO(t, n), vy(n, t), nO(Ch), al = !!Sh, Ch = Sh = null, t.current = n, AO(n), aE(), Oe = a, Ae = d, Zt.transition = s
} else t.current = n;
if (Yl && (Yl = !1, _r = t, Xl = i), s = t.pendingLanes, s === 0 && (xr = null), uE(n.stateNode), It(t, Ke()), e !== null)
for (r = t.onRecoverableError, n = 0; n < e.length; n++) i = e[n], r(i.value, {
componentStack: i.stack,
digest: i.digest
});
if (Wl) throw Wl = !1, t = yd, yd = null, t;
return (Xl & 1) !== 0 && t.tag !== 0 && yo(), s = t.pendingLanes, (s & 1) !== 0 ? t === bd ? Bs++ : (Bs = 0, bd = t) : Bs = 0, vr(), null
}
function yo() {
if (_r !== null) {
var t = p0(Xl),
e = Zt.transition,
n = Ae;
try {
if (Zt.transition = null, Ae = 16 > t ? 16 : t, _r === null) var r = !1;
else {
if (t = _r, _r = null, Xl = 0, (Oe & 6) !== 0) throw Error(oe(331));
var i = Oe;
for (Oe |= 4, pe = t.current; pe !== null;) {
var s = pe,
d = s.child;
if ((pe.flags & 16) !== 0) {
var a = s.deletions;
if (a !== null) {
for (var o = 0; o < a.length; o++) {
var c = a[o];
for (pe = c; pe !== null;) {
var h = pe;
switch (h.tag) {
case 0:
case 11:
case 15:
zs(8, h, s)
}
var l = h.child;
if (l !== null) l.return = h, pe = l;
else
for (; pe !== null;) {
h = pe;
var u = h.sibling,
f = h.return;
if (hy(h), h === c) {
pe = null;
break
}
if (u !== null) {
u.return = f, pe = u;
break
}
pe = f
}
}
}
var p = s.alternate;
if (p !== null) {
var m = p.child;
if (m !== null) {
p.child = null;
do {
var g = m.sibling;
m.sibling = null, m = g
} while (m !== null)
}
}
pe = s
}
}
if ((s.subtreeFlags & 2064) !== 0 && d !== null) d.return = s, pe = d;
else e: for (; pe !== null;) {
if (s = pe, (s.flags & 2048) !== 0) switch (s.tag) {
case 0:
case 11:
case 15:
zs(9, s, s.return)
}
var v = s.sibling;
if (v !== null) {
v.return = s.return, pe = v;
break e
}
pe = s.return
}
}
var y = t.current;
for (pe = y; pe !== null;) {
d = pe;
var b = d.child;
if ((d.subtreeFlags & 2064) !== 0 && b !== null) b.return = d, pe = b;
else e: for (d = y; pe !== null;) {
if (a = pe, (a.flags & 2048) !== 0) try {
switch (a.tag) {
case 0:
case 11:
case 15:
Vl(9, a)
}
} catch (x) {
Ye(a, a.return, x)
}
if (a === d) {
pe = null;
break e
}
var w = a.sibling;
if (w !== null) {
w.return = a.return, pe = w;
break e
}
pe = a.return
}
}
if (Oe = i, vr(), vn && typeof vn.onPostCommitFiberRoot == "function") try {
vn.onPostCommitFiberRoot(tl, t)
} catch {}
r = !0
}
return r
} finally {
Ae = n, Zt.transition = e
}
}
return !1
}
function Oy(t, e, n) {
e = po(n, e), e = Y1(t, e, 1), t = br(t, e, 1), e = Tt(), t !== null && (us(t, 1, e), It(t, e))
}
function Ye(t, e, n) {
if (t.tag === 3) Oy(t, t, n);
else
for (; e !== null;) {
if (e.tag === 3) {
Oy(e, t, n);
break
} else if (e.tag === 1) {
var r = e.stateNode;
if (typeof e.type.getDerivedStateFromError == "function" || typeof r.componentDidCatch == "function" && (xr === null || !xr.has(r))) {
t = po(n, t), t = X1(e, t, 1), e = br(e, t, 1), t = Tt(), e !== null && (us(e, 1, t), It(e, t));
break
}
}
e = e.return
}
}
function zO(t, e, n) {
var r = t.pingCache;
r !== null && r.delete(e), e = Tt(), t.pingedLanes |= t.suspendedLanes & n, lt === t && (ft & n) === n && (nt === 4 || nt === 3 && (ft & 130023424) === ft && 500 > Ke() - vd ? ni(t, 0) : md |= n), It(t, e)
}
function Py(t, e) {
e === 0 && ((t.mode & 1) === 0 ? e = 1 : (e = rl, rl <<= 1, (rl & 130023424) === 0 && (rl = 4194304)));
var n = Tt();
t = In(t, e), t !== null && (us(t, e, n), It(t, n))
}
function NO(t) {
var e = t.memoizedState,
n = 0;
e !== null && (n = e.retryLane), Py(t, n)
}
function jO(t, e) {
var n = 0;
switch (t.tag) {
case 13:
var r = t.stateNode,
i = t.memoizedState;
i !== null && (n = i.retryLane);
break;
case 19:
r = t.stateNode;
break;
default:
throw Error(oe(314))
}
r !== null && r.delete(e), Py(t, n)
}
var My;
My = function(t, e, n) {
if (t !== null)
if (t.memoizedProps !== e.pendingProps || Mt.current) Dt = !0;
else {
if ((t.lanes & n) === 0 && (e.flags & 128) === 0) return Dt = !1, kO(t, e, n);
Dt = (t.flags & 131072) !== 0
}
else Dt = !1, Ne && (e.flags & 1048576) !== 0 && l1(e, Tl, e.index);
switch (e.lanes = 0, e.tag) {
case 2:
var r = e.type;
Bl(t, e), t = e.pendingProps;
var i = oo(e, gt.current);
uo(e, n), i = qh(null, e, r, t, i, n);
var s = Zh();
return e.flags |= 1, typeof i == "object" && i !== null && typeof i.render == "function" && i.$$typeof === void 0 ? (e.tag = 1, e.memoizedState = null, e.updateQueue = null, At(r) ? (s = !0, _l(e)) : s = !1, e.memoizedState = i.state !== null && i.state !== void 0 ? i.state : null, $h(e), i.updater = Al, e.stateNode = i, i._reactInternals = e, Hh(e, r, t, n), e = od(null, e, r, !0, s, n)) : (e.tag = 0, Ne && s && Ah(e), Ct(null, e, i, n), e = e.child), e;
case 16:
r = e.elementType;
e: {
switch (Bl(t, e), t = e.pendingProps, i = r._init, r = i(r._payload), e.type = r, i = e.tag = $O(r), t = ln(r, t), i) {
case 0:
e = id(null, e, r, t, n);
break e;
case 1:
e = ny(null, e, r, t, n);
break e;
case 11:
e = Z1(null, e, r, t, n);
break e;
case 14:
e = Q1(null, e, r, ln(r.type, t), n);
break e
}
throw Error(oe(306, r, ""))
}
return e;
case 0:
return r = e.type, i = e.pendingProps, i = e.elementType === r ? i : ln(r, i), id(t, e, r, i, n);
case 1:
return r = e.type, i = e.pendingProps, i = e.elementType === r ? i : ln(r, i), ny(t, e, r, i, n);
case 3:
e: {
if (ry(e), t === null) throw Error(oe(387));r = e.pendingProps,
s = e.memoizedState,
i = s.element,
p1(t, e),
Ml(e, r, null, n);
var d = e.memoizedState;
if (r = d.element, s.isDehydrated)
if (s = {
element: r,
isDehydrated: !1,
cache: d.cache,
pendingSuspenseBoundaries: d.pendingSuspenseBoundaries,
transitions: d.transitions
}, e.updateQueue.baseState = s, e.memoizedState = s, e.flags & 256) {
i = po(Error(oe(423)), e), e = iy(t, e, r, n, i);
break e
} else if (r !== i) {
i = po(Error(oe(424)), e), e = iy(t, e, r, n, i);
break e
} else
for (Ht = pr(e.stateNode.containerInfo.firstChild), Vt = e, Ne = !0, an = null, n = S1(e, null, r, n), e.child = n; n;) n.flags = n.flags & -3 | 4096, n = n.sibling;
else {
if (lo(), r === i) {
e = Fn(t, e, n);
break e
}
Ct(t, e, r, n)
}
e = e.child
}
return e;
case 5:
return C1(e), t === null && Ih(e), r = e.type, i = e.pendingProps, s = t !== null ? t.memoizedProps : null, d = i.children, Th(r, i) ? d = null : s !== null && Th(r, s) && (e.flags |= 32), ty(t, e), Ct(t, e, d, n), e.child;
case 6:
return t === null && Ih(e), null;
case 13:
return oy(t, e, n);
case 4:
return Uh(e, e.stateNode.containerInfo), r = e.pendingProps, t === null ? e.child = fo(e, null, r, n) : Ct(t, e, r, n), e.child;
case 11:
return r = e.type, i = e.pendingProps, i = e.elementType === r ? i : ln(r, i), Z1(t, e, r, i, n);
case 7:
return Ct(t, e, e.pendingProps, n), e.child;
case 8:
return Ct(t, e, e.pendingProps.children, n), e.child;
case 12:
return Ct(t, e, e.pendingProps.children, n), e.child;
case 10:
e: {
if (r = e.type._context, i = e.pendingProps, s = e.memoizedProps, d = i.value, Ie(El, r._currentValue), r._currentValue = d, s !== null)
if (sn(s.value, d)) {
if (s.children === i.children && !Mt.current) {
e = Fn(t, e, n);
break e
}
} else
for (s = e.child, s !== null && (s.return = e); s !== null;) {
var a = s.dependencies;
if (a !== null) {
d = s.child;
for (var o = a.firstContext; o !== null;) {
if (o.context === r) {
if (s.tag === 1) {
o = Ln(-1, n & -n), o.tag = 2;
var c = s.updateQueue;
if (c !== null) {
c = c.shared;
var h = c.pending;
h === null ? o.next = o : (o.next = h.next, h.next = o), c.pending = o
}
}
s.lanes |= n, o = s.alternate, o !== null && (o.lanes |= n), jh(s.return, n, e), a.lanes |= n;
break
}
o = o.next
}
} else if (s.tag === 10) d = s.type === e.type ? null : s.child;
else if (s.tag === 18) {
if (d = s.return, d === null) throw Error(oe(341));
d.lanes |= n, a = d.alternate, a !== null && (a.lanes |= n), jh(d, n, e), d = s.sibling
} else d = s.child;
if (d !== null) d.return = s;
else
for (d = s; d !== null;) {
if (d === e) {
d = null;
break
}
if (s = d.sibling, s !== null) {
s.return = d.return, d = s;
break
}
d = d.return
}
s = d
}
Ct(t, e, i.children, n),
e = e.child
}
return e;
case 9:
return i = e.type, r = e.pendingProps.children, uo(e, n), i = Kt(i), r = r(i), e.flags |= 1, Ct(t, e, r, n), e.child;
case 14:
return r = e.type, i = ln(r, e.pendingProps), i = ln(r.type, i), Q1(t, e, r, i, n);
case 15:
return J1(t, e, e.type, e.pendingProps, n);
case 17:
return r = e.type, i = e.pendingProps, i = e.elementType === r ? i : ln(r, i), Bl(t, e), e.tag = 1, At(r) ? (t = !0, _l(e)) : t = !1, uo(e, n), b1(e, r, i), Hh(e, r, i, n), od(null, e, r, !0, t, n);
case 19:
return ay(t, e, n);
case 22:
return ey(t, e, n)
}
throw Error(oe(156, e.tag))
};
function Ay(t, e) {
return c0(t, e)
}
function BO(t, e, n, r) {
this.tag = t, this.key = n, this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null, this.index = 0, this.ref = null, this.pendingProps = e, this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null, this.mode = r, this.subtreeFlags = this.flags = 0, this.deletions = null, this.childLanes = this.lanes = 0, this.alternate = null
}
function Qt(t, e, n, r) {
return new BO(t, e, n, r)
}
function Td(t) {
return t = t.prototype, !(!t || !t.isReactComponent)
}
function $O(t) {
if (typeof t == "function") return Td(t) ? 1 : 0;
if (t != null) {
if (t = t.$$typeof, t === Af) return 11;
if (t === If) return 14
}
return 2
}
function Tr(t, e) {
var n = t.alternate;
return n === null ? (n = Qt(t.tag, e, t.key, t.mode), n.elementType = t.elementType, n.type = t.type, n.stateNode = t.stateNode, n.alternate = t, t.alternate = n) : (n.pendingProps = e, n.type = t.type, n.flags = 0, n.subtreeFlags = 0, n.deletions = null), n.flags = t.flags & 14680064, n.childLanes = t.childLanes, n.lanes = t.lanes, n.child = t.child, n.memoizedProps = t.memoizedProps, n.memoizedState = t.memoizedState, n.updateQueue = t.updateQueue, e = t.dependencies, n.dependencies = e === null ? null : {
lanes: e.lanes,
firstContext: e.firstContext
}, n.sibling = t.sibling, n.index = t.index, n.ref = t.ref, n
}
function Zl(t, e, n, r, i, s) {
var d = 2;
if (r = t, typeof t == "function") Td(t) && (d = 1);
else if (typeof t == "string") d = 5;
else e: switch (t) {
case Yi:
return ii(n.children, i, s, e);
case Pf:
d = 8, i |= 8;
break;
case Mf:
return t = Qt(12, n, e, i | 2), t.elementType = Mf, t.lanes = s, t;
case Df:
return t = Qt(13, n, e, i), t.elementType = Df, t.lanes = s, t;
case Rf:
return t = Qt(19, n, e, i), t.elementType = Rf, t.lanes = s, t;
case jv:
return Ql(n, i, s, e);
default:
if (typeof t == "object" && t !== null) switch (t.$$typeof) {
case zv:
d = 10;
break e;
case Nv:
d = 9;
break e;
case Af:
d = 11;
break e;
case If:
d = 14;
break e;
case sr:
d = 16, r = null;
break e
}
throw Error(oe(130, t == null ? t : typeof t, ""))
}
return e = Qt(d, n, e, i), e.elementType = t, e.type = r, e.lanes = s, e
}
function ii(t, e, n, r) {
return t = Qt(7, t, r, e), t.lanes = n, t
}
function Ql(t, e, n, r) {
return t = Qt(22, t, r, e), t.elementType = jv, t.lanes = n, t.stateNode = {
isHidden: !1
}, t
}
function kd(t, e, n) {
return t = Qt(6, t, null, e), t.lanes = n, t
}
function Ed(t, e, n) {
return e = Qt(4, t.children !== null ? t.children : [], t.key, e), e.lanes = n, e.stateNode = {
containerInfo: t.containerInfo,
pendingChildren: null,
implementation: t.implementation
}, e
}
function VO(t, e, n, r, i) {
this.tag = e, this.containerInfo = t, this.finishedWork = this.pingCache = this.current = this.pendingChildren = null, this.timeoutHandle = -1, this.callbackNode = this.pendingContext = this.context = null, this.callbackPriority = 0, this.eventTimes = eh(0), this.expirationTimes = eh(-1), this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0, this.entanglements = eh(0), this.identifierPrefix = r, this.onRecoverableError = i, this.mutableSourceEagerHydrationData = null
}
function Od(t, e, n, r, i, s, d, a, o) {
return t = new VO(t, e, n, a, o), e === 1 ? (e = 1, s === !0 && (e |= 8)) : e = 0, s = Qt(3, null, null, e), t.current = s, s.stateNode = t, s.memoizedState = {
element: r,
isDehydrated: n,
cache: null,
transitions: null,
pendingSuspenseBoundaries: null
}, $h(s), t
}
function HO(t, e, n) {
var r = 3 < arguments.length && arguments[3] !== void 0 ? arguments[3] : null;
return {
$$typeof: Wi,
key: r == null ? null : "" + r,
children: t,
containerInfo: e,
implementation: n
}
}
function Dy(t) {
if (!t) return mr;
t = t._reactInternals;
e: {
if (Yr(t) !== t || t.tag !== 1) throw Error(oe(170));
var e = t;do {
switch (e.tag) {
case 3:
e = e.stateNode.context;
break e;
case 1:
if (At(e.type)) {
e = e.stateNode.__reactInternalMemoizedMergedChildContext;
break e
}
}
e = e.return
} while (e !== null);
throw Error(oe(171))
}
if (t.tag === 1) {
var n = t.type;
if (At(n)) return o1(t, n, e)
}
return e
}
function Ry(t, e, n, r, i, s, d, a, o) {
return t = Od(n, r, !0, t, i, s, d, a, o), t.context = Dy(null), n = t.current, r = Tt(), i = Sr(n), s = Ln(r, i), s.callback = e != null ? e : null, br(n, s, i), t.current.lanes = i, us(t, i, r), It(t, r), t
}
function Jl(t, e, n, r) {
var i = e.current,
s = Tt(),
d = Sr(i);
return n = Dy(n), e.context === null ? e.context = n : e.pendingContext = n, e = Ln(s, d), e.payload = {
element: t
}, r = r === void 0 ? null : r, r !== null && (e.callback = r), t = br(i, e, d), t !== null && (fn(t, i, d, s), Pl(t, i, d)), d
}
function ec(t) {
if (t = t.current, !t.child) return null;
switch (t.child.tag) {
case 5:
return t.child.stateNode;
default:
return t.child.stateNode
}
}
function Iy(t, e) {
if (t = t.memoizedState, t !== null && t.dehydrated !== null) {
var n = t.retryLane;
t.retryLane = n !== 0 && n < e ? n : e
}
}
function Pd(t, e) {
Iy(t, e), (t = t.alternate) && Iy(t, e)
}
function UO() {
return null
}
var Ly = typeof reportError == "function" ? reportError : function(t) {
console.error(t)
};
function Md(t) {
this._internalRoot = t
}
tc.prototype.render = Md.prototype.render = function(t) {
var e = this._internalRoot;
if (e === null) throw Error(oe(409));
Jl(t, e, null, null)
}, tc.prototype.unmount = Md.prototype.unmount = function() {
var t = this._internalRoot;
if (t !== null) {
this._internalRoot = null;
var e = t.containerInfo;
ti(function() {
Jl(null, t, null, null)
}), e[Mn] = null
}
};
function tc(t) {
this._internalRoot = t
}
tc.prototype.unstable_scheduleHydration = function(t) {
if (t) {
var e = v0();
t = {
blockedOn: null,
target: t,
priority: e
};
for (var n = 0; n < fr.length && e !== 0 && e < fr[n].priority; n++);
fr.splice(n, 0, t), n === 0 && w0(t)
}
};
function Ad(t) {
return !(!t || t.nodeType !== 1 && t.nodeType !== 9 && t.nodeType !== 11)
}
function nc(t) {
return !(!t || t.nodeType !== 1 && t.nodeType !== 9 && t.nodeType !== 11 && (t.nodeType !== 8 || t.nodeValue !== " react-mount-point-unstable "))
}
function Fy() {}
function WO(t, e, n, r, i) {
if (i) {
if (typeof r == "function") {
var s = r;
r = function() {
var c = ec(d);
s.call(c)
}
}
var d = Ry(e, r, t, 0, null, !1, !1, "", Fy);
return t._reactRootContainer = d, t[Mn] = d.current, Cs(t.nodeType === 8 ? t.parentNode : t), ti(), d
}
for (; i = t.lastChild;) t.removeChild(i);
if (typeof r == "function") {
var a = r;
r = function() {
var c = ec(o);
a.call(c)
}
}
var o = Od(t, 0, !1, null, null, !1, !1, "", Fy);
return t._reactRootContainer = o, t[Mn] = o.current, Cs(t.nodeType === 8 ? t.parentNode : t), ti(function() {
Jl(e, o, n, r)
}), o
}
function rc(t, e, n, r, i) {
var s = n._reactRootContainer;
if (s) {
var d = s;
if (typeof i == "function") {
var a = i;
i = function() {
var o = ec(d);
a.call(o)
}
}
Jl(e, d, t, i)
} else d = WO(n, e, t, i, r);
return ec(d)
}
g0 = function(t) {
switch (t.tag) {
case 3:
var e = t.stateNode;
if (e.current.memoizedState.isDehydrated) {
var n = cs(e.pendingLanes);
n !== 0 && (th(e, n | 1), It(e, Ke()), (Oe & 6) === 0 && (vo = Ke() + 500, vr()))
}
break;
case 13:
ti(function() {
var r = In(t, 1);
if (r !== null) {
var i = Tt();
fn(r, t, 1, i)
}
}), Pd(t, 1)
}
}, nh = function(t) {
if (t.tag === 13) {
var e = In(t, 134217728);
if (e !== null) {
var n = Tt();
fn(e, t, 134217728, n)
}
Pd(t, 134217728)
}
}, m0 = function(t) {
if (t.tag === 13) {
var e = Sr(t),
n = In(t, e);
if (n !== null) {
var r = Tt();
fn(n, t, e, r)
}
Pd(t, e)
}
}, v0 = function() {
return Ae
}, y0 = function(t, e) {
var n = Ae;
try {
return Ae = t, e()
} finally {
Ae = n
}
}, Gf = function(t, e, n) {
switch (e) {
case "input":
if (Bf(t, n), e = n.name, n.type === "radio" && e != null) {
for (n = t; n.parentNode;) n = n.parentNode;
for (n = n.querySelectorAll("input[name=" + JSON.stringify("" + e) + '][type="radio"]'), e = 0; e < n.length; e++) {
var r = n[e];
if (r !== t && r.form === t.form) {
var i = wl(r);
if (!i) throw Error(oe(90));
Vv(r), Bf(r, i)
}
}
}
break;
case "textarea":
Xv(t, n);
break;
case "select":
e = n.value, e != null && Xi(t, !!n.multiple, e, !1)
}
}, n0 = _d, r0 = ti;
var YO = {
usingClientEntryPoint: !1,
Events: [Es, ro, wl, e0, t0, _d]
},
$s = {
findFiberByHostInstance: Xr,
bundleType: 0,
version: "18.2.0",
rendererPackageName: "react-dom"
},
XO = {
bundleType: $s.bundleType,
version: $s.version,
rendererPackageName: $s.rendererPackageName,
rendererConfig: $s.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
overrideProps: null,
overridePropsDeletePath: null,
overridePropsRenamePath: null,
setErrorHandler: null,
setSuspenseHandler: null,
scheduleUpdate: null,
currentDispatcherRef: Pn.ReactCurrentDispatcher,
findHostInstanceByFiber: function(t) {
return t = a0(t), t === null ? null : t.stateNode
},
findFiberByHostInstance: $s.findFiberByHostInstance || UO,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.2.0-next-9e3b772b8-20220608"
};
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u") {
var ic = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (!ic.isDisabled && ic.supportsFiber) try {
tl = ic.inject(XO), vn = ic
} catch {}
}
jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = YO, jt.createPortal = function(t, e) {
var n = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : null;
if (!Ad(e)) throw Error(oe(200));
return HO(t, e, null, n)
}, jt.createRoot = function(t, e) {
if (!Ad(t)) throw Error(oe(299));
var n = !1,
r = "",
i = Ly;
return e != null && (e.unstable_strictMode === !0 && (n = !0), e.identifierPrefix !== void 0 && (r = e.identifierPrefix), e.onRecoverableError !== void 0 && (i = e.onRecoverableError)), e = Od(t, 1, !1, null, null, n, !1, r, i), t[Mn] = e.current, Cs(t.nodeType === 8 ? t.parentNode : t), new Md(e)
}, jt.findDOMNode = function(t) {
if (t == null) return null;
if (t.nodeType === 1) return t;
var e = t._reactInternals;
if (e === void 0) throw typeof t.render == "function" ? Error(oe(188)) : (t = Object.keys(t).join(","), Error(oe(268, t)));
return t = a0(e), t = t === null ? null : t.stateNode, t
}, jt.flushSync = function(t) {
return ti(t)
}, jt.hydrate = function(t, e, n) {
if (!nc(e)) throw Error(oe(200));
return rc(null, t, e, !0, n)
}, jt.hydrateRoot = function(t, e, n) {
if (!Ad(t)) throw Error(oe(405));
var r = n != null && n.hydratedSources || null,
i = !1,
s = "",
d = Ly;
if (n != null && (n.unstable_strictMode === !0 && (i = !0), n.identifierPrefix !== void 0 && (s = n.identifierPrefix), n.onRecoverableError !== void 0 && (d = n.onRecoverableError)), e = Ry(e, null, t, 1, n != null ? n : null, i, !1, s, d), t[Mn] = e.current, Cs(t), r)
for (t = 0; t < r.length; t++) n = r[t], i = n._getVersion, i = i(n._source), e.mutableSourceEagerHydrationData == null ? e.mutableSourceEagerHydrationData = [n, i] : e.mutableSourceEagerHydrationData.push(n, i);
return new tc(e)
}, jt.render = function(t, e, n) {
if (!nc(e)) throw Error(oe(200));
return rc(null, t, e, !1, n)
}, jt.unmountComponentAtNode = function(t) {
if (!nc(t)) throw Error(oe(40));
return t._reactRootContainer ? (ti(function() {
rc(null, null, t, !1, function() {
t._reactRootContainer = null, t[Mn] = null
})
}), !0) : !1
}, jt.unstable_batchedUpdates = _d, jt.unstable_renderSubtreeIntoContainer = function(t, e, n, r) {
if (!nc(n)) throw Error(oe(200));
if (t == null || t._reactInternals === void 0) throw Error(oe(38));
return rc(t, e, n, !1, r)
}, jt.version = "18.2.0-next-9e3b772b8-20220608",
function(t) {
function e() {
if (!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ > "u" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE != "function")) try {
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)
} catch (n) {
console.error(n)
}
}
e(), t.exports = jt
}(Jo);
var zy, Ny = Jo.exports;
zy = Ny.createRoot, Ny.hydrateRoot;
const jy = E.exports.createContext({
transformPagePoint: t => t,
isStatic: !1,
reducedMotion: "never"
}),
oc = E.exports.createContext({});
function GO() {
return E.exports.useContext(oc).visualElement
}
const Vs = E.exports.createContext(null),
oi = typeof document < "u",
sc = oi ? E.exports.useLayoutEffect : E.exports.useEffect,
Dd = E.exports.createContext({
strict: !1
});
function KO(t, e, n, r) {
const i = GO(),
s = E.exports.useContext(Dd),
d = E.exports.useContext(Vs),
a = E.exports.useContext(jy).reducedMotion,
o = E.exports.useRef(void 0);
r = r || s.renderer, !o.current && r && (o.current = r(t, {
visualState: e,
parent: i,
props: n,
presenceId: d ? d.id : void 0,
blockInitialAnimation: d ? d.initial === !1 : !1,
reducedMotionConfig: a
}));
const c = o.current;
return sc(() => {
c && c.syncRender()
}), E.exports.useEffect(() => {
c && c.animationState && c.animationState.animateChanges()
}), sc(() => () => c && c.notifyUnmount(), []), c
}
function By(t) {
return typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current")
}
function qO(t, e, n) {
return E.exports.useCallback(r => {
r && t.mount && t.mount(r), e && (r ? e.mount(r) : e.unmount()), n && (typeof n == "function" ? n(r) : By(n) && (n.current = r))
}, [e])
}
function Hs(t) {
return typeof t == "string" || Array.isArray(t)
}
function ac(t) {
return typeof t == "object" && typeof t.start == "function"
}
const ZO = ["initial", "animate", "exit", "whileHover", "whileDrag", "whileTap", "whileFocus", "whileInView"];
function lc(t) {
return ac(t.animate) || ZO.some(e => Hs(t[e]))
}
function $y(t) {
return Boolean(lc(t) || t.variants)
}
function QO(t, e) {
if (lc(t)) {
const {
initial: n,
animate: r
} = t;
return {
initial: n === !1 || Hs(n) ? n : void 0,
animate: Hs(r) ? r : void 0
}
}
return t.inherit !== !1 ? e : {}
}
function JO(t) {
const {
initial: e,
animate: n
} = QO(t, E.exports.useContext(oc));
return E.exports.useMemo(() => ({
initial: e,
animate: n
}), [Vy(e), Vy(n)])
}
function Vy(t) {
return Array.isArray(t) ? t.join(" ") : t
}
const Nn = t => ({
isEnabled: e => t.some(n => !!e[n])
}),
Us = {
measureLayout: Nn(["layout", "layoutId", "drag"]),
animation: Nn(["animate", "exit", "variants", "whileHover", "whileTap", "whileFocus", "whileDrag", "whileInView"]),
exit: Nn(["exit"]),
drag: Nn(["drag", "dragControls"]),
focus: Nn(["whileFocus"]),
hover: Nn(["whileHover", "onHoverStart", "onHoverEnd"]),
tap: Nn(["whileTap", "onTap", "onTapStart", "onTapCancel"]),
pan: Nn(["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"]),
inView: Nn(["whileInView", "onViewportEnter", "onViewportLeave"])
};
function Rd(t) {
for (const e in t) e === "projectionNodeConstructor" ? Us.projectionNodeConstructor = t[e] : Us[e].Component = t[e]
}
function Id(t) {
const e = E.exports.useRef(null);
return e.current === null && (e.current = t()), e.current
}
const e4 = {
hasAnimatedSinceResize: !0,
hasEverUpdated: !1
};
let t4 = 1;
function n4() {
return Id(() => {
if (e4.hasEverUpdated) return t4++
})
}
const Hy = E.exports.createContext({});
class r4 extends ue.Component {
getSnapshotBeforeUpdate() {
const {
visualElement: e,
props: n
} = this.props;
return e && e.setProps(n), null
}
componentDidUpdate() {}
render() {
return this.props.children
}
}
const i4 = E.exports.createContext({}),
o4 = Symbol.for("motionComponentSymbol");
function s4({
preloadedFeatures: t,
createVisualElement: e,
projectionNodeConstructor: n,
useRender: r,
useVisualState: i,
Component: s
}) {
t && Rd(t);
function d(o, c) {
const h = {
...E.exports.useContext(jy),
...o,
layoutId: a4(o)
},
{
isStatic: l
} = h;
let u = null;
const f = JO(o),
p = l ? void 0 : n4(),
m = i(o, l);
if (!l && oi) {
f.visualElement = KO(s, m, h, e);
const g = E.exports.useContext(Dd).strict,
v = E.exports.useContext(i4);
f.visualElement && (u = f.visualElement.loadFeatures(h, g, t, p, n || Us.projectionNodeConstructor, v))
}
return se(r4, {
visualElement: f.visualElement,
props: h,
children: [u, _(oc.Provider, {
value: f,
children: r(s, o, p, qO(m, f.visualElement, c), m, l, f.visualElement)
})]
})
}
const a = E.exports.forwardRef(d);
return a[o4] = s, a
}
function a4({
layoutId: t
}) {
const e = E.exports.useContext(Hy).id;
return e && t !== void 0 ? e + "-" + t : t
}
function l4(t) {
function e(r, i = {}) {
return s4(t(r, i))
}
if (typeof Proxy > "u") return e;
const n = new Map;
return new Proxy(e, {
get: (r, i) => (n.has(i) || n.set(i, e(i)), n.get(i))
})
}
const c4 = ["animate", "circle", "defs", "desc", "ellipse", "g", "image", "line", "filter", "marker", "mask", "metadata", "path", "pattern", "polygon", "polyline", "rect", "stop", "svg", "switch", "symbol", "text", "tspan", "use", "view"];
function Ld(t) {
return typeof t != "string" || t.includes("-") ? !1 : !!(c4.indexOf(t) > -1 || /[A-Z]/.test(t))
}
const u4 = {},
cc = ["transformPerspective", "x", "y", "z", "translateX", "translateY", "translateZ", "scale", "scaleX", "scaleY", "rotate", "rotateX", "rotateY", "rotateZ", "skew", "skewX", "skewY"],
Ws = new Set(cc);
function Uy(t, {
layout: e,
layoutId: n
}) {
return Ws.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!u4[t] || t === "opacity")
}
const jn = t => !!(t != null && t.getVelocity),
f4 = {
x: "translateX",
y: "translateY",
z: "translateZ",
transformPerspective: "perspective"
},
h4 = (t, e) => cc.indexOf(t) - cc.indexOf(e);
function d4({
transform: t,
transformKeys: e
}, {
enableHardwareAcceleration: n = !0,
allowTransformNone: r = !0
}, i, s) {
let d = "";
e.sort(h4);
for (const a of e) d += `${f4[a]||a}(${t[a]}) `;
return n && !t.z && (d += "translateZ(0)"), d = d.trim(), s ? d = s(t, i ? "" : d) : r && i && (d = "none"), d
}
function Wy(t) {
return t.startsWith("--")
}
const p4 = (t, e) => e && typeof t == "number" ? e.transform(t) : t,
Yy = (t, e) => n => Math.max(Math.min(n, e), t),
Ys = t => t % 1 ? Number(t.toFixed(5)) : t,
Xs = /(-)?([\d]*\.?[\d])+/g,
Fd = /(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,
g4 = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;
function Gs(t) {
return typeof t == "string"
}
const si = {
test: t => typeof t == "number",
parse: parseFloat,
transform: t => t
},
Ks = Object.assign(Object.assign({}, si), {
transform: Yy(0, 1)
}),
uc = Object.assign(Object.assign({}, si), {
default: 1
}),
qs = t => ({
test: e => Gs(e) && e.endsWith(t) && e.split(" ").length === 1,
parse: parseFloat,
transform: e => `${e}${t}`
}),
kr = qs("deg"),
bo = qs("%"),
we = qs("px"),
m4 = qs("vh"),
v4 = qs("vw"),
Xy = Object.assign(Object.assign({}, bo), {
parse: t => bo.parse(t) / 100,
transform: t => bo.transform(t * 100)
}),
zd = (t, e) => n => Boolean(Gs(n) && g4.test(n) && n.startsWith(t) || e && Object.prototype.hasOwnProperty.call(n, e)),
Gy = (t, e, n) => r => {
if (!Gs(r)) return r;
const [i, s, d, a] = r.match(Xs);
return {
[t]: parseFloat(i),
[e]: parseFloat(s),
[n]: parseFloat(d),
alpha: a !== void 0 ? parseFloat(a) : 1
}
},
ai = {
test: zd("hsl", "hue"),
parse: Gy("hue", "saturation", "lightness"),
transform: ({
hue: t,
saturation: e,
lightness: n,
alpha: r = 1
}) => "hsla(" + Math.round(t) + ", " + bo.transform(Ys(e)) + ", " + bo.transform(Ys(n)) + ", " + Ys(Ks.transform(r)) + ")"
},
y4 = Yy(0, 255),
Nd = Object.assign(Object.assign({}, si), {
transform: t => Math.round(y4(t))
}),
Er = {
test: zd("rgb", "red"),
parse: Gy("red", "green", "blue"),
transform: ({
red: t,
green: e,
blue: n,
alpha: r = 1
}) => "rgba(" + Nd.transform(t) + ", " + Nd.transform(e) + ", " + Nd.transform(n) + ", " + Ys(Ks.transform(r)) + ")"
};
function b4(t) {
let e = "",
n = "",
r = "",
i = "";
return t.length > 5 ? (e = t.substr(1, 2), n = t.substr(3, 2), r = t.substr(5, 2), i = t.substr(7, 2)) : (e = t.substr(1, 1), n = t.substr(2, 1), r = t.substr(3, 1), i = t.substr(4, 1), e += e, n += n, r += r, i += i), {
red: parseInt(e, 16),
green: parseInt(n, 16),
blue: parseInt(r, 16),
alpha: i ? parseInt(i, 16) / 255 : 1
}
}
const jd = {
test: zd("#"),
parse: b4,
transform: Er.transform
},
kt = {
test: t => Er.test(t) || jd.test(t) || ai.test(t),
parse: t => Er.test(t) ? Er.parse(t) : ai.test(t) ? ai.parse(t) : jd.parse(t),
transform: t => Gs(t) ? t : t.hasOwnProperty("red") ? Er.transform(t) : ai.transform(t)
},
Ky = "${c}",
qy = "${n}";
function w4(t) {
var e, n, r, i;
return isNaN(t) && Gs(t) && ((n = (e = t.match(Xs)) === null || e === void 0 ? void 0 : e.length) !== null && n !== void 0 ? n : 0) + ((i = (r = t.match(Fd)) === null || r === void 0 ? void 0 : r.length) !== null && i !== void 0 ? i : 0) > 0
}
function Zy(t) {
typeof t == "number" && (t = `${t}`);
const e = [];
let n = 0;
const r = t.match(Fd);
r && (n = r.length, t = t.replace(Fd, Ky), e.push(...r.map(kt.parse)));
const i = t.match(Xs);
return i && (t = t.replace(Xs, qy), e.push(...i.map(si.parse))), {
values: e,
numColors: n,
tokenised: t
}
}
function Qy(t) {
return Zy(t).values
}
function Jy(t) {
const {
values: e,
numColors: n,
tokenised: r
} = Zy(t), i = e.length;
return s => {
let d = r;
for (let a = 0; a < i; a++) d = d.replace(a < n ? Ky : qy, a < n ? kt.transform(s[a]) : Ys(s[a]));
return d
}
}
const x4 = t => typeof t == "number" ? 0 : t;
function _4(t) {
const e = Qy(t);
return Jy(t)(e.map(x4))
}
const li = {
test: w4,
parse: Qy,
createTransformer: Jy,
getAnimatableNone: _4
},
S4 = new Set(["brightness", "contrast", "saturate", "opacity"]);
function C4(t) {
let [e, n] = t.slice(0, -1).split("(");
if (e === "drop-shadow") return t;
const [r] = n.match(Xs) || [];
if (!r) return t;
const i = n.replace(r, "");
let s = S4.has(e) ? 1 : 0;
return r !== n && (s *= 100), e + "(" + s + i + ")"
}
const T4 = /([a-z-]*)\(.*?\)/g,
Bd = Object.assign(Object.assign({}, li), {
getAnimatableNone: t => {
const e = t.match(T4);
return e ? e.map(C4).join(" ") : t
}
}),
eb = {
...si,
transform: Math.round
},
tb = {
borderWidth: we,
borderTopWidth: we,
borderRightWidth: we,
borderBottomWidth: we,
borderLeftWidth: we,
borderRadius: we,
radius: we,
borderTopLeftRadius: we,
borderTopRightRadius: we,
borderBottomRightRadius: we,
borderBottomLeftRadius: we,
width: we,
maxWidth: we,
height: we,
maxHeight: we,
size: we,
top: we,
right: we,
bottom: we,
left: we,
padding: we,
paddingTop: we,
paddingRight: we,
paddingBottom: we,
paddingLeft: we,
margin: we,
marginTop: we,
marginRight: we,
marginBottom: we,
marginLeft: we,
rotate: kr,
rotateX: kr,
rotateY: kr,
rotateZ: kr,
scale: uc,
scaleX: uc,
scaleY: uc,
scaleZ: uc,
skew: kr,
skewX: kr,
skewY: kr,
distance: we,
translateX: we,
translateY: we,
translateZ: we,
x: we,
y: we,
z: we,
perspective: we,
transformPerspective: we,
opacity: Ks,
originX: Xy,
originY: Xy,
originZ: we,
zIndex: eb,
fillOpacity: Ks,
strokeOpacity: Ks,
numOctaves: eb
};
function $d(t, e, n, r) {
const {
style: i,
vars: s,
transform: d,
transformKeys: a,
transformOrigin: o
} = t;
a.length = 0;
let c = !1,
h = !1,
l = !0;
for (const u in e) {
const f = e[u];
if (Wy(u)) {
s[u] = f;
continue
}
const p = tb[u],
m = p4(f, p);
if (Ws.has(u)) {
if (c = !0, d[u] = m, a.push(u), !l) continue;
f !== (p.default || 0) && (l = !1)
} else u.startsWith("origin") ? (h = !0, o[u] = m) : i[u] = m
}
if (e.transform || (c || r ? i.transform = d4(t, n, l, r) : i.transform && (i.transform = "none")), h) {
const {
originX: u = "50%",
originY: f = "50%",
originZ: p = 0
} = o;
i.transformOrigin = `${u} ${f} ${p}`
}
}
const Vd = () => ({
style: {},
transform: {},
transformKeys: [],
transformOrigin: {},
vars: {}
});
function nb(t, e, n) {
for (const r in e) !jn(e[r]) && !Uy(r, n) && (t[r] = e[r])
}
function k4({
transformTemplate: t
}, e, n) {
return E.exports.useMemo(() => {
const r = Vd();
return $d(r, e, {
enableHardwareAcceleration: !n
}, t), Object.assign({}, r.vars, r.style)
}, [e])
}
function E4(t, e, n) {
const r = t.style || {},
i = {};
return nb(i, r, t), Object.assign(i, k4(t, e, n)), t.transformValues ? t.transformValues(i) : i
}
function O4(t, e, n) {
const r = {},
i = E4(t, e, n);
return t.drag && t.dragListener !== !1 && (r.draggable = !1, i.userSelect = i.WebkitUserSelect = i.WebkitTouchCallout = "none", i.touchAction = t.drag === !0 ? "none" : `pan-${t.drag==="x"?"y":"x"}`), r.style = i, r
}
const P4 = ["animate", "exit", "variants", "whileHover", "whileTap", "whileFocus", "whileDrag", "whileInView"],
M4 = ["whileTap", "onTap", "onTapStart", "onTapCancel"],
A4 = ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
D4 = ["whileInView", "onViewportEnter", "onViewportLeave", "viewport"],
R4 = new Set(["initial", "style", "values", "variants", "transition", "transformTemplate", "transformValues", "custom", "inherit", "layout", "layoutId", "layoutDependency", "onLayoutAnimationStart", "onLayoutAnimationComplete", "onLayoutMeasure", "onBeforeLayoutMeasure", "onAnimationStart", "onAnimationComplete", "onUpdate", "onDragStart", "onDrag", "onDragEnd", "onMeasureDragConstraints", "onDirectionLock", "onDragTransitionEnd", "drag", "dragControls", "dragListener", "dragConstraints", "dragDirectionLock", "dragSnapToOrigin", "_dragX", "_dragY", "dragElastic", "dragMomentum", "dragPropagation", "dragTransition", "onHoverStart", "onHoverEnd", "layoutScroll", ...D4, ...M4, ...P4, ...A4]);
function fc(t) {
return R4.has(t)
}
let rb = t => !fc(t);
function I4(t) {
!t || (rb = e => e.startsWith("on") ? !fc(e) : t(e))
}
try {
I4(require("@emotion/is-prop-valid").default)
} catch {}
function L4(t, e, n) {
const r = {};
for (const i in t)(rb(i) || n === !0 && fc(i) || !e && !fc(i) || t.draggable && i.startsWith("onDrag")) && (r[i] = t[i]);
return r
}
function ib(t, e, n) {
return typeof t == "string" ? t : we.transform(e + n * t)
}
function F4(t, e, n) {
const r = ib(e, t.x, t.width),
i = ib(n, t.y, t.height);
return `${r} ${i}`
}
const z4 = {
offset: "stroke-dashoffset",
array: "stroke-dasharray"
},
N4 = {
offset: "strokeDashoffset",
array: "strokeDasharray"
};
function j4(t, e, n = 1, r = 0, i = !0) {
t.pathLength = 1;
const s = i ? z4 : N4;
t[s.offset] = we.transform(-r);
const d = we.transform(e),
a = we.transform(n);
t[s.array] = `${d} ${a}`
}
function Hd(t, {
attrX: e,
attrY: n,
originX: r,
originY: i,
pathLength: s,
pathSpacing: d = 1,
pathOffset: a = 0,
...o
}, c, h) {
$d(t, o, c, h), t.attrs = t.style, t.style = {};
const {
attrs: l,
style: u,
dimensions: f
} = t;
l.transform && (f && (u.transform = l.transform), delete l.transform), f && (r !== void 0 || i !== void 0 || u.transform) && (u.transformOrigin = F4(f, r !== void 0 ? r : .5, i !== void 0 ? i : .5)), e !== void 0 && (l.x = e), n !== void 0 && (l.y = n), s !== void 0 && j4(l, s, d, a, !1)
}
const ob = () => ({
...Vd(),
attrs: {}
});
function B4(t, e) {
const n = E.exports.useMemo(() => {
const r = ob();
return Hd(r, e, {
enableHardwareAcceleration: !1
}, t.transformTemplate), {
...r.attrs,
style: {
...r.style
}
}
}, [e]);
if (t.style) {
const r = {};
nb(r, t.style, t), n.style = {
...r,
...n.style
}
}
return n
}
function $4(t = !1) {
return (n, r, i, s, {
latestValues: d
}, a) => {
const c = (Ld(n) ? B4 : O4)(r, d, a),
l = {
...L4(r, typeof n == "string", t),
...c,
ref: s
};
return i && (l["data-projection-id"] = i), E.exports.createElement(n, l)
}
}
const sb = t => t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
function ab(t, {
style: e,
vars: n
}, r, i) {
Object.assign(t.style, e, i && i.getProjectionStyles(r));
for (const s in n) t.style.setProperty(s, n[s])
}
const lb = new Set(["baseFrequency", "diffuseConstant", "kernelMatrix", "kernelUnitLength", "keySplines", "keyTimes", "limitingConeAngle", "markerHeight", "markerWidth", "numOctaves", "targetX", "targetY", "surfaceScale", "specularConstant", "specularExponent", "stdDeviation", "tableValues", "viewBox", "gradientTransform", "pathLength"]);
function cb(t, e, n, r) {
ab(t, e, void 0, r);
for (const i in e.attrs) t.setAttribute(lb.has(i) ? i : sb(i), e.attrs[i])
}
function Ud(t) {
const {
style: e
} = t, n = {};
for (const r in e)(jn(e[r]) || Uy(r, t)) && (n[r] = e[r]);
return n
}
function ub(t) {
const e = Ud(t);
for (const n in t)
if (jn(t[n])) {
const r = n === "x" || n === "y" ? "attr" + n.toUpperCase() : n;
e[r] = t[n]
} return e
}
function fb(t, e, n, r = {}, i = {}) {
return typeof e == "function" && (e = e(n !== void 0 ? n : t.custom, r, i)), typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function" && (e = e(n !== void 0 ? n : t.custom, r, i)), e
}
const Zs = t => Array.isArray(t),
V4 = t => Boolean(t && typeof t == "object" && t.mix && t.toValue),
hb = t => Zs(t) ? t[t.length - 1] || 0 : t;
function H4(t) {
const e = jn(t) ? t.get() : t;
return V4(e) ? e.toValue() : e
}
function U4({
scrapeMotionValuesFromProps: t,
createRenderState: e,
onMount: n
}, r, i, s) {
const d = {
latestValues: W4(r, i, s, t),
renderState: e()
};
return n && (d.mount = a => n(r, a, d)), d
}
const db = t => (e, n) => {
const r = E.exports.useContext(oc),
i = E.exports.useContext(Vs),
s = () => U4(t, e, r, i);
return n ? s() : Id(s)
};
function W4(t, e, n, r) {
const i = {},
s = r(t);
for (const u in s) i[u] = H4(s[u]);
let {
initial: d,
animate: a
} = t;
const o = lc(t),
c = $y(t);
e && c && !o && t.inherit !== !1 && (d === void 0 && (d = e.initial), a === void 0 && (a = e.animate));
let h = n ? n.initial === !1 : !1;
h = h || d === !1;
const l = h ? a : d;
return l && typeof l != "boolean" && !ac(l) && (Array.isArray(l) ? l : [l]).forEach(f => {
const p = fb(t, f);
if (!p) return;
const {
transitionEnd: m,
transition: g,
...v
} = p;
for (const y in v) {
let b = v[y];
if (Array.isArray(b)) {
const w = h ? b.length - 1 : 0;
b = b[w]
}
b !== null && (i[y] = b)
}
for (const y in m) i[y] = m[y]
}), i
}
const Y4 = {
useVisualState: db({
scrapeMotionValuesFromProps: ub,
createRenderState: ob,
onMount: (t, e, {
renderState: n,
latestValues: r
}) => {
try {
n.dimensions = typeof e.getBBox == "function" ? e.getBBox() : e.getBoundingClientRect()
} catch {
n.dimensions = {
x: 0,
y: 0,
width: 0,
height: 0
}
}
Hd(n, r, {
enableHardwareAcceleration: !1
}, t.transformTemplate), cb(e, n)
}
})
},
X4 = {
useVisualState: db({
scrapeMotionValuesFromProps: Ud,
createRenderState: Vd
})
};
function G4(t, {
forwardMotionProps: e = !1
}, n, r, i) {
return {
...Ld(t) ? Y4 : X4,
preloadedFeatures: n,
useRender: $4(e),
createVisualElement: r,
projectionNodeConstructor: i,
Component: t
}
}
var je;
(function(t) {
t.Animate = "animate", t.Hover = "whileHover", t.Tap = "whileTap", t.Drag = "whileDrag", t.Focus = "whileFocus", t.InView = "whileInView", t.Exit = "exit"
})(je || (je = {}));
function pb(t, e, n, r = {
passive: !0
}) {
return t.addEventListener(e, n, r), () => t.removeEventListener(e, n)
}
function Wd(t, e, n, r) {
E.exports.useEffect(() => {
const i = t.current;
if (n && i) return pb(i, e, n, r)
}, [t, e, n, r])
}
function K4({
whileFocus: t,
visualElement: e
}) {
const {
animationState: n
} = e, r = () => {
n && n.setActive(je.Focus, !0)
}, i = () => {
n && n.setActive(je.Focus, !1)
};
Wd(e, "focus", t ? r : void 0), Wd(e, "blur", t ? i : void 0)
}
function q4(t) {
return typeof PointerEvent < "u" && t instanceof PointerEvent ? t.pointerType === "mouse" : t instanceof MouseEvent
}
function Z4(t) {
return !!t.touches
}
function Q4(t) {
return e => {
const n = e instanceof MouseEvent;
(!n || n && e.button === 0) && t(e)
}
}
const J4 = {
pageX: 0,
pageY: 0
};
function eP(t, e = "page") {
const r = t.touches[0] || t.changedTouches[0] || J4;
return {
x: r[e + "X"],
y: r[e + "Y"]
}
}
function tP(t, e = "page") {
return {
x: t[e + "X"],
y: t[e + "Y"]
}
}
function nP(t, e = "page") {
return {
point: Z4(t) ? eP(t, e) : tP(t, e)
}
}
const gb = (t, e = !1) => {
const n = r => t(r, nP(r));
return e ? Q4(n) : n
},
rP = () => oi && window.onpointerdown === null,
iP = () => oi && window.ontouchstart === null,
oP = () => oi && window.onmousedown === null,
sP = {
pointerdown: "mousedown",
pointermove: "mousemove",
pointerup: "mouseup",
pointercancel: "mousecancel",
pointerover: "mouseover",
pointerout: "mouseout",
pointerenter: "mouseenter",
pointerleave: "mouseleave"
},
aP = {
pointerdown: "touchstart",
pointermove: "touchmove",
pointerup: "touchend",
pointercancel: "touchcancel"
};
function mb(t) {
return rP() ? t : iP() ? aP[t] : oP() ? sP[t] : t
}
function vb(t, e, n, r) {
return pb(t, mb(e), gb(n, e === "pointerdown"), r)
}
function Yd(t, e, n, r) {
return Wd(t, mb(e), n && gb(n, e === "pointerdown"), r)
}
function yb(t) {
let e = null;
return () => {
const n = () => {
e = null
};
return e === null ? (e = t, n) : !1
}
}
const bb = yb("dragHorizontal"),
wb = yb("dragVertical");
function lP(t) {
let e = !1;
if (t === "y") e = wb();
else if (t === "x") e = bb();
else {
const n = bb(),
r = wb();
n && r ? e = () => {
n(), r()
} : (n && n(), r && r())
}
return e
}
function xb() {
const t = lP(!0);
return t ? (t(), !1) : !0
}
function _b(t, e, n) {
return (r, i) => {
!q4(r) || xb() || (t.animationState && t.animationState.setActive(je.Hover, e), n && n(r, i))
}
}
function cP({
onHoverStart: t,
onHoverEnd: e,
whileHover: n,
visualElement: r
}) {
Yd(r, "pointerenter", t || n ? _b(r, !0, t) : void 0, {
passive: !t
}), Yd(r, "pointerleave", e || n ? _b(r, !1, e) : void 0, {
passive: !e
})
}
const Sb = (t, e) => e ? t === e ? !0 : Sb(t, e.parentElement) : !1;
function Cb(t) {
return E.exports.useEffect(() => () => t(), [])
}
function Tb(t, e) {
var n = {};
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
if (t != null && typeof Object.getOwnPropertySymbols == "function")
for (var i = 0, r = Object.getOwnPropertySymbols(t); i < r.length; i++) e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (n[r[i]] = t[r[i]]);
return n
}
var uP = function() {},
hc = function() {};
const Xd = (t, e, n) => Math.min(Math.max(n, t), e),
Gd = .001,
fP = .01,
kb = 10,
hP = .05,
dP = 1;
function pP({
duration: t = 800,
bounce: e = .25,
velocity: n = 0,
mass: r = 1
}) {
let i, s;
uP(t <= kb * 1e3);
let d = 1 - e;
d = Xd(hP, dP, d), t = Xd(fP, kb, t / 1e3), d < 1 ? (i = c => {
const h = c * d,
l = h * t,
u = h - n,
f = Kd(c, d),
p = Math.exp(-l);
return Gd - u / f * p
}, s = c => {
const l = c * d * t,
u = l * n + n,
f = Math.pow(d, 2) * Math.pow(c, 2) * t,
p = Math.exp(-l),
m = Kd(Math.pow(c, 2), d);
return (-i(c) + Gd > 0 ? -1 : 1) * ((u - f) * p) / m
}) : (i = c => {
const h = Math.exp(-c * t),
l = (c - n) * t + 1;
return -Gd + h * l
}, s = c => {
const h = Math.exp(-c * t),
l = (n - c) * (t * t);
return h * l
});
const a = 5 / t,
o = mP(i, s, a);
if (t = t * 1e3, isNaN(o)) return {
stiffness: 100,
damping: 10,
duration: t
}; {
const c = Math.pow(o, 2) * r;
return {
stiffness: c,
damping: d * 2 * Math.sqrt(r * c),
duration: t
}
}
}
const gP = 12;
function mP(t, e, n) {
let r = n;
for (let i = 1; i < gP; i++) r = r - t(r) / e(r);
return r
}
function Kd(t, e) {
return t * Math.sqrt(1 - e * e)
}
const vP = ["duration", "bounce"],
yP = ["stiffness", "damping", "mass"];
function Eb(t, e) {
return e.some(n => t[n] !== void 0)
}
function bP(t) {
let e = Object.assign({
velocity: 0,
stiffness: 100,
damping: 10,
mass: 1,
isResolvedFromDuration: !1
}, t);
if (!Eb(t, yP) && Eb(t, vP)) {
const n = pP(t);
e = Object.assign(Object.assign(Object.assign({}, e), n), {
velocity: 0,
mass: 1
}), e.isResolvedFromDuration = !0
}
return e
}
function qd(t) {
var {
from: e = 0,
to: n = 1,
restSpeed: r = 2,
restDelta: i
} = t, s = Tb(t, ["from", "to", "restSpeed", "restDelta"]);
const d = {
done: !1,
value: e
};
let {
stiffness: a,
damping: o,
mass: c,
velocity: h,
duration: l,
isResolvedFromDuration: u
} = bP(s), f = Ob, p = Ob;
function m() {
const g = h ? -(h / 1e3) : 0,
v = n - e,
y = o / (2 * Math.sqrt(a * c)),
b = Math.sqrt(a / c) / 1e3;
if (i === void 0 && (i = Math.min(Math.abs(n - e) / 100, .4)), y < 1) {
const w = Kd(b, y);
f = x => {
const S = Math.exp(-y * b * x);
return n - S * ((g + y * b * v) / w * Math.sin(w * x) + v * Math.cos(w * x))
}, p = x => {
const S = Math.exp(-y * b * x);
return y * b * S * (Math.sin(w * x) * (g + y * b * v) / w + v * Math.cos(w * x)) - S * (Math.cos(w * x) * (g + y * b * v) - w * v * Math.sin(w * x))
}
} else if (y === 1) f = w => n - Math.exp(-b * w) * (v + (g + b * v) * w);
else {
const w = b * Math.sqrt(y * y - 1);
f = x => {
const S = Math.exp(-y * b * x),
T = Math.min(w * x, 300);
return n - S * ((g + y * b * v) * Math.sinh(T) + w * v * Math.cosh(T)) / w
}
}
}
return m(), {
next: g => {
const v = f(g);
if (u) d.done = g >= l;
else {
const y = p(g) * 1e3,
b = Math.abs(y) <= r,
w = Math.abs(n - v) <= i;
d.done = b && w
}
return d.value = d.done ? n : v, d
},
flipTarget: () => {
h = -h, [e, n] = [n, e], m()
}
}
}
qd.needsInterpolation = (t, e) => typeof t == "string" || typeof e == "string";
const Ob = t => 0,
Pb = (t, e, n) => {
const r = e - t;
return r === 0 ? 1 : (n - t) / r
},
Zd = (t, e, n) => -n * t + n * e + t;
function Qd(t, e, n) {
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t
}
function Mb({
hue: t,
saturation: e,
lightness: n,
alpha: r
}) {
t /= 360, e /= 100, n /= 100;
let i = 0,
s = 0,
d = 0;
if (!e) i = s = d = n;
else {
const a = n < .5 ? n * (1 + e) : n + e - n * e,
o = 2 * n - a;
i = Qd(o, a, t + 1 / 3), s = Qd(o, a, t), d = Qd(o, a, t - 1 / 3)
}
return {
red: Math.round(i * 255),
green: Math.round(s * 255),
blue: Math.round(d * 255),
alpha: r
}
}
const wP = (t, e, n) => {
const r = t * t,
i = e * e;
return Math.sqrt(Math.max(0, n * (i - r) + r))
},
xP = [jd, Er, ai],
Ab = t => xP.find(e => e.test(t)),
Db = (t, e) => {
let n = Ab(t),
r = Ab(e),
i = n.parse(t),
s = r.parse(e);
n === ai && (i = Mb(i), n = Er), r === ai && (s = Mb(s), r = Er);
const d = Object.assign({}, i);
return a => {
for (const o in d) o !== "alpha" && (d[o] = wP(i[o], s[o], a));
return d.alpha = Zd(i.alpha, s.alpha, a), n.transform(d)
}
},
_P = t => typeof t == "number",
SP = (t, e) => n => e(t(n)),
Jd = (...t) => t.reduce(SP);
function Rb(t, e) {
return _P(t) ? n => Zd(t, e, n) : kt.test(t) ? Db(t, e) : Fb(t, e)
}
const Ib = (t, e) => {
const n = [...t],
r = n.length,
i = t.map((s, d) => Rb(s, e[d]));
return s => {
for (let d = 0; d < r; d++) n[d] = i[d](s);
return n
}
},
CP = (t, e) => {
const n = Object.assign(Object.assign({}, t), e),
r = {};
for (const i in n) t[i] !== void 0 && e[i] !== void 0 && (r[i] = Rb(t[i], e[i]));
return i => {
for (const s in r) n[s] = r[s](i);
return n
}
};
function Lb(t) {
const e = li.parse(t),
n = e.length;
let r = 0,
i = 0,
s = 0;
for (let d = 0; d < n; d++) r || typeof e[d] == "number" ? r++ : e[d].hue !== void 0 ? s++ : i++;
return {
parsed: e,
numNumbers: r,
numRGB: i,
numHSL: s
}
}
const Fb = (t, e) => {
const n = li.createTransformer(e),
r = Lb(t),
i = Lb(e);
return r.numHSL === i.numHSL && r.numRGB === i.numRGB && r.numNumbers >= i.numNumbers ? Jd(Ib(r.parsed, i.parsed), n) : d => `${d>0?e:t}`
},
TP = (t, e) => n => Zd(t, e, n);
function kP(t) {
if (typeof t == "number") return TP;
if (typeof t == "string") return kt.test(t) ? Db : Fb;
if (Array.isArray(t)) return Ib;
if (typeof t == "object") return CP
}
function EP(t, e, n) {
const r = [],
i = n || kP(t[0]),
s = t.length - 1;
for (let d = 0; d < s; d++) {
let a = i(t[d], t[d + 1]);
if (e) {
const o = Array.isArray(e) ? e[d] : e;
a = Jd(o, a)
}
r.push(a)
}
return r
}
function OP([t, e], [n]) {
return r => n(Pb(t, e, r))
}
function PP(t, e) {
const n = t.length,
r = n - 1;
return i => {
let s = 0,
d = !1;
if (i <= t[0] ? d = !0 : i >= t[r] && (s = r - 1, d = !0), !d) {
let o = 1;
for (; o < n && !(t[o] > i || o === r); o++);
s = o - 1
}
const a = Pb(t[s], t[s + 1], i);
return e[s](a)
}
}
function zb(t, e, {
clamp: n = !0,
ease: r,
mixer: i
} = {}) {
const s = t.length;
hc(s === e.length), hc(!r || !Array.isArray(r) || r.length === s - 1), t[0] > t[s - 1] && (t = [].concat(t), e = [].concat(e), t.reverse(), e.reverse());
const d = EP(e, r, i),
a = s === 2 ? OP(t, d) : PP(t, d);
return n ? o => a(Xd(t[0], t[s - 1], o)) : a
}
const dc = t => e => 1 - t(1 - e),
ep = t => e => e <= .5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2,
MP = t => e => Math.pow(e, t),
Nb = t => e => e * e * ((t + 1) * e - t),
AP = t => {
const e = Nb(t);
return n => (n *= 2) < 1 ? .5 * e(n) : .5 * (2 - Math.pow(2, -10 * (n - 1)))
},
jb = 1.525,
DP = 4 / 11,
RP = 8 / 11,
IP = 9 / 10,
Bb = t => t,
tp = MP(2),
LP = dc(tp),
$b = ep(tp),
Vb = t => 1 - Math.sin(Math.acos(t)),
Hb = dc(Vb),
FP = ep(Hb),
np = Nb(jb),
zP = dc(np),
NP = ep(np),
jP = AP(jb),
BP = 4356 / 361,
$P = 35442 / 1805,
VP = 16061 / 1805,
pc = t => {
if (t === 1 || t === 0) return t;
const e = t * t;
return t < DP ? 7.5625 * e : t < RP ? 9.075 * e - 9.9 * t + 3.4 : t < IP ? BP * e - $P * t + VP : 10.8 * t * t - 20.52 * t + 10.72
},
HP = dc(pc),
UP = t => t < .5 ? .5 * (1 - pc(1 - t * 2)) : .5 * pc(t * 2 - 1) + .5;
function WP(t, e) {
return t.map(() => e || $b).splice(0, t.length - 1)
}
function YP(t) {
const e = t.length;
return t.map((n, r) => r !== 0 ? r / (e - 1) : 0)
}
function XP(t, e) {
return t.map(n => n * e)
}
function gc({
from: t = 0,
to: e = 1,
ease: n,
offset: r,
duration: i = 300
}) {
const s = {
done: !1,
value: t
},
d = Array.isArray(e) ? e : [t, e],
a = XP(r && r.length === d.length ? r : YP(d), i);
function o() {
return zb(a, d, {
ease: Array.isArray(n) ? n : WP(d, n)
})
}
let c = o();
return {
next: h => (s.value = c(h), s.done = h >= i, s),
flipTarget: () => {
d.reverse(), c = o()
}
}
}
function GP({
velocity: t = 0,
from: e = 0,
power: n = .8,
timeConstant: r = 350,
restDelta: i = .5,
modifyTarget: s
}) {
const d = {
done: !1,
value: e
};
let a = n * t;
const o = e + a,
c = s === void 0 ? o : s(o);
return c !== o && (a = c - e), {
next: h => {
const l = -a * Math.exp(-h / r);
return d.done = !(l > i || l < -i), d.value = d.done ? c : c + l, d
},
flipTarget: () => {}
}
}
const Ub = {
keyframes: gc,
spring: qd,
decay: GP
};
function KP(t) {
if (Array.isArray(t.to)) return gc;
if (Ub[t.type]) return Ub[t.type];
const e = new Set(Object.keys(t));
return e.has("ease") || e.has("duration") && !e.has("dampingRatio") ? gc : e.has("dampingRatio") || e.has("stiffness") || e.has("mass") || e.has("damping") || e.has("restSpeed") || e.has("restDelta") ? qd : gc
}
const Wb = 1 / 60 * 1e3,
qP = typeof performance < "u" ? () => performance.now() : () => Date.now(),
Yb = typeof window < "u" ? t => window.requestAnimationFrame(t) : t => setTimeout(() => t(qP()), Wb);
function ZP(t) {
let e = [],
n = [],
r = 0,
i = !1,
s = !1;
const d = new WeakSet,
a = {
schedule: (o, c = !1, h = !1) => {
const l = h && i,
u = l ? e : n;
return c && d.add(o), u.indexOf(o) === -1 && (u.push(o), l && i && (r = e.length)), o
},
cancel: o => {
const c = n.indexOf(o);
c !== -1 && n.splice(c, 1), d.delete(o)
},
process: o => {
if (i) {
s = !0;
return
}
if (i = !0, [e, n] = [n, e], n.length = 0, r = e.length, r)
for (let c = 0; c < r; c++) {
const h = e[c];
h(o), d.has(h) && (a.schedule(h), t())
}
i = !1, s && (s = !1, a.process(o))
}
};
return a
}
const QP = 40;
let rp = !0,
Qs = !1,
ip = !1;
const wo = {
delta: 0,
timestamp: 0
},
Js = ["read", "update", "preRender", "render", "postRender"],
mc = Js.reduce((t, e) => (t[e] = ZP(() => Qs = !0), t), {}),
xo = Js.reduce((t, e) => {
const n = mc[e];
return t[e] = (r, i = !1, s = !1) => (Qs || e3(), n.schedule(r, i, s)), t
}, {}),
op = Js.reduce((t, e) => (t[e] = mc[e].cancel, t), {});
Js.reduce((t, e) => (t[e] = () => mc[e].process(wo), t), {});
const JP = t => mc[t].process(wo),
Xb = t => {
Qs = !1, wo.delta = rp ? Wb : Math.max(Math.min(t - wo.timestamp, QP), 1), wo.timestamp = t, ip = !0, Js.forEach(JP), ip = !1, Qs && (rp = !1, Yb(Xb))
},
e3 = () => {
Qs = !0, rp = !0, ip || Yb(Xb)
},
Gb = () => wo;
function Kb(t, e, n = 0) {
return t - e - n
}
function t3(t, e, n = 0, r = !0) {
return r ? Kb(e + -t, e, n) : e - (t - e) + n
}
function n3(t, e, n, r) {
return r ? t >= e + n : t <= -n
}
const r3 = t => {
const e = ({
delta: n
}) => t(n);
return {
start: () => xo.update(e, !0),
stop: () => op.update(e)
}
};
function qb(t) {
var e, n, {
from: r,
autoplay: i = !0,
driver: s = r3,
elapsed: d = 0,
repeat: a = 0,
repeatType: o = "loop",
repeatDelay: c = 0,
onPlay: h,
onStop: l,
onComplete: u,
onRepeat: f,
onUpdate: p
} = t,
m = Tb(t, ["from", "autoplay", "driver", "elapsed", "repeat", "repeatType", "repeatDelay", "onPlay", "onStop", "onComplete", "onRepeat", "onUpdate"]);
let {
to: g
} = m, v, y = 0, b = m.duration, w, x = !1, S = !0, T;
const P = KP(m);
!((n = (e = P).needsInterpolation) === null || n === void 0) && n.call(e, r, g) && (T = zb([0, 100], [r, g], {
clamp: !1
}), r = 0, g = 100);
const I = P(Object.assign(Object.assign({}, m), {
from: r,
to: g
}));
function z() {
y++, o === "reverse" ? (S = y % 2 === 0, d = t3(d, b, c, S)) : (d = Kb(d, b, c), o === "mirror" && I.flipTarget()), x = !1, f && f()
}
function H() {
v.stop(), u && u()
}
function ee(ne) {
if (S || (ne = -ne), d += ne, !x) {
const Z = I.next(Math.max(0, d));
w = Z.value, T && (w = T(w)), x = S ? Z.done : d <= 0
}
p == null || p(w), x && (y === 0 && (b != null || (b = d)), y < a ? n3(d, b, c, S) && z() : H())
}
function te() {
h == null || h(), v = s(ee), v.start()
}
return i && te(), {
stop: () => {
l == null || l(), v.stop()
}
}
}
function Zb(t, e) {
return e ? t * (1e3 / e) : 0
}
function i3({
from: t = 0,
velocity: e = 0,
min: n,
max: r,
power: i = .8,
timeConstant: s = 750,
bounceStiffness: d = 500,
bounceDamping: a = 10,
restDelta: o = 1,
modifyTarget: c,
driver: h,
onUpdate: l,
onComplete: u,
onStop: f
}) {
let p;
function m(b) {
return n !== void 0 && b < n || r !== void 0 && b > r
}
function g(b) {
return n === void 0 ? r : r === void 0 || Math.abs(n - b) < Math.abs(r - b) ? n : r
}
function v(b) {
p == null || p.stop(), p = qb(Object.assign(Object.assign({}, b), {
driver: h,
onUpdate: w => {
var x;
l == null || l(w), (x = b.onUpdate) === null || x === void 0 || x.call(b, w)
},
onComplete: u,
onStop: f
}))
}
function y(b) {
v(Object.assign({
type: "spring",
stiffness: d,
damping: a,
restDelta: o
}, b))
}
if (m(t)) y({
from: t,
velocity: e,
to: g(t)
});
else {
let b = i * e + t;
typeof c < "u" && (b = c(b));
const w = g(b),
x = w === n ? -1 : 1;
let S, T;
const P = I => {
S = T, T = I, e = Zb(I - S, Gb().delta), (x === 1 && I > w || x === -1 && I < w) && y({
from: I,
to: w,
velocity: e
})
};
v({
type: "decay",
from: t,
velocity: e,
timeConstant: s,
power: i,
restDelta: o,
modifyTarget: c,
onUpdate: m(b) ? P : void 0
})
}
return {
stop: () => p == null ? void 0 : p.stop()
}
}
const Qb = (t, e) => 1 - 3 * e + 3 * t,
Jb = (t, e) => 3 * e - 6 * t,
ew = t => 3 * t,
vc = (t, e, n) => ((Qb(e, n) * t + Jb(e, n)) * t + ew(e)) * t,
tw = (t, e, n) => 3 * Qb(e, n) * t * t + 2 * Jb(e, n) * t + ew(e),
o3 = 1e-7,
s3 = 10;
function a3(t, e, n, r, i) {
let s, d, a = 0;
do d = e + (n - e) / 2, s = vc(d, r, i) - t, s > 0 ? n = d : e = d; while (Math.abs(s) > o3 && ++a < s3);
return d
}
const l3 = 8,
c3 = .001;
function u3(t, e, n, r) {
for (let i = 0; i < l3; ++i) {
const s = tw(e, n, r);
if (s === 0) return e;
e -= (vc(e, n, r) - t) / s
}
return e
}
const yc = 11,
bc = 1 / (yc - 1);
function f3(t, e, n, r) {
if (t === e && n === r) return Bb;
const i = new Float32Array(yc);
for (let d = 0; d < yc; ++d) i[d] = vc(d * bc, t, n);
function s(d) {
let a = 0,
o = 1;
const c = yc - 1;
for (; o !== c && i[o] <= d; ++o) a += bc;
--o;
const h = (d - i[o]) / (i[o + 1] - i[o]),
l = a + h * bc,
u = tw(l, t, n);
return u >= c3 ? u3(d, l, t, n) : u === 0 ? l : a3(d, a, a + bc, t, n)
}
return d => d === 0 || d === 1 ? d : vc(s(d), e, r)
}
function h3({
onTap: t,
onTapStart: e,
onTapCancel: n,
whileTap: r,
visualElement: i
}) {
const s = t || e || n || r,
d = E.exports.useRef(!1),
a = E.exports.useRef(null),
o = {
passive: !(e || t || n || f)
};
function c() {
a.current && a.current(), a.current = null
}
function h() {
return c(), d.current = !1, i.animationState && i.animationState.setActive(je.Tap, !1), !xb()
}
function l(p, m) {
!h() || (Sb(i.getInstance(), p.target) ? t && t(p, m) : n && n(p, m))
}
function u(p, m) {
!h() || n && n(p, m)
}
function f(p, m) {
c(), !d.current && (d.current = !0, a.current = Jd(vb(window, "pointerup", l, o), vb(window, "pointercancel", u, o)), i.animationState && i.animationState.setActive(je.Tap, !0), e && e(p, m))
}
Yd(i, "pointerdown", s ? f : void 0, o), Cb(c)
}
const d3 = "production",
nw = typeof process > "u" || process.env === void 0 ? d3 : "production",
rw = new Set;
function iw(t, e, n) {
t || rw.has(e) || (console.warn(e), n && console.warn(n), rw.add(e))
}
const sp = new WeakMap,
ap = new WeakMap,
p3 = t => {
const e = sp.get(t.target);
e && e(t)
},
g3 = t => {
t.forEach(p3)
};
function m3({
root: t,
...e
}) {
const n = t || document;
ap.has(n) || ap.set(n, {});
const r = ap.get(n),
i = JSON.stringify(e);
return r[i] || (r[i] = new IntersectionObserver(g3, {
root: t,
...e
})), r[i]
}
function v3(t, e, n) {
const r = m3(e);
return sp.set(t, n), r.observe(t), () => {
sp.delete(t), r.unobserve(t)
}
}
function y3({
visualElement: t,
whileInView: e,
onViewportEnter: n,
onViewportLeave: r,
viewport: i = {}
}) {
const s = E.exports.useRef({
hasEnteredView: !1,
isInView: !1
});
let d = Boolean(e || n || r);
i.once && s.current.hasEnteredView && (d = !1), (typeof IntersectionObserver > "u" ? x3 : w3)(d, s.current, t, i)
}
const b3 = {
some: 0,
all: 1
};
function w3(t, e, n, {
root: r,
margin: i,
amount: s = "some",
once: d
}) {
E.exports.useEffect(() => {
if (!t) return;
const a = {
root: r == null ? void 0 : r.current,
rootMargin: i,
threshold: typeof s == "number" ? s : b3[s]
},
o = c => {
const {
isIntersecting: h
} = c;
if (e.isInView === h || (e.isInView = h, d && !h && e.hasEnteredView)) return;
h && (e.hasEnteredView = !0), n.animationState && n.animationState.setActive(je.InView, h);
const l = n.getProps(),
u = h ? l.onViewportEnter : l.onViewportLeave;
u && u(c)
};
return v3(n.getInstance(), a, o)
}, [t, r, i, s])
}
function x3(t, e, n, {
fallback: r = !0
}) {
E.exports.useEffect(() => {
!t || !r || (nw !== "production" && iw(!1, "IntersectionObserver not available on this device. whileInView animations will trigger on mount."), requestAnimationFrame(() => {
e.hasEnteredView = !0;
const {
onViewportEnter: i
} = n.getProps();
i && i(null), n.animationState && n.animationState.setActive(je.InView, !0)
}))
}, [t])
}
const _o = t => e => (t(e), null),
_3 = {
inView: _o(y3),
tap: _o(h3),
focus: _o(K4),
hover: _o(cP)
};
function S3() {
const t = E.exports.useContext(Vs);
if (t === null) return [!0, null];
const {
isPresent: e,
onExitComplete: n,
register: r
} = t, i = E.exports.useId();
return E.exports.useEffect(() => r(i), []), !e && n ? [!1, () => n && n(i)] : [!0]
}
function ow(t, e) {
if (!Array.isArray(e)) return !1;
const n = e.length;
if (n !== t.length) return !1;
for (let r = 0; r < n; r++)
if (e[r] !== t[r]) return !1;
return !0
}
const lp = t => t * 1e3,
C3 = {
linear: Bb,
easeIn: tp,
easeInOut: $b,
easeOut: LP,
circIn: Vb,
circInOut: FP,
circOut: Hb,
backIn: np,
backInOut: NP,
backOut: zP,
anticipate: jP,
bounceIn: HP,
bounceInOut: UP,
bounceOut: pc
},
sw = t => {
if (Array.isArray(t)) {
hc(t.length === 4);
const [e, n, r, i] = t;
return f3(e, n, r, i)
} else if (typeof t == "string") return C3[t];
return t
},
T3 = t => Array.isArray(t) && typeof t[0] != "number",
aw = (t, e) => t === "zIndex" ? !1 : !!(typeof e == "number" || Array.isArray(e) || typeof e == "string" && li.test(e) && !e.startsWith("url(")),
ci = () => ({
type: "spring",
stiffness: 500,
damping: 25,
restSpeed: 10
}),
wc = t => ({
type: "spring",
stiffness: 550,
damping: t === 0 ? 2 * Math.sqrt(550) : 30,
restSpeed: 10
}),
cp = () => ({
type: "keyframes",
ease: "linear",
duration: .3
}),
k3 = t => ({
type: "keyframes",
duration: .8,
values: t
}),
lw = {
x: ci,
y: ci,
z: ci,
rotate: ci,
rotateX: ci,
rotateY: ci,
rotateZ: ci,
scaleX: wc,
scaleY: wc,
scale: wc,
opacity: cp,
backgroundColor: cp,
color: cp,
default: wc
},
E3 = (t, e) => {
let n;
return Zs(e) ? n = k3 : n = lw[t] || lw.default, {
to: e,
...n(e)
}
},
O3 = {
...tb,
color: kt,
backgroundColor: kt,
outlineColor: kt,
fill: kt,
stroke: kt,
borderColor: kt,
borderTopColor: kt,
borderRightColor: kt,
borderBottomColor: kt,
borderLeftColor: kt,
filter: Bd,
WebkitFilter: Bd
},
up = t => O3[t];
function fp(t, e) {
var n;
let r = up(t);
return r !== Bd && (r = li), (n = r.getAnimatableNone) === null || n === void 0 ? void 0 : n.call(r, e)
}
const P3 = {
current: !1
};
function M3({
when: t,
delay: e,
delayChildren: n,
staggerChildren: r,
staggerDirection: i,
repeat: s,
repeatType: d,
repeatDelay: a,
from: o,
...c
}) {
return !!Object.keys(c).length
}
function A3({
ease: t,
times: e,
yoyo: n,
flip: r,
loop: i,
...s
}) {
const d = {
...s
};
return e && (d.offset = e), s.duration && (d.duration = lp(s.duration)), s.repeatDelay && (d.repeatDelay = lp(s.repeatDelay)), t && (d.ease = T3(t) ? t.map(sw) : sw(t)), s.type === "tween" && (d.type = "keyframes"), (n || i || r) && (n ? d.repeatType = "reverse" : i ? d.repeatType = "loop" : r && (d.repeatType = "mirror"), d.repeat = i || n || r || s.repeat), s.type !== "spring" && (d.type = "keyframes"), d
}
function D3(t, e) {
var n, r;
return (r = (n = (fw(t, e) || {}).delay) !== null && n !== void 0 ? n : t.delay) !== null && r !== void 0 ? r : 0
}
function R3(t) {
return Array.isArray(t.to) && t.to[0] === null && (t.to = [...t.to], t.to[0] = t.from), t
}
function I3(t, e, n) {
return Array.isArray(e.to) && t.duration === void 0 && (t.duration = .8), R3(e), M3(t) || (t = {
...t,
...E3(n, e.to)
}), {
...e,
...A3(t)
}
}
function L3(t, e, n, r, i) {
const s = fw(r, t) || {};
let d = s.from !== void 0 ? s.from : e.get();
const a = aw(t, n);
d === "none" && a && typeof n == "string" ? d = fp(t, n) : cw(d) && typeof n == "string" ? d = uw(n) : !Array.isArray(n) && cw(n) && typeof d == "string" && (n = uw(d));
const o = aw(t, d);
function c() {
const l = {
from: d,
to: n,
velocity: e.getVelocity(),
onComplete: i,
onUpdate: u => e.set(u)
};
return s.type === "inertia" || s.type === "decay" ? i3({
...l,
...s
}) : qb({
...I3(s, l, t),
onUpdate: u => {
l.onUpdate(u), s.onUpdate && s.onUpdate(u)
},
onComplete: () => {
l.onComplete(), s.onComplete && s.onComplete()
}
})
}
function h() {
const l = hb(n);
return e.set(l), i(), s.onUpdate && s.onUpdate(l), s.onComplete && s.onComplete(), {
stop: () => {}
}
}
return !o || !a || s.type === !1 ? h : c
}
function cw(t) {
return t === 0 || typeof t == "string" && parseFloat(t) === 0 && t.indexOf(" ") === -1
}
function uw(t) {
return typeof t == "number" ? 0 : fp("", t)
}
function fw(t, e) {
return t[e] || t.default || t
}
function F3(t, e, n, r = {}) {
return P3.current && (r = {
type: !1
}), e.start(i => {
let s, d;
const a = L3(t, e, n, r, i),
o = D3(r, t),
c = () => d = a();
return o ? s = window.setTimeout(c, lp(o)) : c(), () => {
clearTimeout(s), d && d.stop()
}
})
}
const z3 = t => /^\-?\d*\.?\d+$/.test(t),
N3 = t => /^0[^.\s]+$/.test(t);
function j3(t, e) {
t.indexOf(e) === -1 && t.push(e)
}
function B3(t, e) {
const n = t.indexOf(e);
n > -1 && t.splice(n, 1)
}
class xc {
constructor() {
this.subscriptions = []
}
add(e) {
return j3(this.subscriptions, e), () => B3(this.subscriptions, e)
}
notify(e, n, r) {
const i = this.subscriptions.length;
if (!!i)
if (i === 1) this.subscriptions[0](e, n, r);
else
for (let s = 0; s < i; s++) {
const d = this.subscriptions[s];
d && d(e, n, r)
}
}
getSize() {
return this.subscriptions.length
}
clear() {
this.subscriptions.length = 0
}
}
const $3 = t => !isNaN(parseFloat(t));
class V3 {
constructor(e) {
this.version = "7.5.1", this.timeDelta = 0, this.lastUpdated = 0, this.updateSubscribers = new xc, this.velocityUpdateSubscribers = new xc, this.renderSubscribers = new xc, this.canTrackVelocity = !1, this.updateAndNotify = (n, r = !0) => {
this.prev = this.current, this.current = n;
const {
delta: i,
timestamp: s
} = Gb();
this.lastUpdated !== s && (this.timeDelta = i, this.lastUpdated = s, xo.postRender(this.scheduleVelocityCheck)), this.prev !== this.current && this.updateSubscribers.notify(this.current), this.velocityUpdateSubscribers.getSize() && this.velocityUpdateSubscribers.notify(this.getVelocity()), r && this.renderSubscribers.notify(this.current)
}, this.scheduleVelocityCheck = () => xo.postRender(this.velocityCheck), this.velocityCheck = ({
timestamp: n
}) => {
n !== this.lastUpdated && (this.prev = this.current, this.velocityUpdateSubscribers.notify(this.getVelocity()))
}, this.hasAnimated = !1, this.prev = this.current = e, this.canTrackVelocity = $3(this.current)
}
onChange(e) {
return this.updateSubscribers.add(e)
}
clearListeners() {
this.updateSubscribers.clear()
}
onRenderRequest(e) {
return e(this.get()), this.renderSubscribers.add(e)
}
attach(e) {
this.passiveEffect = e
}
set(e, n = !0) {
!n || !this.passiveEffect ? this.updateAndNotify(e, n) : this.passiveEffect(e, this.updateAndNotify)
}
get() {
return this.current
}
getPrevious() {
return this.prev
}
getVelocity() {
return this.canTrackVelocity ? Zb(parseFloat(this.current) - parseFloat(this.prev), this.timeDelta) : 0
}
start(e) {
return this.stop(), new Promise(n => {
this.hasAnimated = !0, this.stopAnimation = e(n)
}).then(() => this.clearAnimation())
}
stop() {
this.stopAnimation && this.stopAnimation(), this.clearAnimation()
}
isAnimating() {
return !!this.stopAnimation
}
clearAnimation() {
this.stopAnimation = null
}
destroy() {
this.updateSubscribers.clear(), this.renderSubscribers.clear(), this.stop()
}
}
function ea(t) {
return new V3(t)
}
const hw = t => e => e.test(t),
dw = [si, we, bo, kr, v4, m4, {
test: t => t === "auto",
parse: t => t
}],
ta = t => dw.find(hw(t)),
H3 = [...dw, kt, li],
U3 = t => H3.find(hw(t));
function W3(t) {
const e = {};
return t.forEachValue((n, r) => e[r] = n.get()), e
}
function Y3(t) {
const e = {};
return t.forEachValue((n, r) => e[r] = n.getVelocity()), e
}
function _c(t, e, n) {
const r = t.getProps();
return fb(r, e, n !== void 0 ? n : r.custom, W3(t), Y3(t))
}
function X3(t, e, n) {
t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, ea(n))
}
function G3(t, e) {
const n = _c(t, e);
let {
transitionEnd: r = {},
transition: i = {},
...s
} = n ? t.makeTargetAnimatable(n, !1) : {};
s = {
...s,
...r
};
for (const d in s) {
const a = hb(s[d]);
X3(t, d, a)
}
}
function K3(t, e, n) {
var r, i;
const s = Object.keys(e).filter(a => !t.hasValue(a)),
d = s.length;
if (!!d)
for (let a = 0; a < d; a++) {
const o = s[a],
c = e[o];
let h = null;
Array.isArray(c) && (h = c[0]), h === null && (h = (i = (r = n[o]) !== null && r !== void 0 ? r : t.readValue(o)) !== null && i !== void 0 ? i : e[o]), h != null && (typeof h == "string" && (z3(h) || N3(h)) ? h = parseFloat(h) : !U3(h) && li.test(c) && (h = fp(o, c)), t.addValue(o, ea(h)), n[o] === void 0 && (n[o] = h), t.setBaseTarget(o, h))
}
}
function q3(t, e) {
return e ? (e[t] || e.default || e).from : void 0
}
function Z3(t, e, n) {
var r;
const i = {};
for (const s in t) {
const d = q3(s, e);
i[s] = d !== void 0 ? d : (r = n.getValue(s)) === null || r === void 0 ? void 0 : r.get()
}
return i
}
function Sc(t) {
return Boolean(jn(t) && t.add)
}
function Q3(t, e, n = {}) {
t.notifyAnimationStart(e);
let r;
if (Array.isArray(e)) {
const i = e.map(s => hp(t, s, n));
r = Promise.all(i)
} else if (typeof e == "string") r = hp(t, e, n);
else {
const i = typeof e == "function" ? _c(t, e, n.custom) : e;
r = pw(t, i, n)
}
return r.then(() => t.notifyAnimationComplete(e))
}
function hp(t, e, n = {}) {
var r;
const i = _c(t, e, n.custom);
let {
transition: s = t.getDefaultTransition() || {}
} = i || {};
n.transitionOverride && (s = n.transitionOverride);
const d = i ? () => pw(t, i, n) : () => Promise.resolve(),
a = !((r = t.variantChildren) === null || r === void 0) && r.size ? (c = 0) => {
const {
delayChildren: h = 0,
staggerChildren: l,
staggerDirection: u
} = s;
return J3(t, e, h + c, l, u, n)
} : () => Promise.resolve(),
{
when: o
} = s;
if (o) {
const [c, h] = o === "beforeChildren" ? [d, a] : [a, d];
return c().then(h)
} else return Promise.all([d(), a(n.delay)])
}
function pw(t, e, {
delay: n = 0,
transitionOverride: r,
type: i
} = {}) {
var s;
let {
transition: d = t.getDefaultTransition(),
transitionEnd: a,
...o
} = t.makeTargetAnimatable(e);
const c = t.getValue("willChange");
r && (d = r);
const h = [],
l = i && ((s = t.animationState) === null || s === void 0 ? void 0 : s.getState()[i]);
for (const u in o) {
const f = t.getValue(u),
p = o[u];
if (!f || p === void 0 || l && tM(l, u)) continue;
let m = {
delay: n,
...d
};
t.shouldReduceMotion && Ws.has(u) && (m = {
...m,
type: !1,
delay: 0
});
let g = F3(u, f, p, m);
Sc(c) && (c.add(u), g = g.then(() => c.remove(u))), h.push(g)
}
return Promise.all(h).then(() => {
a && G3(t, a)
})
}
function J3(t, e, n = 0, r = 0, i = 1, s) {
const d = [],
a = (t.variantChildren.size - 1) * r,
o = i === 1 ? (c = 0) => c * r : (c = 0) => a - c * r;
return Array.from(t.variantChildren).sort(eM).forEach((c, h) => {
d.push(hp(c, e, {
...s,
delay: n + o(h)
}).then(() => c.notifyAnimationComplete(e)))
}), Promise.all(d)
}
function eM(t, e) {
return t.sortNodePosition(e)
}
function tM({
protectedKeys: t,
needsAnimating: e
}, n) {
const r = t.hasOwnProperty(n) && e[n] !== !0;
return e[n] = !1, r
}
const dp = [je.Animate, je.InView, je.Focus, je.Hover, je.Tap, je.Drag, je.Exit],
nM = [...dp].reverse(),
rM = dp.length;
function iM(t) {
return e => Promise.all(e.map(({
animation: n,
options: r
}) => Q3(t, n, r)))
}
function oM(t) {
let e = iM(t);
const n = aM();
let r = !0;
const i = (o, c) => {
const h = _c(t, c);
if (h) {
const {
transition: l,
transitionEnd: u,
...f
} = h;
o = {
...o,
...f,
...u
}
}
return o
};
function s(o) {
e = o(t)
}
function d(o, c) {
var h;
const l = t.getProps(),
u = t.getVariantContext(!0) || {},
f = [],
p = new Set;
let m = {},
g = 1 / 0;
for (let y = 0; y < rM; y++) {
const b = nM[y],
w = n[b],
x = (h = l[b]) !== null && h !== void 0 ? h : u[b],
S = Hs(x),
T = b === c ? w.isActive : null;
T === !1 && (g = y);
let P = x === u[b] && x !== l[b] && S;
if (P && r && t.manuallyAnimateOnMount && (P = !1), w.protectedKeys = {
...m
}, !w.isActive && T === null || !x && !w.prevProp || ac(x) || typeof x == "boolean") continue;
const I = sM(w.prevProp, x);
let z = I || b === c && w.isActive && !P && S || y > g && S;
const H = Array.isArray(x) ? x : [x];
let ee = H.reduce(i, {});
T === !1 && (ee = {});
const {
prevResolvedValues: te = {}
} = w, ne = {
...te,
...ee
}, Z = ie => {
z = !0, p.delete(ie), w.needsAnimating[ie] = !0
};
for (const ie in ne) {
const ce = ee[ie],
V = te[ie];
m.hasOwnProperty(ie) || (ce !== V ? Zs(ce) && Zs(V) ? !ow(ce, V) || I ? Z(ie) : w.protectedKeys[ie] = !0 : ce !== void 0 ? Z(ie) : p.add(ie) : ce !== void 0 && p.has(ie) ? Z(ie) : w.protectedKeys[ie] = !0)
}
w.prevProp = x, w.prevResolvedValues = ee, w.isActive && (m = {
...m,
...ee
}), r && t.blockInitialAnimation && (z = !1), z && !P && f.push(...H.map(ie => ({
animation: ie,
options: {
type: b,
...o
}
})))
}
if (p.size) {
const y = {};
p.forEach(b => {
const w = t.getBaseTarget(b);
w !== void 0 && (y[b] = w)
}), f.push({
animation: y
})
}
let v = Boolean(f.length);
return r && l.initial === !1 && !t.manuallyAnimateOnMount && (v = !1), r = !1, v ? e(f) : Promise.resolve()
}
function a(o, c, h) {
var l;
if (n[o].isActive === c) return Promise.resolve();
(l = t.variantChildren) === null || l === void 0 || l.forEach(f => {
var p;
return (p = f.animationState) === null || p === void 0 ? void 0 : p.setActive(o, c)
}), n[o].isActive = c;
const u = d(h, o);
for (const f in n) n[f].protectedKeys = {};
return u
}
return {
animateChanges: d,
setActive: a,
setAnimateFunction: s,
getState: () => n
}
}
function sM(t, e) {
return typeof e == "string" ? e !== t : Array.isArray(e) ? !ow(e, t) : !1
}
function ui(t = !1) {
return {
isActive: t,
protectedKeys: {},
needsAnimating: {},
prevResolvedValues: {}
}
}
function aM() {
return {
[je.Animate]: ui(!0),
[je.InView]: ui(),
[je.Hover]: ui(),
[je.Tap]: ui(),
[je.Drag]: ui(),
[je.Focus]: ui(),
[je.Exit]: ui()
}
}
const lM = {
animation: _o(({
visualElement: t,
animate: e
}) => {
t.animationState || (t.animationState = oM(t)), ac(e) && E.exports.useEffect(() => e.subscribe(t), [e])
}),
exit: _o(t => {
const {
custom: e,
visualElement: n
} = t, [r, i] = S3(), s = E.exports.useContext(Vs);
E.exports.useEffect(() => {
n.isPresent = r;
const d = n.animationState && n.animationState.setActive(je.Exit, !r, {
custom: s && s.custom || e
});
d && !r && d.then(i)
}, [r])
})
};
function cM({
top: t,
left: e,
right: n,
bottom: r
}) {
return {
x: {
min: e,
max: n
},
y: {
min: t,
max: r
}
}
}
function uM(t, e) {
if (!e) return t;
const n = e({
x: t.left,
y: t.top
}),
r = e({
x: t.right,
y: t.bottom
});
return {
top: n.y,
left: n.x,
bottom: r.y,
right: r.x
}
}
function fM(t, e) {
return cM(uM(t.getBoundingClientRect(), e))
}
const pp = {
current: null
},
gw = {
current: !1
};
function hM() {
if (gw.current = !0, !!oi)
if (window.matchMedia) {
const t = window.matchMedia("(prefers-reduced-motion)"),
e = () => pp.current = t.matches;
t.addListener(e), e()
} else pp.current = !1
}
const Cc = ["LayoutMeasure", "BeforeLayoutMeasure", "LayoutUpdate", "ViewportBoxUpdate", "Update", "Render", "AnimationComplete", "LayoutAnimationComplete", "AnimationStart", "LayoutAnimationStart", "SetAxisTarget", "Unmount"];
function dM() {
const t = Cc.map(() => new xc),
e = {},
n = {
clearAllListeners: () => t.forEach(r => r.clear()),
updatePropListeners: r => {
Cc.forEach(i => {
var s;
const d = "on" + i,
a = r[d];
(s = e[i]) === null || s === void 0 || s.call(e), a && (e[i] = n[d](a))
})
}
};
return t.forEach((r, i) => {
n["on" + Cc[i]] = s => r.add(s), n["notify" + Cc[i]] = (...s) => r.notify(...s)
}), n
}
function pM(t, e, n) {
const {
willChange: r
} = e;
for (const i in e) {
const s = e[i],
d = n[i];
if (jn(s)) t.addValue(i, s), Sc(r) && r.add(i);
else if (jn(d)) t.addValue(i, ea(s)), Sc(r) && r.remove(i);
else if (d !== s)
if (t.hasValue(i)) {
const a = t.getValue(i);
!a.hasAnimated && a.set(s)
} else {
const a = t.getStaticValue(i);
t.addValue(i, ea(a !== void 0 ? a : s))
}
}
for (const i in n) e[i] === void 0 && t.removeValue(i);
return e
}
const mw = Object.keys(Us),
gM = mw.length,
vw = ({
treeType: t = "",
build: e,
getBaseTarget: n,
makeTargetAnimatable: r,
measureViewportBox: i,
render: s,
readValueFromInstance: d,
removeValueFromRenderState: a,
sortNodePosition: o,
scrapeMotionValuesFromProps: c
}) => ({
parent: h,
props: l,
presenceId: u,
blockInitialAnimation: f,
visualState: p,
reducedMotionConfig: m
}, g = {}) => {
let v = !1;
const {
latestValues: y,
renderState: b
} = p;
let w;
const x = dM(),
S = new Map,
T = new Map;
let P = {};
const I = {
...y
};
let z;
function H() {
!w || !v || (ee(), s(w, b, l.style, C.projection))
}
function ee() {
e(C, b, y, g, l)
}
function te() {
x.notifyUpdate(y)
}
function ne(k, M) {
const D = M.onChange(R => {
y[k] = R, l.onUpdate && xo.update(te, !1, !0)
}),
$ = M.onRenderRequest(C.scheduleRender);
T.set(k, () => {
D(), $()
})
}
const {
willChange: Z,
...ie
} = c(l);
for (const k in ie) {
const M = ie[k];
y[k] !== void 0 && jn(M) && (M.set(y[k], !1), Sc(Z) && Z.add(k))
}
if (l.values)
for (const k in l.values) y[k] !== void 0 && l.values[k].set(y[k]);
const ce = lc(l),
V = $y(l),
C = {
treeType: t,
current: null,
depth: h ? h.depth + 1 : 0,
parent: h,
children: new Set,
presenceId: u,
shouldReduceMotion: null,
variantChildren: V ? new Set : void 0,
isVisible: void 0,
manuallyAnimateOnMount: Boolean(h == null ? void 0 : h.isMounted()),
blockInitialAnimation: f,
isMounted: () => Boolean(w),
mount(k) {
v = !0, w = C.current = k, C.projection && C.projection.mount(k), V && h && !ce && (z = h == null ? void 0 : h.addVariantChild(C)), S.forEach((M, D) => ne(D, M)), gw.current || hM(), C.shouldReduceMotion = m === "never" ? !1 : m === "always" ? !0 : pp.current, h == null || h.children.add(C), C.setProps(l)
},
unmount() {
var k;
(k = C.projection) === null || k === void 0 || k.unmount(), op.update(te), op.render(H), T.forEach(M => M()), z == null || z(), h == null || h.children.delete(C), x.clearAllListeners(), w = void 0, v = !1
},
loadFeatures(k, M, D, $, R, O) {
const F = [];
for (let N = 0; N < gM; N++) {
const G = mw[N],
{
isEnabled: W,
Component: X
} = Us[G];
W(k) && X && F.push(E.exports.createElement(X, {
key: G,
...k,
visualElement: C
}))
}
if (!C.projection && R) {
C.projection = new R($, C.getLatestValues(), h && h.projection);
const {
layoutId: N,
layout: G,
drag: W,
dragConstraints: X,
layoutScroll: B
} = k;
C.projection.setOptions({
layoutId: N,
layout: G,
alwaysMeasureLayout: Boolean(W) || X && By(X),
visualElement: C,
scheduleRender: () => C.scheduleRender(),
animationType: typeof G == "string" ? G : "both",
initialPromotionConfig: O,
layoutScroll: B
})
}
return F
},
addVariantChild(k) {
var M;
const D = C.getClosestVariantNode();
if (D) return (M = D.variantChildren) === null || M === void 0 || M.add(k), () => D.variantChildren.delete(k)
},
sortNodePosition(k) {
return !o || t !== k.treeType ? 0 : o(C.getInstance(), k.getInstance())
},
getClosestVariantNode: () => V ? C : h == null ? void 0 : h.getClosestVariantNode(),
getLayoutId: () => l.layoutId,
getInstance: () => w,
getStaticValue: k => y[k],
setStaticValue: (k, M) => y[k] = M,
getLatestValues: () => y,
setVisibility(k) {
C.isVisible !== k && (C.isVisible = k, C.scheduleRender())
},
makeTargetAnimatable(k, M = !0) {
return r(C, k, l, M)
},
measureViewportBox() {
return i(w, l)
},
addValue(k, M) {
C.hasValue(k) && C.removeValue(k), S.set(k, M), y[k] = M.get(), ne(k, M)
},
removeValue(k) {
var M;
S.delete(k), (M = T.get(k)) === null || M === void 0 || M(), T.delete(k), delete y[k], a(k, b)
},
hasValue: k => S.has(k),
getValue(k, M) {
if (l.values && l.values[k]) return l.values[k];
let D = S.get(k);
return D === void 0 && M !== void 0 && (D = ea(M), C.addValue(k, D)), D
},
forEachValue: k => S.forEach(k),
readValue: k => y[k] !== void 0 ? y[k] : d(w, k, g),
setBaseTarget(k, M) {
I[k] = M
},
getBaseTarget(k) {
if (n) {
const M = n(l, k);
if (M !== void 0 && !jn(M)) return M
}
return I[k]
},
...x,
build() {
return ee(), b
},
scheduleRender() {
xo.render(H, !1, !0)
},
syncRender: H,
setProps(k) {
(k.transformTemplate || l.transformTemplate) && C.scheduleRender(), l = k, x.updatePropListeners(k), P = pM(C, c(l), P)
},
getProps: () => l,
getVariant: k => {
var M;
return (M = l.variants) === null || M === void 0 ? void 0 : M[k]
},
getDefaultTransition: () => l.transition,
getTransformPagePoint: () => l.transformPagePoint,
getVariantContext(k = !1) {
if (k) return h == null ? void 0 : h.getVariantContext();
if (!ce) {
const D = (h == null ? void 0 : h.getVariantContext()) || {};
return l.initial !== void 0 && (D.initial = l.initial), D
}
const M = {};
for (let D = 0; D < mM; D++) {
const $ = yw[D],
R = l[$];
(Hs(R) || R === !1) && (M[$] = R)
}
return M
}
};
return C
},
yw = ["initial", ...dp],
mM = yw.length;
function gp(t) {
return typeof t == "string" && t.startsWith("var(--")
}
const vM = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;
function yM(t) {
const e = vM.exec(t);
if (!e) return [, ];
const [, n, r] = e;
return [n, r]
}
function mp(t, e, n = 1) {
const [r, i] = yM(t);
if (!r) return;
const s = window.getComputedStyle(e).getPropertyValue(r);
return s ? s.trim() : gp(i) ? mp(i, e, n + 1) : i
}
function bM(t, {
...e
}, n) {
const r = t.getInstance();
if (!(r instanceof Element)) return {
target: e,
transitionEnd: n
};
n && (n = {
...n
}), t.forEachValue(i => {
const s = i.get();
if (!gp(s)) return;
const d = mp(s, r);
d && i.set(d)
});
for (const i in e) {
const s = e[i];
if (!gp(s)) continue;
const d = mp(s, r);
!d || (e[i] = d, n && n[i] === void 0 && (n[i] = s))
}
return {
target: e,
transitionEnd: n
}
}
const wM = new Set(["width", "height", "top", "left", "right", "bottom", "x", "y"]),
bw = t => wM.has(t),
xM = t => Object.keys(t).some(bw),
ww = (t, e) => {
t.set(e, !1), t.set(e)
},
xw = t => t === si || t === we;
var _w;
(function(t) {
t.width = "width", t.height = "height", t.left = "left", t.right = "right", t.top = "top", t.bottom = "bottom"
})(_w || (_w = {}));
const Sw = (t, e) => parseFloat(t.split(", ")[e]),
Cw = (t, e) => (n, {
transform: r
}) => {
if (r === "none" || !r) return 0;
const i = r.match(/^matrix3d\((.+)\)$/);
if (i) return Sw(i[1], e); {
const s = r.match(/^matrix\((.+)\)$/);
return s ? Sw(s[1], t) : 0
}
},
_M = new Set(["x", "y", "z"]),
SM = cc.filter(t => !_M.has(t));
function CM(t) {
const e = [];
return SM.forEach(n => {
const r = t.getValue(n);
r !== void 0 && (e.push([n, r.get()]), r.set(n.startsWith("scale") ? 1 : 0))
}), e.length && t.syncRender(), e
}
const Tw = {
width: ({
x: t
}, {
paddingLeft: e = "0",
paddingRight: n = "0"
}) => t.max - t.min - parseFloat(e) - parseFloat(n),
height: ({
y: t
}, {
paddingTop: e = "0",
paddingBottom: n = "0"
}) => t.max - t.min - parseFloat(e) - parseFloat(n),
top: (t, {
top: e
}) => parseFloat(e),
left: (t, {
left: e
}) => parseFloat(e),
bottom: ({
y: t
}, {
top: e
}) => parseFloat(e) + (t.max - t.min),
right: ({
x: t
}, {
left: e
}) => parseFloat(e) + (t.max - t.min),
x: Cw(4, 13),
y: Cw(5, 14)
},
TM = (t, e, n) => {
const r = e.measureViewportBox(),
i = e.getInstance(),
s = getComputedStyle(i),
{
display: d
} = s,
a = {};
d === "none" && e.setStaticValue("display", t.display || "block"), n.forEach(c => {
a[c] = Tw[c](r, s)
}), e.syncRender();
const o = e.measureViewportBox();
return n.forEach(c => {
const h = e.getValue(c);
ww(h, a[c]), t[c] = Tw[c](o, s)
}), t
},
kM = (t, e, n = {}, r = {}) => {
e = {
...e
}, r = {
...r
};
const i = Object.keys(e).filter(bw);
let s = [],
d = !1;
const a = [];
if (i.forEach(o => {
const c = t.getValue(o);
if (!t.hasValue(o)) return;
let h = n[o],
l = ta(h);
const u = e[o];
let f;
if (Zs(u)) {
const p = u.length,
m = u[0] === null ? 1 : 0;
h = u[m], l = ta(h);
for (let g = m; g < p; g++) f ? hc(ta(u[g]) === f) : f = ta(u[g])
} else f = ta(u);
if (l !== f)
if (xw(l) && xw(f)) {
const p = c.get();
typeof p == "string" && c.set(parseFloat(p)), typeof u == "string" ? e[o] = parseFloat(u) : Array.isArray(u) && f === we && (e[o] = u.map(parseFloat))
} else(l == null ? void 0 : l.transform) && (f == null ? void 0 : f.transform) && (h === 0 || u === 0) ? h === 0 ? c.set(f.transform(h)) : e[o] = l.transform(u) : (d || (s = CM(t), d = !0), a.push(o), r[o] = r[o] !== void 0 ? r[o] : e[o], ww(c, u))
}), a.length) {
const o = a.indexOf("height") >= 0 ? window.pageYOffset : null,
c = TM(e, t, a);
return s.length && s.forEach(([h, l]) => {
t.getValue(h).set(l)
}), t.syncRender(), oi && o !== null && window.scrollTo({
top: o
}), {
target: c,
transitionEnd: r
}
} else return {
target: e,
transitionEnd: r
}
};
function EM(t, e, n, r) {
return xM(e) ? kM(t, e, n, r) : {
target: e,
transitionEnd: r
}
}
const OM = (t, e, n, r) => {
const i = bM(t, e, r);
return e = i.target, r = i.transitionEnd, EM(t, e, n, r)
};
function PM(t) {
return window.getComputedStyle(t)
}
const kw = {
treeType: "dom",
readValueFromInstance(t, e) {
if (Ws.has(e)) {
const n = up(e);
return n && n.default || 0
} else {
const n = PM(t),
r = (Wy(e) ? n.getPropertyValue(e) : n[e]) || 0;
return typeof r == "string" ? r.trim() : r
}
},
sortNodePosition(t, e) {
return t.compareDocumentPosition(e) & 2 ? 1 : -1
},
getBaseTarget(t, e) {
var n;
return (n = t.style) === null || n === void 0 ? void 0 : n[e]
},
measureViewportBox(t, {
transformPagePoint: e
}) {
return fM(t, e)
},
resetTransform(t, e, n) {
const {
transformTemplate: r
} = n;
e.style.transform = r ? r({}, "") : "none", t.scheduleRender()
},
restoreTransform(t, e) {
t.style.transform = e.style.transform
},
removeValueFromRenderState(t, {
vars: e,
style: n
}) {
delete e[t], delete n[t]
},
makeTargetAnimatable(t, {
transition: e,
transitionEnd: n,
...r
}, {
transformValues: i
}, s = !0) {
let d = Z3(r, e || {}, t);
if (i && (n && (n = i(n)), r && (r = i(r)), d && (d = i(d))), s) {
K3(t, r, d);
const a = OM(t, r, d, n);
n = a.transitionEnd, r = a.target
}
return {
transition: e,
transitionEnd: n,
...r
}
},
scrapeMotionValuesFromProps: Ud,
build(t, e, n, r, i) {
t.isVisible !== void 0 && (e.style.visibility = t.isVisible ? "visible" : "hidden"), $d(e, n, r, i.transformTemplate)
},
render: ab
},
MM = vw(kw),
AM = vw({
...kw,
getBaseTarget(t, e) {
return t[e]
},
readValueFromInstance(t, e) {
var n;
return Ws.has(e) ? ((n = up(e)) === null || n === void 0 ? void 0 : n.default) || 0 : (e = lb.has(e) ? e : sb(e), t.getAttribute(e))
},
scrapeMotionValuesFromProps: ub,
build(t, e, n, r, i) {
Hd(e, n, r, i.transformTemplate)
},
render: cb
}),
DM = (t, e) => Ld(t) ? AM(e, {
enableHardwareAcceleration: !1
}) : MM(e, {
enableHardwareAcceleration: !0
}),
Et = l4(G4);
function Ew() {
const t = E.exports.useRef(!1);
return sc(() => (t.current = !0, () => {
t.current = !1
}), []), t
}
function RM() {
const t = Ew(),
[e, n] = E.exports.useState(0),
r = E.exports.useCallback(() => {
t.current && n(e + 1)
}, [e]);
return [E.exports.useCallback(() => xo.postRender(r), [r]), e]
}
class IM extends E.exports.Component {
getSnapshotBeforeUpdate(e) {
const n = this.props.childRef.current;
if (n && e.isPresent && !this.props.isPresent) {
const r = this.props.sizeRef.current;
r.height = n.offsetHeight || 0, r.width = n.offsetWidth || 0, r.top = n.offsetTop, r.left = n.offsetLeft
}
return null
}
componentDidUpdate() {}
render() {
return this.props.children
}
}
function LM({
children: t,
isPresent: e
}) {
const n = E.exports.useId(),
r = E.exports.useRef(null),
i = E.exports.useRef({
width: 0,
height: 0,
top: 0,
left: 0
});
return E.exports.useInsertionEffect(() => {
const {
width: s,
height: d,
top: a,
left: o
} = i.current;
if (e || !r.current || !s || !d) return;
r.current.dataset.motionPopId = n;
const c = document.createElement("style");
return document.head.appendChild(c), c.sheet && c.sheet.insertRule(`
[data-motion-pop-id="${n}"] {
position: absolute !important;
width: ${s}px !important;
height: ${d}px !important;
top: ${a}px !important;
left: ${o}px !important;
}
`), () => {
document.head.removeChild(c)
}
}, [e]), _(IM, {
isPresent: e,
childRef: r,
sizeRef: i,
children: E.exports.cloneElement(t, {
ref: r
})
})
}
const vp = ({
children: t,
initial: e,
isPresent: n,
onExitComplete: r,
custom: i,
presenceAffectsLayout: s,
mode: d
}) => {
const a = Id(FM),
o = E.exports.useId(),
c = E.exports.useMemo(() => ({
id: o,
initial: e,
isPresent: n,
custom: i,
onExitComplete: h => {
a.set(h, !0);
for (const l of a.values())
if (!l) return;
r && r()
},
register: h => (a.set(h, !1), () => a.delete(h))
}), s ? void 0 : [n]);
return E.exports.useMemo(() => {
a.forEach((h, l) => a.set(l, !1))
}, [n]), E.exports.useEffect(() => {
!n && !a.size && r && r()
}, [n]), d === "popLayout" && (t = _(LM, {
isPresent: n,
children: t
})), _(Vs.Provider, {
value: c,
children: t
})
};
function FM() {
return new Map
}
const So = t => t.key || "";
function zM(t, e) {
t.forEach(n => {
const r = So(n);
e.set(r, n)
})
}
function NM(t) {
const e = [];
return E.exports.Children.forEach(t, n => {
E.exports.isValidElement(n) && e.push(n)
}), e
}
const Or = ({
children: t,
custom: e,
initial: n = !0,
onExitComplete: r,
exitBeforeEnter: i,
presenceAffectsLayout: s = !0,
mode: d = "sync"
}) => {
i && (d = "wait", iw(!1, "Replace exitBeforeEnter with mode='wait'"));
let [a] = RM();
const o = E.exports.useContext(Hy).forceRender;
o && (a = o);
const c = Ew(),
h = NM(t);
let l = h;
const u = new Set,
f = E.exports.useRef(l),
p = E.exports.useRef(new Map).current,
m = E.exports.useRef(!0);
if (sc(() => {
m.current = !1, zM(h, p), f.current = l
}), Cb(() => {
m.current = !0, p.clear(), u.clear()
}), m.current) return _(Uo, {
children: l.map(b => _(vp, {
isPresent: !0,
initial: n ? void 0 : !1,
presenceAffectsLayout: s,
mode: d,
children: b
}, So(b)))
});
l = [...l];
const g = f.current.map(So),
v = h.map(So),
y = g.length;
for (let b = 0; b < y; b++) {
const w = g[b];
v.indexOf(w) === -1 && u.add(w)
}
return d === "wait" && u.size && (l = []), u.forEach(b => {
if (v.indexOf(b) !== -1) return;
const w = p.get(b);
if (!w) return;
const x = g.indexOf(b),
S = () => {
p.delete(b), u.delete(b);
const T = f.current.findIndex(P => P.key === b);
if (f.current.splice(T, 1), !u.size) {
if (f.current = h, c.current === !1) return;
a(), r && r()
}
};
l.splice(x, 0, _(vp, {
isPresent: !1,
onExitComplete: S,
custom: e,
presenceAffectsLayout: s,
mode: d,
children: w
}, So(w)))
}), l = l.map(b => {
const w = b.key;
return u.has(w) ? b : _(vp, {
isPresent: !0,
presenceAffectsLayout: s,
mode: d,
children: b
}, So(b))
}), nw !== "production" && d === "wait" && l.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`), _(Uo, {
children: u.size ? l : l.map(b => E.exports.cloneElement(b))
})
};
function jM({
children: t,
features: e,
strict: n = !1
}) {
const [, r] = E.exports.useState(!yp(e)), i = E.exports.useRef(void 0);
if (!yp(e)) {
const {
renderer: s,
...d
} = e;
i.current = s, Rd(d)
}
return E.exports.useEffect(() => {
yp(e) && e().then(({
renderer: s,
...d
}) => {
Rd(d), i.current = s, r(!0)
})
}, []), _(Dd.Provider, {
value: {
renderer: i.current,
strict: n
},
children: t
})
}
function yp(t) {
return typeof t == "function"
}
const BM = {
renderer: DM,
...lM,
..._3
};
function fi(t, e, n) {
let [r, i] = E.exports.useState(t || e), s = E.exports.useRef(t !== void 0), d = s.current, a = t !== void 0, o = E.exports.useRef(r);
d !== a && console.warn(`WARN: A component changed from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}.`), s.current = a;
let c = E.exports.useCallback((h, ...l) => {
let u = (f, ...p) => {
n && (Object.is(o.current, f) || n(f, ...p)), a || (o.current = f)
};
typeof h == "function" ? (console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"), i((p, ...m) => {
let g = h(a ? o.current : p, ...m);
return u(g, ...l), a ? p : g
})) : (a || i(h), u(h, ...l))
}, [a, n]);
return a ? o.current = t : t = r, [t, c]
}
function hi(t, e = -1 / 0, n = 1 / 0) {
return Math.min(Math.max(t, e), n)
}
function $M(t, e, n, r) {
let i = (t - (isNaN(e) ? 0 : e)) % r,
s = Math.abs(i) * 2 >= r ? t + Math.sign(i) * (r - Math.abs(i)) : t - i;
isNaN(e) ? !isNaN(n) && s > n && (s = Math.floor(n / r) * r) : s < e ? s = e : !isNaN(n) && s > n && (s = e + Math.floor((n - e) / r) * r);
let d = r.toString(),
a = d.indexOf("."),
o = a >= 0 ? d.length - a : 0;
if (o > 0) {
let c = Math.pow(10, o);
s = Math.round(s * c) / c
}
return s
}
function Qe(t, e, n = 10) {
const r = Math.pow(n, e);
return Math.round(t * r) / r
}
const Ow = {
prefix: String(Math.round(Math.random() * 1e10)),
current: 0
},
VM = ue.createContext(Ow);
function HM() {
let e = E.exports.useContext(VM) !== Ow,
[n, r] = E.exports.useState(e);
return typeof window < "u" && e && E.exports.useLayoutEffect(() => {
r(!1)
}, []), n
}
const Bn = typeof window < "u" ? ue.useLayoutEffect : () => {};
let Pw = new Map;
function UM(t, e) {
if (t === e) return t;
let n = Pw.get(t);
if (n) return n(e), e;
let r = Pw.get(e);
return r ? (r(t), t) : e
}
function WM(...t) {
return (...e) => {
for (let n of t) typeof n == "function" && n(...e)
}
}
function Co(...t) {
let e = {
...t[0]
};
for (let n = 1; n < t.length; n++) {
let r = t[n];
for (let i in r) {
let s = e[i],
d = r[i];
typeof s == "function" && typeof d == "function" && i[0] === "o" && i[1] === "n" && i.charCodeAt(2) >= 65 && i.charCodeAt(2) <= 90 ? e[i] = WM(s, d) : (i === "className" || i === "UNSAFE_className") && typeof s == "string" && typeof d == "string" ? e[i] = he(s, d) : i === "id" && s && d ? e.id = UM(s, d) : e[i] = d !== void 0 ? d : s
}
}
return e
}
function Mw(t) {
if (YM()) t.focus({
preventScroll: !0
});
else {
let e = XM(t);
t.focus(), GM(e)
}
}
let Tc = null;
function YM() {
if (Tc == null) {
Tc = !1;
try {
var t = document.createElement("div");
t.focus({
get preventScroll() {
return Tc = !0, !0
}
})
} catch {}
}
return Tc
}
function XM(t) {
for (var e = t.parentNode, n = [], r = document.scrollingElement || document.documentElement; e instanceof HTMLElement && e !== r;)(e.offsetHeight < e.scrollHeight || e.offsetWidth < e.scrollWidth) && n.push({
element: e,
scrollTop: e.scrollTop,
scrollLeft: e.scrollLeft
}), e = e.parentNode;
return r instanceof HTMLElement && n.push({
element: r,
scrollTop: r.scrollTop,
scrollLeft: r.scrollLeft
}), n
}
function GM(t) {
for (let {
element: e,
scrollTop: n,
scrollLeft: r
}
of t) e.scrollTop = n, e.scrollLeft = r
}
let To = new Map,
bp = new Set;
function Aw() {
if (typeof window > "u") return;
let t = n => {
let r = To.get(n.target);
r || (r = new Set, To.set(n.target, r), n.target.addEventListener("transitioncancel", e)), r.add(n.propertyName)
},
e = n => {
let r = To.get(n.target);
if (!!r && (r.delete(n.propertyName), r.size === 0 && (n.target.removeEventListener("transitioncancel", e), To.delete(n.target)), To.size === 0)) {
for (let i of bp) i();
bp.clear()
}
};
document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", e)
}
typeof document < "u" && (document.readyState !== "loading" ? Aw() : document.addEventListener("DOMContentLoaded", Aw));
function KM(t) {
requestAnimationFrame(() => {
To.size === 0 ? t() : bp.add(t)
})
}
function wp() {
let t = E.exports.useRef(new Map),
e = E.exports.useCallback((i, s, d, a) => {
let o = a != null && a.once ? (...c) => {
t.current.delete(d), d(...c)
} : d;
t.current.set(d, {
type: s,
eventTarget: i,
fn: o,
options: a
}), i.addEventListener(s, d, a)
}, []),
n = E.exports.useCallback((i, s, d, a) => {
var o;
let c = ((o = t.current.get(d)) === null || o === void 0 ? void 0 : o.fn) || d;
i.removeEventListener(s, c, a), t.current.delete(d)
}, []),
r = E.exports.useCallback(() => {
t.current.forEach((i, s) => {
n(i.eventTarget, i.type, s, i.options)
})
}, [n]);
return E.exports.useEffect(() => r, [r]), {
addGlobalListener: e,
removeGlobalListener: n,
removeAllGlobalListeners: r
}
}
function di(t) {
const e = E.exports.useRef();
return Bn(() => {
!t || (typeof t == "function" ? t(e.current) : t.current = e.current)
}, [t]), e
}
let _n = typeof window < "u" && window.visualViewport;
function qM() {
let [t, e] = E.exports.useState(() => Dw());
return E.exports.useEffect(() => {
let n = () => {
e(r => {
let i = Dw();
return i.width === r.width && i.height === r.height ? r : i
})
};
return _n ? _n.addEventListener("resize", n) : window.addEventListener("resize", n), () => {
_n ? _n.removeEventListener("resize", n) : window.removeEventListener("resize", n)
}
}, []), t
}
function Dw() {
return {
width: (_n == null ? void 0 : _n.width) || window.innerWidth,
height: (_n == null ? void 0 : _n.height) || window.innerHeight
}
}
function ZM(t) {
var e;
return typeof window < "u" && window.navigator != null ? t.test(((e = window.navigator.userAgentData) === null || e === void 0 ? void 0 : e.platform) || window.navigator.platform) : !1
}
function Rw() {
return ZM(/^Mac/i)
}
var be = {};
const xp = B_(Object.freeze(Object.defineProperty({
__proto__: null,
default: {}
}, Symbol.toStringTag, {
value: "Module"
})));
(function(t) {
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
var e = e || {
version: "5.2.4"
};
if (t.fabric = e, typeof document < "u" && typeof window < "u") document instanceof(typeof HTMLDocument < "u" ? HTMLDocument : Document) ? e.document = document : e.document = document.implementation.createHTMLDocument(""), e.window = window;
else {
var n = xp,
r = new n.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"), {
features: {
FetchExternalResources: ["img"]
},
resources: "usable"
}).window;
e.document = r.document, e.jsdomImplForWrapper = xp.implForWrapper, e.nodeCanvas = xp.Canvas, e.window = r, DOMParser = e.window.DOMParser
}
e.isTouchSupported = "ontouchstart" in e.window || "ontouchstart" in e.document || e.window && e.window.navigator && e.window.navigator.maxTouchPoints > 0, e.isLikelyNode = typeof Buffer < "u" && typeof window > "u", e.SHARED_ATTRIBUTES = ["display", "transform", "fill", "fill-opacity", "fill-rule", "opacity", "stroke", "stroke-dasharray", "stroke-linecap", "stroke-dashoffset", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "id", "paint-order", "vector-effect", "instantiated_by_use", "clip-path"], e.DPI = 96, e.reNum = "(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)", e.commaWsp = "(?:\\s+,?\\s*|,\\s*)", e.rePathCommand = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/ig, e.reNonWord = /[ \n\.,;!\?\-]/, e.fontPaths = {}, e.iMatrix = [1, 0, 0, 1, 0, 0], e.svgNS = "http://www.w3.org/2000/svg", e.perfLimitSizeTotal = 2097152, e.maxCacheSideLimit = 4096, e.minCacheSideLimit = 256, e.charWidthsCache = {}, e.textureSize = 2048, e.disableStyleCopyPaste = !1, e.enableGLFiltering = !0, e.devicePixelRatio = e.window.devicePixelRatio || e.window.webkitDevicePixelRatio || e.window.mozDevicePixelRatio || 1, e.browserShadowBlurConstant = 1, e.arcToSegmentsCache = {}, e.boundsOfCurveCache = {}, e.cachesBoundsOfCurve = !0, e.forceGLPutImageData = !1, e.initFilterBackend = function() {
if (e.enableGLFiltering && e.isWebglSupported && e.isWebglSupported(e.textureSize)) return console.log("max texture size: " + e.maxTextureSize), new e.WebglFilterBackend({
tileSize: e.textureSize
});
if (e.Canvas2dFilterBackend) return new e.Canvas2dFilterBackend
}, typeof document < "u" && typeof window < "u" && (window.fabric = e),
function() {
function a(f, p) {
if (!!this.__eventListeners[f]) {
var m = this.__eventListeners[f];
p ? m[m.indexOf(p)] = !1 : e.util.array.fill(m, !1)
}
}
function o(f, p) {
if (this.__eventListeners || (this.__eventListeners = {}), arguments.length === 1)
for (var m in f) this.on(m, f[m]);
else this.__eventListeners[f] || (this.__eventListeners[f] = []), this.__eventListeners[f].push(p);
return this
}
function c(f, p) {
var m = function() {
p.apply(this, arguments), this.off(f, m)
}.bind(this);
this.on(f, m)
}
function h(f, p) {
if (arguments.length === 1)
for (var m in f) c.call(this, m, f[m]);
else c.call(this, f, p);
return this
}
function l(f, p) {
if (!this.__eventListeners) return this;
if (arguments.length === 0)
for (f in this.__eventListeners) a.call(this, f);
else if (arguments.length === 1 && typeof arguments[0] == "object")
for (var m in f) a.call(this, m, f[m]);
else a.call(this, f, p);
return this
}
function u(f, p) {
if (!this.__eventListeners) return this;
var m = this.__eventListeners[f];
if (!m) return this;
for (var g = 0, v = m.length; g < v; g++) m[g] && m[g].call(this, p || {});
return this.__eventListeners[f] = m.filter(function(y) {
return y !== !1
}), this
}
e.Observable = {
fire: u,
on: o,
once: h,
off: l
}
}(), e.Collection = {
_objects: [],
add: function() {
if (this._objects.push.apply(this._objects, arguments), this._onObjectAdded)
for (var a = 0, o = arguments.length; a < o; a++) this._onObjectAdded(arguments[a]);
return this.renderOnAddRemove && this.requestRenderAll(), this
},
insertAt: function(a, o, c) {
var h = this._objects;
return c ? h[o] = a : h.splice(o, 0, a), this._onObjectAdded && this._onObjectAdded(a), this.renderOnAddRemove && this.requestRenderAll(), this
},
remove: function() {
for (var a = this._objects, o, c = !1, h = 0, l = arguments.length; h < l; h++) o = a.indexOf(arguments[h]), o !== -1 && (c = !0, a.splice(o, 1), this._onObjectRemoved && this._onObjectRemoved(arguments[h]));
return this.renderOnAddRemove && c && this.requestRenderAll(), this
},
forEachObject: function(a, o) {
for (var c = this.getObjects(), h = 0, l = c.length; h < l; h++) a.call(o, c[h], h, c);
return this
},
getObjects: function(a) {
return typeof a > "u" ? this._objects.concat() : this._objects.filter(function(o) {
return o.type === a
})
},
item: function(a) {
return this._objects[a]
},
isEmpty: function() {
return this._objects.length === 0
},
size: function() {
return this._objects.length
},
contains: function(a, o) {
return this._objects.indexOf(a) > -1 ? !0 : o ? this._objects.some(function(c) {
return typeof c.contains == "function" && c.contains(a, !0)
}) : !1
},
complexity: function() {
return this._objects.reduce(function(a, o) {
return a += o.complexity ? o.complexity() : 0, a
}, 0)
}
}, e.CommonMethods = {
_setOptions: function(a) {
for (var o in a) this.set(o, a[o])
},
_initGradient: function(a, o) {
a && a.colorStops && !(a instanceof e.Gradient) && this.set(o, new e.Gradient(a))
},
_initPattern: function(a, o, c) {
a && a.source && !(a instanceof e.Pattern) ? this.set(o, new e.Pattern(a, c)) : c && c()
},
_setObject: function(a) {
for (var o in a) this._set(o, a[o])
},
set: function(a, o) {
return typeof a == "object" ? this._setObject(a) : this._set(a, o), this
},
_set: function(a, o) {
this[a] = o
},
toggle: function(a) {
var o = this.get(a);
return typeof o == "boolean" && this.set(a, !o), this
},
get: function(a) {
return this[a]
}
},
function(a) {
var o = Math.sqrt,
c = Math.atan2,
h = Math.pow,
l = Math.PI / 180,
u = Math.PI / 2;
e.util = {
cos: function(f) {
if (f === 0) return 1;
f < 0 && (f = -f);
var p = f / u;
switch (p) {
case 1:
case 3:
return 0;
case 2:
return -1
}
return Math.cos(f)
},
sin: function(f) {
if (f === 0) return 0;
var p = f / u,
m = 1;
switch (f < 0 && (m = -1), p) {
case 1:
return m;
case 2:
return 0;
case 3:
return -m
}
return Math.sin(f)
},
removeFromArray: function(f, p) {
var m = f.indexOf(p);
return m !== -1 && f.splice(m, 1), f
},
getRandomInt: function(f, p) {
return Math.floor(Math.random() * (p - f + 1)) + f
},
degreesToRadians: function(f) {
return f * l
},
radiansToDegrees: function(f) {
return f / l
},
rotatePoint: function(f, p, m) {
var g = new e.Point(f.x - p.x, f.y - p.y),
v = e.util.rotateVector(g, m);
return new e.Point(v.x, v.y).addEquals(p)
},
rotateVector: function(f, p) {
var m = e.util.sin(p),
g = e.util.cos(p),
v = f.x * g - f.y * m,
y = f.x * m + f.y * g;
return {
x: v,
y
}
},
createVector: function(f, p) {
return new e.Point(p.x - f.x, p.y - f.y)
},
calcAngleBetweenVectors: function(f, p) {
return Math.acos((f.x * p.x + f.y * p.y) / (Math.hypot(f.x, f.y) * Math.hypot(p.x, p.y)))
},
getHatVector: function(f) {
return new e.Point(f.x, f.y).multiply(1 / Math.hypot(f.x, f.y))
},
getBisector: function(f, p, m) {
var g = e.util.createVector(f, p),
v = e.util.createVector(f, m),
y = e.util.calcAngleBetweenVectors(g, v),
b = e.util.calcAngleBetweenVectors(e.util.rotateVector(g, y), v),
w = y * (b === 0 ? 1 : -1) / 2;
return {
vector: e.util.getHatVector(e.util.rotateVector(g, w)),
angle: y
}
},
projectStrokeOnPoints: function(f, p, m) {
var g = [],
v = p.strokeWidth / 2,
y = p.strokeUniform ? new e.Point(1 / p.scaleX, 1 / p.scaleY) : new e.Point(1, 1),
b = function(w) {
var x = v / Math.hypot(w.x, w.y);
return new e.Point(w.x * x * y.x, w.y * x * y.y)
};
return f.length <= 1 || f.forEach(function(w, x) {
var S = new e.Point(w.x, w.y),
T, P;
x === 0 ? (P = f[x + 1], T = m ? b(e.util.createVector(P, S)).addEquals(S) : f[f.length - 1]) : x === f.length - 1 ? (T = f[x - 1], P = m ? b(e.util.createVector(T, S)).addEquals(S) : f[0]) : (T = f[x - 1], P = f[x + 1]);
var I = e.util.getBisector(S, T, P),
z = I.vector,
H = I.angle,
ee, te;
if (p.strokeLineJoin === "miter" && (ee = -v / Math.sin(H / 2), te = new e.Point(z.x * ee * y.x, z.y * ee * y.y), Math.hypot(te.x, te.y) / v <= p.strokeMiterLimit)) {
g.push(S.add(te)), g.push(S.subtract(te));
return
}
ee = -v * Math.SQRT2, te = new e.Point(z.x * ee * y.x, z.y * ee * y.y), g.push(S.add(te)), g.push(S.subtract(te))
}), g
},
transformPoint: function(f, p, m) {
return m ? new e.Point(p[0] * f.x + p[2] * f.y, p[1] * f.x + p[3] * f.y) : new e.Point(p[0] * f.x + p[2] * f.y + p[4], p[1] * f.x + p[3] * f.y + p[5])
},
makeBoundingBoxFromPoints: function(f, p) {
if (p)
for (var m = 0; m < f.length; m++) f[m] = e.util.transformPoint(f[m], p);
var g = [f[0].x, f[1].x, f[2].x, f[3].x],
v = e.util.array.min(g),
y = e.util.array.max(g),
b = y - v,
w = [f[0].y, f[1].y, f[2].y, f[3].y],
x = e.util.array.min(w),
S = e.util.array.max(w),
T = S - x;
return {
left: v,
top: x,
width: b,
height: T
}
},
invertTransform: function(f) {
var p = 1 / (f[0] * f[3] - f[1] * f[2]),
m = [p * f[3], -p * f[1], -p * f[2], p * f[0]],
g = e.util.transformPoint({
x: f[4],
y: f[5]
}, m, !0);
return m[4] = -g.x, m[5] = -g.y, m
},
toFixed: function(f, p) {
return parseFloat(Number(f).toFixed(p))
},
parseUnit: function(f, p) {
var m = /\D{0,2}$/.exec(f),
g = parseFloat(f);
switch (p || (p = e.Text.DEFAULT_SVG_FONT_SIZE), m[0]) {
case "mm":
return g * e.DPI / 25.4;
case "cm":
return g * e.DPI / 2.54;
case "in":
return g * e.DPI;
case "pt":
return g * e.DPI / 72;
case "pc":
return g * e.DPI / 72 * 12;
case "em":
return g * p;
default:
return g
}
},
falseFunction: function() {
return !1
},
getKlass: function(f, p) {
return f = e.util.string.camelize(f.charAt(0).toUpperCase() + f.slice(1)), e.util.resolveNamespace(p)[f]
},
getSvgAttributes: function(f) {
var p = ["instantiated_by_use", "style", "id", "class"];
switch (f) {
case "linearGradient":
p = p.concat(["x1", "y1", "x2", "y2", "gradientUnits", "gradientTransform"]);
break;
case "radialGradient":
p = p.concat(["gradientUnits", "gradientTransform", "cx", "cy", "r", "fx", "fy", "fr"]);
break;
case "stop":
p = p.concat(["offset", "stop-color", "stop-opacity"]);
break
}
return p
},
resolveNamespace: function(f) {
if (!f) return e;
var p = f.split("."),
m = p.length,
g, v = a || e.window;
for (g = 0; g < m; ++g) v = v[p[g]];
return v
},
loadImage: function(f, p, m, g) {
if (!f) {
p && p.call(m, f);
return
}
var v = e.util.createImage(),
y = function() {
p && p.call(m, v, !1), v = v.onload = v.onerror = null
};
v.onload = y, v.onerror = function() {
e.log("Error loading " + v.src), p && p.call(m, null, !0), v = v.onload = v.onerror = null
}, f.indexOf("data") !== 0 && g !== void 0 && g !== null && (v.crossOrigin = g), f.substring(0, 14) === "data:image/svg" && (v.onload = null, e.util.loadImageInDom(v, y)), v.src = f
},
loadImageInDom: function(f, p) {
var m = e.document.createElement("div");
m.style.width = m.style.height = "1px", m.style.left = m.style.top = "-100%", m.style.position = "absolute", m.appendChild(f), e.document.querySelector("body").appendChild(m), f.onload = function() {
p(), m.parentNode.removeChild(m), m = null
}
},
enlivenObjects: function(f, p, m, g) {
f = f || [];
var v = [],
y = 0,
b = f.length;
function w() {
++y === b && p && p(v.filter(function(x) {
return x
}))
}
if (!b) {
p && p(v);
return
}
f.forEach(function(x, S) {
if (!x || !x.type) {
w();
return
}
var T = e.util.getKlass(x.type, m);
T.fromObject(x, function(P, I) {
I || (v[S] = P), g && g(x, P, I), w()
})
})
},
enlivenObjectEnlivables: function(f, p, m) {
var g = e.Object.ENLIVEN_PROPS.filter(function(v) {
return !!f[v]
});
e.util.enlivenObjects(g.map(function(v) {
return f[v]
}), function(v) {
var y = {};
g.forEach(function(b, w) {
y[b] = v[w], p && (p[b] = v[w])
}), m && m(y)
})
},
enlivenPatterns: function(f, p) {
f = f || [];
function m() {
++v === y && p && p(g)
}
var g = [],
v = 0,
y = f.length;
if (!y) {
p && p(g);
return
}
f.forEach(function(b, w) {
b && b.source ? new e.Pattern(b, function(x) {
g[w] = x, m()
}) : (g[w] = b, m())
})
},
groupSVGElements: function(f, p, m) {
var g;
return f && f.length === 1 ? (typeof m < "u" && (f[0].sourcePath = m), f[0]) : (p && (p.width && p.height ? p.centerPoint = {
x: p.width / 2,
y: p.height / 2
} : (delete p.width, delete p.height)), g = new e.Group(f, p), typeof m < "u" && (g.sourcePath = m), g)
},
populateWithProperties: function(f, p, m) {
if (m && Array.isArray(m))
for (var g = 0, v = m.length; g < v; g++) m[g] in f && (p[m[g]] = f[m[g]])
},
createCanvasElement: function() {
return e.document.createElement("canvas")
},
copyCanvasElement: function(f) {
var p = e.util.createCanvasElement();
return p.width = f.width, p.height = f.height, p.getContext("2d").drawImage(f, 0, 0), p
},
toDataURL: function(f, p, m) {
return f.toDataURL("image/" + p, m)
},
createImage: function() {
return e.document.createElement("img")
},
multiplyTransformMatrices: function(f, p, m) {
return [f[0] * p[0] + f[2] * p[1], f[1] * p[0] + f[3] * p[1], f[0] * p[2] + f[2] * p[3], f[1] * p[2] + f[3] * p[3], m ? 0 : f[0] * p[4] + f[2] * p[5] + f[4], m ? 0 : f[1] * p[4] + f[3] * p[5] + f[5]]
},
qrDecompose: function(f) {
var p = c(f[1], f[0]),
m = h(f[0], 2) + h(f[1], 2),
g = o(m),
v = (f[0] * f[3] - f[2] * f[1]) / g,
y = c(f[0] * f[2] + f[1] * f[3], m);
return {
angle: p / l,
scaleX: g,
scaleY: v,
skewX: y / l,
skewY: 0,
translateX: f[4],
translateY: f[5]
}
},
calcRotateMatrix: function(f) {
if (!f.angle) return e.iMatrix.concat();
var p = e.util.degreesToRadians(f.angle),
m = e.util.cos(p),
g = e.util.sin(p);
return [m, g, -g, m, 0, 0]
},
calcDimensionsMatrix: function(f) {
var p = typeof f.scaleX > "u" ? 1 : f.scaleX,
m = typeof f.scaleY > "u" ? 1 : f.scaleY,
g = [f.flipX ? -p : p, 0, 0, f.flipY ? -m : m, 0, 0],
v = e.util.multiplyTransformMatrices,
y = e.util.degreesToRadians;
return f.skewX && (g = v(g, [1, 0, Math.tan(y(f.skewX)), 1], !0)), f.skewY && (g = v(g, [1, Math.tan(y(f.skewY)), 0, 1], !0)), g
},
composeMatrix: function(f) {
var p = [1, 0, 0, 1, f.translateX || 0, f.translateY || 0],
m = e.util.multiplyTransformMatrices;
return f.angle && (p = m(p, e.util.calcRotateMatrix(f))), (f.scaleX !== 1 || f.scaleY !== 1 || f.skewX || f.skewY || f.flipX || f.flipY) && (p = m(p, e.util.calcDimensionsMatrix(f))), p
},
resetObjectTransform: function(f) {
f.scaleX = 1, f.scaleY = 1, f.skewX = 0, f.skewY = 0, f.flipX = !1, f.flipY = !1, f.rotate(0)
},
saveObjectTransform: function(f) {
return {
scaleX: f.scaleX,
scaleY: f.scaleY,
skewX: f.skewX,
skewY: f.skewY,
angle: f.angle,
left: f.left,
flipX: f.flipX,
flipY: f.flipY,
top: f.top
}
},
isTransparent: function(f, p, m, g) {
g > 0 && (p > g ? p -= g : p = 0, m > g ? m -= g : m = 0);
var v = !0,
y, b, w = f.getImageData(p, m, g * 2 || 1, g * 2 || 1),
x = w.data.length;
for (y = 3; y < x && (b = w.data[y], v = b <= 0, v !== !1); y += 4);
return w = null, v
},
parsePreserveAspectRatioAttribute: function(f) {
var p = "meet",
m = "Mid",
g = "Mid",
v = f.split(" "),
y;
return v && v.length && (p = v.pop(), p !== "meet" && p !== "slice" ? (y = p, p = "meet") : v.length && (y = v.pop())), m = y !== "none" ? y.slice(1, 4) : "none", g = y !== "none" ? y.slice(5, 8) : "none", {
meetOrSlice: p,
alignX: m,
alignY: g
}
},
clearFabricFontCache: function(f) {
f = (f || "").toLowerCase(), f ? e.charWidthsCache[f] && delete e.charWidthsCache[f] : e.charWidthsCache = {}
},
limitDimsByArea: function(f, p) {
var m = Math.sqrt(p * f),
g = Math.floor(p / m);
return {
x: Math.floor(m),
y: g
}
},
capValue: function(f, p, m) {
return Math.max(f, Math.min(p, m))
},
findScaleToFit: function(f, p) {
return Math.min(p.width / f.width, p.height / f.height)
},
findScaleToCover: function(f, p) {
return Math.max(p.width / f.width, p.height / f.height)
},
matrixToSVG: function(f) {
return "matrix(" + f.map(function(p) {
return e.util.toFixed(p, e.Object.NUM_FRACTION_DIGITS)
}).join(" ") + ")"
},
removeTransformFromObject: function(f, p) {
var m = e.util.invertTransform(p),
g = e.util.multiplyTransformMatrices(m, f.calcOwnMatrix());
e.util.applyTransformToObject(f, g)
},
addTransformToObject: function(f, p) {
e.util.applyTransformToObject(f, e.util.multiplyTransformMatrices(p, f.calcOwnMatrix()))
},
applyTransformToObject: function(f, p) {
var m = e.util.qrDecompose(p),
g = new e.Point(m.translateX, m.translateY);
f.flipX = !1, f.flipY = !1, f.set("scaleX", m.scaleX), f.set("scaleY", m.scaleY), f.skewX = m.skewX, f.skewY = m.skewY, f.angle = m.angle, f.setPositionByOrigin(g, "center", "center")
},
sizeAfterTransform: function(f, p, m) {
var g = f / 2,
v = p / 2,
y = [{
x: -g,
y: -v
}, {
x: g,
y: -v
}, {
x: -g,
y: v
}, {
x: g,
y: v
}],
b = e.util.calcDimensionsMatrix(m),
w = e.util.makeBoundingBoxFromPoints(y, b);
return {
x: w.width,
y: w.height
}
},
mergeClipPaths: function(f, p) {
var m = f,
g = p;
m.inverted && !g.inverted && (m = p, g = f), e.util.applyTransformToObject(g, e.util.multiplyTransformMatrices(e.util.invertTransform(m.calcTransformMatrix()), g.calcTransformMatrix()));
var v = m.inverted && g.inverted;
return v && (m.inverted = g.inverted = !1), new e.Group([m], {
clipPath: g,
inverted: v
})
},
hasStyleChanged: function(f, p, m) {
return m = m || !1, f.fill !== p.fill || f.stroke !== p.stroke || f.strokeWidth !== p.strokeWidth || f.fontSize !== p.fontSize || f.fontFamily !== p.fontFamily || f.fontWeight !== p.fontWeight || f.fontStyle !== p.fontStyle || f.deltaY !== p.deltaY || m && (f.overline !== p.overline || f.underline !== p.underline || f.linethrough !== p.linethrough)
},
stylesToArray: function(m, p) {
for (var m = e.util.object.clone(m, !0), g = p.split(`
`), v = -1, y = {}, b = [], w = 0; w < g.length; w++) {
if (!m[w]) {
v += g[w].length;
continue
}
for (var x = 0; x < g[w].length; x++) {
v++;
var S = m[w][x];
if (S) {
var T = e.util.hasStyleChanged(y, S, !0);
T ? b.push({
start: v,
end: v + 1,
style: S
}) : b[b.length - 1].end++
}
y = S || {}
}
}
return b
},
stylesFromArray: function(f, p) {
if (!Array.isArray(f)) return f;
for (var m = p.split(`
`), g = -1, v = 0, y = {}, b = 0; b < m.length; b++)
for (var w = 0; w < m[b].length; w++) g++, f[v] && f[v].start <= g && g < f[v].end && (y[b] = y[b] || {}, y[b][w] = Object.assign({}, f[v].style), g === f[v].end - 1 && v++);
return y
}
}
}(t),
function() {
var a = Array.prototype.join,
o = {
m: 2,
l: 2,
h: 1,
v: 1,
c: 6,
s: 4,
q: 4,
t: 2,
a: 7
},
c = {
m: "l",
M: "L"
};
function h(C, k, M, D, $, R, O, F, N, G, W) {
var X = e.util.cos(C),
B = e.util.sin(C),
re = e.util.cos(k),
U = e.util.sin(k),
j = M * $ * re - D * R * U + O,
K = D * $ * re + M * R * U + F,
q = G + N * (-M * $ * B - D * R * X),
Y = W + N * (-D * $ * B + M * R * X),
J = j + N * (M * $ * U + D * R * re),
le = K + N * (D * $ * U - M * R * re);
return ["C", q, Y, J, le, j, K]
}
function l(C, k, M, D, $, R, O) {
var F = Math.PI,
N = O * F / 180,
G = e.util.sin(N),
W = e.util.cos(N),
X = 0,
B = 0;
M = Math.abs(M), D = Math.abs(D);
var re = -W * C * .5 - G * k * .5,
U = -W * k * .5 + G * C * .5,
j = M * M,
K = D * D,
q = U * U,
Y = re * re,
J = j * K - j * q - K * Y,
le = 0;
if (J < 0) {
var xe = Math.sqrt(1 - J / (j * K));
M *= xe, D *= xe
} else le = ($ === R ? -1 : 1) * Math.sqrt(J / (j * q + K * Y));
var me = le * M * U / D,
Q = -le * D * re / M,
ve = W * me - G * Q + C * .5,
Se = G * me + W * Q + k * .5,
Ee = u(1, 0, (re - me) / M, (U - Q) / D),
Be = u((re - me) / M, (U - Q) / D, (-re - me) / M, (-U - Q) / D);
R === 0 && Be > 0 ? Be -= 2 * F : R === 1 && Be < 0 && (Be += 2 * F);
for (var De = Math.ceil(Math.abs(Be / F * 2)), Pt = [], Je = Be / De, Ci = 8 / 3 * Math.sin(Je / 4) * Math.sin(Je / 4) / Math.sin(Je / 2), ba = Ee + Je, Tn = 0; Tn < De; Tn++) Pt[Tn] = h(Ee, ba, W, G, M, D, ve, Se, Ci, X, B), X = Pt[Tn][5], B = Pt[Tn][6], Ee = ba, ba += Je;
return Pt
}
function u(C, k, M, D) {
var $ = Math.atan2(k, C),
R = Math.atan2(D, M);
return R >= $ ? R - $ : 2 * Math.PI - ($ - R)
}
function f(C, k, M, D, $, R, O, F) {
var N;
if (e.cachesBoundsOfCurve && (N = a.call(arguments), e.boundsOfCurveCache[N])) return e.boundsOfCurveCache[N];
var G = Math.sqrt,
W = Math.min,
X = Math.max,
B = Math.abs,
re = [],
U = [
[],
[]
],
j, K, q, Y, J, le, xe, me;
K = 6 * C - 12 * M + 6 * $, j = -3 * C + 9 * M - 9 * $ + 3 * O, q = 3 * M - 3 * C;
for (var Q = 0; Q < 2; ++Q) {
if (Q > 0 && (K = 6 * k - 12 * D + 6 * R, j = -3 * k + 9 * D - 9 * R + 3 * F, q = 3 * D - 3 * k), B(j) < 1e-12) {
if (B(K) < 1e-12) continue;
Y = -q / K, 0 < Y && Y < 1 && re.push(Y);
continue
}
xe = K * K - 4 * q * j, !(xe < 0) && (me = G(xe), J = (-K + me) / (2 * j), 0 < J && J < 1 && re.push(J), le = (-K - me) / (2 * j), 0 < le && le < 1 && re.push(le))
}
for (var ve, Se, Ee = re.length, Be = Ee, De; Ee--;) Y = re[Ee], De = 1 - Y, ve = De * De * De * C + 3 * De * De * Y * M + 3 * De * Y * Y * $ + Y * Y * Y * O, U[0][Ee] = ve, Se = De * De * De * k + 3 * De * De * Y * D + 3 * De * Y * Y * R + Y * Y * Y * F, U[1][Ee] = Se;
U[0][Be] = C, U[1][Be] = k, U[0][Be + 1] = O, U[1][Be + 1] = F;
var Pt = [{
x: W.apply(null, U[0]),
y: W.apply(null, U[1])
}, {
x: X.apply(null, U[0]),
y: X.apply(null, U[1])
}];
return e.cachesBoundsOfCurve && (e.boundsOfCurveCache[N] = Pt), Pt
}
function p(C, k, M) {
for (var D = M[1], $ = M[2], R = M[3], O = M[4], F = M[5], N = M[6], G = M[7], W = l(N - C, G - k, D, $, O, F, R), X = 0, B = W.length; X < B; X++) W[X][1] += C, W[X][2] += k, W[X][3] += C, W[X][4] += k, W[X][5] += C, W[X][6] += k;
return W
}
function m(C) {
var k = 0,
M = 0,
D = C.length,
$ = 0,
R = 0,
O, F, N, G = [],
W, X, B;
for (F = 0; F < D; ++F) {
switch (N = !1, O = C[F].slice(0), O[0]) {
case "l":
O[0] = "L", O[1] += k, O[2] += M;
case "L":
k = O[1], M = O[2];
break;
case "h":
O[1] += k;
case "H":
O[0] = "L", O[2] = M, k = O[1];
break;
case "v":
O[1] += M;
case "V":
O[0] = "L", M = O[1], O[1] = k, O[2] = M;
break;
case "m":
O[0] = "M", O[1] += k, O[2] += M;
case "M":
k = O[1], M = O[2], $ = O[1], R = O[2];
break;
case "c":
O[0] = "C", O[1] += k, O[2] += M, O[3] += k, O[4] += M, O[5] += k, O[6] += M;
case "C":
X = O[3], B = O[4], k = O[5], M = O[6];
break;
case "s":
O[0] = "S", O[1] += k, O[2] += M, O[3] += k, O[4] += M;
case "S":
W === "C" ? (X = 2 * k - X, B = 2 * M - B) : (X = k, B = M), k = O[3], M = O[4], O[0] = "C", O[5] = O[3], O[6] = O[4], O[3] = O[1], O[4] = O[2], O[1] = X, O[2] = B, X = O[3], B = O[4];
break;
case "q":
O[0] = "Q", O[1] += k, O[2] += M, O[3] += k, O[4] += M;
case "Q":
X = O[1], B = O[2], k = O[3], M = O[4];
break;
case "t":
O[0] = "T", O[1] += k, O[2] += M;
case "T":
W === "Q" ? (X = 2 * k - X, B = 2 * M - B) : (X = k, B = M), O[0] = "Q", k = O[1], M = O[2], O[1] = X, O[2] = B, O[3] = k, O[4] = M;
break;
case "a":
O[0] = "A", O[6] += k, O[7] += M;
case "A":
N = !0, G = G.concat(p(k, M, O)), k = O[6], M = O[7];
break;
case "z":
case "Z":
k = $, M = R;
break
}
N || G.push(O), W = O[0]
}
return G
}
function g(C, k, M, D) {
return Math.sqrt((M - C) * (M - C) + (D - k) * (D - k))
}
function v(C) {
return C * C * C
}
function y(C) {
return 3 * C * C * (1 - C)
}
function b(C) {
return 3 * C * (1 - C) * (1 - C)
}
function w(C) {
return (1 - C) * (1 - C) * (1 - C)
}
function x(C, k, M, D, $, R, O, F) {
return function(N) {
var G = v(N),
W = y(N),
X = b(N),
B = w(N);
return {
x: O * G + $ * W + M * X + C * B,
y: F * G + R * W + D * X + k * B
}
}
}
function S(C, k, M, D, $, R, O, F) {
return function(N) {
var G = 1 - N,
W = 3 * G * G * (M - C) + 6 * G * N * ($ - M) + 3 * N * N * (O - $),
X = 3 * G * G * (D - k) + 6 * G * N * (R - D) + 3 * N * N * (F - R);
return Math.atan2(X, W)
}
}
function T(C) {
return C * C
}
function P(C) {
return 2 * C * (1 - C)
}
function I(C) {
return (1 - C) * (1 - C)
}
function z(C, k, M, D, $, R) {
return function(O) {
var F = T(O),
N = P(O),
G = I(O);
return {
x: $ * F + M * N + C * G,
y: R * F + D * N + k * G
}
}
}
function H(C, k, M, D, $, R) {
return function(O) {
var F = 1 - O,
N = 2 * F * (M - C) + 2 * O * ($ - M),
G = 2 * F * (D - k) + 2 * O * (R - D);
return Math.atan2(G, N)
}
}
function ee(C, k, M) {
var D = {
x: k,
y: M
},
$, R = 0,
O;
for (O = 1; O <= 100; O += 1) $ = C(O / 100), R += g(D.x, D.y, $.x, $.y), D = $;
return R
}
function te(C, k) {
for (var M = 0, D = 0, $ = C.iterator, R = {
x: C.x,
y: C.y
}, O, F, N = .01, G = C.angleFinder, W; D < k && N > 1e-4;) O = $(M), W = M, F = g(R.x, R.y, O.x, O.y), F + D > k ? (M -= N, N /= 2) : (R = O, M += N, D += F);
return O.angle = G(W), O
}
function ne(C) {
for (var k = 0, M = C.length, D, $ = 0, R = 0, O = 0, F = 0, N = [], G, W, X, B = 0; B < M; B++) {
switch (D = C[B], W = {
x: $,
y: R,
command: D[0]
}, D[0]) {
case "M":
W.length = 0, O = $ = D[1], F = R = D[2];
break;
case "L":
W.length = g($, R, D[1], D[2]), $ = D[1], R = D[2];
break;
case "C":
G = x($, R, D[1], D[2], D[3], D[4], D[5], D[6]), X = S($, R, D[1], D[2], D[3], D[4], D[5], D[6]), W.iterator = G, W.angleFinder = X, W.length = ee(G, $, R), $ = D[5], R = D[6];
break;
case "Q":
G = z($, R, D[1], D[2], D[3], D[4]), X = H($, R, D[1], D[2], D[3], D[4]), W.iterator = G, W.angleFinder = X, W.length = ee(G, $, R), $ = D[3], R = D[4];
break;
case "Z":
case "z":
W.destX = O, W.destY = F, W.length = g($, R, O, F), $ = O, R = F;
break
}
k += W.length, N.push(W)
}
return N.push({
length: k,
x: $,
y: R
}), N
}
function Z(C, k, M) {
M || (M = ne(C));
for (var D = 0; k - M[D].length > 0 && D < M.length - 2;) k -= M[D].length, D++;
var $ = M[D],
R = k / $.length,
O = $.command,
F = C[D],
N;
switch (O) {
case "M":
return {
x: $.x, y: $.y, angle: 0
};
case "Z":
case "z":
return N = new e.Point($.x, $.y).lerp(new e.Point($.destX, $.destY), R), N.angle = Math.atan2($.destY - $.y, $.destX - $.x), N;
case "L":
return N = new e.Point($.x, $.y).lerp(new e.Point(F[1], F[2]), R), N.angle = Math.atan2(F[2] - $.y, F[1] - $.x), N;
case "C":
return te($, k);
case "Q":
return te($, k)
}
}
function ie(C) {
var k = [],
M = [],
D, $, R = e.rePathCommand,
O = "[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",
F = "(" + O + ")" + e.commaWsp,
N = "([01])" + e.commaWsp + "?",
G = F + "?" + F + "?" + F + N + N + F + "?(" + O + ")",
W = new RegExp(G, "g"),
X, B, re;
if (!C || !C.match) return k;
re = C.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);
for (var U = 0, j, K = re.length; U < K; U++) {
D = re[U], B = D.slice(1).trim(), M.length = 0;
var q = D.charAt(0);
if (j = [q], q.toLowerCase() === "a")
for (var Y; Y = W.exec(B);)
for (var J = 1; J < Y.length; J++) M.push(Y[J]);
else
for (; X = R.exec(B);) M.push(X[0]);
for (var J = 0, le = M.length; J < le; J++) $ = parseFloat(M[J]), isNaN($) || j.push($);
var xe = o[q.toLowerCase()],
me = c[q] || q;
if (j.length - 1 > xe)
for (var Q = 1, ve = j.length; Q < ve; Q += xe) k.push([q].concat(j.slice(Q, Q + xe))), q = me;
else k.push(j)
}
return k
}
function ce(C, k) {
var M = [],
D, $ = new e.Point(C[0].x, C[0].y),
R = new e.Point(C[1].x, C[1].y),
O = C.length,
F = 1,
N = 0,
G = O > 2;
for (k = k || 0, G && (F = C[2].x < R.x ? -1 : C[2].x === R.x ? 0 : 1, N = C[2].y < R.y ? -1 : C[2].y === R.y ? 0 : 1), M.push(["M", $.x - F * k, $.y - N * k]), D = 1; D < O; D++) {
if (!$.eq(R)) {
var W = $.midPointFrom(R);
M.push(["Q", $.x, $.y, W.x, W.y])
}
$ = C[D], D + 1 < C.length && (R = C[D + 1])
}
return G && (F = $.x > C[D - 2].x ? 1 : $.x === C[D - 2].x ? 0 : -1, N = $.y > C[D - 2].y ? 1 : $.y === C[D - 2].y ? 0 : -1), M.push(["L", $.x + F * k, $.y + N * k]), M
}
function V(C, k, M) {
return M && (k = e.util.multiplyTransformMatrices(k, [1, 0, 0, 1, -M.x, -M.y])), C.map(function(D) {
for (var $ = D.slice(0), R = {}, O = 1; O < D.length - 1; O += 2) R.x = D[O], R.y = D[O + 1], R = e.util.transformPoint(R, k), $[O] = R.x, $[O + 1] = R.y;
return $
})
}
e.util.joinPath = function(C) {
return C.map(function(k) {
return k.join(" ")
}).join(" ")
}, e.util.parsePath = ie, e.util.makePathSimpler = m, e.util.getSmoothPathFromPoints = ce, e.util.getPathSegmentsInfo = ne, e.util.getBoundsOfCurve = f, e.util.getPointOnPath = Z, e.util.transformPath = V
}(),
function() {
var a = Array.prototype.slice;
function o(f, p) {
for (var m = a.call(arguments, 2), g = [], v = 0, y = f.length; v < y; v++) g[v] = m.length ? f[v][p].apply(f[v], m) : f[v][p].call(f[v]);
return g
}
function c(f, p) {
return u(f, p, function(m, g) {
return m >= g
})
}
function h(f, p) {
return u(f, p, function(m, g) {
return m < g
})
}
function l(f, p) {
for (var m = f.length; m--;) f[m] = p;
return f
}
function u(f, p, m) {
if (!(!f || f.length === 0)) {
var g = f.length - 1,
v = p ? f[g][p] : f[g];
if (p)
for (; g--;) m(f[g][p], v) && (v = f[g][p]);
else
for (; g--;) m(f[g], v) && (v = f[g]);
return v
}
}
e.util.array = {
fill: l,
invoke: o,
min: h,
max: c
}
}(),
function() {
function a(c, h, l) {
if (l)
if (!e.isLikelyNode && h instanceof Element) c = h;
else if (h instanceof Array) {
c = [];
for (var u = 0, f = h.length; u < f; u++) c[u] = a({}, h[u], l)
} else if (h && typeof h == "object")
for (var p in h) p === "canvas" || p === "group" ? c[p] = null : h.hasOwnProperty(p) && (c[p] = a({}, h[p], l));
else c = h;
else
for (var p in h) c[p] = h[p];
return c
}
function o(c, h) {
return a({}, c, h)
}
e.util.object = {
extend: a,
clone: o
}, e.util.object.extend(e.util, e.Observable)
}(),
function() {
function a(u) {
return u.replace(/-+(.)?/g, function(f, p) {
return p ? p.toUpperCase() : ""
})
}
function o(u, f) {
return u.charAt(0).toUpperCase() + (f ? u.slice(1) : u.slice(1).toLowerCase())
}
function c(u) {
return u.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">")
}
function h(u) {
var f = 0,
p, m = [];
for (f = 0, p; f < u.length; f++)(p = l(u, f)) !== !1 && m.push(p);
return m
}
function l(u, f) {
var p = u.charCodeAt(f);
if (isNaN(p)) return "";
if (p < 55296 || p > 57343) return u.charAt(f);
if (55296 <= p && p <= 56319) {
if (u.length <= f + 1) throw "High surrogate without following low surrogate";
var m = u.charCodeAt(f + 1);
if (56320 > m || m > 57343) throw "High surrogate without following low surrogate";
return u.charAt(f) + u.charAt(f + 1)
}
if (f === 0) throw "Low surrogate without preceding high surrogate";
var g = u.charCodeAt(f - 1);
if (55296 > g || g > 56319) throw "Low surrogate without preceding high surrogate";
return !1
}
e.util.string = {
camelize: a,
capitalize: o,
escapeXml: c,
graphemeSplit: h
}
}(),
function() {
var a = Array.prototype.slice,
o = function() {},
c = function() {
for (var p in {
toString: 1
})
if (p === "toString") return !1;
return !0
}(),
h = function(p, m, g) {
for (var v in m) v in p.prototype && typeof p.prototype[v] == "function" && (m[v] + "").indexOf("callSuper") > -1 ? p.prototype[v] = function(y) {
return function() {
var b = this.constructor.superclass;
this.constructor.superclass = g;
var w = m[y].apply(this, arguments);
if (this.constructor.superclass = b, y !== "initialize") return w
}
}(v) : p.prototype[v] = m[v], c && (m.toString !== Object.prototype.toString && (p.prototype.toString = m.toString), m.valueOf !== Object.prototype.valueOf && (p.prototype.valueOf = m.valueOf))
};
function l() {}
function u(p) {
for (var m = null, g = this; g.constructor.superclass;) {
var v = g.constructor.superclass.prototype[p];
if (g[p] !== v) {
m = v;
break
}
g = g.constructor.superclass.prototype
}
return m ? arguments.length > 1 ? m.apply(this, a.call(arguments, 1)) : m.call(this) : console.log("tried to callSuper " + p + ", method not found in prototype chain", this)
}
function f() {
var p = null,
m = a.call(arguments, 0);
typeof m[0] == "function" && (p = m.shift());
function g() {
this.initialize.apply(this, arguments)
}
g.superclass = p, g.subclasses = [], p && (l.prototype = p.prototype, g.prototype = new l, p.subclasses.push(g));
for (var v = 0, y = m.length; v < y; v++) h(g, m[v], p);
return g.prototype.initialize || (g.prototype.initialize = o), g.prototype.constructor = g, g.prototype.callSuper = u, g
}
e.util.createClass = f
}(),
function() {
var a = !!e.document.createElement("div").attachEvent,
o = ["touchstart", "touchmove", "touchend"];
e.util.addListener = function(h, l, u, f) {
h && h.addEventListener(l, u, a ? !1 : f)
}, e.util.removeListener = function(h, l, u, f) {
h && h.removeEventListener(l, u, a ? !1 : f)
};
function c(h) {
var l = h.changedTouches;
return l && l[0] ? l[0] : h
}
e.util.getPointer = function(h) {
var l = h.target,
u = e.util.getScrollLeftTop(l),
f = c(h);
return {
x: f.clientX + u.left,
y: f.clientY + u.top
}
}, e.util.isTouchEvent = function(h) {
return o.indexOf(h.type) > -1 || h.pointerType === "touch"
}
}(),
function() {
function a(f, p) {
var m = f.style;
if (!m) return f;
if (typeof p == "string") return f.style.cssText += ";" + p, p.indexOf("opacity") > -1 ? u(f, p.match(/opacity:\s*(\d?\.?\d*)/)[1]) : f;
for (var g in p)
if (g === "opacity") u(f, p[g]);
else {
var v = g === "float" || g === "cssFloat" ? typeof m.styleFloat > "u" ? "cssFloat" : "styleFloat" : g;
m.setProperty(v, p[g])
} return f
}
var o = e.document.createElement("div"),
c = typeof o.style.opacity == "string",
h = typeof o.style.filter == "string",
l = /alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,
u = function(f) {
return f
};
c ? u = function(f, p) {
return f.style.opacity = p, f
} : h && (u = function(f, p) {
var m = f.style;
return f.currentStyle && !f.currentStyle.hasLayout && (m.zoom = 1), l.test(m.filter) ? (p = p >= .9999 ? "" : "alpha(opacity=" + p * 100 + ")", m.filter = m.filter.replace(l, p)) : m.filter += " alpha(opacity=" + p * 100 + ")", f
}), e.util.setStyle = a
}(),
function() {
var a = Array.prototype.slice;
function o(w) {
return typeof w == "string" ? e.document.getElementById(w) : w
}
var c, h = function(w) {
return a.call(w, 0)
};
try {
c = h(e.document.childNodes) instanceof Array
} catch {}
c || (h = function(w) {
for (var x = new Array(w.length), S = w.length; S--;) x[S] = w[S];
return x
});
function l(w, x) {
var S = e.document.createElement(w);
for (var T in x) T === "class" ? S.className = x[T] : T === "for" ? S.htmlFor = x[T] : S.setAttribute(T, x[T]);
return S
}
function u(w, x) {
w && (" " + w.className + " ").indexOf(" " + x + " ") === -1 && (w.className += (w.className ? " " : "") + x)
}
function f(w, x, S) {
return typeof x == "string" && (x = l(x, S)), w.parentNode && w.parentNode.replaceChild(x, w), x.appendChild(w), x
}
function p(w) {
for (var x = 0, S = 0, T = e.document.documentElement, P = e.document.body || {
scrollLeft: 0,
scrollTop: 0
}; w && (w.parentNode || w.host) && (w = w.parentNode || w.host, w === e.document ? (x = P.scrollLeft || T.scrollLeft || 0, S = P.scrollTop || T.scrollTop || 0) : (x += w.scrollLeft || 0, S += w.scrollTop || 0), !(w.nodeType === 1 && w.style.position === "fixed")););
return {
left: x,
top: S
}
}
function m(w) {
var x, S = w && w.ownerDocument,
T = {
left: 0,
top: 0
},
P = {
left: 0,
top: 0
},
I, z = {
borderLeftWidth: "left",
borderTopWidth: "top",
paddingLeft: "left",
paddingTop: "top"
};
if (!S) return P;
for (var H in z) P[z[H]] += parseInt(g(w, H), 10) || 0;
return x = S.documentElement, typeof w.getBoundingClientRect < "u" && (T = w.getBoundingClientRect()), I = p(w), {
left: T.left + I.left - (x.clientLeft || 0) + P.left,
top: T.top + I.top - (x.clientTop || 0) + P.top
}
}
var g;
e.document.defaultView && e.document.defaultView.getComputedStyle ? g = function(w, x) {
var S = e.document.defaultView.getComputedStyle(w, null);
return S ? S[x] : void 0
} : g = function(w, x) {
var S = w.style[x];
return !S && w.currentStyle && (S = w.currentStyle[x]), S
},
function() {
var w = e.document.documentElement.style,
x = "userSelect" in w ? "userSelect" : "MozUserSelect" in w ? "MozUserSelect" : "WebkitUserSelect" in w ? "WebkitUserSelect" : "KhtmlUserSelect" in w ? "KhtmlUserSelect" : "";
function S(P) {
return typeof P.onselectstart < "u" && (P.onselectstart = e.util.falseFunction), x ? P.style[x] = "none" : typeof P.unselectable == "string" && (P.unselectable = "on"), P
}
function T(P) {
return typeof P.onselectstart < "u" && (P.onselectstart = null), x ? P.style[x] = "" : typeof P.unselectable == "string" && (P.unselectable = ""), P
}
e.util.makeElementUnselectable = S, e.util.makeElementSelectable = T
}();
function v(w) {
var x = e.jsdomImplForWrapper(w);
return x._canvas || x._image
}
function y(w) {
if (!!e.isLikelyNode) {
var x = e.jsdomImplForWrapper(w);
x && (x._image = null, x._canvas = null, x._currentSrc = null, x._attributes = null, x._classList = null)
}
}
function b(w, x) {
w.imageSmoothingEnabled = w.imageSmoothingEnabled || w.webkitImageSmoothingEnabled || w.mozImageSmoothingEnabled || w.msImageSmoothingEnabled || w.oImageSmoothingEnabled, w.imageSmoothingEnabled = x
}
e.util.setImageSmoothing = b, e.util.getById = o, e.util.toArray = h, e.util.addClass = u, e.util.makeElement = l, e.util.wrapElement = f, e.util.getScrollLeftTop = p, e.util.getElementOffset = m, e.util.getNodeCanvas = v, e.util.cleanUpJsdomNode = y
}(),
function() {
function a(h, l) {
return h + (/\?/.test(h) ? "&" : "?") + l
}
function o() {}
function c(h, l) {
l || (l = {});
var u = l.method ? l.method.toUpperCase() : "GET",
f = l.onComplete || function() {},
p = new e.window.XMLHttpRequest,
m = l.body || l.parameters;
return p.onreadystatechange = function() {
p.readyState === 4 && (f(p), p.onreadystatechange = o)
}, u === "GET" && (m = null, typeof l.parameters == "string" && (h = a(h, l.parameters))), p.open(u, h, !0), (u === "POST" || u === "PUT") && p.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), p.send(m), p
}
e.util.request = c
}(), e.log = console.log, e.warn = console.warn,
function() {
var a = e.util.object.extend,
o = e.util.object.clone,
c = [];
e.util.object.extend(c, {
cancelAll: function() {
var v = this.splice(0);
return v.forEach(function(y) {
y.cancel()
}), v
},
cancelByCanvas: function(v) {
if (!v) return [];
var y = this.filter(function(b) {
return typeof b.target == "object" && b.target.canvas === v
});
return y.forEach(function(b) {
b.cancel()
}), y
},
cancelByTarget: function(v) {
var y = this.findAnimationsByTarget(v);
return y.forEach(function(b) {
b.cancel()
}), y
},
findAnimationIndex: function(v) {
return this.indexOf(this.findAnimation(v))
},
findAnimation: function(v) {
return this.find(function(y) {
return y.cancel === v
})
},
findAnimationsByTarget: function(v) {
return v ? this.filter(function(y) {
return y.target === v
}) : []
}
});
function h() {
return !1
}
function l(v, y, b, w) {
return -b * Math.cos(v / w * (Math.PI / 2)) + b + y
}
function u(v) {
v || (v = {});
var y = !1,
b, w = function() {
var x = e.runningAnimations.indexOf(b);
return x > -1 && e.runningAnimations.splice(x, 1)[0]
};
return b = a(o(v), {
cancel: function() {
return y = !0, w()
},
currentValue: "startValue" in v ? v.startValue : 0,
completionRate: 0,
durationRate: 0
}), e.runningAnimations.push(b), m(function(x) {
var S = x || +new Date,
T = v.duration || 500,
P = S + T,
I, z = v.onChange || h,
H = v.abort || h,
ee = v.onComplete || h,
te = v.easing || l,
ne = "startValue" in v ? v.startValue.length > 0 : !1,
Z = "startValue" in v ? v.startValue : 0,
ie = "endValue" in v ? v.endValue : 100,
ce = v.byValue || (ne ? Z.map(function(V, C) {
return ie[C] - Z[C]
}) : ie - Z);
v.onStart && v.onStart(),
function V(C) {
I = C || +new Date;
var k = I > P ? T : I - S,
M = k / T,
D = ne ? Z.map(function(R, O) {
return te(k, Z[O], ce[O], T)
}) : te(k, Z, ce, T),
$ = Math.abs(ne ? (D[0] - Z[0]) / ce[0] : (D - Z) / ce);
if (b.currentValue = ne ? D.slice() : D, b.completionRate = $, b.durationRate = M, !y) {
if (H(D, $, M)) {
w();
return
}
if (I > P) {
b.currentValue = ne ? ie.slice() : ie, b.completionRate = 1, b.durationRate = 1, z(ne ? ie.slice() : ie, 1, 1), ee(ie, 1, 1), w();
return
} else z(D, $, M), m(V)
}
}(S)
}), b.cancel
}
var f = e.window.requestAnimationFrame || e.window.webkitRequestAnimationFrame || e.window.mozRequestAnimationFrame || e.window.oRequestAnimationFrame || e.window.msRequestAnimationFrame || function(v) {
return e.window.setTimeout(v, 1e3 / 60)
},
p = e.window.cancelAnimationFrame || e.window.clearTimeout;
function m() {
return f.apply(e.window, arguments)
}
function g() {
return p.apply(e.window, arguments)
}
e.util.animate = u, e.util.requestAnimFrame = m, e.util.cancelAnimFrame = g, e.runningAnimations = c
}(),
function() {
function a(c, h, l) {
var u = "rgba(" + parseInt(c[0] + l * (h[0] - c[0]), 10) + "," + parseInt(c[1] + l * (h[1] - c[1]), 10) + "," + parseInt(c[2] + l * (h[2] - c[2]), 10);
return u += "," + (c && h ? parseFloat(c[3] + l * (h[3] - c[3])) : 1), u += ")", u
}
function o(c, h, l, u) {
var f = new e.Color(c).getSource(),
p = new e.Color(h).getSource(),
m = u.onComplete,
g = u.onChange;
return u = u || {}, e.util.animate(e.util.object.extend(u, {
duration: l || 500,
startValue: f,
endValue: p,
byValue: p,
easing: function(v, y, b, w) {
var x = u.colorEasing ? u.colorEasing(v, w) : 1 - Math.cos(v / w * (Math.PI / 2));
return a(y, b, x)
},
onComplete: function(v, y, b) {
if (m) return m(a(p, p, 0), y, b)
},
onChange: function(v, y, b) {
if (g) {
if (Array.isArray(v)) return g(a(v, v, 0), y, b);
g(v, y, b)
}
}
}))
}
e.util.animateColor = o
}(),
function() {
function a(C, k, M, D) {
return C < Math.abs(k) ? (C = k, D = M / 4) : k === 0 && C === 0 ? D = M / (2 * Math.PI) * Math.asin(1) : D = M / (2 * Math.PI) * Math.asin(k / C), {
a: C,
c: k,
p: M,
s: D
}
}
function o(C, k, M) {
return C.a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k * M - C.s) * (2 * Math.PI) / C.p)
}
function c(C, k, M, D) {
return M * ((C = C / D - 1) * C * C + 1) + k
}
function h(C, k, M, D) {
return C /= D / 2, C < 1 ? M / 2 * C * C * C + k : M / 2 * ((C -= 2) * C * C + 2) + k
}
function l(C, k, M, D) {
return M * (C /= D) * C * C * C + k
}
function u(C, k, M, D) {
return -M * ((C = C / D - 1) * C * C * C - 1) + k
}
function f(C, k, M, D) {
return C /= D / 2, C < 1 ? M / 2 * C * C * C * C + k : -M / 2 * ((C -= 2) * C * C * C - 2) + k
}
function p(C, k, M, D) {
return M * (C /= D) * C * C * C * C + k
}
function m(C, k, M, D) {
return M * ((C = C / D - 1) * C * C * C * C + 1) + k
}
function g(C, k, M, D) {
return C /= D / 2, C < 1 ? M / 2 * C * C * C * C * C + k : M / 2 * ((C -= 2) * C * C * C * C + 2) + k
}
function v(C, k, M, D) {
return -M * Math.cos(C / D * (Math.PI / 2)) + M + k
}
function y(C, k, M, D) {
return M * Math.sin(C / D * (Math.PI / 2)) + k
}
function b(C, k, M, D) {
return -M / 2 * (Math.cos(Math.PI * C / D) - 1) + k
}
function w(C, k, M, D) {
return C === 0 ? k : M * Math.pow(2, 10 * (C / D - 1)) + k
}
function x(C, k, M, D) {
return C === D ? k + M : M * (-Math.pow(2, -10 * C / D) + 1) + k
}
function S(C, k, M, D) {
return C === 0 ? k : C === D ? k + M : (C /= D / 2, C < 1 ? M / 2 * Math.pow(2, 10 * (C - 1)) + k : M / 2 * (-Math.pow(2, -10 * --C) + 2) + k)
}
function T(C, k, M, D) {
return -M * (Math.sqrt(1 - (C /= D) * C) - 1) + k
}
function P(C, k, M, D) {
return M * Math.sqrt(1 - (C = C / D - 1) * C) + k
}
function I(C, k, M, D) {
return C /= D / 2, C < 1 ? -M / 2 * (Math.sqrt(1 - C * C) - 1) + k : M / 2 * (Math.sqrt(1 - (C -= 2) * C) + 1) + k
}
function z(C, k, M, D) {
var $ = 1.70158,
R = 0,
O = M;
if (C === 0) return k;
if (C /= D, C === 1) return k + M;
R || (R = D * .3);
var F = a(O, M, R, $);
return -o(F, C, D) + k
}
function H(C, k, M, D) {
var $ = 1.70158,
R = 0,
O = M;
if (C === 0) return k;
if (C /= D, C === 1) return k + M;
R || (R = D * .3);
var F = a(O, M, R, $);
return F.a * Math.pow(2, -10 * C) * Math.sin((C * D - F.s) * (2 * Math.PI) / F.p) + F.c + k
}
function ee(C, k, M, D) {
var $ = 1.70158,
R = 0,
O = M;
if (C === 0) return k;
if (C /= D / 2, C === 2) return k + M;
R || (R = D * (.3 * 1.5));
var F = a(O, M, R, $);
return C < 1 ? -.5 * o(F, C, D) + k : F.a * Math.pow(2, -10 * (C -= 1)) * Math.sin((C * D - F.s) * (2 * Math.PI) / F.p) * .5 + F.c + k
}
function te(C, k, M, D, $) {
return $ === void 0 && ($ = 1.70158), M * (C /= D) * C * (($ + 1) * C - $) + k
}
function ne(C, k, M, D, $) {
return $ === void 0 && ($ = 1.70158), M * ((C = C / D - 1) * C * (($ + 1) * C + $) + 1) + k
}
function Z(C, k, M, D, $) {
return $ === void 0 && ($ = 1.70158), C /= D / 2, C < 1 ? M / 2 * (C * C * ((($ *= 1.525) + 1) * C - $)) + k : M / 2 * ((C -= 2) * C * ((($ *= 1.525) + 1) * C + $) + 2) + k
}
function ie(C, k, M, D) {
return M - ce(D - C, 0, M, D) + k
}
function ce(C, k, M, D) {
return (C /= D) < 1 / 2.75 ? M * (7.5625 * C * C) + k : C < 2 / 2.75 ? M * (7.5625 * (C -= 1.5 / 2.75) * C + .75) + k : C < 2.5 / 2.75 ? M * (7.5625 * (C -= 2.25 / 2.75) * C + .9375) + k : M * (7.5625 * (C -= 2.625 / 2.75) * C + .984375) + k
}
function V(C, k, M, D) {
return C < D / 2 ? ie(C * 2, 0, M, D) * .5 + k : ce(C * 2 - D, 0, M, D) * .5 + M * .5 + k
}
e.util.ease = {
easeInQuad: function(C, k, M, D) {
return M * (C /= D) * C + k
},
easeOutQuad: function(C, k, M, D) {
return -M * (C /= D) * (C - 2) + k
},
easeInOutQuad: function(C, k, M, D) {
return C /= D / 2, C < 1 ? M / 2 * C * C + k : -M / 2 * (--C * (C - 2) - 1) + k
},
easeInCubic: function(C, k, M, D) {
return M * (C /= D) * C * C + k
},
easeOutCubic: c,
easeInOutCubic: h,
easeInQuart: l,
easeOutQuart: u,
easeInOutQuart: f,
easeInQuint: p,
easeOutQuint: m,
easeInOutQuint: g,
easeInSine: v,
easeOutSine: y,
easeInOutSine: b,
easeInExpo: w,
easeOutExpo: x,
easeInOutExpo: S,
easeInCirc: T,
easeOutCirc: P,
easeInOutCirc: I,
easeInElastic: z,
easeOutElastic: H,
easeInOutElastic: ee,
easeInBack: te,
easeOutBack: ne,
easeInOutBack: Z,
easeInBounce: ie,
easeOutBounce: ce,
easeInOutBounce: V
}
}(),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.object.extend,
h = o.util.object.clone,
l = o.util.toFixed,
u = o.util.parseUnit,
f = o.util.multiplyTransformMatrices,
p = ["path", "circle", "polygon", "polyline", "ellipse", "rect", "line", "image", "text"],
m = ["symbol", "image", "marker", "pattern", "view", "svg"],
g = ["pattern", "defs", "symbol", "metadata", "clipPath", "mask", "desc"],
v = ["symbol", "g", "a", "svg", "clipPath", "defs"],
y = {
cx: "left",
x: "left",
r: "radius",
cy: "top",
y: "top",
display: "visible",
visibility: "visible",
transform: "transformMatrix",
"fill-opacity": "fillOpacity",
"fill-rule": "fillRule",
"font-family": "fontFamily",
"font-size": "fontSize",
"font-style": "fontStyle",
"font-weight": "fontWeight",
"letter-spacing": "charSpacing",
"paint-order": "paintFirst",
"stroke-dasharray": "strokeDashArray",
"stroke-dashoffset": "strokeDashOffset",
"stroke-linecap": "strokeLineCap",
"stroke-linejoin": "strokeLineJoin",
"stroke-miterlimit": "strokeMiterLimit",
"stroke-opacity": "strokeOpacity",
"stroke-width": "strokeWidth",
"text-decoration": "textDecoration",
"text-anchor": "textAnchor",
opacity: "opacity",
"clip-path": "clipPath",
"clip-rule": "clipRule",
"vector-effect": "strokeUniform",
"image-rendering": "imageSmoothing"
},
b = {
stroke: "strokeOpacity",
fill: "fillOpacity"
},
w = "font-size",
x = "clip-path";
o.svgValidTagNamesRegEx = P(p), o.svgViewBoxElementsRegEx = P(m), o.svgInvalidAncestorsRegEx = P(g), o.svgValidParentsRegEx = P(v), o.cssRules = {}, o.gradientDefs = {}, o.clipPaths = {};
function S(R) {
return R in y ? y[R] : R
}
function T(R, O, F, N) {
var G = Array.isArray(O),
W;
if ((R === "fill" || R === "stroke") && O === "none") O = "";
else {
if (R === "strokeUniform") return O === "non-scaling-stroke";
if (R === "strokeDashArray") O === "none" ? O = null : O = O.replace(/,/g, " ").split(/\s+/).map(parseFloat);
else if (R === "transformMatrix") F && F.transformMatrix ? O = f(F.transformMatrix, o.parseTransformAttribute(O)) : O = o.parseTransformAttribute(O);
else if (R === "visible") O = O !== "none" && O !== "hidden", F && F.visible === !1 && (O = !1);
else if (R === "opacity") O = parseFloat(O), F && typeof F.opacity < "u" && (O *= F.opacity);
else if (R === "textAnchor") O = O === "start" ? "left" : O === "end" ? "right" : "center";
else if (R === "charSpacing") W = u(O, N) / N * 1e3;
else if (R === "paintFirst") {
var X = O.indexOf("fill"),
B = O.indexOf("stroke"),
O = "fill";
(X > -1 && B > -1 && B < X || X === -1 && B > -1) && (O = "stroke")
} else {
if (R === "href" || R === "xlink:href" || R === "font") return O;
if (R === "imageSmoothing") return O === "optimizeQuality";
W = G ? O.map(u) : u(O, N)
}
}
return !G && isNaN(W) ? O : W
}
function P(R) {
return new RegExp("^(" + R.join("|") + ")\\b", "i")
}
function I(R) {
for (var O in b)
if (!(typeof R[b[O]] > "u" || R[O] === "")) {
if (typeof R[O] > "u") {
if (!o.Object.prototype[O]) continue;
R[O] = o.Object.prototype[O]
}
if (R[O].indexOf("url(") !== 0) {
var F = new o.Color(R[O]);
R[O] = F.setAlpha(l(F.getAlpha() * R[b[O]], 2)).toRgba()
}
} return R
}
function z(R, O) {
var F, N = [],
G, W, X;
for (W = 0, X = O.length; W < X; W++) F = O[W], G = R.getElementsByTagName(F), N = N.concat(Array.prototype.slice.call(G));
return N
}
o.parseTransformAttribute = function() {
function R(Q, ve) {
var Se = o.util.cos(ve[0]),
Ee = o.util.sin(ve[0]),
Be = 0,
De = 0;
ve.length === 3 && (Be = ve[1], De = ve[2]), Q[0] = Se, Q[1] = Ee, Q[2] = -Ee, Q[3] = Se, Q[4] = Be - (Se * Be - Ee * De), Q[5] = De - (Ee * Be + Se * De)
}
function O(Q, ve) {
var Se = ve[0],
Ee = ve.length === 2 ? ve[1] : ve[0];
Q[0] = Se, Q[3] = Ee
}
function F(Q, ve, Se) {
Q[Se] = Math.tan(o.util.degreesToRadians(ve[0]))
}
function N(Q, ve) {
Q[4] = ve[0], ve.length === 2 && (Q[5] = ve[1])
}
var G = o.iMatrix,
W = o.reNum,
X = o.commaWsp,
B = "(?:(skewX)\\s*\\(\\s*(" + W + ")\\s*\\))",
re = "(?:(skewY)\\s*\\(\\s*(" + W + ")\\s*\\))",
U = "(?:(rotate)\\s*\\(\\s*(" + W + ")(?:" + X + "(" + W + ")" + X + "(" + W + "))?\\s*\\))",
j = "(?:(scale)\\s*\\(\\s*(" + W + ")(?:" + X + "(" + W + "))?\\s*\\))",
K = "(?:(translate)\\s*\\(\\s*(" + W + ")(?:" + X + "(" + W + "))?\\s*\\))",
q = "(?:(matrix)\\s*\\(\\s*(" + W + ")" + X + "(" + W + ")" + X + "(" + W + ")" + X + "(" + W + ")" + X + "(" + W + ")" + X + "(" + W + ")\\s*\\))",
Y = "(?:" + q + "|" + K + "|" + j + "|" + U + "|" + B + "|" + re + ")",
J = "(?:" + Y + "(?:" + X + "*" + Y + ")*)",
le = "^\\s*(?:" + J + "?)\\s*$",
xe = new RegExp(le),
me = new RegExp(Y, "g");
return function(Q) {
var ve = G.concat(),
Se = [];
if (!Q || Q && !xe.test(Q)) return ve;
Q.replace(me, function(Be) {
var De = new RegExp(Y).exec(Be).filter(function(Ci) {
return !!Ci
}),
Pt = De[1],
Je = De.slice(2).map(parseFloat);
switch (Pt) {
case "translate":
N(ve, Je);
break;
case "rotate":
Je[0] = o.util.degreesToRadians(Je[0]), R(ve, Je);
break;
case "scale":
O(ve, Je);
break;
case "skewX":
F(ve, Je, 2);
break;
case "skewY":
F(ve, Je, 1);
break;
case "matrix":
ve = Je;
break
}
Se.push(ve.concat()), ve = G.concat()
});
for (var Ee = Se[0]; Se.length > 1;) Se.shift(), Ee = o.util.multiplyTransformMatrices(Ee, Se[0]);
return Ee
}
}();
function H(R, O) {
var F, N;
R.replace(/;\s*$/, "").split(";").forEach(function(G) {
var W = G.split(":");
F = W[0].trim().toLowerCase(), N = W[1].trim(), O[F] = N
})
}
function ee(R, O) {
var F, N;
for (var G in R) typeof R[G] > "u" || (F = G.toLowerCase(), N = R[G], O[F] = N)
}
function te(R, O) {
var F = {};
for (var N in o.cssRules[O])
if (ne(R, N.split(" ")))
for (var G in o.cssRules[O][N]) F[G] = o.cssRules[O][N][G];
return F
}
function ne(R, O) {
var F, N = !0;
return F = ie(R, O.pop()), F && O.length && (N = Z(R, O)), F && N && O.length === 0
}
function Z(R, O) {
for (var F, N = !0; R.parentNode && R.parentNode.nodeType === 1 && O.length;) N && (F = O.pop()), R = R.parentNode, N = ie(R, F);
return O.length === 0
}
function ie(R, O) {
var F = R.nodeName,
N = R.getAttribute("class"),
G = R.getAttribute("id"),
W, X;
if (W = new RegExp("^" + F, "i"), O = O.replace(W, ""), G && O.length && (W = new RegExp("#" + G + "(?![a-zA-Z\\-]+)", "i"), O = O.replace(W, "")), N && O.length)
for (N = N.split(" "), X = N.length; X--;) W = new RegExp("\\." + N[X] + "(?![a-zA-Z\\-]+)", "i"), O = O.replace(W, "");
return O.length === 0
}
function ce(R, O) {
var F;
if (R.getElementById && (F = R.getElementById(O)), F) return F;
var N, G, W, X = R.getElementsByTagName("*");
for (G = 0, W = X.length; G < W; G++)
if (N = X[G], O === N.getAttribute("id")) return N
}
function V(R) {
for (var O = z(R, ["use", "svg:use"]), F = 0; O.length && F < O.length;) {
var N = O[F],
G = N.getAttribute("xlink:href") || N.getAttribute("href");
if (G === null) return;
var W = G.slice(1),
X = N.getAttribute("x") || 0,
B = N.getAttribute("y") || 0,
re = ce(R, W).cloneNode(!0),
U = (re.getAttribute("transform") || "") + " translate(" + X + ", " + B + ")",
j, K = O.length,
q, Y, J, le, xe = o.svgNS;
if (k(re), /^svg$/i.test(re.nodeName)) {
var me = re.ownerDocument.createElementNS(xe, "g");
for (Y = 0, J = re.attributes, le = J.length; Y < le; Y++) q = J.item(Y), me.setAttributeNS(xe, q.nodeName, q.nodeValue);
for (; re.firstChild;) me.appendChild(re.firstChild);
re = me
}
for (Y = 0, J = N.attributes, le = J.length; Y < le; Y++) q = J.item(Y), !(q.nodeName === "x" || q.nodeName === "y" || q.nodeName === "xlink:href" || q.nodeName === "href") && (q.nodeName === "transform" ? U = q.nodeValue + " " + U : re.setAttribute(q.nodeName, q.nodeValue));
re.setAttribute("transform", U), re.setAttribute("instantiated_by_use", "1"), re.removeAttribute("id"), j = N.parentNode, j.replaceChild(re, N), O.length === K && F++
}
}
var C = new RegExp("^\\s*(" + o.reNum + "+)\\s*,?\\s*(" + o.reNum + "+)\\s*,?\\s*(" + o.reNum + "+)\\s*,?\\s*(" + o.reNum + "+)\\s*$");
function k(R) {
if (!o.svgViewBoxElementsRegEx.test(R.nodeName)) return {};
var O = R.getAttribute("viewBox"),
F = 1,
N = 1,
G = 0,
W = 0,
X, B, re, U, j = R.getAttribute("width"),
K = R.getAttribute("height"),
q = R.getAttribute("x") || 0,
Y = R.getAttribute("y") || 0,
J = R.getAttribute("preserveAspectRatio") || "",
le = !O || !(O = O.match(C)),
xe = !j || !K || j === "100%" || K === "100%",
me = le && xe,
Q = {},
ve = "",
Se = 0,
Ee = 0;
if (Q.width = 0, Q.height = 0, Q.toBeParsed = me, le && (q || Y) && R.parentNode && R.parentNode.nodeName !== "#document" && (ve = " translate(" + u(q) + " " + u(Y) + ") ", re = (R.getAttribute("transform") || "") + ve, R.setAttribute("transform", re), R.removeAttribute("x"), R.removeAttribute("y")), me) return Q;
if (le) return Q.width = u(j), Q.height = u(K), Q;
if (G = -parseFloat(O[1]), W = -parseFloat(O[2]), X = parseFloat(O[3]), B = parseFloat(O[4]), Q.minX = G, Q.minY = W, Q.viewBoxWidth = X, Q.viewBoxHeight = B, xe ? (Q.width = X, Q.height = B) : (Q.width = u(j), Q.height = u(K), F = Q.width / X, N = Q.height / B), J = o.util.parsePreserveAspectRatioAttribute(J), J.alignX !== "none" && (J.meetOrSlice === "meet" && (N = F = F > N ? N : F), J.meetOrSlice === "slice" && (N = F = F > N ? F : N), Se = Q.width - X * F, Ee = Q.height - B * F, J.alignX === "Mid" && (Se /= 2), J.alignY === "Mid" && (Ee /= 2), J.alignX === "Min" && (Se = 0), J.alignY === "Min" && (Ee = 0)), F === 1 && N === 1 && G === 0 && W === 0 && q === 0 && Y === 0) return Q;
if ((q || Y) && R.parentNode.nodeName !== "#document" && (ve = " translate(" + u(q) + " " + u(Y) + ") "), re = ve + " matrix(" + F + " 0 0 " + N + " " + (G * F + Se) + " " + (W * N + Ee) + ") ", R.nodeName === "svg") {
for (U = R.ownerDocument.createElementNS(o.svgNS, "g"); R.firstChild;) U.appendChild(R.firstChild);
R.appendChild(U)
} else U = R, U.removeAttribute("x"), U.removeAttribute("y"), re = U.getAttribute("transform") + re;
return U.setAttribute("transform", re), Q
}
function M(R, O) {
for (; R && (R = R.parentNode);)
if (R.nodeName && O.test(R.nodeName.replace("svg:", "")) && !R.getAttribute("instantiated_by_use")) return !0;
return !1
}
o.parseSVGDocument = function(R, O, F, N) {
if (!!R) {
V(R);
var G = o.Object.__uid++,
W, X, B = k(R),
re = o.util.toArray(R.getElementsByTagName("*"));
if (B.crossOrigin = N && N.crossOrigin, B.svgUid = G, re.length === 0 && o.isLikelyNode) {
re = R.selectNodes('//*[name(.)!="svg"]');
var U = [];
for (W = 0, X = re.length; W < X; W++) U[W] = re[W];
re = U
}
var j = re.filter(function(q) {
return k(q), o.svgValidTagNamesRegEx.test(q.nodeName.replace("svg:", "")) && !M(q, o.svgInvalidAncestorsRegEx)
});
if (!j || j && !j.length) {
O && O([], {});
return
}
var K = {};
re.filter(function(q) {
return q.nodeName.replace("svg:", "") === "clipPath"
}).forEach(function(q) {
var Y = q.getAttribute("id");
K[Y] = o.util.toArray(q.getElementsByTagName("*")).filter(function(J) {
return o.svgValidTagNamesRegEx.test(J.nodeName.replace("svg:", ""))
})
}), o.gradientDefs[G] = o.getGradientDefs(R), o.cssRules[G] = o.getCSSRules(R), o.clipPaths[G] = K, o.parseElements(j, function(q, Y) {
O && (O(q, B, Y, re), delete o.gradientDefs[G], delete o.cssRules[G], delete o.clipPaths[G])
}, h(B), F, N)
}
};
function D(R, O) {
var F = ["gradientTransform", "x1", "x2", "y1", "y2", "gradientUnits", "cx", "cy", "r", "fx", "fy"],
N = "xlink:href",
G = O.getAttribute(N).slice(1),
W = ce(R, G);
if (W && W.getAttribute(N) && D(R, W), F.forEach(function(B) {
W && !O.hasAttribute(B) && W.hasAttribute(B) && O.setAttribute(B, W.getAttribute(B))
}), !O.children.length)
for (var X = W.cloneNode(!0); X.firstChild;) O.appendChild(X.firstChild);
O.removeAttribute(N)
}
var $ = new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*(" + o.reNum + "(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|" + o.reNum + "))?\\s+(.*)");
c(o, {
parseFontDeclaration: function(R, O) {
var F = R.match($);
if (!!F) {
var N = F[1],
G = F[3],
W = F[4],
X = F[5],
B = F[6];
N && (O.fontStyle = N), G && (O.fontWeight = isNaN(parseFloat(G)) ? G : parseFloat(G)), W && (O.fontSize = u(W)), B && (O.fontFamily = B), X && (O.lineHeight = X === "normal" ? 1 : X)
}
},
getGradientDefs: function(R) {
var O = ["linearGradient", "radialGradient", "svg:linearGradient", "svg:radialGradient"],
F = z(R, O),
N, G = 0,
W = {};
for (G = F.length; G--;) N = F[G], N.getAttribute("xlink:href") && D(R, N), W[N.getAttribute("id")] = N;
return W
},
parseAttributes: function(R, O, F) {
if (!!R) {
var N, G = {},
W, X;
typeof F > "u" && (F = R.getAttribute("svgUid")), R.parentNode && o.svgValidParentsRegEx.test(R.parentNode.nodeName) && (G = o.parseAttributes(R.parentNode, O, F));
var B = O.reduce(function(J, le) {
return N = R.getAttribute(le), N && (J[le] = N), J
}, {}),
re = c(te(R, F), o.parseStyleAttribute(R));
B = c(B, re), re[x] && R.setAttribute(x, re[x]), W = X = G.fontSize || o.Text.DEFAULT_SVG_FONT_SIZE, B[w] && (B[w] = W = u(B[w], X));
var U, j, K = {};
for (var q in B) U = S(q), j = T(U, B[q], G, W), K[U] = j;
K && K.font && o.parseFontDeclaration(K.font, K);
var Y = c(G, K);
return o.svgValidParentsRegEx.test(R.nodeName) ? Y : I(Y)
}
},
parseElements: function(R, O, F, N, G) {
new o.ElementsParser(R, O, F, N, G).parse()
},
parseStyleAttribute: function(R) {
var O = {},
F = R.getAttribute("style");
return F && (typeof F == "string" ? H(F, O) : ee(F, O)), O
},
parsePointsAttribute: function(R) {
if (!R) return null;
R = R.replace(/,/g, " ").trim(), R = R.split(/\s+/);
var O = [],
F, N;
for (F = 0, N = R.length; F < N; F += 2) O.push({
x: parseFloat(R[F]),
y: parseFloat(R[F + 1])
});
return O
},
getCSSRules: function(R) {
var O = R.getElementsByTagName("style"),
F, N, G = {},
W;
for (F = 0, N = O.length; F < N; F++) {
var X = O[F].textContent;
X = X.replace(/\/\*[\s\S]*?\*\//g, ""), X.trim() !== "" && (W = X.split("}"), W = W.filter(function(B) {
return B.trim()
}), W.forEach(function(B) {
var re = B.split("{"),
U = {},
j = re[1].trim(),
K = j.split(";").filter(function(le) {
return le.trim()
});
for (F = 0, N = K.length; F < N; F++) {
var q = K[F].split(":"),
Y = q[0].trim(),
J = q[1].trim();
U[Y] = J
}
B = re[0].trim(), B.split(",").forEach(function(le) {
le = le.replace(/^svg/i, "").trim(), le !== "" && (G[le] ? o.util.object.extend(G[le], U) : G[le] = o.util.object.clone(U))
})
}))
}
return G
},
loadSVGFromURL: function(R, O, F, N) {
R = R.replace(/^\n\s*/, "").trim(), new o.util.request(R, {
method: "get",
onComplete: G
});
function G(W) {
var X = W.responseXML;
if (!X || !X.documentElement) return O && O(null), !1;
o.parseSVGDocument(X.documentElement, function(B, re, U, j) {
O && O(B, re, U, j)
}, F, N)
}
},
loadSVGFromString: function(R, O, F, N) {
var G = new o.window.DOMParser,
W = G.parseFromString(R.trim(), "text/xml");
o.parseSVGDocument(W.documentElement, function(X, B, re, U) {
O(X, B, re, U)
}, F, N)
}
})
}(t), e.ElementsParser = function(a, o, c, h, l, u) {
this.elements = a, this.callback = o, this.options = c, this.reviver = h, this.svgUid = c && c.svgUid || 0, this.parsingOptions = l, this.regexUrl = /^url\(['"]?#([^'"]+)['"]?\)/g, this.doc = u
},
function(a) {
a.parse = function() {
this.instances = new Array(this.elements.length), this.numElements = this.elements.length, this.createObjects()
}, a.createObjects = function() {
var o = this;
this.elements.forEach(function(c, h) {
c.setAttribute("svgUid", o.svgUid), o.createObject(c, h)
})
}, a.findTag = function(o) {
return e[e.util.string.capitalize(o.tagName.replace("svg:", ""))]
}, a.createObject = function(o, c) {
var h = this.findTag(o);
if (h && h.fromElement) try {
h.fromElement(o, this.createCallback(c, o), this.options)
} catch (l) {
e.log(l)
} else this.checkIfDone()
}, a.createCallback = function(o, c) {
var h = this;
return function(l) {
var u;
h.resolveGradient(l, c, "fill"), h.resolveGradient(l, c, "stroke"), l instanceof e.Image && l._originalElement && (u = l.parsePreserveAspectRatioAttribute(c)), l._removeTransformMatrix(u), h.resolveClipPath(l, c), h.reviver && h.reviver(c, l), h.instances[o] = l, h.checkIfDone()
}
}, a.extractPropertyDefinition = function(o, c, h) {
var l = o[c],
u = this.regexUrl;
if (!!u.test(l)) {
u.lastIndex = 0;
var f = u.exec(l)[1];
return u.lastIndex = 0, e[h][this.svgUid][f]
}
}, a.resolveGradient = function(o, c, h) {
var l = this.extractPropertyDefinition(o, h, "gradientDefs");
if (l) {
var u = c.getAttribute(h + "-opacity"),
f = e.Gradient.fromElement(l, o, u, this.options);
o.set(h, f)
}
}, a.createClipPathCallback = function(o, c) {
return function(h) {
h._removeTransformMatrix(), h.fillRule = h.clipRule, c.push(h)
}
}, a.resolveClipPath = function(o, c) {
var h = this.extractPropertyDefinition(o, "clipPath", "clipPaths"),
l, u, f, p, m, g;
if (h) {
p = [], f = e.util.invertTransform(o.calcTransformMatrix());
for (var v = h[0].parentNode, y = c; y.parentNode && y.getAttribute("clip-path") !== o.clipPath;) y = y.parentNode;
y.parentNode.appendChild(v);
for (var b = 0; b < h.length; b++) l = h[b], u = this.findTag(l), u.fromElement(l, this.createClipPathCallback(o, p), this.options);
p.length === 1 ? h = p[0] : h = new e.Group(p), m = e.util.multiplyTransformMatrices(f, h.calcTransformMatrix()), h.clipPath && this.resolveClipPath(h, y);
var g = e.util.qrDecompose(m);
h.flipX = !1, h.flipY = !1, h.set("scaleX", g.scaleX), h.set("scaleY", g.scaleY), h.angle = g.angle, h.skewX = g.skewX, h.skewY = 0, h.setPositionByOrigin({
x: g.translateX,
y: g.translateY
}, "center", "center"), o.clipPath = h
} else delete o.clipPath
}, a.checkIfDone = function() {
--this.numElements === 0 && (this.instances = this.instances.filter(function(o) {
return o != null
}), this.callback(this.instances, this.elements))
}
}(e.ElementsParser.prototype),
function(a) {
var o = a.fabric || (a.fabric = {});
if (o.Point) {
o.warn("fabric.Point is already defined");
return
}
o.Point = c;
function c(h, l) {
this.x = h, this.y = l
}
c.prototype = {
type: "point",
constructor: c,
add: function(h) {
return new c(this.x + h.x, this.y + h.y)
},
addEquals: function(h) {
return this.x += h.x, this.y += h.y, this
},
scalarAdd: function(h) {
return new c(this.x + h, this.y + h)
},
scalarAddEquals: function(h) {
return this.x += h, this.y += h, this
},
subtract: function(h) {
return new c(this.x - h.x, this.y - h.y)
},
subtractEquals: function(h) {
return this.x -= h.x, this.y -= h.y, this
},
scalarSubtract: function(h) {
return new c(this.x - h, this.y - h)
},
scalarSubtractEquals: function(h) {
return this.x -= h, this.y -= h, this
},
multiply: function(h) {
return new c(this.x * h, this.y * h)
},
multiplyEquals: function(h) {
return this.x *= h, this.y *= h, this
},
divide: function(h) {
return new c(this.x / h, this.y / h)
},
divideEquals: function(h) {
return this.x /= h, this.y /= h, this
},
eq: function(h) {
return this.x === h.x && this.y === h.y
},
lt: function(h) {
return this.x < h.x && this.y < h.y
},
lte: function(h) {
return this.x <= h.x && this.y <= h.y
},
gt: function(h) {
return this.x > h.x && this.y > h.y
},
gte: function(h) {
return this.x >= h.x && this.y >= h.y
},
lerp: function(h, l) {
return typeof l > "u" && (l = .5), l = Math.max(Math.min(1, l), 0), new c(this.x + (h.x - this.x) * l, this.y + (h.y - this.y) * l)
},
distanceFrom: function(h) {
var l = this.x - h.x,
u = this.y - h.y;
return Math.sqrt(l * l + u * u)
},
midPointFrom: function(h) {
return this.lerp(h)
},
min: function(h) {
return new c(Math.min(this.x, h.x), Math.min(this.y, h.y))
},
max: function(h) {
return new c(Math.max(this.x, h.x), Math.max(this.y, h.y))
},
toString: function() {
return this.x + "," + this.y
},
setXY: function(h, l) {
return this.x = h, this.y = l, this
},
setX: function(h) {
return this.x = h, this
},
setY: function(h) {
return this.y = h, this
},
setFromPoint: function(h) {
return this.x = h.x, this.y = h.y, this
},
swap: function(h) {
var l = this.x,
u = this.y;
this.x = h.x, this.y = h.y, h.x = l, h.y = u
},
clone: function() {
return new c(this.x, this.y)
}
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {});
if (o.Intersection) {
o.warn("fabric.Intersection is already defined");
return
}
function c(h) {
this.status = h, this.points = []
}
o.Intersection = c, o.Intersection.prototype = {
constructor: c,
appendPoint: function(h) {
return this.points.push(h), this
},
appendPoints: function(h) {
return this.points = this.points.concat(h), this
}
}, o.Intersection.intersectLineLine = function(h, l, u, f) {
var p, m = (f.x - u.x) * (h.y - u.y) - (f.y - u.y) * (h.x - u.x),
g = (l.x - h.x) * (h.y - u.y) - (l.y - h.y) * (h.x - u.x),
v = (f.y - u.y) * (l.x - h.x) - (f.x - u.x) * (l.y - h.y);
if (v !== 0) {
var y = m / v,
b = g / v;
0 <= y && y <= 1 && 0 <= b && b <= 1 ? (p = new c("Intersection"), p.appendPoint(new o.Point(h.x + y * (l.x - h.x), h.y + y * (l.y - h.y)))) : p = new c
} else m === 0 || g === 0 ? p = new c("Coincident") : p = new c("Parallel");
return p
}, o.Intersection.intersectLinePolygon = function(h, l, u) {
var f = new c,
p = u.length,
m, g, v, y;
for (y = 0; y < p; y++) m = u[y], g = u[(y + 1) % p], v = c.intersectLineLine(h, l, m, g), f.appendPoints(v.points);
return f.points.length > 0 && (f.status = "Intersection"), f
}, o.Intersection.intersectPolygonPolygon = function(h, l) {
var u = new c,
f = h.length,
p;
for (p = 0; p < f; p++) {
var m = h[p],
g = h[(p + 1) % f],
v = c.intersectLinePolygon(m, g, l);
u.appendPoints(v.points)
}
return u.points.length > 0 && (u.status = "Intersection"), u
}, o.Intersection.intersectPolygonRectangle = function(h, l, u) {
var f = l.min(u),
p = l.max(u),
m = new o.Point(p.x, f.y),
g = new o.Point(f.x, p.y),
v = c.intersectLinePolygon(f, m, h),
y = c.intersectLinePolygon(m, p, h),
b = c.intersectLinePolygon(p, g, h),
w = c.intersectLinePolygon(g, f, h),
x = new c;
return x.appendPoints(v.points), x.appendPoints(y.points), x.appendPoints(b.points), x.appendPoints(w.points), x.points.length > 0 && (x.status = "Intersection"), x
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {});
if (o.Color) {
o.warn("fabric.Color is already defined.");
return
}
function c(l) {
l ? this._tryParsingColor(l) : this.setSource([0, 0, 0, 1])
}
o.Color = c, o.Color.prototype = {
_tryParsingColor: function(l) {
var u;
l in c.colorNameMap && (l = c.colorNameMap[l]), l === "transparent" && (u = [255, 255, 255, 0]), u || (u = c.sourceFromHex(l)), u || (u = c.sourceFromRgb(l)), u || (u = c.sourceFromHsl(l)), u || (u = [0, 0, 0, 1]), u && this.setSource(u)
},
_rgbToHsl: function(l, u, f) {
l /= 255, u /= 255, f /= 255;
var p, m, g, v = o.util.array.max([l, u, f]),
y = o.util.array.min([l, u, f]);
if (g = (v + y) / 2, v === y) p = m = 0;
else {
var b = v - y;
switch (m = g > .5 ? b / (2 - v - y) : b / (v + y), v) {
case l:
p = (u - f) / b + (u < f ? 6 : 0);
break;
case u:
p = (f - l) / b + 2;
break;
case f:
p = (l - u) / b + 4;
break
}
p /= 6
}
return [Math.round(p * 360), Math.round(m * 100), Math.round(g * 100)]
},
getSource: function() {
return this._source
},
setSource: function(l) {
this._source = l
},
toRgb: function() {
var l = this.getSource();
return "rgb(" + l[0] + "," + l[1] + "," + l[2] + ")"
},
toRgba: function() {
var l = this.getSource();
return "rgba(" + l[0] + "," + l[1] + "," + l[2] + "," + l[3] + ")"
},
toHsl: function() {
var l = this.getSource(),
u = this._rgbToHsl(l[0], l[1], l[2]);
return "hsl(" + u[0] + "," + u[1] + "%," + u[2] + "%)"
},
toHsla: function() {
var l = this.getSource(),
u = this._rgbToHsl(l[0], l[1], l[2]);
return "hsla(" + u[0] + "," + u[1] + "%," + u[2] + "%," + l[3] + ")"
},
toHex: function() {
var l = this.getSource(),
u, f, p;
return u = l[0].toString(16), u = u.length === 1 ? "0" + u : u, f = l[1].toString(16), f = f.length === 1 ? "0" + f : f, p = l[2].toString(16), p = p.length === 1 ? "0" + p : p, u.toUpperCase() + f.toUpperCase() + p.toUpperCase()
},
toHexa: function() {
var l = this.getSource(),
u;
return u = Math.round(l[3] * 255), u = u.toString(16), u = u.length === 1 ? "0" + u : u, this.toHex() + u.toUpperCase()
},
getAlpha: function() {
return this.getSource()[3]
},
setAlpha: function(l) {
var u = this.getSource();
return u[3] = l, this.setSource(u), this
},
toGrayscale: function() {
var l = this.getSource(),
u = parseInt((l[0] * .3 + l[1] * .59 + l[2] * .11).toFixed(0), 10),
f = l[3];
return this.setSource([u, u, u, f]), this
},
toBlackWhite: function(l) {
var u = this.getSource(),
f = (u[0] * .3 + u[1] * .59 + u[2] * .11).toFixed(0),
p = u[3];
return l = l || 127, f = Number(f) < Number(l) ? 0 : 255, this.setSource([f, f, f, p]), this
},
overlayWith: function(l) {
l instanceof c || (l = new c(l));
var u = [],
f = this.getAlpha(),
p = .5,
m = this.getSource(),
g = l.getSource(),
v;
for (v = 0; v < 3; v++) u.push(Math.round(m[v] * (1 - p) + g[v] * p));
return u[3] = f, this.setSource(u), this
}
}, o.Color.reRGBa = /^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i, o.Color.reHSLa = /^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i, o.Color.reHex = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i, o.Color.colorNameMap = {
aliceblue: "#F0F8FF",
antiquewhite: "#FAEBD7",
aqua: "#00FFFF",
aquamarine: "#7FFFD4",
azure: "#F0FFFF",
beige: "#F5F5DC",
bisque: "#FFE4C4",
black: "#000000",
blanchedalmond: "#FFEBCD",
blue: "#0000FF",
blueviolet: "#8A2BE2",
brown: "#A52A2A",
burlywood: "#DEB887",
cadetblue: "#5F9EA0",
chartreuse: "#7FFF00",
chocolate: "#D2691E",
coral: "#FF7F50",
cornflowerblue: "#6495ED",
cornsilk: "#FFF8DC",
crimson: "#DC143C",
cyan: "#00FFFF",
darkblue: "#00008B",
darkcyan: "#008B8B",
darkgoldenrod: "#B8860B",
darkgray: "#A9A9A9",
darkgrey: "#A9A9A9",
darkgreen: "#006400",
darkkhaki: "#BDB76B",
darkmagenta: "#8B008B",
darkolivegreen: "#556B2F",
darkorange: "#FF8C00",
darkorchid: "#9932CC",
darkred: "#8B0000",
darksalmon: "#E9967A",
darkseagreen: "#8FBC8F",
darkslateblue: "#483D8B",
darkslategray: "#2F4F4F",
darkslategrey: "#2F4F4F",
darkturquoise: "#00CED1",
darkviolet: "#9400D3",
deeppink: "#FF1493",
deepskyblue: "#00BFFF",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1E90FF",
firebrick: "#B22222",
floralwhite: "#FFFAF0",
forestgreen: "#228B22",
fuchsia: "#FF00FF",
gainsboro: "#DCDCDC",
ghostwhite: "#F8F8FF",
gold: "#FFD700",
goldenrod: "#DAA520",
gray: "#808080",
grey: "#808080",
green: "#008000",
greenyellow: "#ADFF2F",
honeydew: "#F0FFF0",
hotpink: "#FF69B4",
indianred: "#CD5C5C",
indigo: "#4B0082",
ivory: "#FFFFF0",
khaki: "#F0E68C",
lavender: "#E6E6FA",
lavenderblush: "#FFF0F5",
lawngreen: "#7CFC00",
lemonchiffon: "#FFFACD",
lightblue: "#ADD8E6",
lightcoral: "#F08080",
lightcyan: "#E0FFFF",
lightgoldenrodyellow: "#FAFAD2",
lightgray: "#D3D3D3",
lightgrey: "#D3D3D3",
lightgreen: "#90EE90",
lightpink: "#FFB6C1",
lightsalmon: "#FFA07A",
lightseagreen: "#20B2AA",
lightskyblue: "#87CEFA",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#B0C4DE",
lightyellow: "#FFFFE0",
lime: "#00FF00",
limegreen: "#32CD32",
linen: "#FAF0E6",
magenta: "#FF00FF",
maroon: "#800000",
mediumaquamarine: "#66CDAA",
mediumblue: "#0000CD",
mediumorchid: "#BA55D3",
mediumpurple: "#9370DB",
mediumseagreen: "#3CB371",
mediumslateblue: "#7B68EE",
mediumspringgreen: "#00FA9A",
mediumturquoise: "#48D1CC",
mediumvioletred: "#C71585",
midnightblue: "#191970",
mintcream: "#F5FFFA",
mistyrose: "#FFE4E1",
moccasin: "#FFE4B5",
navajowhite: "#FFDEAD",
navy: "#000080",
oldlace: "#FDF5E6",
olive: "#808000",
olivedrab: "#6B8E23",
orange: "#FFA500",
orangered: "#FF4500",
orchid: "#DA70D6",
palegoldenrod: "#EEE8AA",
palegreen: "#98FB98",
paleturquoise: "#AFEEEE",
palevioletred: "#DB7093",
papayawhip: "#FFEFD5",
peachpuff: "#FFDAB9",
peru: "#CD853F",
pink: "#FFC0CB",
plum: "#DDA0DD",
powderblue: "#B0E0E6",
purple: "#800080",
rebeccapurple: "#663399",
red: "#FF0000",
rosybrown: "#BC8F8F",
royalblue: "#4169E1",
saddlebrown: "#8B4513",
salmon: "#FA8072",
sandybrown: "#F4A460",
seagreen: "#2E8B57",
seashell: "#FFF5EE",
sienna: "#A0522D",
silver: "#C0C0C0",
skyblue: "#87CEEB",
slateblue: "#6A5ACD",
slategray: "#708090",
slategrey: "#708090",
snow: "#FFFAFA",
springgreen: "#00FF7F",
steelblue: "#4682B4",
tan: "#D2B48C",
teal: "#008080",
thistle: "#D8BFD8",
tomato: "#FF6347",
turquoise: "#40E0D0",
violet: "#EE82EE",
wheat: "#F5DEB3",
white: "#FFFFFF",
whitesmoke: "#F5F5F5",
yellow: "#FFFF00",
yellowgreen: "#9ACD32"
};
function h(l, u, f) {
return f < 0 && (f += 1), f > 1 && (f -= 1), f < 1 / 6 ? l + (u - l) * 6 * f : f < 1 / 2 ? u : f < 2 / 3 ? l + (u - l) * (2 / 3 - f) * 6 : l
}
o.Color.fromRgb = function(l) {
return c.fromSource(c.sourceFromRgb(l))
}, o.Color.sourceFromRgb = function(l) {
var u = l.match(c.reRGBa);
if (u) {
var f = parseInt(u[1], 10) / (/%$/.test(u[1]) ? 100 : 1) * (/%$/.test(u[1]) ? 255 : 1),
p = parseInt(u[2], 10) / (/%$/.test(u[2]) ? 100 : 1) * (/%$/.test(u[2]) ? 255 : 1),
m = parseInt(u[3], 10) / (/%$/.test(u[3]) ? 100 : 1) * (/%$/.test(u[3]) ? 255 : 1);
return [parseInt(f, 10), parseInt(p, 10), parseInt(m, 10), u[4] ? parseFloat(u[4]) : 1]
}
}, o.Color.fromRgba = c.fromRgb, o.Color.fromHsl = function(l) {
return c.fromSource(c.sourceFromHsl(l))
}, o.Color.sourceFromHsl = function(l) {
var u = l.match(c.reHSLa);
if (!!u) {
var f = (parseFloat(u[1]) % 360 + 360) % 360 / 360,
p = parseFloat(u[2]) / (/%$/.test(u[2]) ? 100 : 1),
m = parseFloat(u[3]) / (/%$/.test(u[3]) ? 100 : 1),
g, v, y;
if (p === 0) g = v = y = m;
else {
var b = m <= .5 ? m * (p + 1) : m + p - m * p,
w = m * 2 - b;
g = h(w, b, f + 1 / 3), v = h(w, b, f), y = h(w, b, f - 1 / 3)
}
return [Math.round(g * 255), Math.round(v * 255), Math.round(y * 255), u[4] ? parseFloat(u[4]) : 1]
}
}, o.Color.fromHsla = c.fromHsl, o.Color.fromHex = function(l) {
return c.fromSource(c.sourceFromHex(l))
}, o.Color.sourceFromHex = function(l) {
if (l.match(c.reHex)) {
var u = l.slice(l.indexOf("#") + 1),
f = u.length === 3 || u.length === 4,
p = u.length === 8 || u.length === 4,
m = f ? u.charAt(0) + u.charAt(0) : u.substring(0, 2),
g = f ? u.charAt(1) + u.charAt(1) : u.substring(2, 4),
v = f ? u.charAt(2) + u.charAt(2) : u.substring(4, 6),
y = p ? f ? u.charAt(3) + u.charAt(3) : u.substring(6, 8) : "FF";
return [parseInt(m, 16), parseInt(g, 16), parseInt(v, 16), parseFloat((parseInt(y, 16) / 255).toFixed(2))]
}
}, o.Color.fromSource = function(l) {
var u = new c;
return u.setSource(l), u
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = ["e", "se", "s", "sw", "w", "nw", "n", "ne", "e"],
h = ["ns", "nesw", "ew", "nwse"],
l = {},
u = "left",
f = "top",
p = "right",
m = "bottom",
g = "center",
v = {
top: m,
bottom: f,
left: p,
right: u,
center: g
},
y = o.util.radiansToDegrees,
b = Math.sign || function(U) {
return (U > 0) - (U < 0) || +U
};
function w(U, j) {
var K = U.angle + y(Math.atan2(j.y, j.x)) + 360;
return Math.round(K % 360 / 45)
}
function x(U, j) {
var K = j.transform.target,
q = K.canvas,
Y = o.util.object.clone(j);
Y.target = K, q && q.fire("object:" + U, Y), K.fire(U, j)
}
function S(U, j) {
var K = j.canvas,
q = K.uniScaleKey,
Y = U[q];
return K.uniformScaling && !Y || !K.uniformScaling && Y
}
function T(U) {
return U.originX === g && U.originY === g
}
function P(U, j, K) {
var q = U.lockScalingX,
Y = U.lockScalingY;
return !!(q && Y || !j && (q || Y) && K || q && j === "x" || Y && j === "y")
}
function I(U, j, K) {
var q = "not-allowed",
Y = S(U, K),
J = "";
if (j.x !== 0 && j.y === 0 ? J = "x" : j.x === 0 && j.y !== 0 && (J = "y"), P(K, J, Y)) return q;
var le = w(K, j);
return c[le] + "-resize"
}
function z(U, j, K) {
var q = "not-allowed";
if (j.x !== 0 && K.lockSkewingY || j.y !== 0 && K.lockSkewingX) return q;
var Y = w(K, j) % 4;
return h[Y] + "-resize"
}
function H(U, j, K) {
return U[K.canvas.altActionKey] ? l.skewCursorStyleHandler(U, j, K) : l.scaleCursorStyleHandler(U, j, K)
}
function ee(U, j, K) {
var q = U[K.canvas.altActionKey];
if (j.x === 0) return q ? "skewX" : "scaleY";
if (j.y === 0) return q ? "skewY" : "scaleX"
}
function te(U, j, K) {
return K.lockRotation ? "not-allowed" : j.cursorStyle
}
function ne(U, j, K, q) {
return {
e: U,
transform: j,
pointer: {
x: K,
y: q
}
}
}
function Z(U) {
return function(j, K, q, Y) {
var J = K.target,
le = J.getCenterPoint(),
xe = J.translateToOriginPoint(le, K.originX, K.originY),
me = U(j, K, q, Y);
return J.setPositionByOrigin(xe, K.originX, K.originY), me
}
}
function ie(U, j) {
return function(K, q, Y, J) {
var le = j(K, q, Y, J);
return le && x(U, ne(K, q, Y, J)), le
}
}
function ce(U, j, K, q, Y) {
var J = U.target,
le = J.controls[U.corner],
xe = J.canvas.getZoom(),
me = J.padding / xe,
Q = J.toLocalPoint(new o.Point(q, Y), j, K);
return Q.x >= me && (Q.x -= me), Q.x <= -me && (Q.x += me), Q.y >= me && (Q.y -= me), Q.y <= me && (Q.y += me), Q.x -= le.offsetX, Q.y -= le.offsetY, Q
}
function V(U) {
return U.flipX !== U.flipY
}
function C(U, j, K, q, Y) {
if (U[j] !== 0) {
var J = U._getTransformedDimensions()[q],
le = Y / J * U[K];
U.set(K, le)
}
}
function k(U, j, K, q) {
var Y = j.target,
J = Y._getTransformedDimensions(0, Y.skewY),
le = ce(j, j.originX, j.originY, K, q),
xe = Math.abs(le.x * 2) - J.x,
me = Y.skewX,
Q;
xe < 2 ? Q = 0 : (Q = y(Math.atan2(xe / Y.scaleX, J.y / Y.scaleY)), j.originX === u && j.originY === m && (Q = -Q), j.originX === p && j.originY === f && (Q = -Q), V(Y) && (Q = -Q));
var ve = me !== Q;
if (ve) {
var Se = Y._getTransformedDimensions().y;
Y.set("skewX", Q), C(Y, "skewY", "scaleY", "y", Se)
}
return ve
}
function M(U, j, K, q) {
var Y = j.target,
J = Y._getTransformedDimensions(Y.skewX, 0),
le = ce(j, j.originX, j.originY, K, q),
xe = Math.abs(le.y * 2) - J.y,
me = Y.skewY,
Q;
xe < 2 ? Q = 0 : (Q = y(Math.atan2(xe / Y.scaleY, J.x / Y.scaleX)), j.originX === u && j.originY === m && (Q = -Q), j.originX === p && j.originY === f && (Q = -Q), V(Y) && (Q = -Q));
var ve = me !== Q;
if (ve) {
var Se = Y._getTransformedDimensions().x;
Y.set("skewY", Q), C(Y, "skewX", "scaleX", "x", Se)
}
return ve
}
function D(U, j, K, q) {
var Y = j.target,
J = Y.skewX,
le, xe = j.originY;
if (Y.lockSkewingX) return !1;
if (J === 0) {
var me = ce(j, g, g, K, q);
me.x > 0 ? le = u : le = p
} else J > 0 && (le = xe === f ? u : p), J < 0 && (le = xe === f ? p : u), V(Y) && (le = le === u ? p : u);
j.originX = le;
var Q = ie("skewing", Z(k));
return Q(U, j, K, q)
}
function $(U, j, K, q) {
var Y = j.target,
J = Y.skewY,
le, xe = j.originX;
if (Y.lockSkewingY) return !1;
if (J === 0) {
var me = ce(j, g, g, K, q);
me.y > 0 ? le = f : le = m
} else J > 0 && (le = xe === u ? f : m), J < 0 && (le = xe === u ? m : f), V(Y) && (le = le === f ? m : f);
j.originY = le;
var Q = ie("skewing", Z(M));
return Q(U, j, K, q)
}
function R(U, j, K, q) {
var Y = j,
J = Y.target,
le = J.translateToOriginPoint(J.getCenterPoint(), Y.originX, Y.originY);
if (J.lockRotation) return !1;
var xe = Math.atan2(Y.ey - le.y, Y.ex - le.x),
me = Math.atan2(q - le.y, K - le.x),
Q = y(me - xe + Y.theta),
ve = !0;
if (J.snapAngle > 0) {
var Se = J.snapAngle,
Ee = J.snapThreshold || Se,
Be = Math.ceil(Q / Se) * Se,
De = Math.floor(Q / Se) * Se;
Math.abs(Q - De) < Ee ? Q = De : Math.abs(Q - Be) < Ee && (Q = Be)
}
return Q < 0 && (Q = 360 + Q), Q %= 360, ve = J.angle !== Q, J.angle = Q, ve
}
function O(U, j, K, q, Y) {
Y = Y || {};
var J = j.target,
le = J.lockScalingX,
xe = J.lockScalingY,
me = Y.by,
Q, ve, Se, Ee, Be = S(U, J),
De = P(J, me, Be),
Pt, Je, Ci = j.gestureScale;
if (De) return !1;
if (Ci) ve = j.scaleX * Ci, Se = j.scaleY * Ci;
else {
if (Q = ce(j, j.originX, j.originY, K, q), Pt = me !== "y" ? b(Q.x) : 1, Je = me !== "x" ? b(Q.y) : 1, j.signX || (j.signX = Pt), j.signY || (j.signY = Je), J.lockScalingFlip && (j.signX !== Pt || j.signY !== Je)) return !1;
if (Ee = J._getTransformedDimensions(), Be && !me) {
var ba = Math.abs(Q.x) + Math.abs(Q.y),
Tn = j.original,
cz = Math.abs(Ee.x * Tn.scaleX / J.scaleX) + Math.abs(Ee.y * Tn.scaleY / J.scaleY),
j_ = ba / cz;
ve = Tn.scaleX * j_, Se = Tn.scaleY * j_
} else ve = Math.abs(Q.x * J.scaleX / Ee.x), Se = Math.abs(Q.y * J.scaleY / Ee.y);
T(j) && (ve *= 2, Se *= 2), j.signX !== Pt && me !== "y" && (j.originX = v[j.originX], ve *= -1, j.signX = Pt), j.signY !== Je && me !== "x" && (j.originY = v[j.originY], Se *= -1, j.signY = Je)
}
var uz = J.scaleX,
fz = J.scaleY;
return me ? (me === "x" && J.set("scaleX", ve), me === "y" && J.set("scaleY", Se)) : (!le && J.set("scaleX", ve), !xe && J.set("scaleY", Se)), uz !== J.scaleX || fz !== J.scaleY
}
function F(U, j, K, q) {
return O(U, j, K, q)
}
function N(U, j, K, q) {
return O(U, j, K, q, {
by: "x"
})
}
function G(U, j, K, q) {
return O(U, j, K, q, {
by: "y"
})
}
function W(U, j, K, q) {
return U[j.target.canvas.altActionKey] ? l.skewHandlerX(U, j, K, q) : l.scalingY(U, j, K, q)
}
function X(U, j, K, q) {
return U[j.target.canvas.altActionKey] ? l.skewHandlerY(U, j, K, q) : l.scalingX(U, j, K, q)
}
function B(U, j, K, q) {
var Y = j.target,
J = ce(j, j.originX, j.originY, K, q),
le = Y.strokeWidth / (Y.strokeUniform ? Y.scaleX : 1),
xe = T(j) ? 2 : 1,
me = Y.width,
Q = Math.abs(J.x * xe / Y.scaleX) - le;
return Y.set("width", Math.max(Q, 0)), me !== Q
}
function re(U, j, K, q) {
var Y = j.target,
J = K - j.offsetX,
le = q - j.offsetY,
xe = !Y.get("lockMovementX") && Y.left !== J,
me = !Y.get("lockMovementY") && Y.top !== le;
return xe && Y.set("left", J), me && Y.set("top", le), (xe || me) && x("moving", ne(U, j, K, q)), xe || me
}
l.scaleCursorStyleHandler = I, l.skewCursorStyleHandler = z, l.scaleSkewCursorStyleHandler = H, l.rotationWithSnapping = ie("rotating", Z(R)), l.scalingEqually = ie("scaling", Z(F)), l.scalingX = ie("scaling", Z(N)), l.scalingY = ie("scaling", Z(G)), l.scalingYOrSkewingX = W, l.scalingXOrSkewingY = X, l.changeWidth = ie("resizing", Z(B)), l.skewHandlerX = D, l.skewHandlerY = $, l.dragHandler = re, l.scaleOrSkewActionName = ee, l.rotationStyleHandler = te, l.fireEvent = x, l.wrapWithFixedAnchor = Z, l.wrapWithFireEvent = ie, l.getLocalPoint = ce, o.controlsUtils = l
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.degreesToRadians,
h = o.controlsUtils;
function l(f, p, m, g, v) {
g = g || {};
var y = this.sizeX || g.cornerSize || v.cornerSize,
b = this.sizeY || g.cornerSize || v.cornerSize,
w = typeof g.transparentCorners < "u" ? g.transparentCorners : v.transparentCorners,
x = w ? "stroke" : "fill",
S = !w && (g.cornerStrokeColor || v.cornerStrokeColor),
T = p,
P = m,
I;
f.save(), f.fillStyle = g.cornerColor || v.cornerColor, f.strokeStyle = g.cornerStrokeColor || v.cornerStrokeColor, y > b ? (I = y, f.scale(1, b / y), P = m * y / b) : b > y ? (I = b, f.scale(y / b, 1), T = p * b / y) : I = y, f.lineWidth = 1, f.beginPath(), f.arc(T, P, I / 2, 0, 2 * Math.PI, !1), f[x](), S && f.stroke(), f.restore()
}
function u(f, p, m, g, v) {
g = g || {};
var y = this.sizeX || g.cornerSize || v.cornerSize,
b = this.sizeY || g.cornerSize || v.cornerSize,
w = typeof g.transparentCorners < "u" ? g.transparentCorners : v.transparentCorners,
x = w ? "stroke" : "fill",
S = !w && (g.cornerStrokeColor || v.cornerStrokeColor),
T = y / 2,
P = b / 2;
f.save(), f.fillStyle = g.cornerColor || v.cornerColor, f.strokeStyle = g.cornerStrokeColor || v.cornerStrokeColor, f.lineWidth = 1, f.translate(p, m), f.rotate(c(v.angle)), f[x + "Rect"](-T, -P, y, b), S && f.strokeRect(-T, -P, y, b), f.restore()
}
h.renderCircleControl = l, h.renderSquareControl = u
}(t),
function(a) {
var o = a.fabric || (a.fabric = {});
function c(h) {
for (var l in h) this[l] = h[l]
}
o.Control = c, o.Control.prototype = {
visible: !0,
actionName: "scale",
angle: 0,
x: 0,
y: 0,
offsetX: 0,
offsetY: 0,
sizeX: null,
sizeY: null,
touchSizeX: null,
touchSizeY: null,
cursorStyle: "crosshair",
withConnection: !1,
actionHandler: function() {},
mouseDownHandler: function() {},
mouseUpHandler: function() {},
getActionHandler: function() {
return this.actionHandler
},
getMouseDownHandler: function() {
return this.mouseDownHandler
},
getMouseUpHandler: function() {
return this.mouseUpHandler
},
cursorStyleHandler: function(h, l) {
return l.cursorStyle
},
getActionName: function(h, l) {
return l.actionName
},
getVisibility: function(h, l) {
var u = h._controlsVisibility;
return u && typeof u[l] < "u" ? u[l] : this.visible
},
setVisibility: function(h) {
this.visible = h
},
positionHandler: function(h, l) {
var u = o.util.transformPoint({
x: this.x * h.x + this.offsetX,
y: this.y * h.y + this.offsetY
}, l);
return u
},
calcCornerCoords: function(h, l, u, f, p) {
var m, g, v, y, b = p ? this.touchSizeX : this.sizeX,
w = p ? this.touchSizeY : this.sizeY;
if (b && w && b !== w) {
var x = Math.atan2(w, b),
S = Math.sqrt(b * b + w * w) / 2,
T = x - o.util.degreesToRadians(h),
P = Math.PI / 2 - x - o.util.degreesToRadians(h);
m = S * o.util.cos(T), g = S * o.util.sin(T), v = S * o.util.cos(P), y = S * o.util.sin(P)
} else {
var I = b && w ? b : l;
S = I * .7071067812;
var T = o.util.degreesToRadians(45 - h);
m = v = S * o.util.cos(T), g = y = S * o.util.sin(T)
}
return {
tl: {
x: u - y,
y: f - v
},
tr: {
x: u + m,
y: f - g
},
bl: {
x: u - m,
y: f + g
},
br: {
x: u + y,
y: f + v
}
}
},
render: function(h, l, u, f, p) {
switch (f = f || {}, f.cornerStyle || p.cornerStyle) {
case "circle":
o.controlsUtils.renderCircleControl.call(this, h, l, u, f, p);
break;
default:
o.controlsUtils.renderSquareControl.call(this, h, l, u, f, p)
}
}
}
}(t),
function() {
function a(u, f) {
var p = u.getAttribute("style"),
m = u.getAttribute("offset") || 0,
g, v, y, b;
if (m = parseFloat(m) / (/%$/.test(m) ? 100 : 1), m = m < 0 ? 0 : m > 1 ? 1 : m, p) {
var w = p.split(/\s*;\s*/);
for (w[w.length - 1] === "" && w.pop(), b = w.length; b--;) {
var x = w[b].split(/\s*:\s*/),
S = x[0].trim(),
T = x[1].trim();
S === "stop-color" ? g = T : S === "stop-opacity" && (y = T)
}
}
return g || (g = u.getAttribute("stop-color") || "rgb(0,0,0)"), y || (y = u.getAttribute("stop-opacity")), g = new e.Color(g), v = g.getAlpha(), y = isNaN(parseFloat(y)) ? 1 : parseFloat(y), y *= v * f, {
offset: m,
color: g.toRgb(),
opacity: y
}
}
function o(u) {
return {
x1: u.getAttribute("x1") || 0,
y1: u.getAttribute("y1") || 0,
x2: u.getAttribute("x2") || "100%",
y2: u.getAttribute("y2") || 0
}
}
function c(u) {
return {
x1: u.getAttribute("fx") || u.getAttribute("cx") || "50%",
y1: u.getAttribute("fy") || u.getAttribute("cy") || "50%",
r1: 0,
x2: u.getAttribute("cx") || "50%",
y2: u.getAttribute("cy") || "50%",
r2: u.getAttribute("r") || "50%"
}
}
var h = e.util.object.clone;
e.Gradient = e.util.createClass({
offsetX: 0,
offsetY: 0,
gradientTransform: null,
gradientUnits: "pixels",
type: "linear",
initialize: function(u) {
u || (u = {}), u.coords || (u.coords = {});
var f, p = this;
Object.keys(u).forEach(function(m) {
p[m] = u[m]
}), this.id ? this.id += "_" + e.Object.__uid++ : this.id = e.Object.__uid++, f = {
x1: u.coords.x1 || 0,
y1: u.coords.y1 || 0,
x2: u.coords.x2 || 0,
y2: u.coords.y2 || 0
}, this.type === "radial" && (f.r1 = u.coords.r1 || 0, f.r2 = u.coords.r2 || 0), this.coords = f, this.colorStops = u.colorStops.slice()
},
addColorStop: function(u) {
for (var f in u) {
var p = new e.Color(u[f]);
this.colorStops.push({
offset: parseFloat(f),
color: p.toRgb(),
opacity: p.getAlpha()
})
}
return this
},
toObject: function(u) {
var f = {
type: this.type,
coords: this.coords,
colorStops: this.colorStops,
offsetX: this.offsetX,
offsetY: this.offsetY,
gradientUnits: this.gradientUnits,
gradientTransform: this.gradientTransform ? this.gradientTransform.concat() : this.gradientTransform
};
return e.util.populateWithProperties(this, f, u), f
},
toSVG: function(u, v) {
var p = h(this.coords, !0),
m, g, v = v || {},
y, b, w = h(this.colorStops, !0),
x = p.r1 > p.r2,
S = this.gradientTransform ? this.gradientTransform.concat() : e.iMatrix.concat(),
T = -this.offsetX,
P = -this.offsetY,
I = !!v.additionalTransform,
z = this.gradientUnits === "pixels" ? "userSpaceOnUse" : "objectBoundingBox";
if (w.sort(function(Z, ie) {
return Z.offset - ie.offset
}), z === "objectBoundingBox" ? (T /= u.width, P /= u.height) : (T += u.width / 2, P += u.height / 2), u.type === "path" && this.gradientUnits !== "percentage" && (T -= u.pathOffset.x, P -= u.pathOffset.y), S[4] -= T, S[5] -= P, b = 'id="SVGID_' + this.id + '" gradientUnits="' + z + '"', b += ' gradientTransform="' + (I ? v.additionalTransform + " " : "") + e.util.matrixToSVG(S) + '" ', this.type === "linear" ? y = ["<linearGradient ", b, ' x1="', p.x1, '" y1="', p.y1, '" x2="', p.x2, '" y2="', p.y2, `">
`] : this.type === "radial" && (y = ["<radialGradient ", b, ' cx="', x ? p.x1 : p.x2, '" cy="', x ? p.y1 : p.y2, '" r="', x ? p.r1 : p.r2, '" fx="', x ? p.x2 : p.x1, '" fy="', x ? p.y2 : p.y1, `">
`]), this.type === "radial") {
if (x)
for (w = w.concat(), w.reverse(), m = 0, g = w.length; m < g; m++) w[m].offset = 1 - w[m].offset;
var H = Math.min(p.r1, p.r2);
if (H > 0) {
var ee = Math.max(p.r1, p.r2),
te = H / ee;
for (m = 0, g = w.length; m < g; m++) w[m].offset += te * (1 - w[m].offset)
}
}
for (m = 0, g = w.length; m < g; m++) {
var ne = w[m];
y.push("<stop ", 'offset="', ne.offset * 100 + "%", '" style="stop-color:', ne.color, typeof ne.opacity < "u" ? ";stop-opacity: " + ne.opacity : ";", `"/>
`)
}
return y.push(this.type === "linear" ? `</linearGradient>
` : `</radialGradient>
`), y.join("")
},
toLive: function(u) {
var f, p = e.util.object.clone(this.coords),
m, g;
if (!!this.type) {
for (this.type === "linear" ? f = u.createLinearGradient(p.x1, p.y1, p.x2, p.y2) : this.type === "radial" && (f = u.createRadialGradient(p.x1, p.y1, p.r1, p.x2, p.y2, p.r2)), m = 0, g = this.colorStops.length; m < g; m++) {
var v = this.colorStops[m].color,
y = this.colorStops[m].opacity,
b = this.colorStops[m].offset;
typeof y < "u" && (v = new e.Color(v).setAlpha(y).toRgba()), f.addColorStop(b, v)
}
return f
}
}
}), e.util.object.extend(e.Gradient, {
fromElement: function(u, f, p, m) {
var g = parseFloat(p) / (/%$/.test(p) ? 100 : 1);
g = g < 0 ? 0 : g > 1 ? 1 : g, isNaN(g) && (g = 1);
var v = u.getElementsByTagName("stop"),
y, b = u.getAttribute("gradientUnits") === "userSpaceOnUse" ? "pixels" : "percentage",
w = u.getAttribute("gradientTransform") || "",
x = [],
S, T, P = 0,
I = 0,
z;
for (u.nodeName === "linearGradient" || u.nodeName === "LINEARGRADIENT" ? (y = "linear", S = o(u)) : (y = "radial", S = c(u)), T = v.length; T--;) x.push(a(v[T], g));
z = e.parseTransformAttribute(w), l(f, S, m, b), b === "pixels" && (P = -f.left, I = -f.top);
var H = new e.Gradient({
id: u.getAttribute("id"),
type: y,
coords: S,
colorStops: x,
gradientUnits: b,
gradientTransform: z,
offsetX: P,
offsetY: I
});
return H
}
});
function l(u, f, p, m) {
var g, v;
Object.keys(f).forEach(function(y) {
g = f[y], g === "Infinity" ? v = 1 : g === "-Infinity" ? v = 0 : (v = parseFloat(f[y], 10), typeof g == "string" && /^(\d+\.\d+)%|(\d+)%$/.test(g) && (v *= .01, m === "pixels" && ((y === "x1" || y === "x2" || y === "r2") && (v *= p.viewBoxWidth || p.width), (y === "y1" || y === "y2") && (v *= p.viewBoxHeight || p.height)))), f[y] = v
})
}
}(),
function() {
var a = e.util.toFixed;
e.Pattern = e.util.createClass({
repeat: "repeat",
offsetX: 0,
offsetY: 0,
crossOrigin: "",
patternTransform: null,
initialize: function(o, c) {
if (o || (o = {}), this.id = e.Object.__uid++, this.setOptions(o), !o.source || o.source && typeof o.source != "string") {
c && c(this);
return
} else {
var h = this;
this.source = e.util.createImage(), e.util.loadImage(o.source, function(l, u) {
h.source = l, c && c(h, u)
}, null, this.crossOrigin)
}
},
toObject: function(o) {
var c = e.Object.NUM_FRACTION_DIGITS,
h, l;
return typeof this.source.src == "string" ? h = this.source.src : typeof this.source == "object" && this.source.toDataURL && (h = this.source.toDataURL()), l = {
type: "pattern",
source: h,
repeat: this.repeat,
crossOrigin: this.crossOrigin,
offsetX: a(this.offsetX, c),
offsetY: a(this.offsetY, c),
patternTransform: this.patternTransform ? this.patternTransform.concat() : null
}, e.util.populateWithProperties(this, l, o), l
},
toSVG: function(o) {
var c = typeof this.source == "function" ? this.source() : this.source,
h = c.width / o.width,
l = c.height / o.height,
u = this.offsetX / o.width,
f = this.offsetY / o.height,
p = "";
return (this.repeat === "repeat-x" || this.repeat === "no-repeat") && (l = 1, f && (l += Math.abs(f))), (this.repeat === "repeat-y" || this.repeat === "no-repeat") && (h = 1, u && (h += Math.abs(u))), c.src ? p = c.src : c.toDataURL && (p = c.toDataURL()), '<pattern id="SVGID_' + this.id + '" x="' + u + '" y="' + f + '" width="' + h + '" height="' + l + `">
<image x="0" y="0" width="` + c.width + '" height="' + c.height + '" xlink:href="' + p + `"></image>
</pattern>
`
},
setOptions: function(o) {
for (var c in o) this[c] = o[c]
},
toLive: function(o) {
var c = this.source;
return !c || typeof c.src < "u" && (!c.complete || c.naturalWidth === 0 || c.naturalHeight === 0) ? "" : o.createPattern(c, this.repeat)
}
})
}(),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.toFixed;
if (o.Shadow) {
o.warn("fabric.Shadow is already defined.");
return
}
o.Shadow = o.util.createClass({
color: "rgb(0,0,0)",
blur: 0,
offsetX: 0,
offsetY: 0,
affectStroke: !1,
includeDefaultValues: !0,
nonScaling: !1,
initialize: function(h) {
typeof h == "string" && (h = this._parseShadow(h));
for (var l in h) this[l] = h[l];
this.id = o.Object.__uid++
},
_parseShadow: function(h) {
var l = h.trim(),
u = o.Shadow.reOffsetsAndBlur.exec(l) || [],
f = l.replace(o.Shadow.reOffsetsAndBlur, "") || "rgb(0,0,0)";
return {
color: f.trim(),
offsetX: parseFloat(u[1], 10) || 0,
offsetY: parseFloat(u[2], 10) || 0,
blur: parseFloat(u[3], 10) || 0
}
},
toString: function() {
return [this.offsetX, this.offsetY, this.blur, this.color].join("px ")
},
toSVG: function(h) {
var l = 40,
u = 40,
f = o.Object.NUM_FRACTION_DIGITS,
p = o.util.rotateVector({
x: this.offsetX,
y: this.offsetY
}, o.util.degreesToRadians(-h.angle)),
m = 20,
g = new o.Color(this.color);
return h.width && h.height && (l = c((Math.abs(p.x) + this.blur) / h.width, f) * 100 + m, u = c((Math.abs(p.y) + this.blur) / h.height, f) * 100 + m), h.flipX && (p.x *= -1), h.flipY && (p.y *= -1), '<filter id="SVGID_' + this.id + '" y="-' + u + '%" height="' + (100 + 2 * u) + '%" x="-' + l + '%" width="' + (100 + 2 * l) + `%" >
<feGaussianBlur in="SourceAlpha" stdDeviation="` + c(this.blur ? this.blur / 2 : 0, f) + `"></feGaussianBlur>
<feOffset dx="` + c(p.x, f) + '" dy="' + c(p.y, f) + `" result="oBlur" ></feOffset>
<feFlood flood-color="` + g.toRgb() + '" flood-opacity="' + g.getAlpha() + `"/>
<feComposite in2="oBlur" operator="in" />
<feMerge>
<feMergeNode></feMergeNode>
<feMergeNode in="SourceGraphic"></feMergeNode>
</feMerge>
</filter>
`
},
toObject: function() {
if (this.includeDefaultValues) return {
color: this.color,
blur: this.blur,
offsetX: this.offsetX,
offsetY: this.offsetY,
affectStroke: this.affectStroke,
nonScaling: this.nonScaling
};
var h = {},
l = o.Shadow.prototype;
return ["color", "blur", "offsetX", "offsetY", "affectStroke", "nonScaling"].forEach(function(u) {
this[u] !== l[u] && (h[u] = this[u])
}, this), h
}
}), o.Shadow.reOffsetsAndBlur = /(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/
}(t),
function() {
if (e.StaticCanvas) {
e.warn("fabric.StaticCanvas is already defined.");
return
}
var a = e.util.object.extend,
o = e.util.getElementOffset,
c = e.util.removeFromArray,
h = e.util.toFixed,
l = e.util.transformPoint,
u = e.util.invertTransform,
f = e.util.getNodeCanvas,
p = e.util.createCanvasElement,
m = new Error("Could not initialize `canvas` element");
e.StaticCanvas = e.util.createClass(e.CommonMethods, {
initialize: function(g, v) {
v || (v = {}), this.renderAndResetBound = this.renderAndReset.bind(this), this.requestRenderAllBound = this.requestRenderAll.bind(this), this._initStatic(g, v)
},
backgroundColor: "",
backgroundImage: null,
overlayColor: "",
overlayImage: null,
includeDefaultValues: !0,
stateful: !1,
renderOnAddRemove: !0,
controlsAboveOverlay: !1,
allowTouchScrolling: !1,
imageSmoothingEnabled: !0,
viewportTransform: e.iMatrix.concat(),
backgroundVpt: !0,
overlayVpt: !0,
enableRetinaScaling: !0,
vptCoords: {},
skipOffscreen: !0,
clipPath: void 0,
_initStatic: function(g, v) {
var y = this.requestRenderAllBound;
this._objects = [], this._createLowerCanvas(g), this._initOptions(v), this.interactive || this._initRetinaScaling(), v.overlayImage && this.setOverlayImage(v.overlayImage, y), v.backgroundImage && this.setBackgroundImage(v.backgroundImage, y), v.backgroundColor && this.setBackgroundColor(v.backgroundColor, y), v.overlayColor && this.setOverlayColor(v.overlayColor, y), this.calcOffset()
},
_isRetinaScaling: function() {
return e.devicePixelRatio > 1 && this.enableRetinaScaling
},
getRetinaScaling: function() {
return this._isRetinaScaling() ? Math.max(1, e.devicePixelRatio) : 1
},
_initRetinaScaling: function() {
if (!!this._isRetinaScaling()) {
var g = e.devicePixelRatio;
this.__initRetinaScaling(g, this.lowerCanvasEl, this.contextContainer), this.upperCanvasEl && this.__initRetinaScaling(g, this.upperCanvasEl, this.contextTop)
}
},
__initRetinaScaling: function(g, v, y) {
v.setAttribute("width", this.width * g), v.setAttribute("height", this.height * g), y.scale(g, g)
},
calcOffset: function() {
return this._offset = o(this.lowerCanvasEl), this
},
setOverlayImage: function(g, v, y) {
return this.__setBgOverlayImage("overlayImage", g, v, y)
},
setBackgroundImage: function(g, v, y) {
return this.__setBgOverlayImage("backgroundImage", g, v, y)
},
setOverlayColor: function(g, v) {
return this.__setBgOverlayColor("overlayColor", g, v)
},
setBackgroundColor: function(g, v) {
return this.__setBgOverlayColor("backgroundColor", g, v)
},
__setBgOverlayImage: function(g, v, y, b) {
return typeof v == "string" ? e.util.loadImage(v, function(w, x) {
if (w) {
var S = new e.Image(w, b);
this[g] = S, S.canvas = this
}
y && y(w, x)
}, this, b && b.crossOrigin) : (b && v.setOptions(b), this[g] = v, v && (v.canvas = this), y && y(v, !1)), this
},
__setBgOverlayColor: function(g, v, y) {
return this[g] = v, this._initGradient(v, g), this._initPattern(v, g, y), this
},
_createCanvasElement: function() {
var g = p();
if (!g || (g.style || (g.style = {}), typeof g.getContext > "u")) throw m;
return g
},
_initOptions: function(g) {
var v = this.lowerCanvasEl;
this._setOptions(g), this.width = this.width || parseInt(v.width, 10) || 0, this.height = this.height || parseInt(v.height, 10) || 0, this.lowerCanvasEl.style && (v.width = this.width, v.height = this.height, v.style.width = this.width + "px", v.style.height = this.height + "px", this.viewportTransform = this.viewportTransform.slice())
},
_createLowerCanvas: function(g) {
g && g.getContext ? this.lowerCanvasEl = g : this.lowerCanvasEl = e.util.getById(g) || this._createCanvasElement(), e.util.addClass(this.lowerCanvasEl, "lower-canvas"), this._originalCanvasStyle = this.lowerCanvasEl.style, this.interactive && this._applyCanvasStyle(this.lowerCanvasEl), this.contextContainer = this.lowerCanvasEl.getContext("2d")
},
getWidth: function() {
return this.width
},
getHeight: function() {
return this.height
},
setWidth: function(g, v) {
return this.setDimensions({
width: g
}, v)
},
setHeight: function(g, v) {
return this.setDimensions({
height: g
}, v)
},
setDimensions: function(g, v) {
var y;
v = v || {};
for (var b in g) y = g[b], v.cssOnly || (this._setBackstoreDimension(b, g[b]), y += "px", this.hasLostContext = !0), v.backstoreOnly || this._setCssDimension(b, y);
return this._isCurrentlyDrawing && this.freeDrawingBrush && this.freeDrawingBrush._setBrushStyles(this.contextTop), this._initRetinaScaling(), this.calcOffset(), v.cssOnly || this.requestRenderAll(), this
},
_setBackstoreDimension: function(g, v) {
return this.lowerCanvasEl[g] = v, this.upperCanvasEl && (this.upperCanvasEl[g] = v), this.cacheCanvasEl && (this.cacheCanvasEl[g] = v), this[g] = v, this
},
_setCssDimension: function(g, v) {
return this.lowerCanvasEl.style[g] = v, this.upperCanvasEl && (this.upperCanvasEl.style[g] = v), this.wrapperEl && (this.wrapperEl.style[g] = v), this
},
getZoom: function() {
return this.viewportTransform[0]
},
setViewportTransform: function(g) {
var v = this._activeObject,
y = this.backgroundImage,
b = this.overlayImage,
w, x, S;
for (this.viewportTransform = g, x = 0, S = this._objects.length; x < S; x++) w = this._objects[x], w.group || w.setCoords(!0);
return v && v.setCoords(), y && y.setCoords(!0), b && b.setCoords(!0), this.calcViewportBoundaries(), this.renderOnAddRemove && this.requestRenderAll(), this
},
zoomToPoint: function(g, v) {
var y = g,
b = this.viewportTransform.slice(0);
g = l(g, u(this.viewportTransform)), b[0] = v, b[3] = v;
var w = l(g, b);
return b[4] += y.x - w.x, b[5] += y.y - w.y, this.setViewportTransform(b)
},
setZoom: function(g) {
return this.zoomToPoint(new e.Point(0, 0), g), this
},
absolutePan: function(g) {
var v = this.viewportTransform.slice(0);
return v[4] = -g.x, v[5] = -g.y, this.setViewportTransform(v)
},
relativePan: function(g) {
return this.absolutePan(new e.Point(-g.x - this.viewportTransform[4], -g.y - this.viewportTransform[5]))
},
getElement: function() {
return this.lowerCanvasEl
},
_onObjectAdded: function(g) {
this.stateful && g.setupState(), g._set("canvas", this), g.setCoords(), this.fire("object:added", {
target: g
}), g.fire("added")
},
_onObjectRemoved: function(g) {
this.fire("object:removed", {
target: g
}), g.fire("removed"), delete g.canvas
},
clearContext: function(g) {
return g.clearRect(0, 0, this.width, this.height), this
},
getContext: function() {
return this.contextContainer
},
clear: function() {
return this.remove.apply(this, this.getObjects()), this.backgroundImage = null, this.overlayImage = null, this.backgroundColor = "", this.overlayColor = "", this._hasITextHandlers && (this.off("mouse:up", this._mouseUpITextHandler), this._iTextInstances = null, this._hasITextHandlers = !1), this.clearContext(this.contextContainer), this.fire("canvas:cleared"), this.renderOnAddRemove && this.requestRenderAll(), this
},
renderAll: function() {
var g = this.contextContainer;
return this.renderCanvas(g, this._objects), this
},
renderAndReset: function() {
this.isRendering = 0, this.renderAll()
},
requestRenderAll: function() {
return this.isRendering || (this.isRendering = e.util.requestAnimFrame(this.renderAndResetBound)), this
},
calcViewportBoundaries: function() {
var g = {},
v = this.width,
y = this.height,
b = u(this.viewportTransform);
return g.tl = l({
x: 0,
y: 0
}, b), g.br = l({
x: v,
y
}, b), g.tr = new e.Point(g.br.x, g.tl.y), g.bl = new e.Point(g.tl.x, g.br.y), this.vptCoords = g, g
},
cancelRequestedRender: function() {
this.isRendering && (e.util.cancelAnimFrame(this.isRendering), this.isRendering = 0)
},
renderCanvas: function(g, v) {
var y = this.viewportTransform,
b = this.clipPath;
this.cancelRequestedRender(), this.calcViewportBoundaries(), this.clearContext(g), e.util.setImageSmoothing(g, this.imageSmoothingEnabled), this.fire("before:render", {
ctx: g
}), this._renderBackground(g), g.save(), g.transform(y[0], y[1], y[2], y[3], y[4], y[5]), this._renderObjects(g, v), g.restore(), !this.controlsAboveOverlay && this.interactive && this.drawControls(g), b && (b.canvas = this, b.shouldCache(), b._transformDone = !0, b.renderCache({
forClipping: !0
}), this.drawClipPathOnCanvas(g)), this._renderOverlay(g), this.controlsAboveOverlay && this.interactive && this.drawControls(g), this.fire("after:render", {
ctx: g
})
},
drawClipPathOnCanvas: function(g) {
var v = this.viewportTransform,
y = this.clipPath;
g.save(), g.transform(v[0], v[1], v[2], v[3], v[4], v[5]), g.globalCompositeOperation = "destination-in", y.transform(g), g.scale(1 / y.zoomX, 1 / y.zoomY), g.drawImage(y._cacheCanvas, -y.cacheTranslationX, -y.cacheTranslationY), g.restore()
},
_renderObjects: function(g, v) {
var y, b;
for (y = 0, b = v.length; y < b; ++y) v[y] && v[y].render(g)
},
_renderBackgroundOrOverlay: function(g, v) {
var y = this[v + "Color"],
b = this[v + "Image"],
w = this.viewportTransform,
x = this[v + "Vpt"];
if (!(!y && !b)) {
if (y) {
g.save(), g.beginPath(), g.moveTo(0, 0), g.lineTo(this.width, 0), g.lineTo(this.width, this.height), g.lineTo(0, this.height), g.closePath(), g.fillStyle = y.toLive ? y.toLive(g, this) : y, x && g.transform(w[0], w[1], w[2], w[3], w[4], w[5]), g.transform(1, 0, 0, 1, y.offsetX || 0, y.offsetY || 0);
var S = y.gradientTransform || y.patternTransform;
S && g.transform(S[0], S[1], S[2], S[3], S[4], S[5]), g.fill(), g.restore()
}
b && (g.save(), x && g.transform(w[0], w[1], w[2], w[3], w[4], w[5]), b.render(g), g.restore())
}
},
_renderBackground: function(g) {
this._renderBackgroundOrOverlay(g, "background")
},
_renderOverlay: function(g) {
this._renderBackgroundOrOverlay(g, "overlay")
},
getCenter: function() {
return {
top: this.height / 2,
left: this.width / 2
}
},
getCenterPoint: function() {
return new e.Point(this.width / 2, this.height / 2)
},
centerObjectH: function(g) {
return this._centerObject(g, new e.Point(this.getCenterPoint().x, g.getCenterPoint().y))
},
centerObjectV: function(g) {
return this._centerObject(g, new e.Point(g.getCenterPoint().x, this.getCenterPoint().y))
},
centerObject: function(g) {
var v = this.getCenterPoint();
return this._centerObject(g, v)
},
viewportCenterObject: function(g) {
var v = this.getVpCenter();
return this._centerObject(g, v)
},
viewportCenterObjectH: function(g) {
var v = this.getVpCenter();
return this._centerObject(g, new e.Point(v.x, g.getCenterPoint().y)), this
},
viewportCenterObjectV: function(g) {
var v = this.getVpCenter();
return this._centerObject(g, new e.Point(g.getCenterPoint().x, v.y))
},
getVpCenter: function() {
var g = this.getCenterPoint(),
v = u(this.viewportTransform);
return l(g, v)
},
_centerObject: function(g, v) {
return g.setPositionByOrigin(v, "center", "center"), g.setCoords(), this.renderOnAddRemove && this.requestRenderAll(), this
},
toDatalessJSON: function(g) {
return this.toDatalessObject(g)
},
toObject: function(g) {
return this._toObjectMethod("toObject", g)
},
toDatalessObject: function(g) {
return this._toObjectMethod("toDatalessObject", g)
},
_toObjectMethod: function(g, v) {
var y = this.clipPath,
b = {
version: e.version,
objects: this._toObjects(g, v)
};
return y && !y.excludeFromExport && (b.clipPath = this._toObject(this.clipPath, g, v)), a(b, this.__serializeBgOverlay(g, v)), e.util.populateWithProperties(this, b, v), b
},
_toObjects: function(g, v) {
return this._objects.filter(function(y) {
return !y.excludeFromExport
}).map(function(y) {
return this._toObject(y, g, v)
}, this)
},
_toObject: function(g, v, y) {
var b;
this.includeDefaultValues || (b = g.includeDefaultValues, g.includeDefaultValues = !1);
var w = g[v](y);
return this.includeDefaultValues || (g.includeDefaultValues = b), w
},
__serializeBgOverlay: function(g, v) {
var y = {},
b = this.backgroundImage,
w = this.overlayImage,
x = this.backgroundColor,
S = this.overlayColor;
return x && x.toObject ? x.excludeFromExport || (y.background = x.toObject(v)) : x && (y.background = x), S && S.toObject ? S.excludeFromExport || (y.overlay = S.toObject(v)) : S && (y.overlay = S), b && !b.excludeFromExport && (y.backgroundImage = this._toObject(b, g, v)), w && !w.excludeFromExport && (y.overlayImage = this._toObject(w, g, v)), y
},
svgViewportTransformation: !0,
toSVG: function(g, v) {
g || (g = {}), g.reviver = v;
var y = [];
return this._setSVGPreamble(y, g), this._setSVGHeader(y, g), this.clipPath && y.push('<g clip-path="url(#' + this.clipPath.clipPathId + `)" >
`), this._setSVGBgOverlayColor(y, "background"), this._setSVGBgOverlayImage(y, "backgroundImage", v), this._setSVGObjects(y, v), this.clipPath && y.push(`</g>
`), this._setSVGBgOverlayColor(y, "overlay"), this._setSVGBgOverlayImage(y, "overlayImage", v), y.push("</svg>"), y.join("")
},
_setSVGPreamble: function(g, v) {
v.suppressPreamble || g.push('<?xml version="1.0" encoding="', v.encoding || "UTF-8", `" standalone="no" ?>
`, '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ', `"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
`)
},
_setSVGHeader: function(g, v) {
var y = v.width || this.width,
b = v.height || this.height,
w, x = 'viewBox="0 0 ' + this.width + " " + this.height + '" ',
S = e.Object.NUM_FRACTION_DIGITS;
v.viewBox ? x = 'viewBox="' + v.viewBox.x + " " + v.viewBox.y + " " + v.viewBox.width + " " + v.viewBox.height + '" ' : this.svgViewportTransformation && (w = this.viewportTransform, x = 'viewBox="' + h(-w[4] / w[0], S) + " " + h(-w[5] / w[3], S) + " " + h(this.width / w[0], S) + " " + h(this.height / w[3], S) + '" '), g.push("<svg ", 'xmlns="http://www.w3.org/2000/svg" ', 'xmlns:xlink="http://www.w3.org/1999/xlink" ', 'version="1.1" ', 'width="', y, '" ', 'height="', b, '" ', x, `xml:space="preserve">
`, "<desc>Created with Fabric.js ", e.version, `</desc>
`, `<defs>
`, this.createSVGFontFacesMarkup(), this.createSVGRefElementsMarkup(), this.createSVGClipPathMarkup(v), `</defs>
`)
},
createSVGClipPathMarkup: function(g) {
var v = this.clipPath;
return v ? (v.clipPathId = "CLIPPATH_" + e.Object.__uid++, '<clipPath id="' + v.clipPathId + `" >
` + this.clipPath.toClipPathSVG(g.reviver) + `</clipPath>
`) : ""
},
createSVGRefElementsMarkup: function() {
var g = this,
v = ["background", "overlay"].map(function(y) {
var b = g[y + "Color"];
if (b && b.toLive) {
var w = g[y + "Vpt"],
x = g.viewportTransform,
S = {
width: g.width / (w ? x[0] : 1),
height: g.height / (w ? x[3] : 1)
};
return b.toSVG(S, {
additionalTransform: w ? e.util.matrixToSVG(x) : ""
})
}
});
return v.join("")
},
createSVGFontFacesMarkup: function() {
var g = "",
v = {},
y, b, w, x, S, T, P, I, z, H = e.fontPaths,
ee = [];
for (this._objects.forEach(function ne(Z) {
ee.push(Z), Z._objects && Z._objects.forEach(ne)
}), I = 0, z = ee.length; I < z; I++)
if (y = ee[I], b = y.fontFamily, !(y.type.indexOf("text") === -1 || v[b] || !H[b]) && (v[b] = !0, !!y.styles)) {
w = y.styles;
for (S in w) {
x = w[S];
for (P in x) T = x[P], b = T.fontFamily, !v[b] && H[b] && (v[b] = !0)
}
} for (var te in v) g += [` @font-face {
`, " font-family: '", te, `';
`, " src: url('", H[te], `');
`, ` }
`].join("");
return g && (g = [' <style type="text/css">', `<![CDATA[
`, g, "]]>", `</style>
`].join("")), g
},
_setSVGObjects: function(g, v) {
var y, b, w, x = this._objects;
for (b = 0, w = x.length; b < w; b++) y = x[b], !y.excludeFromExport && this._setSVGObject(g, y, v)
},
_setSVGObject: function(g, v, y) {
g.push(v.toSVG(y))
},
_setSVGBgOverlayImage: function(g, v, y) {
this[v] && !this[v].excludeFromExport && this[v].toSVG && g.push(this[v].toSVG(y))
},
_setSVGBgOverlayColor: function(g, v) {
var y = this[v + "Color"],
b = this.viewportTransform,
w = this.width,
x = this.height;
if (!!y)
if (y.toLive) {
var S = y.repeat,
T = e.util.invertTransform(b),
P = this[v + "Vpt"],
I = P ? e.util.matrixToSVG(T) : "";
g.push('<rect transform="' + I + " translate(", w / 2, ",", x / 2, ')"', ' x="', y.offsetX - w / 2, '" y="', y.offsetY - x / 2, '" ', 'width="', S === "repeat-y" || S === "no-repeat" ? y.source.width : w, '" height="', S === "repeat-x" || S === "no-repeat" ? y.source.height : x, '" fill="url(#SVGID_' + y.id + ')"', `></rect>
`)
} else g.push('<rect x="0" y="0" width="100%" height="100%" ', 'fill="', y, '"', `></rect>
`)
},
sendToBack: function(g) {
if (!g) return this;
var v = this._activeObject,
y, b, w;
if (g === v && g.type === "activeSelection")
for (w = v._objects, y = w.length; y--;) b = w[y], c(this._objects, b), this._objects.unshift(b);
else c(this._objects, g), this._objects.unshift(g);
return this.renderOnAddRemove && this.requestRenderAll(), this
},
bringToFront: function(g) {
if (!g) return this;
var v = this._activeObject,
y, b, w;
if (g === v && g.type === "activeSelection")
for (w = v._objects, y = 0; y < w.length; y++) b = w[y], c(this._objects, b), this._objects.push(b);
else c(this._objects, g), this._objects.push(g);
return this.renderOnAddRemove && this.requestRenderAll(), this
},
sendBackwards: function(g, v) {
if (!g) return this;
var y = this._activeObject,
b, w, x, S, T, P = 0;
if (g === y && g.type === "activeSelection")
for (T = y._objects, b = 0; b < T.length; b++) w = T[b], x = this._objects.indexOf(w), x > 0 + P && (S = x - 1, c(this._objects, w), this._objects.splice(S, 0, w)), P++;
else x = this._objects.indexOf(g), x !== 0 && (S = this._findNewLowerIndex(g, x, v), c(this._objects, g), this._objects.splice(S, 0, g));
return this.renderOnAddRemove && this.requestRenderAll(), this
},
_findNewLowerIndex: function(g, v, y) {
var b, w;
if (y)
for (b = v, w = v - 1; w >= 0; --w) {
var x = g.intersectsWithObject(this._objects[w]) || g.isContainedWithinObject(this._objects[w]) || this._objects[w].isContainedWithinObject(g);
if (x) {
b = w;
break
}
} else b = v - 1;
return b
},
bringForward: function(g, v) {
if (!g) return this;
var y = this._activeObject,
b, w, x, S, T, P = 0;
if (g === y && g.type === "activeSelection")
for (T = y._objects, b = T.length; b--;) w = T[b], x = this._objects.indexOf(w), x < this._objects.length - 1 - P && (S = x + 1, c(this._objects, w), this._objects.splice(S, 0, w)), P++;
else x = this._objects.indexOf(g), x !== this._objects.length - 1 && (S = this._findNewUpperIndex(g, x, v), c(this._objects, g), this._objects.splice(S, 0, g));
return this.renderOnAddRemove && this.requestRenderAll(), this
},
_findNewUpperIndex: function(g, v, y) {
var b, w, x;
if (y)
for (b = v, w = v + 1, x = this._objects.length; w < x; ++w) {
var S = g.intersectsWithObject(this._objects[w]) || g.isContainedWithinObject(this._objects[w]) || this._objects[w].isContainedWithinObject(g);
if (S) {
b = w;
break
}
} else b = v + 1;
return b
},
moveTo: function(g, v) {
return c(this._objects, g), this._objects.splice(v, 0, g), this.renderOnAddRemove && this.requestRenderAll()
},
dispose: function() {
return this.isRendering && (e.util.cancelAnimFrame(this.isRendering), this.isRendering = 0), this.forEachObject(function(g) {
g.dispose && g.dispose()
}), this._objects = [], this.backgroundImage && this.backgroundImage.dispose && this.backgroundImage.dispose(), this.backgroundImage = null, this.overlayImage && this.overlayImage.dispose && this.overlayImage.dispose(), this.overlayImage = null, this._iTextInstances = null, this.contextContainer = null, this.lowerCanvasEl.classList.remove("lower-canvas"), e.util.setStyle(this.lowerCanvasEl, this._originalCanvasStyle), delete this._originalCanvasStyle, this.lowerCanvasEl.setAttribute("width", this.width), this.lowerCanvasEl.setAttribute("height", this.height), e.util.cleanUpJsdomNode(this.lowerCanvasEl), this.lowerCanvasEl = void 0, this
},
toString: function() {
return "#<fabric.Canvas (" + this.complexity() + "): { objects: " + this._objects.length + " }>"
}
}), a(e.StaticCanvas.prototype, e.Observable), a(e.StaticCanvas.prototype, e.Collection), a(e.StaticCanvas.prototype, e.DataURLExporter), a(e.StaticCanvas, {
EMPTY_JSON: '{"objects": [], "background": "white"}',
supports: function(g) {
var v = p();
if (!v || !v.getContext) return null;
var y = v.getContext("2d");
if (!y) return null;
switch (g) {
case "setLineDash":
return typeof y.setLineDash < "u";
default:
return null
}
}
}), e.StaticCanvas.prototype.toJSON = e.StaticCanvas.prototype.toObject, e.isLikelyNode && (e.StaticCanvas.prototype.createPNGStream = function() {
var g = f(this.lowerCanvasEl);
return g && g.createPNGStream()
}, e.StaticCanvas.prototype.createJPEGStream = function(g) {
var v = f(this.lowerCanvasEl);
return v && v.createJPEGStream(g)
})
}(), e.BaseBrush = e.util.createClass({
color: "rgb(0, 0, 0)",
width: 1,
shadow: null,
strokeLineCap: "round",
strokeLineJoin: "round",
strokeMiterLimit: 10,
strokeDashArray: null,
limitedToCanvasSize: !1,
_setBrushStyles: function(a) {
a.strokeStyle = this.color, a.lineWidth = this.width, a.lineCap = this.strokeLineCap, a.miterLimit = this.strokeMiterLimit, a.lineJoin = this.strokeLineJoin, a.setLineDash(this.strokeDashArray || [])
},
_saveAndTransform: function(a) {
var o = this.canvas.viewportTransform;
a.save(), a.transform(o[0], o[1], o[2], o[3], o[4], o[5])
},
_setShadow: function() {
if (!!this.shadow) {
var a = this.canvas,
o = this.shadow,
c = a.contextTop,
h = a.getZoom();
a && a._isRetinaScaling() && (h *= e.devicePixelRatio), c.shadowColor = o.color, c.shadowBlur = o.blur * h, c.shadowOffsetX = o.offsetX * h, c.shadowOffsetY = o.offsetY * h
}
},
needsFullRender: function() {
var a = new e.Color(this.color);
return a.getAlpha() < 1 || !!this.shadow
},
_resetShadow: function() {
var a = this.canvas.contextTop;
a.shadowColor = "", a.shadowBlur = a.shadowOffsetX = a.shadowOffsetY = 0
},
_isOutSideCanvas: function(a) {
return a.x < 0 || a.x > this.canvas.getWidth() || a.y < 0 || a.y > this.canvas.getHeight()
}
}),
function() {
e.PencilBrush = e.util.createClass(e.BaseBrush, {
decimate: .4,
drawStraightLine: !1,
straightLineKey: "shiftKey",
initialize: function(a) {
this.canvas = a, this._points = []
},
needsFullRender: function() {
return this.callSuper("needsFullRender") || this._hasStraightLine
},
_drawSegment: function(a, o, c) {
var h = o.midPointFrom(c);
return a.quadraticCurveTo(o.x, o.y, h.x, h.y), h
},
onMouseDown: function(a, o) {
!this.canvas._isMainEvent(o.e) || (this.drawStraightLine = o.e[this.straightLineKey], this._prepareForDrawing(a), this._captureDrawingPath(a), this._render())
},
onMouseMove: function(a, o) {
if (!!this.canvas._isMainEvent(o.e) && (this.drawStraightLine = o.e[this.straightLineKey], !(this.limitedToCanvasSize === !0 && this._isOutSideCanvas(a)) && this._captureDrawingPath(a) && this._points.length > 1))
if (this.needsFullRender()) this.canvas.clearContext(this.canvas.contextTop), this._render();
else {
var c = this._points,
h = c.length,
l = this.canvas.contextTop;
this._saveAndTransform(l), this.oldEnd && (l.beginPath(), l.moveTo(this.oldEnd.x, this.oldEnd.y)), this.oldEnd = this._drawSegment(l, c[h - 2], c[h - 1], !0), l.stroke(), l.restore()
}
},
onMouseUp: function(a) {
return this.canvas._isMainEvent(a.e) ? (this.drawStraightLine = !1, this.oldEnd = void 0, this._finalizeAndAddPath(), !1) : !0
},
_prepareForDrawing: function(a) {
var o = new e.Point(a.x, a.y);
this._reset(), this._addPoint(o), this.canvas.contextTop.moveTo(o.x, o.y)
},
_addPoint: function(a) {
return this._points.length > 1 && a.eq(this._points[this._points.length - 1]) ? !1 : (this.drawStraightLine && this._points.length > 1 && (this._hasStraightLine = !0, this._points.pop()), this._points.push(a), !0)
},
_reset: function() {
this._points = [], this._setBrushStyles(this.canvas.contextTop), this._setShadow(), this._hasStraightLine = !1
},
_captureDrawingPath: function(a) {
var o = new e.Point(a.x, a.y);
return this._addPoint(o)
},
_render: function(a) {
var o, c, h = this._points[0],
l = this._points[1];
if (a = a || this.canvas.contextTop, this._saveAndTransform(a), a.beginPath(), this._points.length === 2 && h.x === l.x && h.y === l.y) {
var u = this.width / 1e3;
h = new e.Point(h.x, h.y), l = new e.Point(l.x, l.y), h.x -= u, l.x += u
}
for (a.moveTo(h.x, h.y), o = 1, c = this._points.length; o < c; o++) this._drawSegment(a, h, l), h = this._points[o], l = this._points[o + 1];
a.lineTo(h.x, h.y), a.stroke(), a.restore()
},
convertPointsToSVGPath: function(a) {
var o = this.width / 1e3;
return e.util.getSmoothPathFromPoints(a, o)
},
_isEmptySVGPath: function(a) {
var o = e.util.joinPath(a);
return o === "M 0 0 Q 0 0 0 0 L 0 0"
},
createPath: function(a) {
var o = new e.Path(a, {
fill: null,
stroke: this.color,
strokeWidth: this.width,
strokeLineCap: this.strokeLineCap,
strokeMiterLimit: this.strokeMiterLimit,
strokeLineJoin: this.strokeLineJoin,
strokeDashArray: this.strokeDashArray
});
return this.shadow && (this.shadow.affectStroke = !0, o.shadow = new e.Shadow(this.shadow)), o
},
decimatePoints: function(a, o) {
if (a.length <= 2) return a;
var c = this.canvas.getZoom(),
h = Math.pow(o / c, 2),
l, u = a.length - 1,
f = a[0],
p = [f],
m;
for (l = 1; l < u - 1; l++) m = Math.pow(f.x - a[l].x, 2) + Math.pow(f.y - a[l].y, 2), m >= h && (f = a[l], p.push(f));
return p.push(a[u]), p
},
_finalizeAndAddPath: function() {
var a = this.canvas.contextTop;
a.closePath(), this.decimate && (this._points = this.decimatePoints(this._points, this.decimate));
var o = this.convertPointsToSVGPath(this._points);
if (this._isEmptySVGPath(o)) {
this.canvas.requestRenderAll();
return
}
var c = this.createPath(o);
this.canvas.clearContext(this.canvas.contextTop), this.canvas.fire("before:path:created", {
path: c
}), this.canvas.add(c), this.canvas.requestRenderAll(), c.setCoords(), this._resetShadow(), this.canvas.fire("path:created", {
path: c
})
}
})
}(), e.CircleBrush = e.util.createClass(e.BaseBrush, {
width: 10,
initialize: function(a) {
this.canvas = a, this.points = []
},
drawDot: function(a) {
var o = this.addPoint(a),
c = this.canvas.contextTop;
this._saveAndTransform(c), this.dot(c, o), c.restore()
},
dot: function(a, o) {
a.fillStyle = o.fill, a.beginPath(), a.arc(o.x, o.y, o.radius, 0, Math.PI * 2, !1), a.closePath(), a.fill()
},
onMouseDown: function(a) {
this.points.length = 0, this.canvas.clearContext(this.canvas.contextTop), this._setShadow(), this.drawDot(a)
},
_render: function() {
var a = this.canvas.contextTop,
o, c, h = this.points;
for (this._saveAndTransform(a), o = 0, c = h.length; o < c; o++) this.dot(a, h[o]);
a.restore()
},
onMouseMove: function(a) {
this.limitedToCanvasSize === !0 && this._isOutSideCanvas(a) || (this.needsFullRender() ? (this.canvas.clearContext(this.canvas.contextTop), this.addPoint(a), this._render()) : this.drawDot(a))
},
onMouseUp: function() {
var a = this.canvas.renderOnAddRemove,
o, c;
this.canvas.renderOnAddRemove = !1;
var h = [];
for (o = 0, c = this.points.length; o < c; o++) {
var l = this.points[o],
u = new e.Circle({
radius: l.radius,
left: l.x,
top: l.y,
originX: "center",
originY: "center",
fill: l.fill
});
this.shadow && (u.shadow = new e.Shadow(this.shadow)), h.push(u)
}
var f = new e.Group(h);
f.canvas = this.canvas, this.canvas.fire("before:path:created", {
path: f
}), this.canvas.add(f), this.canvas.fire("path:created", {
path: f
}), this.canvas.clearContext(this.canvas.contextTop), this._resetShadow(), this.canvas.renderOnAddRemove = a, this.canvas.requestRenderAll()
},
addPoint: function(a) {
var o = new e.Point(a.x, a.y),
c = e.util.getRandomInt(Math.max(0, this.width - 20), this.width + 20) / 2,
h = new e.Color(this.color).setAlpha(e.util.getRandomInt(0, 100) / 100).toRgba();
return o.radius = c, o.fill = h, this.points.push(o), o
}
}), e.SprayBrush = e.util.createClass(e.BaseBrush, {
width: 10,
density: 20,
dotWidth: 1,
dotWidthVariance: 1,
randomOpacity: !1,
optimizeOverlapping: !0,
initialize: function(a) {
this.canvas = a, this.sprayChunks = []
},
onMouseDown: function(a) {
this.sprayChunks.length = 0, this.canvas.clearContext(this.canvas.contextTop), this._setShadow(), this.addSprayChunk(a), this.render(this.sprayChunkPoints)
},
onMouseMove: function(a) {
this.limitedToCanvasSize === !0 && this._isOutSideCanvas(a) || (this.addSprayChunk(a), this.render(this.sprayChunkPoints))
},
onMouseUp: function() {
var a = this.canvas.renderOnAddRemove;
this.canvas.renderOnAddRemove = !1;
for (var o = [], c = 0, h = this.sprayChunks.length; c < h; c++)
for (var l = this.sprayChunks[c], u = 0, f = l.length; u < f; u++) {
var p = new e.Rect({
width: l[u].width,
height: l[u].width,
left: l[u].x + 1,
top: l[u].y + 1,
originX: "center",
originY: "center",
fill: this.color
});
o.push(p)
}
this.optimizeOverlapping && (o = this._getOptimizedRects(o));
var m = new e.Group(o);
this.shadow && m.set("shadow", new e.Shadow(this.shadow)), this.canvas.fire("before:path:created", {
path: m
}), this.canvas.add(m), this.canvas.fire("path:created", {
path: m
}), this.canvas.clearContext(this.canvas.contextTop), this._resetShadow(), this.canvas.renderOnAddRemove = a, this.canvas.requestRenderAll()
},
_getOptimizedRects: function(a) {
var o = {},
c, h, l;
for (h = 0, l = a.length; h < l; h++) c = a[h].left + "" + a[h].top, o[c] || (o[c] = a[h]);
var u = [];
for (c in o) u.push(o[c]);
return u
},
render: function(a) {
var o = this.canvas.contextTop,
c, h;
for (o.fillStyle = this.color, this._saveAndTransform(o), c = 0, h = a.length; c < h; c++) {
var l = a[c];
typeof l.opacity < "u" && (o.globalAlpha = l.opacity), o.fillRect(l.x, l.y, l.width, l.width)
}
o.restore()
},
_render: function() {
var a = this.canvas.contextTop,
o, c;
for (a.fillStyle = this.color, this._saveAndTransform(a), o = 0, c = this.sprayChunks.length; o < c; o++) this.render(this.sprayChunks[o]);
a.restore()
},
addSprayChunk: function(a) {
this.sprayChunkPoints = [];
var o, c, h, l = this.width / 2,
u;
for (u = 0; u < this.density; u++) {
o = e.util.getRandomInt(a.x - l, a.x + l), c = e.util.getRandomInt(a.y - l, a.y + l), this.dotWidthVariance ? h = e.util.getRandomInt(Math.max(1, this.dotWidth - this.dotWidthVariance), this.dotWidth + this.dotWidthVariance) : h = this.dotWidth;
var f = new e.Point(o, c);
f.width = h, this.randomOpacity && (f.opacity = e.util.getRandomInt(0, 100) / 100), this.sprayChunkPoints.push(f)
}
this.sprayChunks.push(this.sprayChunkPoints)
}
}), e.PatternBrush = e.util.createClass(e.PencilBrush, {
getPatternSrc: function() {
var a = 20,
o = 5,
c = e.util.createCanvasElement(),
h = c.getContext("2d");
return c.width = c.height = a + o, h.fillStyle = this.color, h.beginPath(), h.arc(a / 2, a / 2, a / 2, 0, Math.PI * 2, !1), h.closePath(), h.fill(), c
},
getPatternSrcFunction: function() {
return String(this.getPatternSrc).replace("this.color", '"' + this.color + '"')
},
getPattern: function(a) {
return a.createPattern(this.source || this.getPatternSrc(), "repeat")
},
_setBrushStyles: function(a) {
this.callSuper("_setBrushStyles", a), a.strokeStyle = this.getPattern(a)
},
createPath: function(a) {
var o = this.callSuper("createPath", a),
c = o._getLeftTopCoords().scalarAdd(o.strokeWidth / 2);
return o.stroke = new e.Pattern({
source: this.source || this.getPatternSrcFunction(),
offsetX: -c.x,
offsetY: -c.y
}), o
}
}),
function() {
var a = e.util.getPointer,
o = e.util.degreesToRadians,
c = e.util.isTouchEvent;
e.Canvas = e.util.createClass(e.StaticCanvas, {
initialize: function(l, u) {
u || (u = {}), this.renderAndResetBound = this.renderAndReset.bind(this), this.requestRenderAllBound = this.requestRenderAll.bind(this), this._initStatic(l, u), this._initInteractive(), this._createCacheCanvas()
},
uniformScaling: !0,
uniScaleKey: "shiftKey",
centeredScaling: !1,
centeredRotation: !1,
centeredKey: "altKey",
altActionKey: "shiftKey",
interactive: !0,
selection: !0,
selectionKey: "shiftKey",
altSelectionKey: null,
selectionColor: "rgba(100, 100, 255, 0.3)",
selectionDashArray: [],
selectionBorderColor: "rgba(255, 255, 255, 0.3)",
selectionLineWidth: 1,
selectionFullyContained: !1,
hoverCursor: "move",
moveCursor: "move",
defaultCursor: "default",
freeDrawingCursor: "crosshair",
notAllowedCursor: "not-allowed",
containerClass: "canvas-container",
perPixelTargetFind: !1,
targetFindTolerance: 0,
skipTargetFind: !1,
isDrawingMode: !1,
preserveObjectStacking: !1,
snapAngle: 0,
snapThreshold: null,
stopContextMenu: !1,
fireRightClick: !1,
fireMiddleClick: !1,
targets: [],
enablePointerEvents: !1,
_hoveredTarget: null,
_hoveredTargets: [],
_initInteractive: function() {
this._currentTransform = null, this._groupSelector = null, this._initWrapperElement(), this._createUpperCanvas(), this._initEventListeners(), this._initRetinaScaling(), this.freeDrawingBrush = e.PencilBrush && new e.PencilBrush(this), this.calcOffset()
},
_chooseObjectsToRender: function() {
var l = this.getActiveObjects(),
u, f, p;
if (l.length > 0 && !this.preserveObjectStacking) {
f = [], p = [];
for (var m = 0, g = this._objects.length; m < g; m++) u = this._objects[m], l.indexOf(u) === -1 ? f.push(u) : p.push(u);
l.length > 1 && (this._activeObject._objects = p), f.push.apply(f, p)
} else f = this._objects;
return f
},
renderAll: function() {
this.contextTopDirty && !this._groupSelector && !this.isDrawingMode && (this.clearContext(this.contextTop), this.contextTopDirty = !1), this.hasLostContext && (this.renderTopLayer(this.contextTop), this.hasLostContext = !1);
var l = this.contextContainer;
return this.renderCanvas(l, this._chooseObjectsToRender()), this
},
renderTopLayer: function(l) {
l.save(), this.isDrawingMode && this._isCurrentlyDrawing && (this.freeDrawingBrush && this.freeDrawingBrush._render(), this.contextTopDirty = !0), this.selection && this._groupSelector && (this._drawSelection(l), this.contextTopDirty = !0), l.restore()
},
renderTop: function() {
var l = this.contextTop;
return this.clearContext(l), this.renderTopLayer(l), this.fire("after:render"), this
},
_normalizePointer: function(l, u) {
var f = l.calcTransformMatrix(),
p = e.util.invertTransform(f),
m = this.restorePointerVpt(u);
return e.util.transformPoint(m, p)
},
isTargetTransparent: function(l, u, f) {
if (l.shouldCache() && l._cacheCanvas && l !== this._activeObject) {
var p = this._normalizePointer(l, {
x: u,
y: f
}),
m = Math.max(l.cacheTranslationX + p.x * l.zoomX, 0),
g = Math.max(l.cacheTranslationY + p.y * l.zoomY, 0),
w = e.util.isTransparent(l._cacheContext, Math.round(m), Math.round(g), this.targetFindTolerance);
return w
}
var v = this.contextCache,
y = l.selectionBackgroundColor,
b = this.viewportTransform;
l.selectionBackgroundColor = "", this.clearContext(v), v.save(), v.transform(b[0], b[1], b[2], b[3], b[4], b[5]), l.render(v), v.restore(), l.selectionBackgroundColor = y;
var w = e.util.isTransparent(v, u, f, this.targetFindTolerance);
return w
},
_isSelectionKeyPressed: function(l) {
var u = !1;
return Array.isArray(this.selectionKey) ? u = !!this.selectionKey.find(function(f) {
return l[f] === !0
}) : u = l[this.selectionKey], u
},
_shouldClearSelection: function(l, u) {
var f = this.getActiveObjects(),
p = this._activeObject;
return !u || u && p && f.length > 1 && f.indexOf(u) === -1 && p !== u && !this._isSelectionKeyPressed(l) || u && !u.evented || u && !u.selectable && p && p !== u
},
_shouldCenterTransform: function(l, u, f) {
if (!!l) {
var p;
return u === "scale" || u === "scaleX" || u === "scaleY" || u === "resizing" ? p = this.centeredScaling || l.centeredScaling : u === "rotate" && (p = this.centeredRotation || l.centeredRotation), p ? !f : f
}
},
_getOriginFromCorner: function(l, u) {
var f = {
x: l.originX,
y: l.originY
};
return u === "ml" || u === "tl" || u === "bl" ? f.x = "right" : (u === "mr" || u === "tr" || u === "br") && (f.x = "left"), u === "tl" || u === "mt" || u === "tr" ? f.y = "bottom" : (u === "bl" || u === "mb" || u === "br") && (f.y = "top"), f
},
_getActionFromCorner: function(l, u, f, p) {
if (!u || !l) return "drag";
var m = p.controls[u];
return m.getActionName(f, m, p)
},
_setupCurrentTransform: function(l, u, f) {
if (!!u) {
var p = this.getPointer(l),
m = u.__corner,
g = u.controls[m],
v = f && m ? g.getActionHandler(l, u, g) : e.controlsUtils.dragHandler,
y = this._getActionFromCorner(f, m, l, u),
b = this._getOriginFromCorner(u, m),
w = l[this.centeredKey],
x = {
target: u,
action: y,
actionHandler: v,
corner: m,
scaleX: u.scaleX,
scaleY: u.scaleY,
skewX: u.skewX,
skewY: u.skewY,
offsetX: p.x - u.left,
offsetY: p.y - u.top,
originX: b.x,
originY: b.y,
ex: p.x,
ey: p.y,
lastX: p.x,
lastY: p.y,
theta: o(u.angle),
width: u.width * u.scaleX,
shiftKey: l.shiftKey,
altKey: w,
original: e.util.saveObjectTransform(u)
};
this._shouldCenterTransform(u, y, w) && (x.originX = "center", x.originY = "center"), x.original.originX = b.x, x.original.originY = b.y, this._currentTransform = x, this._beforeTransform(l)
}
},
setCursor: function(l) {
this.upperCanvasEl.style.cursor = l
},
_drawSelection: function(l) {
var u = this._groupSelector,
f = new e.Point(u.ex, u.ey),
p = e.util.transformPoint(f, this.viewportTransform),
m = new e.Point(u.ex + u.left, u.ey + u.top),
g = e.util.transformPoint(m, this.viewportTransform),
v = Math.min(p.x, g.x),
y = Math.min(p.y, g.y),
b = Math.max(p.x, g.x),
w = Math.max(p.y, g.y),
x = this.selectionLineWidth / 2;
this.selectionColor && (l.fillStyle = this.selectionColor, l.fillRect(v, y, b - v, w - y)), !(!this.selectionLineWidth || !this.selectionBorderColor) && (l.lineWidth = this.selectionLineWidth, l.strokeStyle = this.selectionBorderColor, v += x, y += x, b -= x, w -= x, e.Object.prototype._setLineDash.call(this, l, this.selectionDashArray), l.strokeRect(v, y, b - v, w - y))
},
findTarget: function(l, u) {
if (!this.skipTargetFind) {
var f = !0,
p = this.getPointer(l, f),
m = this._activeObject,
g = this.getActiveObjects(),
v, y, b = c(l),
w = g.length > 1 && !u || g.length === 1;
if (this.targets = [], w && m._findTargetCorner(p, b) || g.length > 1 && !u && m === this._searchPossibleTargets([m], p)) return m;
if (g.length === 1 && m === this._searchPossibleTargets([m], p))
if (this.preserveObjectStacking) v = m, y = this.targets, this.targets = [];
else return m;
var x = this._searchPossibleTargets(this._objects, p);
return l[this.altSelectionKey] && x && v && x !== v && (x = v, this.targets = y), x
}
},
_checkTarget: function(l, u, f) {
if (u && u.visible && u.evented && u.containsPoint(l))
if ((this.perPixelTargetFind || u.perPixelTargetFind) && !u.isEditing) {
var p = this.isTargetTransparent(u, f.x, f.y);
if (!p) return !0
} else return !0
},
_searchPossibleTargets: function(l, u) {
for (var f, p = l.length, m; p--;) {
var g = l[p],
v = g.group ? this._normalizePointer(g.group, u) : u;
if (this._checkTarget(v, g, u)) {
f = l[p], f.subTargetCheck && f instanceof e.Group && (m = this._searchPossibleTargets(f._objects, u), m && this.targets.push(m));
break
}
}
return f
},
restorePointerVpt: function(l) {
return e.util.transformPoint(l, e.util.invertTransform(this.viewportTransform))
},
getPointer: function(l, u) {
if (this._absolutePointer && !u) return this._absolutePointer;
if (this._pointer && u) return this._pointer;
var f = a(l),
p = this.upperCanvasEl,
m = p.getBoundingClientRect(),
g = m.width || 0,
v = m.height || 0,
y;
(!g || !v) && ("top" in m && "bottom" in m && (v = Math.abs(m.top - m.bottom)), "right" in m && "left" in m && (g = Math.abs(m.right - m.left))), this.calcOffset(), f.x = f.x - this._offset.left, f.y = f.y - this._offset.top, u || (f = this.restorePointerVpt(f));
var b = this.getRetinaScaling();
return b !== 1 && (f.x /= b, f.y /= b), g === 0 || v === 0 ? y = {
width: 1,
height: 1
} : y = {
width: p.width / g,
height: p.height / v
}, {
x: f.x * y.width,
y: f.y * y.height
}
},
_createUpperCanvas: function() {
var l = this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/, ""),
u = this.lowerCanvasEl,
f = this.upperCanvasEl;
f ? f.className = "" : (f = this._createCanvasElement(), this.upperCanvasEl = f), e.util.addClass(f, "upper-canvas " + l), this.wrapperEl.appendChild(f), this._copyCanvasStyle(u, f), this._applyCanvasStyle(f), this.contextTop = f.getContext("2d")
},
getTopContext: function() {
return this.contextTop
},
_createCacheCanvas: function() {
this.cacheCanvasEl = this._createCanvasElement(), this.cacheCanvasEl.setAttribute("width", this.width), this.cacheCanvasEl.setAttribute("height", this.height), this.contextCache = this.cacheCanvasEl.getContext("2d")
},
_initWrapperElement: function() {
this.wrapperEl = e.util.wrapElement(this.lowerCanvasEl, "div", {
class: this.containerClass
}), e.util.setStyle(this.wrapperEl, {
width: this.width + "px",
height: this.height + "px",
position: "relative"
}), e.util.makeElementUnselectable(this.wrapperEl)
},
_applyCanvasStyle: function(l) {
var u = this.width || l.width,
f = this.height || l.height;
e.util.setStyle(l, {
position: "absolute",
width: u + "px",
height: f + "px",
left: 0,
top: 0,
"touch-action": this.allowTouchScrolling ? "manipulation" : "none",
"-ms-touch-action": this.allowTouchScrolling ? "manipulation" : "none"
}), l.width = u, l.height = f, e.util.makeElementUnselectable(l)
},
_copyCanvasStyle: function(l, u) {
u.style.cssText = l.style.cssText
},
getSelectionContext: function() {
return this.contextTop
},
getSelectionElement: function() {
return this.upperCanvasEl
},
getActiveObject: function() {
return this._activeObject
},
getActiveObjects: function() {
var l = this._activeObject;
return l ? l.type === "activeSelection" && l._objects ? l._objects.slice(0) : [l] : []
},
_onObjectRemoved: function(l) {
l === this._activeObject && (this.fire("before:selection:cleared", {
target: l
}), this._discardActiveObject(), this.fire("selection:cleared", {
target: l
}), l.fire("deselected")), l === this._hoveredTarget && (this._hoveredTarget = null, this._hoveredTargets = []), this.callSuper("_onObjectRemoved", l)
},
_fireSelectionEvents: function(l, u) {
var f = !1,
p = this.getActiveObjects(),
m = [],
g = [];
l.forEach(function(v) {
p.indexOf(v) === -1 && (f = !0, v.fire("deselected", {
e: u,
target: v
}), g.push(v))
}), p.forEach(function(v) {
l.indexOf(v) === -1 && (f = !0, v.fire("selected", {
e: u,
target: v
}), m.push(v))
}), l.length > 0 && p.length > 0 ? f && this.fire("selection:updated", {
e: u,
selected: m,
deselected: g
}) : p.length > 0 ? this.fire("selection:created", {
e: u,
selected: m
}) : l.length > 0 && this.fire("selection:cleared", {
e: u,
deselected: g
})
},
setActiveObject: function(l, u) {
var f = this.getActiveObjects();
return this._setActiveObject(l, u), this._fireSelectionEvents(f, u), this
},
_setActiveObject: function(l, u) {
return this._activeObject === l || !this._discardActiveObject(u, l) || l.onSelect({
e: u
}) ? !1 : (this._activeObject = l, !0)
},
_discardActiveObject: function(l, u) {
var f = this._activeObject;
if (f) {
if (f.onDeselect({
e: l,
object: u
})) return !1;
this._activeObject = null
}
return !0
},
discardActiveObject: function(l) {
var u = this.getActiveObjects(),
f = this.getActiveObject();
return u.length && this.fire("before:selection:cleared", {
target: f,
e: l
}), this._discardActiveObject(l), this._fireSelectionEvents(u, l), this
},
dispose: function() {
var l = this.wrapperEl;
return this.removeListeners(), l.removeChild(this.upperCanvasEl), l.removeChild(this.lowerCanvasEl), this.contextCache = null, this.contextTop = null, ["upperCanvasEl", "cacheCanvasEl"].forEach(function(u) {
e.util.cleanUpJsdomNode(this[u]), this[u] = void 0
}.bind(this)), l.parentNode && l.parentNode.replaceChild(this.lowerCanvasEl, this.wrapperEl), delete this.wrapperEl, e.StaticCanvas.prototype.dispose.call(this), this
},
clear: function() {
return this.discardActiveObject(), this.clearContext(this.contextTop), this.callSuper("clear")
},
drawControls: function(l) {
var u = this._activeObject;
u && u._renderControls(l)
},
_toObject: function(l, u, f) {
var p = this._realizeGroupTransformOnObject(l),
m = this.callSuper("_toObject", l, u, f);
return this._unwindGroupTransformOnObject(l, p), m
},
_realizeGroupTransformOnObject: function(l) {
if (l.group && l.group.type === "activeSelection" && this._activeObject === l.group) {
var u = ["angle", "flipX", "flipY", "left", "scaleX", "scaleY", "skewX", "skewY", "top"],
f = {};
return u.forEach(function(p) {
f[p] = l[p]
}), e.util.addTransformToObject(l, this._activeObject.calcOwnMatrix()), f
} else return null
},
_unwindGroupTransformOnObject: function(l, u) {
u && l.set(u)
},
_setSVGObject: function(l, u, f) {
var p = this._realizeGroupTransformOnObject(u);
this.callSuper("_setSVGObject", l, u, f), this._unwindGroupTransformOnObject(u, p)
},
setViewportTransform: function(l) {
this.renderOnAddRemove && this._activeObject && this._activeObject.isEditing && this._activeObject.clearContextTop(), e.StaticCanvas.prototype.setViewportTransform.call(this, l)
}
});
for (var h in e.StaticCanvas) h !== "prototype" && (e.Canvas[h] = e.StaticCanvas[h])
}(),
function() {
var a = e.util.addListener,
o = e.util.removeListener,
c = 3,
h = 2,
l = 1,
u = {
passive: !1
};
function f(p, m) {
return p.button && p.button === m - 1
}
e.util.object.extend(e.Canvas.prototype, {
mainTouchId: null,
_initEventListeners: function() {
this.removeListeners(), this._bindEvents(), this.addOrRemove(a, "add")
},
_getEventPrefix: function() {
return this.enablePointerEvents ? "pointer" : "mouse"
},
addOrRemove: function(p, m) {
var g = this.upperCanvasEl,
v = this._getEventPrefix();
p(e.window, "resize", this._onResize), p(g, v + "down", this._onMouseDown), p(g, v + "move", this._onMouseMove, u), p(g, v + "out", this._onMouseOut), p(g, v + "enter", this._onMouseEnter), p(g, "wheel", this._onMouseWheel), p(g, "contextmenu", this._onContextMenu), p(g, "dblclick", this._onDoubleClick), p(g, "dragover", this._onDragOver), p(g, "dragenter", this._onDragEnter), p(g, "dragleave", this._onDragLeave), p(g, "drop", this._onDrop), this.enablePointerEvents || p(g, "touchstart", this._onTouchStart, u), typeof eventjs < "u" && m in eventjs && (eventjs[m](g, "gesture", this._onGesture), eventjs[m](g, "drag", this._onDrag), eventjs[m](g, "orientation", this._onOrientationChange), eventjs[m](g, "shake", this._onShake), eventjs[m](g, "longpress", this._onLongPress))
},
removeListeners: function() {
this.addOrRemove(o, "remove");
var p = this._getEventPrefix();
o(e.document, p + "up", this._onMouseUp), o(e.document, "touchend", this._onTouchEnd, u), o(e.document, p + "move", this._onMouseMove, u), o(e.document, "touchmove", this._onMouseMove, u)
},
_bindEvents: function() {
this.eventsBound || (this._onMouseDown = this._onMouseDown.bind(this), this._onTouchStart = this._onTouchStart.bind(this), this._onMouseMove = this._onMouseMove.bind(this), this._onMouseUp = this._onMouseUp.bind(this), this._onTouchEnd = this._onTouchEnd.bind(this), this._onResize = this._onResize.bind(this), this._onGesture = this._onGesture.bind(this), this._onDrag = this._onDrag.bind(this), this._onShake = this._onShake.bind(this), this._onLongPress = this._onLongPress.bind(this), this._onOrientationChange = this._onOrientationChange.bind(this), this._onMouseWheel = this._onMouseWheel.bind(this), this._onMouseOut = this._onMouseOut.bind(this), this._onMouseEnter = this._onMouseEnter.bind(this), this._onContextMenu = this._onContextMenu.bind(this), this._onDoubleClick = this._onDoubleClick.bind(this), this._onDragOver = this._onDragOver.bind(this), this._onDragEnter = this._simpleEventHandler.bind(this, "dragenter"), this._onDragLeave = this._simpleEventHandler.bind(this, "dragleave"), this._onDrop = this._onDrop.bind(this), this.eventsBound = !0)
},
_onGesture: function(p, m) {
this.__onTransformGesture && this.__onTransformGesture(p, m)
},
_onDrag: function(p, m) {
this.__onDrag && this.__onDrag(p, m)
},
_onMouseWheel: function(p) {
this.__onMouseWheel(p)
},
_onMouseOut: function(p) {
var m = this._hoveredTarget;
this.fire("mouse:out", {
target: m,
e: p
}), this._hoveredTarget = null, m && m.fire("mouseout", {
e: p
});
var g = this;
this._hoveredTargets.forEach(function(v) {
g.fire("mouse:out", {
target: m,
e: p
}), v && m.fire("mouseout", {
e: p
})
}), this._hoveredTargets = []
},
_onMouseEnter: function(p) {
!this._currentTransform && !this.findTarget(p) && (this.fire("mouse:over", {
target: null,
e: p
}), this._hoveredTarget = null, this._hoveredTargets = [])
},
_onOrientationChange: function(p, m) {
this.__onOrientationChange && this.__onOrientationChange(p, m)
},
_onShake: function(p, m) {
this.__onShake && this.__onShake(p, m)
},
_onLongPress: function(p, m) {
this.__onLongPress && this.__onLongPress(p, m)
},
_onDragOver: function(p) {
p.preventDefault();
var m = this._simpleEventHandler("dragover", p);
this._fireEnterLeaveEvents(m, p)
},
_onDrop: function(p) {
return this._simpleEventHandler("drop:before", p), this._simpleEventHandler("drop", p)
},
_onContextMenu: function(p) {
return this.stopContextMenu && (p.stopPropagation(), p.preventDefault()), !1
},
_onDoubleClick: function(p) {
this._cacheTransformEventData(p), this._handleEvent(p, "dblclick"), this._resetTransformEventData(p)
},
getPointerId: function(p) {
var m = p.changedTouches;
return m ? m[0] && m[0].identifier : this.enablePointerEvents ? p.pointerId : -1
},
_isMainEvent: function(p) {
return p.isPrimary === !0 ? !0 : p.isPrimary === !1 ? !1 : p.type === "touchend" && p.touches.length === 0 ? !0 : p.changedTouches ? p.changedTouches[0].identifier === this.mainTouchId : !0
},
_onTouchStart: function(p) {
p.preventDefault(), this.mainTouchId === null && (this.mainTouchId = this.getPointerId(p)), this.__onMouseDown(p), this._resetTransformEventData();
var m = this.upperCanvasEl,
g = this._getEventPrefix();
a(e.document, "touchend", this._onTouchEnd, u), a(e.document, "touchmove", this._onMouseMove, u), o(m, g + "down", this._onMouseDown)
},
_onMouseDown: function(p) {
this.__onMouseDown(p), this._resetTransformEventData();
var m = this.upperCanvasEl,
g = this._getEventPrefix();
o(m, g + "move", this._onMouseMove, u), a(e.document, g + "up", this._onMouseUp), a(e.document, g + "move", this._onMouseMove, u)
},
_onTouchEnd: function(p) {
if (!(p.touches.length > 0)) {
this.__onMouseUp(p), this._resetTransformEventData(), this.mainTouchId = null;
var m = this._getEventPrefix();
o(e.document, "touchend", this._onTouchEnd, u), o(e.document, "touchmove", this._onMouseMove, u);
var g = this;
this._willAddMouseDown && clearTimeout(this._willAddMouseDown), this._willAddMouseDown = setTimeout(function() {
a(g.upperCanvasEl, m + "down", g._onMouseDown), g._willAddMouseDown = 0
}, 400)
}
},
_onMouseUp: function(p) {
this.__onMouseUp(p), this._resetTransformEventData();
var m = this.upperCanvasEl,
g = this._getEventPrefix();
this._isMainEvent(p) && (o(e.document, g + "up", this._onMouseUp), o(e.document, g + "move", this._onMouseMove, u), a(m, g + "move", this._onMouseMove, u))
},
_onMouseMove: function(p) {
!this.allowTouchScrolling && p.preventDefault && p.preventDefault(), this.__onMouseMove(p)
},
_onResize: function() {
this.calcOffset()
},
_shouldRender: function(p) {
var m = this._activeObject;
return !!m != !!p || m && p && m !== p ? !0 : (m && m.isEditing, !1)
},
__onMouseUp: function(p) {
var m, g = this._currentTransform,
v = this._groupSelector,
y = !1,
b = !v || v.left === 0 && v.top === 0;
if (this._cacheTransformEventData(p), m = this._target, this._handleEvent(p, "up:before"), f(p, c)) {
this.fireRightClick && this._handleEvent(p, "up", c, b);
return
}
if (f(p, h)) {
this.fireMiddleClick && this._handleEvent(p, "up", h, b), this._resetTransformEventData();
return
}
if (this.isDrawingMode && this._isCurrentlyDrawing) {
this._onMouseUpInDrawingMode(p);
return
}
if (!!this._isMainEvent(p)) {
if (g && (this._finalizeCurrentTransform(p), y = g.actionPerformed), !b) {
var w = m === this._activeObject;
this._maybeGroupObjects(p), y || (y = this._shouldRender(m) || !w && m === this._activeObject)
}
var x, S;
if (m) {
if (x = m._findTargetCorner(this.getPointer(p, !0), e.util.isTouchEvent(p)), m.selectable && m !== this._activeObject && m.activeOn === "up") this.setActiveObject(m, p), y = !0;
else {
var T = m.controls[x],
P = T && T.getMouseUpHandler(p, m, T);
P && (S = this.getPointer(p), P(p, g, S.x, S.y))
}
m.isMoving = !1
}
if (g && (g.target !== m || g.corner !== x)) {
var I = g.target && g.target.controls[g.corner],
z = I && I.getMouseUpHandler(p, m, T);
S = S || this.getPointer(p), z && z(p, g, S.x, S.y)
}
this._setCursorFromEvent(p, m), this._handleEvent(p, "up", l, b), this._groupSelector = null, this._currentTransform = null, m && (m.__corner = 0), y ? this.requestRenderAll() : b || this.renderTop()
}
},
_simpleEventHandler: function(p, m) {
var g = this.findTarget(m),
v = this.targets,
y = {
e: m,
target: g,
subTargets: v
};
if (this.fire(p, y), g && g.fire(p, y), !v) return g;
for (var b = 0; b < v.length; b++) v[b].fire(p, y);
return g
},
_handleEvent: function(p, m, g, v) {
var y = this._target,
b = this.targets || [],
w = {
e: p,
target: y,
subTargets: b,
button: g || l,
isClick: v || !1,
pointer: this._pointer,
absolutePointer: this._absolutePointer,
transform: this._currentTransform
};
m === "up" && (w.currentTarget = this.findTarget(p), w.currentSubTargets = this.targets), this.fire("mouse:" + m, w), y && y.fire("mouse" + m, w);
for (var x = 0; x < b.length; x++) b[x].fire("mouse" + m, w)
},
_finalizeCurrentTransform: function(p) {
var m = this._currentTransform,
g = m.target,
v = {
e: p,
target: g,
transform: m,
action: m.action
};
g._scaling && (g._scaling = !1), g.setCoords(), (m.actionPerformed || this.stateful && g.hasStateChanged()) && this._fire("modified", v)
},
_onMouseDownInDrawingMode: function(p) {
this._isCurrentlyDrawing = !0, this.getActiveObject() && this.discardActiveObject(p).requestRenderAll();
var m = this.getPointer(p);
this.freeDrawingBrush.onMouseDown(m, {
e: p,
pointer: m
}), this._handleEvent(p, "down")
},
_onMouseMoveInDrawingMode: function(p) {
if (this._isCurrentlyDrawing) {
var m = this.getPointer(p);
this.freeDrawingBrush.onMouseMove(m, {
e: p,
pointer: m
})
}
this.setCursor(this.freeDrawingCursor), this._handleEvent(p, "move")
},
_onMouseUpInDrawingMode: function(p) {
var m = this.getPointer(p);
this._isCurrentlyDrawing = this.freeDrawingBrush.onMouseUp({
e: p,
pointer: m
}), this._handleEvent(p, "up")
},
__onMouseDown: function(p) {
this._cacheTransformEventData(p), this._handleEvent(p, "down:before");
var m = this._target;
if (f(p, c)) {
this.fireRightClick && this._handleEvent(p, "down", c);
return
}
if (f(p, h)) {
this.fireMiddleClick && this._handleEvent(p, "down", h);
return
}
if (this.isDrawingMode) {
this._onMouseDownInDrawingMode(p);
return
}
if (!!this._isMainEvent(p) && !this._currentTransform) {
var g = this._pointer;
this._previousPointer = g;
var v = this._shouldRender(m),
y = this._shouldGroup(p, m);
if (this._shouldClearSelection(p, m) ? this.discardActiveObject(p) : y && (this._handleGrouping(p, m), m = this._activeObject), this.selection && (!m || !m.selectable && !m.isEditing && m !== this._activeObject) && (this._groupSelector = {
ex: this._absolutePointer.x,
ey: this._absolutePointer.y,
top: 0,
left: 0
}), m) {
var b = m === this._activeObject;
m.selectable && m.activeOn === "down" && this.setActiveObject(m, p);
var w = m._findTargetCorner(this.getPointer(p, !0), e.util.isTouchEvent(p));
if (m.__corner = w, m === this._activeObject && (w || !y)) {
this._setupCurrentTransform(p, m, b);
var x = m.controls[w],
g = this.getPointer(p),
S = x && x.getMouseDownHandler(p, m, x);
S && S(p, this._currentTransform, g.x, g.y)
}
}
this._handleEvent(p, "down"), (v || y) && this.requestRenderAll()
}
},
_resetTransformEventData: function() {
this._target = null, this._pointer = null, this._absolutePointer = null
},
_cacheTransformEventData: function(p) {
this._resetTransformEventData(), this._pointer = this.getPointer(p, !0), this._absolutePointer = this.restorePointerVpt(this._pointer), this._target = this._currentTransform ? this._currentTransform.target : this.findTarget(p) || null
},
_beforeTransform: function(p) {
var m = this._currentTransform;
this.stateful && m.target.saveState(), this.fire("before:transform", {
e: p,
transform: m
})
},
__onMouseMove: function(p) {
this._handleEvent(p, "move:before"), this._cacheTransformEventData(p);
var m, g;
if (this.isDrawingMode) {
this._onMouseMoveInDrawingMode(p);
return
}
if (!!this._isMainEvent(p)) {
var v = this._groupSelector;
v ? (g = this._absolutePointer, v.left = g.x - v.ex, v.top = g.y - v.ey, this.renderTop()) : this._currentTransform ? this._transformObject(p) : (m = this.findTarget(p) || null, this._setCursorFromEvent(p, m), this._fireOverOutEvents(m, p)), this._handleEvent(p, "move"), this._resetTransformEventData()
}
},
_fireOverOutEvents: function(p, m) {
var g = this._hoveredTarget,
v = this._hoveredTargets,
y = this.targets,
b = Math.max(v.length, y.length);
this.fireSyntheticInOutEvents(p, m, {
oldTarget: g,
evtOut: "mouseout",
canvasEvtOut: "mouse:out",
evtIn: "mouseover",
canvasEvtIn: "mouse:over"
});
for (var w = 0; w < b; w++) this.fireSyntheticInOutEvents(y[w], m, {
oldTarget: v[w],
evtOut: "mouseout",
evtIn: "mouseover"
});
this._hoveredTarget = p, this._hoveredTargets = this.targets.concat()
},
_fireEnterLeaveEvents: function(p, m) {
var g = this._draggedoverTarget,
v = this._hoveredTargets,
y = this.targets,
b = Math.max(v.length, y.length);
this.fireSyntheticInOutEvents(p, m, {
oldTarget: g,
evtOut: "dragleave",
evtIn: "dragenter"
});
for (var w = 0; w < b; w++) this.fireSyntheticInOutEvents(y[w], m, {
oldTarget: v[w],
evtOut: "dragleave",
evtIn: "dragenter"
});
this._draggedoverTarget = p
},
fireSyntheticInOutEvents: function(p, m, g) {
var v, y, b = g.oldTarget,
w, x, S = b !== p,
T = g.canvasEvtIn,
P = g.canvasEvtOut;
S && (v = {
e: m,
target: p,
previousTarget: b
}, y = {
e: m,
target: b,
nextTarget: p
}), x = p && S, w = b && S, w && (P && this.fire(P, y), b.fire(g.evtOut, y)), x && (T && this.fire(T, v), p.fire(g.evtIn, v))
},
__onMouseWheel: function(p) {
this._cacheTransformEventData(p), this._handleEvent(p, "wheel"), this._resetTransformEventData()
},
_transformObject: function(p) {
var m = this.getPointer(p),
g = this._currentTransform;
g.reset = !1, g.shiftKey = p.shiftKey, g.altKey = p[this.centeredKey], this._performTransformAction(p, g, m), g.actionPerformed && this.requestRenderAll()
},
_performTransformAction: function(p, m, g) {
var v = g.x,
y = g.y,
b = m.action,
w = !1,
x = m.actionHandler;
x && (w = x(p, m, v, y)), b === "drag" && w && (m.target.isMoving = !0, this.setCursor(m.target.moveCursor || this.moveCursor)), m.actionPerformed = m.actionPerformed || w
},
_fire: e.controlsUtils.fireEvent,
_setCursorFromEvent: function(p, m) {
if (!m) return this.setCursor(this.defaultCursor), !1;
var g = m.hoverCursor || this.hoverCursor,
v = this._activeObject && this._activeObject.type === "activeSelection" ? this._activeObject : null,
y = (!v || !v.contains(m)) && m._findTargetCorner(this.getPointer(p, !0));
y ? this.setCursor(this.getCornerCursor(y, m, p)) : (m.subTargetCheck && this.targets.concat().reverse().map(function(b) {
g = b.hoverCursor || g
}), this.setCursor(g))
},
getCornerCursor: function(p, m, g) {
var v = m.controls[p];
return v.cursorStyleHandler(g, v, m)
}
})
}(),
function() {
var a = Math.min,
o = Math.max;
e.util.object.extend(e.Canvas.prototype, {
_shouldGroup: function(c, h) {
var l = this._activeObject;
return l && this._isSelectionKeyPressed(c) && h && h.selectable && this.selection && (l !== h || l.type === "activeSelection") && !h.onSelect({
e: c
})
},
_handleGrouping: function(c, h) {
var l = this._activeObject;
l.__corner || h === l && (h = this.findTarget(c, !0), !h || !h.selectable) || (l && l.type === "activeSelection" ? this._updateActiveSelection(h, c) : this._createActiveSelection(h, c))
},
_updateActiveSelection: function(c, h) {
var l = this._activeObject,
u = l._objects.slice(0);
l.contains(c) ? (l.removeWithUpdate(c), this._hoveredTarget = c, this._hoveredTargets = this.targets.concat(), l.size() === 1 && this._setActiveObject(l.item(0), h)) : (l.addWithUpdate(c), this._hoveredTarget = l, this._hoveredTargets = this.targets.concat()), this._fireSelectionEvents(u, h)
},
_createActiveSelection: function(c, h) {
var l = this.getActiveObjects(),
u = this._createGroup(c);
this._hoveredTarget = u, this._setActiveObject(u, h), this._fireSelectionEvents(l, h)
},
_createGroup: function(c) {
var h = this._objects,
l = h.indexOf(this._activeObject) < h.indexOf(c),
u = l ? [this._activeObject, c] : [c, this._activeObject];
return this._activeObject.isEditing && this._activeObject.exitEditing(), new e.ActiveSelection(u, {
canvas: this
})
},
_groupSelectedObjects: function(c) {
var h = this._collectObjects(c),
l;
h.length === 1 ? this.setActiveObject(h[0], c) : h.length > 1 && (l = new e.ActiveSelection(h.reverse(), {
canvas: this
}), this.setActiveObject(l, c))
},
_collectObjects: function(c) {
for (var h = [], l, u = this._groupSelector.ex, f = this._groupSelector.ey, p = u + this._groupSelector.left, m = f + this._groupSelector.top, g = new e.Point(a(u, p), a(f, m)), v = new e.Point(o(u, p), o(f, m)), y = !this.selectionFullyContained, b = u === p && f === m, w = this._objects.length; w-- && (l = this._objects[w], !(!(!l || !l.selectable || !l.visible) && (y && l.intersectsWithRect(g, v, !0) || l.isContainedWithinRect(g, v, !0) || y && l.containsPoint(g, null, !0) || y && l.containsPoint(v, null, !0)) && (h.push(l), b))););
return h.length > 1 && (h = h.filter(function(x) {
return !x.onSelect({
e: c
})
})), h
},
_maybeGroupObjects: function(c) {
this.selection && this._groupSelector && this._groupSelectedObjects(c), this.setCursor(this.defaultCursor), this._groupSelector = null
}
})
}(),
function() {
e.util.object.extend(e.StaticCanvas.prototype, {
toDataURL: function(a) {
a || (a = {});
var o = a.format || "png",
c = a.quality || 1,
h = (a.multiplier || 1) * (a.enableRetinaScaling ? this.getRetinaScaling() : 1),
l = this.toCanvasElement(h, a);
return e.util.toDataURL(l, o, c)
},
toCanvasElement: function(a, o) {
a = a || 1, o = o || {};
var c = (o.width || this.width) * a,
h = (o.height || this.height) * a,
l = this.getZoom(),
u = this.width,
f = this.height,
p = l * a,
m = this.viewportTransform,
g = (m[4] - (o.left || 0)) * a,
v = (m[5] - (o.top || 0)) * a,
y = this.interactive,
b = [p, 0, 0, p, g, v],
w = this.enableRetinaScaling,
x = e.util.createCanvasElement(),
S = this.contextTop;
return x.width = c, x.height = h, this.contextTop = null, this.enableRetinaScaling = !1, this.interactive = !1, this.viewportTransform = b, this.width = c, this.height = h, this.calcViewportBoundaries(), this.renderCanvas(x.getContext("2d"), this._objects), this.viewportTransform = m, this.width = u, this.height = f, this.calcViewportBoundaries(), this.interactive = y, this.enableRetinaScaling = w, this.contextTop = S, x
}
})
}(), e.util.object.extend(e.StaticCanvas.prototype, {
loadFromJSON: function(a, o, c) {
if (!!a) {
var h = typeof a == "string" ? JSON.parse(a) : e.util.object.clone(a),
l = this,
u = h.clipPath,
f = this.renderOnAddRemove;
return this.renderOnAddRemove = !1, delete h.clipPath, this._enlivenObjects(h.objects, function(p) {
l.clear(), l._setBgOverlay(h, function() {
u ? l._enlivenObjects([u], function(m) {
l.clipPath = m[0], l.__setupCanvas.call(l, h, p, f, o)
}) : l.__setupCanvas.call(l, h, p, f, o)
})
}, c), this
}
},
__setupCanvas: function(a, o, c, h) {
var l = this;
o.forEach(function(u, f) {
l.insertAt(u, f)
}), this.renderOnAddRemove = c, delete a.objects, delete a.backgroundImage, delete a.overlayImage, delete a.background, delete a.overlay, this._setOptions(a), this.renderAll(), h && h()
},
_setBgOverlay: function(a, o) {
var c = {
backgroundColor: !1,
overlayColor: !1,
backgroundImage: !1,
overlayImage: !1
};
if (!a.backgroundImage && !a.overlayImage && !a.background && !a.overlay) {
o && o();
return
}
var h = function() {
c.backgroundImage && c.overlayImage && c.backgroundColor && c.overlayColor && o && o()
};
this.__setBgOverlay("backgroundImage", a.backgroundImage, c, h), this.__setBgOverlay("overlayImage", a.overlayImage, c, h), this.__setBgOverlay("backgroundColor", a.background, c, h), this.__setBgOverlay("overlayColor", a.overlay, c, h)
},
__setBgOverlay: function(a, o, c, h) {
var l = this;
if (!o) {
c[a] = !0, h && h();
return
}
a === "backgroundImage" || a === "overlayImage" ? e.util.enlivenObjects([o], function(u) {
l[a] = u[0], c[a] = !0, h && h()
}) : this["set" + e.util.string.capitalize(a, !0)](o, function() {
c[a] = !0, h && h()
})
},
_enlivenObjects: function(a, o, c) {
if (!a || a.length === 0) {
o && o([]);
return
}
e.util.enlivenObjects(a, function(h) {
o && o(h)
}, null, c)
},
_toDataURL: function(a, o) {
this.clone(function(c) {
o(c.toDataURL(a))
})
},
_toDataURLWithMultiplier: function(a, o, c) {
this.clone(function(h) {
c(h.toDataURLWithMultiplier(a, o))
})
},
clone: function(a, o) {
var c = JSON.stringify(this.toJSON(o));
this.cloneWithoutData(function(h) {
h.loadFromJSON(c, function() {
a && a(h)
})
})
},
cloneWithoutData: function(a) {
var o = e.util.createCanvasElement();
o.width = this.width, o.height = this.height;
var c = new e.Canvas(o);
this.backgroundImage ? (c.setBackgroundImage(this.backgroundImage.src, function() {
c.renderAll(), a && a(c)
}), c.backgroundImageOpacity = this.backgroundImageOpacity, c.backgroundImageStretch = this.backgroundImageStretch) : a && a(c)
}
}),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.object.extend,
h = o.util.object.clone,
l = o.util.toFixed,
u = o.util.string.capitalize,
f = o.util.degreesToRadians,
p = !o.isLikelyNode,
m = 2;
o.Object || (o.Object = o.util.createClass(o.CommonMethods, {
type: "object",
originX: "left",
originY: "top",
top: 0,
left: 0,
width: 0,
height: 0,
scaleX: 1,
scaleY: 1,
flipX: !1,
flipY: !1,
opacity: 1,
angle: 0,
skewX: 0,
skewY: 0,
cornerSize: 13,
touchCornerSize: 24,
transparentCorners: !0,
hoverCursor: null,
moveCursor: null,
padding: 0,
borderColor: "rgb(178,204,255)",
borderDashArray: null,
cornerColor: "rgb(178,204,255)",
cornerStrokeColor: null,
cornerStyle: "rect",
cornerDashArray: null,
centeredScaling: !1,
centeredRotation: !0,
fill: "rgb(0,0,0)",
fillRule: "nonzero",
globalCompositeOperation: "source-over",
backgroundColor: "",
selectionBackgroundColor: "",
stroke: null,
strokeWidth: 1,
strokeDashArray: null,
strokeDashOffset: 0,
strokeLineCap: "butt",
strokeLineJoin: "miter",
strokeMiterLimit: 4,
shadow: null,
borderOpacityWhenMoving: .4,
borderScaleFactor: 1,
minScaleLimit: 0,
selectable: !0,
evented: !0,
visible: !0,
hasControls: !0,
hasBorders: !0,
perPixelTargetFind: !1,
includeDefaultValues: !0,
lockMovementX: !1,
lockMovementY: !1,
lockRotation: !1,
lockScalingX: !1,
lockScalingY: !1,
lockSkewingX: !1,
lockSkewingY: !1,
lockScalingFlip: !1,
excludeFromExport: !1,
objectCaching: p,
statefullCache: !1,
noScaleCache: !0,
strokeUniform: !1,
dirty: !0,
__corner: 0,
paintFirst: "fill",
activeOn: "down",
stateProperties: "top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "),
cacheProperties: "fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "),
colorProperties: "fill stroke backgroundColor".split(" "),
clipPath: void 0,
inverted: !1,
absolutePositioned: !1,
initialize: function(g) {
g && this.setOptions(g)
},
_createCacheCanvas: function() {
this._cacheProperties = {}, this._cacheCanvas = o.util.createCanvasElement(), this._cacheContext = this._cacheCanvas.getContext("2d"), this._updateCacheCanvas(), this.dirty = !0
},
_limitCacheSize: function(g) {
var v = o.perfLimitSizeTotal,
y = g.width,
b = g.height,
w = o.maxCacheSideLimit,
x = o.minCacheSideLimit;
if (y <= w && b <= w && y * b <= v) return y < x && (g.width = x), b < x && (g.height = x), g;
var S = y / b,
T = o.util.limitDimsByArea(S, v),
P = o.util.capValue,
I = P(x, T.x, w),
z = P(x, T.y, w);
return y > I && (g.zoomX /= y / I, g.width = I, g.capped = !0), b > z && (g.zoomY /= b / z, g.height = z, g.capped = !0), g
},
_getCacheCanvasDimensions: function() {
var g = this.getTotalObjectScaling(),
v = this._getTransformedDimensions(0, 0),
y = v.x * g.scaleX / this.scaleX,
b = v.y * g.scaleY / this.scaleY;
return {
width: y + m,
height: b + m,
zoomX: g.scaleX,
zoomY: g.scaleY,
x: y,
y: b
}
},
_updateCacheCanvas: function() {
var g = this.canvas;
if (this.noScaleCache && g && g._currentTransform) {
var v = g._currentTransform.target,
y = g._currentTransform.action;
if (this === v && y.slice && y.slice(0, 5) === "scale") return !1
}
var b = this._cacheCanvas,
w = this._limitCacheSize(this._getCacheCanvasDimensions()),
x = o.minCacheSideLimit,
S = w.width,
T = w.height,
P, I, z = w.zoomX,
H = w.zoomY,
ee = S !== this.cacheWidth || T !== this.cacheHeight,
te = this.zoomX !== z || this.zoomY !== H,
ne = ee || te,
Z = 0,
ie = 0,
ce = !1;
if (ee) {
var V = this._cacheCanvas.width,
C = this._cacheCanvas.height,
k = S > V || T > C,
M = (S < V * .9 || T < C * .9) && V > x && C > x;
ce = k || M, k && !w.capped && (S > x || T > x) && (Z = S * .1, ie = T * .1)
}
return this instanceof o.Text && this.path && (ne = !0, ce = !0, Z += this.getHeightOfLine(0) * this.zoomX, ie += this.getHeightOfLine(0) * this.zoomY), ne ? (ce ? (b.width = Math.ceil(S + Z), b.height = Math.ceil(T + ie)) : (this._cacheContext.setTransform(1, 0, 0, 1, 0, 0), this._cacheContext.clearRect(0, 0, b.width, b.height)), P = w.x / 2, I = w.y / 2, this.cacheTranslationX = Math.round(b.width / 2 - P) + P, this.cacheTranslationY = Math.round(b.height / 2 - I) + I, this.cacheWidth = S, this.cacheHeight = T, this._cacheContext.translate(this.cacheTranslationX, this.cacheTranslationY), this._cacheContext.scale(z, H), this.zoomX = z, this.zoomY = H, !0) : !1
},
setOptions: function(g) {
this._setOptions(g), this._initGradient(g.fill, "fill"), this._initGradient(g.stroke, "stroke"), this._initPattern(g.fill, "fill"), this._initPattern(g.stroke, "stroke")
},
transform: function(g) {
var v = this.group && !this.group._transformDone || this.group && this.canvas && g === this.canvas.contextTop,
y = this.calcTransformMatrix(!v);
g.transform(y[0], y[1], y[2], y[3], y[4], y[5])
},
toObject: function(g) {
var v = o.Object.NUM_FRACTION_DIGITS,
y = {
type: this.type,
version: o.version,
originX: this.originX,
originY: this.originY,
left: l(this.left, v),
top: l(this.top, v),
width: l(this.width, v),
height: l(this.height, v),
fill: this.fill && this.fill.toObject ? this.fill.toObject() : this.fill,
stroke: this.stroke && this.stroke.toObject ? this.stroke.toObject() : this.stroke,
strokeWidth: l(this.strokeWidth, v),
strokeDashArray: this.strokeDashArray ? this.strokeDashArray.concat() : this.strokeDashArray,
strokeLineCap: this.strokeLineCap,
strokeDashOffset: this.strokeDashOffset,
strokeLineJoin: this.strokeLineJoin,
strokeUniform: this.strokeUniform,
strokeMiterLimit: l(this.strokeMiterLimit, v),
scaleX: l(this.scaleX, v),
scaleY: l(this.scaleY, v),
angle: l(this.angle, v),
flipX: this.flipX,
flipY: this.flipY,
opacity: l(this.opacity, v),
shadow: this.shadow && this.shadow.toObject ? this.shadow.toObject() : this.shadow,
visible: this.visible,
backgroundColor: this.backgroundColor,
fillRule: this.fillRule,
paintFirst: this.paintFirst,
globalCompositeOperation: this.globalCompositeOperation,
skewX: l(this.skewX, v),
skewY: l(this.skewY, v)
};
return this.clipPath && !this.clipPath.excludeFromExport && (y.clipPath = this.clipPath.toObject(g), y.clipPath.inverted = this.clipPath.inverted, y.clipPath.absolutePositioned = this.clipPath.absolutePositioned), o.util.populateWithProperties(this, y, g), this.includeDefaultValues || (y = this._removeDefaultValues(y)), y
},
toDatalessObject: function(g) {
return this.toObject(g)
},
_removeDefaultValues: function(g) {
var v = o.util.getKlass(g.type).prototype,
y = v.stateProperties;
return y.forEach(function(b) {
b === "left" || b === "top" || (g[b] === v[b] && delete g[b], Array.isArray(g[b]) && Array.isArray(v[b]) && g[b].length === 0 && v[b].length === 0 && delete g[b])
}), g
},
toString: function() {
return "#<fabric." + u(this.type) + ">"
},
getObjectScaling: function() {
if (!this.group) return {
scaleX: this.scaleX,
scaleY: this.scaleY
};
var g = o.util.qrDecompose(this.calcTransformMatrix());
return {
scaleX: Math.abs(g.scaleX),
scaleY: Math.abs(g.scaleY)
}
},
getTotalObjectScaling: function() {
var g = this.getObjectScaling(),
v = g.scaleX,
y = g.scaleY;
if (this.canvas) {
var b = this.canvas.getZoom(),
w = this.canvas.getRetinaScaling();
v *= b * w, y *= b * w
}
return {
scaleX: v,
scaleY: y
}
},
getObjectOpacity: function() {
var g = this.opacity;
return this.group && (g *= this.group.getObjectOpacity()), g
},
_set: function(g, v) {
var y = g === "scaleX" || g === "scaleY",
b = this[g] !== v,
w = !1;
return y && (v = this._constrainScale(v)), g === "scaleX" && v < 0 ? (this.flipX = !this.flipX, v *= -1) : g === "scaleY" && v < 0 ? (this.flipY = !this.flipY, v *= -1) : g === "shadow" && v && !(v instanceof o.Shadow) ? v = new o.Shadow(v) : g === "dirty" && this.group && this.group.set("dirty", v), this[g] = v, b && (w = this.group && this.group.isOnACache(), this.cacheProperties.indexOf(g) > -1 ? (this.dirty = !0, w && this.group.set("dirty", !0)) : w && this.stateProperties.indexOf(g) > -1 && this.group.set("dirty", !0)), this
},
setOnGroup: function() {},
getViewportTransform: function() {
return this.canvas && this.canvas.viewportTransform ? this.canvas.viewportTransform : o.iMatrix.concat()
},
isNotVisible: function() {
return this.opacity === 0 || !this.width && !this.height && this.strokeWidth === 0 || !this.visible
},
render: function(g) {
this.isNotVisible() || this.canvas && this.canvas.skipOffscreen && !this.group && !this.isOnScreen() || (g.save(), this._setupCompositeOperation(g), this.drawSelectionBackground(g), this.transform(g), this._setOpacity(g), this._setShadow(g, this), this.shouldCache() ? (this.renderCache(), this.drawCacheOnCanvas(g)) : (this._removeCacheCanvas(), this.dirty = !1, this.drawObject(g), this.objectCaching && this.statefullCache && this.saveState({
propertySet: "cacheProperties"
})), g.restore())
},
renderCache: function(g) {
g = g || {}, (!this._cacheCanvas || !this._cacheContext) && this._createCacheCanvas(), this.isCacheDirty() && (this.statefullCache && this.saveState({
propertySet: "cacheProperties"
}), this.drawObject(this._cacheContext, g.forClipping), this.dirty = !1)
},
_removeCacheCanvas: function() {
this._cacheCanvas = null, this._cacheContext = null, this.cacheWidth = 0, this.cacheHeight = 0
},
hasStroke: function() {
return this.stroke && this.stroke !== "transparent" && this.strokeWidth !== 0
},
hasFill: function() {
return this.fill && this.fill !== "transparent"
},
needsItsOwnCache: function() {
return !!(this.paintFirst === "stroke" && this.hasFill() && this.hasStroke() && typeof this.shadow == "object" || this.clipPath)
},
shouldCache: function() {
return this.ownCaching = this.needsItsOwnCache() || this.objectCaching && (!this.group || !this.group.isOnACache()), this.ownCaching
},
willDrawShadow: function() {
return !!this.shadow && (this.shadow.offsetX !== 0 || this.shadow.offsetY !== 0)
},
drawClipPathOnCache: function(g, v) {
if (g.save(), v.inverted ? g.globalCompositeOperation = "destination-out" : g.globalCompositeOperation = "destination-in", v.absolutePositioned) {
var y = o.util.invertTransform(this.calcTransformMatrix());
g.transform(y[0], y[1], y[2], y[3], y[4], y[5])
}
v.transform(g), g.scale(1 / v.zoomX, 1 / v.zoomY), g.drawImage(v._cacheCanvas, -v.cacheTranslationX, -v.cacheTranslationY), g.restore()
},
drawObject: function(g, v) {
var y = this.fill,
b = this.stroke;
v ? (this.fill = "black", this.stroke = "", this._setClippingProperties(g)) : this._renderBackground(g), this._render(g), this._drawClipPath(g, this.clipPath), this.fill = y, this.stroke = b
},
_drawClipPath: function(g, v) {
!v || (v.canvas = this.canvas, v.shouldCache(), v._transformDone = !0, v.renderCache({
forClipping: !0
}), this.drawClipPathOnCache(g, v))
},
drawCacheOnCanvas: function(g) {
g.scale(1 / this.zoomX, 1 / this.zoomY), g.drawImage(this._cacheCanvas, -this.cacheTranslationX, -this.cacheTranslationY)
},
isCacheDirty: function(g) {
if (this.isNotVisible()) return !1;
if (this._cacheCanvas && this._cacheContext && !g && this._updateCacheCanvas()) return !0;
if (this.dirty || this.clipPath && this.clipPath.absolutePositioned || this.statefullCache && this.hasStateChanged("cacheProperties")) {
if (this._cacheCanvas && this._cacheContext && !g) {
var v = this.cacheWidth / this.zoomX,
y = this.cacheHeight / this.zoomY;
this._cacheContext.clearRect(-v / 2, -y / 2, v, y)
}
return !0
}
return !1
},
_renderBackground: function(g) {
if (!!this.backgroundColor) {
var v = this._getNonTransformedDimensions();
g.fillStyle = this.backgroundColor, g.fillRect(-v.x / 2, -v.y / 2, v.x, v.y), this._removeShadow(g)
}
},
_setOpacity: function(g) {
this.group && !this.group._transformDone ? g.globalAlpha = this.getObjectOpacity() : g.globalAlpha *= this.opacity
},
_setStrokeStyles: function(g, v) {
var y = v.stroke;
y && (g.lineWidth = v.strokeWidth, g.lineCap = v.strokeLineCap, g.lineDashOffset = v.strokeDashOffset, g.lineJoin = v.strokeLineJoin, g.miterLimit = v.strokeMiterLimit, y.toLive ? y.gradientUnits === "percentage" || y.gradientTransform || y.patternTransform ? this._applyPatternForTransformedGradient(g, y) : (g.strokeStyle = y.toLive(g, this), this._applyPatternGradientTransform(g, y)) : g.strokeStyle = v.stroke)
},
_setFillStyles: function(g, v) {
var y = v.fill;
y && (y.toLive ? (g.fillStyle = y.toLive(g, this), this._applyPatternGradientTransform(g, v.fill)) : g.fillStyle = y)
},
_setClippingProperties: function(g) {
g.globalAlpha = 1, g.strokeStyle = "transparent", g.fillStyle = "#000000"
},
_setLineDash: function(g, v) {
!v || v.length === 0 || (1 & v.length && v.push.apply(v, v), g.setLineDash(v))
},
_renderControls: function(g, v) {
var y = this.getViewportTransform(),
b = this.calcTransformMatrix(),
w, x, S;
v = v || {}, x = typeof v.hasBorders < "u" ? v.hasBorders : this.hasBorders, S = typeof v.hasControls < "u" ? v.hasControls : this.hasControls, b = o.util.multiplyTransformMatrices(y, b), w = o.util.qrDecompose(b), g.save(), g.translate(w.translateX, w.translateY), g.lineWidth = 1 * this.borderScaleFactor, this.group || (g.globalAlpha = this.isMoving ? this.borderOpacityWhenMoving : 1), this.flipX && (w.angle -= 180), g.rotate(f(this.group ? w.angle : this.angle)), v.forActiveSelection || this.group ? x && this.drawBordersInGroup(g, w, v) : x && this.drawBorders(g, v), S && this.drawControls(g, v), g.restore()
},
_setShadow: function(g) {
if (!!this.shadow) {
var v = this.shadow,
y = this.canvas,
b, w = y && y.viewportTransform[0] || 1,
x = y && y.viewportTransform[3] || 1;
v.nonScaling ? b = {
scaleX: 1,
scaleY: 1
} : b = this.getObjectScaling(), y && y._isRetinaScaling() && (w *= o.devicePixelRatio, x *= o.devicePixelRatio), g.shadowColor = v.color, g.shadowBlur = v.blur * o.browserShadowBlurConstant * (w + x) * (b.scaleX + b.scaleY) / 4, g.shadowOffsetX = v.offsetX * w * b.scaleX, g.shadowOffsetY = v.offsetY * x * b.scaleY
}
},
_removeShadow: function(g) {
!this.shadow || (g.shadowColor = "", g.shadowBlur = g.shadowOffsetX = g.shadowOffsetY = 0)
},
_applyPatternGradientTransform: function(g, v) {
if (!v || !v.toLive) return {
offsetX: 0,
offsetY: 0
};
var y = v.gradientTransform || v.patternTransform,
b = -this.width / 2 + v.offsetX || 0,
w = -this.height / 2 + v.offsetY || 0;
return v.gradientUnits === "percentage" ? g.transform(this.width, 0, 0, this.height, b, w) : g.transform(1, 0, 0, 1, b, w), y && g.transform(y[0], y[1], y[2], y[3], y[4], y[5]), {
offsetX: b,
offsetY: w
}
},
_renderPaintInOrder: function(g) {
this.paintFirst === "stroke" ? (this._renderStroke(g), this._renderFill(g)) : (this._renderFill(g), this._renderStroke(g))
},
_render: function() {},
_renderFill: function(g) {
!this.fill || (g.save(), this._setFillStyles(g, this), this.fillRule === "evenodd" ? g.fill("evenodd") : g.fill(), g.restore())
},
_renderStroke: function(g) {
if (!(!this.stroke || this.strokeWidth === 0)) {
if (this.shadow && !this.shadow.affectStroke && this._removeShadow(g), g.save(), this.strokeUniform && this.group) {
var v = this.getObjectScaling();
g.scale(1 / v.scaleX, 1 / v.scaleY)
} else this.strokeUniform && g.scale(1 / this.scaleX, 1 / this.scaleY);
this._setLineDash(g, this.strokeDashArray), this._setStrokeStyles(g, this), g.stroke(), g.restore()
}
},
_applyPatternForTransformedGradient: function(g, v) {
var y = this._limitCacheSize(this._getCacheCanvasDimensions()),
b = o.util.createCanvasElement(),
w, x = this.canvas.getRetinaScaling(),
S = y.x / this.scaleX / x,
T = y.y / this.scaleY / x;
b.width = S, b.height = T, w = b.getContext("2d"), w.beginPath(), w.moveTo(0, 0), w.lineTo(S, 0), w.lineTo(S, T), w.lineTo(0, T), w.closePath(), w.translate(S / 2, T / 2), w.scale(y.zoomX / this.scaleX / x, y.zoomY / this.scaleY / x), this._applyPatternGradientTransform(w, v), w.fillStyle = v.toLive(g), w.fill(), g.translate(-this.width / 2 - this.strokeWidth / 2, -this.height / 2 - this.strokeWidth / 2), g.scale(x * this.scaleX / y.zoomX, x * this.scaleY / y.zoomY), g.strokeStyle = w.createPattern(b, "no-repeat")
},
_findCenterFromElement: function() {
return {
x: this.left + this.width / 2,
y: this.top + this.height / 2
}
},
_assignTransformMatrixProps: function() {
if (this.transformMatrix) {
var g = o.util.qrDecompose(this.transformMatrix);
this.flipX = !1, this.flipY = !1, this.set("scaleX", g.scaleX), this.set("scaleY", g.scaleY), this.angle = g.angle, this.skewX = g.skewX, this.skewY = 0
}
},
_removeTransformMatrix: function(g) {
var v = this._findCenterFromElement();
this.transformMatrix && (this._assignTransformMatrixProps(), v = o.util.transformPoint(v, this.transformMatrix)), this.transformMatrix = null, g && (this.scaleX *= g.scaleX, this.scaleY *= g.scaleY, this.cropX = g.cropX, this.cropY = g.cropY, v.x += g.offsetLeft, v.y += g.offsetTop, this.width = g.width, this.height = g.height), this.setPositionByOrigin(v, "center", "center")
},
clone: function(g, v) {
var y = this.toObject(v);
this.constructor.fromObject ? this.constructor.fromObject(y, g) : o.Object._fromObject("Object", y, g)
},
cloneAsImage: function(g, v) {
var y = this.toCanvasElement(v);
return g && g(new o.Image(y)), this
},
toCanvasElement: function(g) {
g || (g = {});
var v = o.util,
y = v.saveObjectTransform(this),
b = this.group,
w = this.shadow,
x = Math.abs,
S = (g.multiplier || 1) * (g.enableRetinaScaling ? o.devicePixelRatio : 1);
delete this.group, g.withoutTransform && v.resetObjectTransform(this), g.withoutShadow && (this.shadow = null);
var T = o.util.createCanvasElement(),
P = this.getBoundingRect(!0, !0),
I = this.shadow,
z, H = {
x: 0,
y: 0
},
ee, te, ne;
I && (ee = I.blur, I.nonScaling ? z = {
scaleX: 1,
scaleY: 1
} : z = this.getObjectScaling(), H.x = 2 * Math.round(x(I.offsetX) + ee) * x(z.scaleX), H.y = 2 * Math.round(x(I.offsetY) + ee) * x(z.scaleY)), te = P.width + H.x, ne = P.height + H.y, T.width = Math.ceil(te), T.height = Math.ceil(ne);
var Z = new o.StaticCanvas(T, {
enableRetinaScaling: !1,
renderOnAddRemove: !1,
skipOffscreen: !1
});
g.format === "jpeg" && (Z.backgroundColor = "#fff"), this.setPositionByOrigin(new o.Point(Z.width / 2, Z.height / 2), "center", "center");
var ie = this.canvas;
Z.add(this);
var ce = Z.toCanvasElement(S || 1, g);
return this.shadow = w, this.set("canvas", ie), b && (this.group = b), this.set(y).setCoords(), Z._objects = [], Z.dispose(), Z = null, ce
},
toDataURL: function(g) {
return g || (g = {}), o.util.toDataURL(this.toCanvasElement(g), g.format || "png", g.quality || 1)
},
isType: function(g) {
return arguments.length > 1 ? Array.from(arguments).includes(this.type) : this.type === g
},
complexity: function() {
return 1
},
toJSON: function(g) {
return this.toObject(g)
},
rotate: function(g) {
var v = (this.originX !== "center" || this.originY !== "center") && this.centeredRotation;
return v && this._setOriginToCenter(), this.set("angle", g), v && this._resetOrigin(), this
},
centerH: function() {
return this.canvas && this.canvas.centerObjectH(this), this
},
viewportCenterH: function() {
return this.canvas && this.canvas.viewportCenterObjectH(this), this
},
centerV: function() {
return this.canvas && this.canvas.centerObjectV(this), this
},
viewportCenterV: function() {
return this.canvas && this.canvas.viewportCenterObjectV(this), this
},
center: function() {
return this.canvas && this.canvas.centerObject(this), this
},
viewportCenter: function() {
return this.canvas && this.canvas.viewportCenterObject(this), this
},
getLocalPointer: function(g, v) {
v = v || this.canvas.getPointer(g);
var y = new o.Point(v.x, v.y),
b = this._getLeftTopCoords();
return this.angle && (y = o.util.rotatePoint(y, b, f(-this.angle))), {
x: y.x - b.x,
y: y.y - b.y
}
},
_setupCompositeOperation: function(g) {
this.globalCompositeOperation && (g.globalCompositeOperation = this.globalCompositeOperation)
},
dispose: function() {
o.runningAnimations && o.runningAnimations.cancelByTarget(this)
}
}), o.util.createAccessors && o.util.createAccessors(o.Object), c(o.Object.prototype, o.Observable), o.Object.NUM_FRACTION_DIGITS = 2, o.Object.ENLIVEN_PROPS = ["clipPath"], o.Object._fromObject = function(g, v, y, b) {
var w = o[g];
v = h(v, !0), o.util.enlivenPatterns([v.fill, v.stroke], function(x) {
typeof x[0] < "u" && (v.fill = x[0]), typeof x[1] < "u" && (v.stroke = x[1]), o.util.enlivenObjectEnlivables(v, v, function() {
var S = b ? new w(v[b], v) : new w(v);
y && y(S)
})
})
}, o.Object.__uid = 0)
}(t),
function() {
var a = e.util.degreesToRadians,
o = {
left: -.5,
center: 0,
right: .5
},
c = {
top: -.5,
center: 0,
bottom: .5
};
e.util.object.extend(e.Object.prototype, {
translateToGivenOrigin: function(h, l, u, f, p) {
var m = h.x,
g = h.y,
v, y, b;
return typeof l == "string" ? l = o[l] : l -= .5, typeof f == "string" ? f = o[f] : f -= .5, v = f - l, typeof u == "string" ? u = c[u] : u -= .5, typeof p == "string" ? p = c[p] : p -= .5, y = p - u, (v || y) && (b = this._getTransformedDimensions(), m = h.x + v * b.x, g = h.y + y * b.y), new e.Point(m, g)
},
translateToCenterPoint: function(h, l, u) {
var f = this.translateToGivenOrigin(h, l, u, "center", "center");
return this.angle ? e.util.rotatePoint(f, h, a(this.angle)) : f
},
translateToOriginPoint: function(h, l, u) {
var f = this.translateToGivenOrigin(h, "center", "center", l, u);
return this.angle ? e.util.rotatePoint(f, h, a(this.angle)) : f
},
getCenterPoint: function() {
var h = new e.Point(this.left, this.top);
return this.translateToCenterPoint(h, this.originX, this.originY)
},
getPointByOrigin: function(h, l) {
var u = this.getCenterPoint();
return this.translateToOriginPoint(u, h, l)
},
toLocalPoint: function(h, l, u) {
var f = this.getCenterPoint(),
p, m;
return typeof l < "u" && typeof u < "u" ? p = this.translateToGivenOrigin(f, "center", "center", l, u) : p = new e.Point(this.left, this.top), m = new e.Point(h.x, h.y), this.angle && (m = e.util.rotatePoint(m, f, -a(this.angle))), m.subtractEquals(p)
},
setPositionByOrigin: function(h, l, u) {
var f = this.translateToCenterPoint(h, l, u),
p = this.translateToOriginPoint(f, this.originX, this.originY);
this.set("left", p.x), this.set("top", p.y)
},
adjustPosition: function(h) {
var l = a(this.angle),
u = this.getScaledWidth(),
f = e.util.cos(l) * u,
p = e.util.sin(l) * u,
m, g;
typeof this.originX == "string" ? m = o[this.originX] : m = this.originX - .5, typeof h == "string" ? g = o[h] : g = h - .5, this.left += f * (g - m), this.top += p * (g - m), this.setCoords(), this.originX = h
},
_setOriginToCenter: function() {
this._originalOriginX = this.originX, this._originalOriginY = this.originY;
var h = this.getCenterPoint();
this.originX = "center", this.originY = "center", this.left = h.x, this.top = h.y
},
_resetOrigin: function() {
var h = this.translateToOriginPoint(this.getCenterPoint(), this._originalOriginX, this._originalOriginY);
this.originX = this._originalOriginX, this.originY = this._originalOriginY, this.left = h.x, this.top = h.y, this._originalOriginX = null, this._originalOriginY = null
},
_getLeftTopCoords: function() {
return this.translateToOriginPoint(this.getCenterPoint(), "left", "top")
}
})
}(),
function() {
function a(u) {
return [new e.Point(u.tl.x, u.tl.y), new e.Point(u.tr.x, u.tr.y), new e.Point(u.br.x, u.br.y), new e.Point(u.bl.x, u.bl.y)]
}
var o = e.util,
c = o.degreesToRadians,
h = o.multiplyTransformMatrices,
l = o.transformPoint;
o.object.extend(e.Object.prototype, {
oCoords: null,
aCoords: null,
lineCoords: null,
ownMatrixCache: null,
matrixCache: null,
controls: {},
_getCoords: function(u, f) {
return f ? u ? this.calcACoords() : this.calcLineCoords() : ((!this.aCoords || !this.lineCoords) && this.setCoords(!0), u ? this.aCoords : this.lineCoords)
},
getCoords: function(u, f) {
return a(this._getCoords(u, f))
},
intersectsWithRect: function(u, f, p, m) {
var g = this.getCoords(p, m),
v = e.Intersection.intersectPolygonRectangle(g, u, f);
return v.status === "Intersection"
},
intersectsWithObject: function(u, f, p) {
var m = e.Intersection.intersectPolygonPolygon(this.getCoords(f, p), u.getCoords(f, p));
return m.status === "Intersection" || u.isContainedWithinObject(this, f, p) || this.isContainedWithinObject(u, f, p)
},
isContainedWithinObject: function(u, f, p) {
for (var m = this.getCoords(f, p), g = f ? u.aCoords : u.lineCoords, v = 0, y = u._getImageLines(g); v < 4; v++)
if (!u.containsPoint(m[v], y)) return !1;
return !0
},
isContainedWithinRect: function(u, f, p, m) {
var g = this.getBoundingRect(p, m);
return g.left >= u.x && g.left + g.width <= f.x && g.top >= u.y && g.top + g.height <= f.y
},
containsPoint: function(u, v, p, m) {
var g = this._getCoords(p, m),
v = v || this._getImageLines(g),
y = this._findCrossPoints(u, v);
return y !== 0 && y % 2 === 1
},
isOnScreen: function(u) {
if (!this.canvas) return !1;
var f = this.canvas.vptCoords.tl,
p = this.canvas.vptCoords.br,
m = this.getCoords(!0, u);
return m.some(function(g) {
return g.x <= p.x && g.x >= f.x && g.y <= p.y && g.y >= f.y
}) || this.intersectsWithRect(f, p, !0, u) ? !0 : this._containsCenterOfCanvas(f, p, u)
},
_containsCenterOfCanvas: function(u, f, p) {
var m = {
x: (u.x + f.x) / 2,
y: (u.y + f.y) / 2
};
return !!this.containsPoint(m, null, !0, p)
},
isPartiallyOnScreen: function(u) {
if (!this.canvas) return !1;
var f = this.canvas.vptCoords.tl,
p = this.canvas.vptCoords.br;
if (this.intersectsWithRect(f, p, !0, u)) return !0;
var m = this.getCoords(!0, u).every(function(g) {
return (g.x >= p.x || g.x <= f.x) && (g.y >= p.y || g.y <= f.y)
});
return m && this._containsCenterOfCanvas(f, p, u)
},
_getImageLines: function(u) {
var f = {
topline: {
o: u.tl,
d: u.tr
},
rightline: {
o: u.tr,
d: u.br
},
bottomline: {
o: u.br,
d: u.bl
},
leftline: {
o: u.bl,
d: u.tl
}
};
return f
},
_findCrossPoints: function(u, f) {
var p, m, g, v, y, b = 0,
w;
for (var x in f)
if (w = f[x], !(w.o.y < u.y && w.d.y < u.y) && !(w.o.y >= u.y && w.d.y >= u.y) && (w.o.x === w.d.x && w.o.x >= u.x ? y = w.o.x : (p = 0, m = (w.d.y - w.o.y) / (w.d.x - w.o.x), g = u.y - p * u.x, v = w.o.y - m * w.o.x, y = -(g - v) / (p - m)), y >= u.x && (b += 1), b === 2)) break;
return b
},
getBoundingRect: function(u, f) {
var p = this.getCoords(u, f);
return o.makeBoundingBoxFromPoints(p)
},
getScaledWidth: function() {
return this._getTransformedDimensions().x
},
getScaledHeight: function() {
return this._getTransformedDimensions().y
},
_constrainScale: function(u) {
return Math.abs(u) < this.minScaleLimit ? u < 0 ? -this.minScaleLimit : this.minScaleLimit : u === 0 ? 1e-4 : u
},
scale: function(u) {
return this._set("scaleX", u), this._set("scaleY", u), this.setCoords()
},
scaleToWidth: function(u, f) {
var p = this.getBoundingRect(f).width / this.getScaledWidth();
return this.scale(u / this.width / p)
},
scaleToHeight: function(u, f) {
var p = this.getBoundingRect(f).height / this.getScaledHeight();
return this.scale(u / this.height / p)
},
calcLineCoords: function() {
var u = this.getViewportTransform(),
f = this.padding,
p = c(this.angle),
m = o.cos(p),
g = o.sin(p),
v = m * f,
y = g * f,
b = v + y,
w = v - y,
x = this.calcACoords(),
S = {
tl: l(x.tl, u),
tr: l(x.tr, u),
bl: l(x.bl, u),
br: l(x.br, u)
};
return f && (S.tl.x -= w, S.tl.y -= b, S.tr.x += b, S.tr.y -= w, S.bl.x -= b, S.bl.y += w, S.br.x += w, S.br.y += b), S
},
calcOCoords: function() {
var u = this._calcRotateMatrix(),
f = this._calcTranslateMatrix(),
p = this.getViewportTransform(),
m = h(p, f),
g = h(m, u),
g = h(g, [1 / p[0], 0, 0, 1 / p[3], 0, 0]),
v = this._calculateCurrentDimensions(),
y = {};
return this.forEachControl(function(b, w, x) {
y[w] = b.positionHandler(v, g, x)
}), y
},
calcACoords: function() {
var u = this._calcRotateMatrix(),
f = this._calcTranslateMatrix(),
p = h(f, u),
m = this._getTransformedDimensions(),
g = m.x / 2,
v = m.y / 2;
return {
tl: l({
x: -g,
y: -v
}, p),
tr: l({
x: g,
y: -v
}, p),
bl: l({
x: -g,
y: v
}, p),
br: l({
x: g,
y: v
}, p)
}
},
setCoords: function(u) {
return this.aCoords = this.calcACoords(), this.lineCoords = this.group ? this.aCoords : this.calcLineCoords(), u ? this : (this.oCoords = this.calcOCoords(), this._setCornerCoords && this._setCornerCoords(), this)
},
_calcRotateMatrix: function() {
return o.calcRotateMatrix(this)
},
_calcTranslateMatrix: function() {
var u = this.getCenterPoint();
return [1, 0, 0, 1, u.x, u.y]
},
transformMatrixKey: function(u) {
var f = "_",
p = "";
return !u && this.group && (p = this.group.transformMatrixKey(u) + f), p + this.top + f + this.left + f + this.scaleX + f + this.scaleY + f + this.skewX + f + this.skewY + f + this.angle + f + this.originX + f + this.originY + f + this.width + f + this.height + f + this.strokeWidth + this.flipX + this.flipY
},
calcTransformMatrix: function(u) {
var f = this.calcOwnMatrix();
if (u || !this.group) return f;
var p = this.transformMatrixKey(u),
m = this.matrixCache || (this.matrixCache = {});
return m.key === p ? m.value : (this.group && (f = h(this.group.calcTransformMatrix(!1), f)), m.key = p, m.value = f, f)
},
calcOwnMatrix: function() {
var u = this.transformMatrixKey(!0),
f = this.ownMatrixCache || (this.ownMatrixCache = {});
if (f.key === u) return f.value;
var p = this._calcTranslateMatrix(),
m = {
angle: this.angle,
translateX: p[4],
translateY: p[5],
scaleX: this.scaleX,
scaleY: this.scaleY,
skewX: this.skewX,
skewY: this.skewY,
flipX: this.flipX,
flipY: this.flipY
};
return f.key = u, f.value = o.composeMatrix(m), f.value
},
_getNonTransformedDimensions: function() {
var u = this.strokeWidth,
f = this.width + u,
p = this.height + u;
return {
x: f,
y: p
}
},
_getTransformedDimensions: function(u, f) {
typeof u > "u" && (u = this.skewX), typeof f > "u" && (f = this.skewY);
var p, m, g, v = u === 0 && f === 0;
if (this.strokeUniform ? (m = this.width, g = this.height) : (p = this._getNonTransformedDimensions(), m = p.x, g = p.y), v) return this._finalizeDimensions(m * this.scaleX, g * this.scaleY);
var y = o.sizeAfterTransform(m, g, {
scaleX: this.scaleX,
scaleY: this.scaleY,
skewX: u,
skewY: f
});
return this._finalizeDimensions(y.x, y.y)
},
_finalizeDimensions: function(u, f) {
return this.strokeUniform ? {
x: u + this.strokeWidth,
y: f + this.strokeWidth
} : {
x: u,
y: f
}
},
_calculateCurrentDimensions: function() {
var u = this.getViewportTransform(),
f = this._getTransformedDimensions(),
p = l(f, u, !0);
return p.scalarAdd(2 * this.padding)
}
})
}(), e.util.object.extend(e.Object.prototype, {
sendToBack: function() {
return this.group ? e.StaticCanvas.prototype.sendToBack.call(this.group, this) : this.canvas && this.canvas.sendToBack(this), this
},
bringToFront: function() {
return this.group ? e.StaticCanvas.prototype.bringToFront.call(this.group, this) : this.canvas && this.canvas.bringToFront(this), this
},
sendBackwards: function(a) {
return this.group ? e.StaticCanvas.prototype.sendBackwards.call(this.group, this, a) : this.canvas && this.canvas.sendBackwards(this, a), this
},
bringForward: function(a) {
return this.group ? e.StaticCanvas.prototype.bringForward.call(this.group, this, a) : this.canvas && this.canvas.bringForward(this, a), this
},
moveTo: function(a) {
return this.group && this.group.type !== "activeSelection" ? e.StaticCanvas.prototype.moveTo.call(this.group, this, a) : this.canvas && this.canvas.moveTo(this, a), this
}
}),
function() {
function a(c, h) {
if (h) {
if (h.toLive) return c + ": url(#SVGID_" + h.id + "); ";
var l = new e.Color(h),
u = c + ": " + l.toRgb() + "; ",
f = l.getAlpha();
return f !== 1 && (u += c + "-opacity: " + f.toString() + "; "), u
} else return c + ": none; "
}
var o = e.util.toFixed;
e.util.object.extend(e.Object.prototype, {
getSvgStyles: function(c) {
var h = this.fillRule ? this.fillRule : "nonzero",
l = this.strokeWidth ? this.strokeWidth : "0",
u = this.strokeDashArray ? this.strokeDashArray.join(" ") : "none",
f = this.strokeDashOffset ? this.strokeDashOffset : "0",
p = this.strokeLineCap ? this.strokeLineCap : "butt",
m = this.strokeLineJoin ? this.strokeLineJoin : "miter",
g = this.strokeMiterLimit ? this.strokeMiterLimit : "4",
v = typeof this.opacity < "u" ? this.opacity : "1",
y = this.visible ? "" : " visibility: hidden;",
b = c ? "" : this.getSvgFilter(),
w = a("fill", this.fill),
x = a("stroke", this.stroke);
return [x, "stroke-width: ", l, "; ", "stroke-dasharray: ", u, "; ", "stroke-linecap: ", p, "; ", "stroke-dashoffset: ", f, "; ", "stroke-linejoin: ", m, "; ", "stroke-miterlimit: ", g, "; ", w, "fill-rule: ", h, "; ", "opacity: ", v, ";", b, y].join("")
},
getSvgSpanStyles: function(c, h) {
var l = "; ",
f = c.fontFamily ? "font-family: " + (c.fontFamily.indexOf("'") === -1 && c.fontFamily.indexOf('"') === -1 ? "'" + c.fontFamily + "'" : c.fontFamily) + l : "",
u = c.strokeWidth ? "stroke-width: " + c.strokeWidth + l : "",
f = f,
p = c.fontSize ? "font-size: " + c.fontSize + "px" + l : "",
m = c.fontStyle ? "font-style: " + c.fontStyle + l : "",
g = c.fontWeight ? "font-weight: " + c.fontWeight + l : "",
v = c.fill ? a("fill", c.fill) : "",
y = c.stroke ? a("stroke", c.stroke) : "",
b = this.getSvgTextDecoration(c),
w = c.deltaY ? "baseline-shift: " + -c.deltaY + "; " : "";
return b && (b = "text-decoration: " + b + l), [y, u, f, p, m, g, b, v, w, h ? "white-space: pre; " : ""].join("")
},
getSvgTextDecoration: function(c) {
return ["overline", "underline", "line-through"].filter(function(h) {
return c[h.replace("-", "")]
}).join(" ")
},
getSvgFilter: function() {
return this.shadow ? "filter: url(#SVGID_" + this.shadow.id + ");" : ""
},
getSvgCommons: function() {
return [this.id ? 'id="' + this.id + '" ' : "", this.clipPath ? 'clip-path="url(#' + this.clipPath.clipPathId + ')" ' : ""].join("")
},
getSvgTransform: function(c, h) {
var l = c ? this.calcTransformMatrix() : this.calcOwnMatrix(),
u = 'transform="' + e.util.matrixToSVG(l);
return u + (h || "") + '" '
},
_setSVGBg: function(c) {
if (this.backgroundColor) {
var h = e.Object.NUM_FRACTION_DIGITS;
c.push(" <rect ", this._getFillAttributes(this.backgroundColor), ' x="', o(-this.width / 2, h), '" y="', o(-this.height / 2, h), '" width="', o(this.width, h), '" height="', o(this.height, h), `"></rect>
`)
}
},
toSVG: function(c) {
return this._createBaseSVGMarkup(this._toSVG(c), {
reviver: c
})
},
toClipPathSVG: function(c) {
return " " + this._createBaseClipPathSVGMarkup(this._toSVG(c), {
reviver: c
})
},
_createBaseClipPathSVGMarkup: function(c, h) {
h = h || {};
var l = h.reviver,
u = h.additionalTransform || "",
f = [this.getSvgTransform(!0, u), this.getSvgCommons()].join(""),
p = c.indexOf("COMMON_PARTS");
return c[p] = f, l ? l(c.join("")) : c.join("")
},
_createBaseSVGMarkup: function(c, h) {
h = h || {};
var l = h.noStyle,
u = h.reviver,
f = l ? "" : 'style="' + this.getSvgStyles() + '" ',
p = h.withShadow ? 'style="' + this.getSvgFilter() + '" ' : "",
m = this.clipPath,
g = this.strokeUniform ? 'vector-effect="non-scaling-stroke" ' : "",
v = m && m.absolutePositioned,
y = this.stroke,
b = this.fill,
w = this.shadow,
x, S = [],
T, P = c.indexOf("COMMON_PARTS"),
I = h.additionalTransform;
return m && (m.clipPathId = "CLIPPATH_" + e.Object.__uid++, T = '<clipPath id="' + m.clipPathId + `" >
` + m.toClipPathSVG(u) + `</clipPath>
`), v && S.push("<g ", p, this.getSvgCommons(), ` >
`), S.push("<g ", this.getSvgTransform(!1), v ? "" : p + this.getSvgCommons(), ` >
`), x = [f, g, l ? "" : this.addPaintOrder(), " ", I ? 'transform="' + I + '" ' : ""].join(""), c[P] = x, b && b.toLive && S.push(b.toSVG(this)), y && y.toLive && S.push(y.toSVG(this)), w && S.push(w.toSVG(this)), m && S.push(T), S.push(c.join("")), S.push(`</g>
`), v && S.push(`</g>
`), u ? u(S.join("")) : S.join("")
},
addPaintOrder: function() {
return this.paintFirst !== "fill" ? ' paint-order="' + this.paintFirst + '" ' : ""
}
})
}(),
function() {
var a = e.util.object.extend,
o = "stateProperties";
function c(l, u, f) {
var p = {},
m = !0;
f.forEach(function(g) {
p[g] = l[g]
}), a(l[u], p, m)
}
function h(l, u, f) {
if (l === u) return !0;
if (Array.isArray(l)) {
if (!Array.isArray(u) || l.length !== u.length) return !1;
for (var p = 0, m = l.length; p < m; p++)
if (!h(l[p], u[p])) return !1;
return !0
} else if (l && typeof l == "object") {
var g = Object.keys(l),
v;
if (!u || typeof u != "object" || !f && g.length !== Object.keys(u).length) return !1;
for (var p = 0, m = g.length; p < m; p++)
if (v = g[p], !(v === "canvas" || v === "group") && !h(l[v], u[v])) return !1;
return !0
}
}
e.util.object.extend(e.Object.prototype, {
hasStateChanged: function(l) {
l = l || o;
var u = "_" + l;
return Object.keys(this[u]).length < this[l].length ? !0 : !h(this[u], this, !0)
},
saveState: function(l) {
var u = l && l.propertySet || o,
f = "_" + u;
return this[f] ? (c(this, f, this[u]), l && l.stateProperties && c(this, f, l.stateProperties), this) : this.setupState(l)
},
setupState: function(l) {
l = l || {};
var u = l.propertySet || o;
return l.propertySet = u, this["_" + u] = {}, this.saveState(l), this
}
})
}(),
function() {
var a = e.util.degreesToRadians;
e.util.object.extend(e.Object.prototype, {
_findTargetCorner: function(o, c) {
if (!this.hasControls || this.group || !this.canvas || this.canvas._activeObject !== this) return !1;
var h = o.x,
l = o.y,
u, f, p = Object.keys(this.oCoords),
m = p.length - 1,
g;
for (this.__corner = 0; m >= 0; m--)
if (g = p[m], !!this.isControlVisible(g) && (f = this._getImageLines(c ? this.oCoords[g].touchCorner : this.oCoords[g].corner), u = this._findCrossPoints({
x: h,
y: l
}, f), u !== 0 && u % 2 === 1)) return this.__corner = g, g;
return !1
},
forEachControl: function(o) {
for (var c in this.controls) o(this.controls[c], c, this)
},
_setCornerCoords: function() {
var o = this.oCoords;
for (var c in o) {
var h = this.controls[c];
o[c].corner = h.calcCornerCoords(this.angle, this.cornerSize, o[c].x, o[c].y, !1), o[c].touchCorner = h.calcCornerCoords(this.angle, this.touchCornerSize, o[c].x, o[c].y, !0)
}
},
drawSelectionBackground: function(o) {
if (!this.selectionBackgroundColor || this.canvas && !this.canvas.interactive || this.canvas && this.canvas._activeObject !== this) return this;
o.save();
var c = this.getCenterPoint(),
h = this._calculateCurrentDimensions(),
l = this.canvas.viewportTransform;
return o.translate(c.x, c.y), o.scale(1 / l[0], 1 / l[3]), o.rotate(a(this.angle)), o.fillStyle = this.selectionBackgroundColor, o.fillRect(-h.x / 2, -h.y / 2, h.x, h.y), o.restore(), this
},
drawBorders: function(o, c) {
c = c || {};
var h = this._calculateCurrentDimensions(),
l = this.borderScaleFactor,
u = h.x + l,
f = h.y + l,
p = typeof c.hasControls < "u" ? c.hasControls : this.hasControls,
m = !1;
return o.save(), o.strokeStyle = c.borderColor || this.borderColor, this._setLineDash(o, c.borderDashArray || this.borderDashArray), o.strokeRect(-u / 2, -f / 2, u, f), p && (o.beginPath(), this.forEachControl(function(g, v, y) {
g.withConnection && g.getVisibility(y, v) && (m = !0, o.moveTo(g.x * u, g.y * f), o.lineTo(g.x * u + g.offsetX, g.y * f + g.offsetY))
}), m && o.stroke()), o.restore(), this
},
drawBordersInGroup: function(o, c, h) {
h = h || {};
var l = e.util.sizeAfterTransform(this.width, this.height, c),
u = this.strokeWidth,
f = this.strokeUniform,
p = this.borderScaleFactor,
m = l.x + u * (f ? this.canvas.getZoom() : c.scaleX) + p,
g = l.y + u * (f ? this.canvas.getZoom() : c.scaleY) + p;
return o.save(), this._setLineDash(o, h.borderDashArray || this.borderDashArray), o.strokeStyle = h.borderColor || this.borderColor, o.strokeRect(-m / 2, -g / 2, m, g), o.restore(), this
},
drawControls: function(o, c) {
c = c || {}, o.save();
var h = this.canvas.getRetinaScaling(),
l, u;
return o.setTransform(h, 0, 0, h, 0, 0), o.strokeStyle = o.fillStyle = c.cornerColor || this.cornerColor, this.transparentCorners || (o.strokeStyle = c.cornerStrokeColor || this.cornerStrokeColor), this._setLineDash(o, c.cornerDashArray || this.cornerDashArray), this.setCoords(), this.group && (l = this.group.calcTransformMatrix()), this.forEachControl(function(f, p, m) {
u = m.oCoords[p], f.getVisibility(m, p) && (l && (u = e.util.transformPoint(u, l)), f.render(o, u.x, u.y, c, m))
}), o.restore(), this
},
isControlVisible: function(o) {
return this.controls[o] && this.controls[o].getVisibility(this, o)
},
setControlVisible: function(o, c) {
return this._controlsVisibility || (this._controlsVisibility = {}), this._controlsVisibility[o] = c, this
},
setControlsVisibility: function(o) {
o || (o = {});
for (var c in o) this.setControlVisible(c, o[c]);
return this
},
onDeselect: function() {},
onSelect: function() {}
})
}(), e.util.object.extend(e.StaticCanvas.prototype, {
FX_DURATION: 500,
fxCenterObjectH: function(a, o) {
o = o || {};
var c = function() {},
h = o.onComplete || c,
l = o.onChange || c,
u = this;
return e.util.animate({
target: this,
startValue: a.left,
endValue: this.getCenterPoint().x,
duration: this.FX_DURATION,
onChange: function(f) {
a.set("left", f), u.requestRenderAll(), l()
},
onComplete: function() {
a.setCoords(), h()
}
})
},
fxCenterObjectV: function(a, o) {
o = o || {};
var c = function() {},
h = o.onComplete || c,
l = o.onChange || c,
u = this;
return e.util.animate({
target: this,
startValue: a.top,
endValue: this.getCenterPoint().y,
duration: this.FX_DURATION,
onChange: function(f) {
a.set("top", f), u.requestRenderAll(), l()
},
onComplete: function() {
a.setCoords(), h()
}
})
},
fxRemove: function(a, o) {
o = o || {};
var c = function() {},
h = o.onComplete || c,
l = o.onChange || c,
u = this;
return e.util.animate({
target: this,
startValue: a.opacity,
endValue: 0,
duration: this.FX_DURATION,
onChange: function(f) {
a.set("opacity", f), u.requestRenderAll(), l()
},
onComplete: function() {
u.remove(a), h()
}
})
}
}), e.util.object.extend(e.Object.prototype, {
animate: function() {
if (arguments[0] && typeof arguments[0] == "object") {
var a = [],
o, c, h = [];
for (o in arguments[0]) a.push(o);
for (var l = 0, u = a.length; l < u; l++) o = a[l], c = l !== u - 1, h.push(this._animate(o, arguments[0][o], arguments[1], c));
return h
} else return this._animate.apply(this, arguments)
},
_animate: function(a, o, c, h) {
var l = this,
u;
o = o.toString(), c ? c = e.util.object.clone(c) : c = {}, ~a.indexOf(".") && (u = a.split("."));
var f = l.colorProperties.indexOf(a) > -1 || u && l.colorProperties.indexOf(u[1]) > -1,
p = u ? this.get(u[0])[u[1]] : this.get(a);
"from" in c || (c.from = p), f || (~o.indexOf("=") ? o = p + parseFloat(o.replace("=", "")) : o = parseFloat(o));
var m = {
target: this,
startValue: c.from,
endValue: o,
byValue: c.by,
easing: c.easing,
duration: c.duration,
abort: c.abort && function(g, v, y) {
return c.abort.call(l, g, v, y)
},
onChange: function(g, v, y) {
u ? l[u[0]][u[1]] = g : l.set(a, g), !h && c.onChange && c.onChange(g, v, y)
},
onComplete: function(g, v, y) {
h || (l.setCoords(), c.onComplete && c.onComplete(g, v, y))
}
};
return f ? e.util.animateColor(m.startValue, m.endValue, m.duration, m) : e.util.animate(m)
}
}),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.object.extend,
h = o.util.object.clone,
l = {
x1: 1,
x2: 1,
y1: 1,
y2: 1
};
if (o.Line) {
o.warn("fabric.Line is already defined");
return
}
o.Line = o.util.createClass(o.Object, {
type: "line",
x1: 0,
y1: 0,
x2: 0,
y2: 0,
cacheProperties: o.Object.prototype.cacheProperties.concat("x1", "x2", "y1", "y2"),
initialize: function(f, p) {
f || (f = [0, 0, 0, 0]), this.callSuper("initialize", p), this.set("x1", f[0]), this.set("y1", f[1]), this.set("x2", f[2]), this.set("y2", f[3]), this._setWidthHeight(p)
},
_setWidthHeight: function(f) {
f || (f = {}), this.width = Math.abs(this.x2 - this.x1), this.height = Math.abs(this.y2 - this.y1), this.left = "left" in f ? f.left : this._getLeftToOriginX(), this.top = "top" in f ? f.top : this._getTopToOriginY()
},
_set: function(f, p) {
return this.callSuper("_set", f, p), typeof l[f] < "u" && this._setWidthHeight(), this
},
_getLeftToOriginX: u({
origin: "originX",
axis1: "x1",
axis2: "x2",
dimension: "width"
}, {
nearest: "left",
center: "center",
farthest: "right"
}),
_getTopToOriginY: u({
origin: "originY",
axis1: "y1",
axis2: "y2",
dimension: "height"
}, {
nearest: "top",
center: "center",
farthest: "bottom"
}),
_render: function(f) {
f.beginPath();
var p = this.calcLinePoints();
f.moveTo(p.x1, p.y1), f.lineTo(p.x2, p.y2), f.lineWidth = this.strokeWidth;
var m = f.strokeStyle;
f.strokeStyle = this.stroke || f.fillStyle, this.stroke && this._renderStroke(f), f.strokeStyle = m
},
_findCenterFromElement: function() {
return {
x: (this.x1 + this.x2) / 2,
y: (this.y1 + this.y2) / 2
}
},
toObject: function(f) {
return c(this.callSuper("toObject", f), this.calcLinePoints())
},
_getNonTransformedDimensions: function() {
var f = this.callSuper("_getNonTransformedDimensions");
return this.strokeLineCap === "butt" && (this.width === 0 && (f.y -= this.strokeWidth), this.height === 0 && (f.x -= this.strokeWidth)), f
},
calcLinePoints: function() {
var f = this.x1 <= this.x2 ? -1 : 1,
p = this.y1 <= this.y2 ? -1 : 1,
m = f * this.width * .5,
g = p * this.height * .5,
v = f * this.width * -.5,
y = p * this.height * -.5;
return {
x1: m,
x2: v,
y1: g,
y2: y
}
},
_toSVG: function() {
var f = this.calcLinePoints();
return ["<line ", "COMMON_PARTS", 'x1="', f.x1, '" y1="', f.y1, '" x2="', f.x2, '" y2="', f.y2, `" />
`]
}
}), o.Line.ATTRIBUTE_NAMES = o.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")), o.Line.fromElement = function(f, p, m) {
m = m || {};
var g = o.parseAttributes(f, o.Line.ATTRIBUTE_NAMES),
v = [g.x1 || 0, g.y1 || 0, g.x2 || 0, g.y2 || 0];
p(new o.Line(v, c(g, m)))
}, o.Line.fromObject = function(f, p) {
function m(v) {
delete v.points, p && p(v)
}
var g = h(f, !0);
g.points = [f.x1, f.y1, f.x2, f.y2], o.Object._fromObject("Line", g, m, "points")
};
function u(f, p) {
var m = f.origin,
g = f.axis1,
v = f.axis2,
y = f.dimension,
b = p.nearest,
w = p.center,
x = p.farthest;
return function() {
switch (this.get(m)) {
case b:
return Math.min(this.get(g), this.get(v));
case w:
return Math.min(this.get(g), this.get(v)) + .5 * this.get(y);
case x:
return Math.max(this.get(g), this.get(v))
}
}
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.degreesToRadians;
if (o.Circle) {
o.warn("fabric.Circle is already defined.");
return
}
o.Circle = o.util.createClass(o.Object, {
type: "circle",
radius: 0,
startAngle: 0,
endAngle: 360,
cacheProperties: o.Object.prototype.cacheProperties.concat("radius", "startAngle", "endAngle"),
_set: function(l, u) {
return this.callSuper("_set", l, u), l === "radius" && this.setRadius(u), this
},
toObject: function(l) {
return this.callSuper("toObject", ["radius", "startAngle", "endAngle"].concat(l))
},
_toSVG: function() {
var l, u = 0,
f = 0,
p = (this.endAngle - this.startAngle) % 360;
if (p === 0) l = ["<circle ", "COMMON_PARTS", 'cx="' + u + '" cy="' + f + '" ', 'r="', this.radius, `" />
`];
else {
var m = c(this.startAngle),
g = c(this.endAngle),
v = this.radius,
y = o.util.cos(m) * v,
b = o.util.sin(m) * v,
w = o.util.cos(g) * v,
x = o.util.sin(g) * v,
S = p > 180 ? "1" : "0";
l = ['<path d="M ' + y + " " + b, " A " + v + " " + v, " 0 ", +S + " 1", " " + w + " " + x, '" ', "COMMON_PARTS", ` />
`]
}
return l
},
_render: function(l) {
l.beginPath(), l.arc(0, 0, this.radius, c(this.startAngle), c(this.endAngle), !1), this._renderPaintInOrder(l)
},
getRadiusX: function() {
return this.get("radius") * this.get("scaleX")
},
getRadiusY: function() {
return this.get("radius") * this.get("scaleY")
},
setRadius: function(l) {
return this.radius = l, this.set("width", l * 2).set("height", l * 2)
}
}), o.Circle.ATTRIBUTE_NAMES = o.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")), o.Circle.fromElement = function(l, u) {
var f = o.parseAttributes(l, o.Circle.ATTRIBUTE_NAMES);
if (!h(f)) throw new Error("value of `r` attribute is required and can not be negative");
f.left = (f.left || 0) - f.radius, f.top = (f.top || 0) - f.radius, u(new o.Circle(f))
};
function h(l) {
return "radius" in l && l.radius >= 0
}
o.Circle.fromObject = function(l, u) {
o.Object._fromObject("Circle", l, u)
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {});
if (o.Triangle) {
o.warn("fabric.Triangle is already defined");
return
}
o.Triangle = o.util.createClass(o.Object, {
type: "triangle",
width: 100,
height: 100,
_render: function(c) {
var h = this.width / 2,
l = this.height / 2;
c.beginPath(), c.moveTo(-h, l), c.lineTo(0, -l), c.lineTo(h, l), c.closePath(), this._renderPaintInOrder(c)
},
_toSVG: function() {
var c = this.width / 2,
h = this.height / 2,
l = [-c + " " + h, "0 " + -h, c + " " + h].join(",");
return ["<polygon ", "COMMON_PARTS", 'points="', l, '" />']
}
}), o.Triangle.fromObject = function(c, h) {
return o.Object._fromObject("Triangle", c, h)
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = Math.PI * 2;
if (o.Ellipse) {
o.warn("fabric.Ellipse is already defined.");
return
}
o.Ellipse = o.util.createClass(o.Object, {
type: "ellipse",
rx: 0,
ry: 0,
cacheProperties: o.Object.prototype.cacheProperties.concat("rx", "ry"),
initialize: function(h) {
this.callSuper("initialize", h), this.set("rx", h && h.rx || 0), this.set("ry", h && h.ry || 0)
},
_set: function(h, l) {
switch (this.callSuper("_set", h, l), h) {
case "rx":
this.rx = l, this.set("width", l * 2);
break;
case "ry":
this.ry = l, this.set("height", l * 2);
break
}
return this
},
getRx: function() {
return this.get("rx") * this.get("scaleX")
},
getRy: function() {
return this.get("ry") * this.get("scaleY")
},
toObject: function(h) {
return this.callSuper("toObject", ["rx", "ry"].concat(h))
},
_toSVG: function() {
return ["<ellipse ", "COMMON_PARTS", 'cx="0" cy="0" ', 'rx="', this.rx, '" ry="', this.ry, `" />
`]
},
_render: function(h) {
h.beginPath(), h.save(), h.transform(1, 0, 0, this.ry / this.rx, 0, 0), h.arc(0, 0, this.rx, 0, c, !1), h.restore(), this._renderPaintInOrder(h)
}
}), o.Ellipse.ATTRIBUTE_NAMES = o.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")), o.Ellipse.fromElement = function(h, l) {
var u = o.parseAttributes(h, o.Ellipse.ATTRIBUTE_NAMES);
u.left = (u.left || 0) - u.rx, u.top = (u.top || 0) - u.ry, l(new o.Ellipse(u))
}, o.Ellipse.fromObject = function(h, l) {
o.Object._fromObject("Ellipse", h, l)
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.object.extend;
if (o.Rect) {
o.warn("fabric.Rect is already defined");
return
}
o.Rect = o.util.createClass(o.Object, {
stateProperties: o.Object.prototype.stateProperties.concat("rx", "ry"),
type: "rect",
rx: 0,
ry: 0,
cacheProperties: o.Object.prototype.cacheProperties.concat("rx", "ry"),
initialize: function(h) {
this.callSuper("initialize", h), this._initRxRy()
},
_initRxRy: function() {
this.rx && !this.ry ? this.ry = this.rx : this.ry && !this.rx && (this.rx = this.ry)
},
_render: function(h) {
var l = this.rx ? Math.min(this.rx, this.width / 2) : 0,
u = this.ry ? Math.min(this.ry, this.height / 2) : 0,
f = this.width,
p = this.height,
m = -this.width / 2,
g = -this.height / 2,
v = l !== 0 || u !== 0,
y = 1 - .5522847498;
h.beginPath(), h.moveTo(m + l, g), h.lineTo(m + f - l, g), v && h.bezierCurveTo(m + f - y * l, g, m + f, g + y * u, m + f, g + u), h.lineTo(m + f, g + p - u), v && h.bezierCurveTo(m + f, g + p - y * u, m + f - y * l, g + p, m + f - l, g + p), h.lineTo(m + l, g + p), v && h.bezierCurveTo(m + y * l, g + p, m, g + p - y * u, m, g + p - u), h.lineTo(m, g + u), v && h.bezierCurveTo(m, g + y * u, m + y * l, g, m + l, g), h.closePath(), this._renderPaintInOrder(h)
},
toObject: function(h) {
return this.callSuper("toObject", ["rx", "ry"].concat(h))
},
_toSVG: function() {
var h = -this.width / 2,
l = -this.height / 2;
return ["<rect ", "COMMON_PARTS", 'x="', h, '" y="', l, '" rx="', this.rx, '" ry="', this.ry, '" width="', this.width, '" height="', this.height, `" />
`]
}
}), o.Rect.ATTRIBUTE_NAMES = o.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")), o.Rect.fromElement = function(h, l, u) {
if (!h) return l(null);
u = u || {};
var f = o.parseAttributes(h, o.Rect.ATTRIBUTE_NAMES);
f.left = f.left || 0, f.top = f.top || 0, f.height = f.height || 0, f.width = f.width || 0;
var p = new o.Rect(c(u ? o.util.object.clone(u) : {}, f));
p.visible = p.visible && p.width > 0 && p.height > 0, l(p)
}, o.Rect.fromObject = function(h, l) {
return o.Object._fromObject("Rect", h, l)
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.object.extend,
h = o.util.array.min,
l = o.util.array.max,
u = o.util.toFixed,
f = o.util.projectStrokeOnPoints;
if (o.Polyline) {
o.warn("fabric.Polyline is already defined");
return
}
o.Polyline = o.util.createClass(o.Object, {
type: "polyline",
points: null,
exactBoundingBox: !1,
cacheProperties: o.Object.prototype.cacheProperties.concat("points"),
initialize: function(p, m) {
m = m || {}, this.points = p || [], this.callSuper("initialize", m), this._setPositionDimensions(m)
},
_projectStrokeOnPoints: function() {
return f(this.points, this, !0)
},
_setPositionDimensions: function(p) {
var m = this._calcDimensions(p),
g, v = this.exactBoundingBox ? this.strokeWidth : 0;
this.width = m.width - v, this.height = m.height - v, p.fromSVG || (g = this.translateToGivenOrigin({
x: m.left - this.strokeWidth / 2 + v / 2,
y: m.top - this.strokeWidth / 2 + v / 2
}, "left", "top", this.originX, this.originY)), typeof p.left > "u" && (this.left = p.fromSVG ? m.left : g.x), typeof p.top > "u" && (this.top = p.fromSVG ? m.top : g.y), this.pathOffset = {
x: m.left + this.width / 2 + v / 2,
y: m.top + this.height / 2 + v / 2
}
},
_calcDimensions: function() {
var p = this.exactBoundingBox ? this._projectStrokeOnPoints() : this.points,
m = h(p, "x") || 0,
g = h(p, "y") || 0,
v = l(p, "x") || 0,
y = l(p, "y") || 0,
b = v - m,
w = y - g;
return {
left: m,
top: g,
width: b,
height: w
}
},
toObject: function(p) {
return c(this.callSuper("toObject", p), {
points: this.points.concat()
})
},
_toSVG: function() {
for (var p = [], m = this.pathOffset.x, g = this.pathOffset.y, v = o.Object.NUM_FRACTION_DIGITS, y = 0, b = this.points.length; y < b; y++) p.push(u(this.points[y].x - m, v), ",", u(this.points[y].y - g, v), " ");
return ["<" + this.type + " ", "COMMON_PARTS", 'points="', p.join(""), `" />
`]
},
commonRender: function(p) {
var m, g = this.points.length,
v = this.pathOffset.x,
y = this.pathOffset.y;
if (!g || isNaN(this.points[g - 1].y)) return !1;
p.beginPath(), p.moveTo(this.points[0].x - v, this.points[0].y - y);
for (var b = 0; b < g; b++) m = this.points[b], p.lineTo(m.x - v, m.y - y);
return !0
},
_render: function(p) {
!this.commonRender(p) || this._renderPaintInOrder(p)
},
complexity: function() {
return this.get("points").length
}
}), o.Polyline.ATTRIBUTE_NAMES = o.SHARED_ATTRIBUTES.concat(), o.Polyline.fromElementGenerator = function(p) {
return function(m, g, v) {
if (!m) return g(null);
v || (v = {});
var y = o.parsePointsAttribute(m.getAttribute("points")),
b = o.parseAttributes(m, o[p].ATTRIBUTE_NAMES);
b.fromSVG = !0, g(new o[p](y, c(b, v)))
}
}, o.Polyline.fromElement = o.Polyline.fromElementGenerator("Polyline"), o.Polyline.fromObject = function(p, m) {
return o.Object._fromObject("Polyline", p, m, "points")
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.projectStrokeOnPoints;
if (o.Polygon) {
o.warn("fabric.Polygon is already defined");
return
}
o.Polygon = o.util.createClass(o.Polyline, {
type: "polygon",
_projectStrokeOnPoints: function() {
return c(this.points, this)
},
_render: function(h) {
!this.commonRender(h) || (h.closePath(), this._renderPaintInOrder(h))
}
}), o.Polygon.ATTRIBUTE_NAMES = o.SHARED_ATTRIBUTES.concat(), o.Polygon.fromElement = o.Polyline.fromElementGenerator("Polygon"), o.Polygon.fromObject = function(h, l) {
o.Object._fromObject("Polygon", h, l, "points")
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.array.min,
h = o.util.array.max,
l = o.util.object.extend,
u = o.util.object.clone,
f = o.util.toFixed;
if (o.Path) {
o.warn("fabric.Path is already defined");
return
}
o.Path = o.util.createClass(o.Object, {
type: "path",
path: null,
cacheProperties: o.Object.prototype.cacheProperties.concat("path", "fillRule"),
stateProperties: o.Object.prototype.stateProperties.concat("path"),
initialize: function(p, m) {
m = u(m || {}), delete m.path, this.callSuper("initialize", m), this._setPath(p || [], m)
},
_setPath: function(p, m) {
this.path = o.util.makePathSimpler(Array.isArray(p) ? p : o.util.parsePath(p)), o.Polyline.prototype._setPositionDimensions.call(this, m || {})
},
_renderPathCommands: function(p) {
var m, g = 0,
v = 0,
y = 0,
b = 0,
w = 0,
x = 0,
S = -this.pathOffset.x,
T = -this.pathOffset.y;
p.beginPath();
for (var P = 0, I = this.path.length; P < I; ++P) switch (m = this.path[P], m[0]) {
case "L":
y = m[1], b = m[2], p.lineTo(y + S, b + T);
break;
case "M":
y = m[1], b = m[2], g = y, v = b, p.moveTo(y + S, b + T);
break;
case "C":
y = m[5], b = m[6], w = m[3], x = m[4], p.bezierCurveTo(m[1] + S, m[2] + T, w + S, x + T, y + S, b + T);
break;
case "Q":
p.quadraticCurveTo(m[1] + S, m[2] + T, m[3] + S, m[4] + T), y = m[3], b = m[4], w = m[1], x = m[2];
break;
case "z":
case "Z":
y = g, b = v, p.closePath();
break
}
},
_render: function(p) {
this._renderPathCommands(p), this._renderPaintInOrder(p)
},
toString: function() {
return "#<fabric.Path (" + this.complexity() + '): { "top": ' + this.top + ', "left": ' + this.left + " }>"
},
toObject: function(p) {
return l(this.callSuper("toObject", p), {
path: this.path.map(function(m) {
return m.slice()
})
})
},
toDatalessObject: function(p) {
var m = this.toObject(["sourcePath"].concat(p));
return m.sourcePath && delete m.path, m
},
_toSVG: function() {
var p = o.util.joinPath(this.path);
return ["<path ", "COMMON_PARTS", 'd="', p, '" stroke-linecap="round" ', `/>
`]
},
_getOffsetTransform: function() {
var p = o.Object.NUM_FRACTION_DIGITS;
return " translate(" + f(-this.pathOffset.x, p) + ", " + f(-this.pathOffset.y, p) + ")"
},
toClipPathSVG: function(p) {
var m = this._getOffsetTransform();
return " " + this._createBaseClipPathSVGMarkup(this._toSVG(), {
reviver: p,
additionalTransform: m
})
},
toSVG: function(p) {
var m = this._getOffsetTransform();
return this._createBaseSVGMarkup(this._toSVG(), {
reviver: p,
additionalTransform: m
})
},
complexity: function() {
return this.path.length
},
_calcDimensions: function() {
for (var p = [], m = [], g, v = 0, y = 0, b = 0, w = 0, x, S = 0, T = this.path.length; S < T; ++S) {
switch (g = this.path[S], g[0]) {
case "L":
b = g[1], w = g[2], x = [];
break;
case "M":
b = g[1], w = g[2], v = b, y = w, x = [];
break;
case "C":
x = o.util.getBoundsOfCurve(b, w, g[1], g[2], g[3], g[4], g[5], g[6]), b = g[5], w = g[6];
break;
case "Q":
x = o.util.getBoundsOfCurve(b, w, g[1], g[2], g[1], g[2], g[3], g[4]), b = g[3], w = g[4];
break;
case "z":
case "Z":
b = v, w = y;
break
}
x.forEach(function(ne) {
p.push(ne.x), m.push(ne.y)
}), p.push(b), m.push(w)
}
var P = c(p) || 0,
I = c(m) || 0,
z = h(p) || 0,
H = h(m) || 0,
ee = z - P,
te = H - I;
return {
left: P,
top: I,
width: ee,
height: te
}
}
}), o.Path.fromObject = function(p, m) {
if (typeof p.sourcePath == "string") {
var g = p.sourcePath;
o.loadSVGFromURL(g, function(v) {
var y = v[0];
y.setOptions(p), p.clipPath ? o.util.enlivenObjects([p.clipPath], function(b) {
y.clipPath = b[0], m && m(y)
}) : m && m(y)
})
} else o.Object._fromObject("Path", p, m, "path")
}, o.Path.ATTRIBUTE_NAMES = o.SHARED_ATTRIBUTES.concat(["d"]), o.Path.fromElement = function(p, m, g) {
var v = o.parseAttributes(p, o.Path.ATTRIBUTE_NAMES);
v.fromSVG = !0, m(new o.Path(v.d, l(v, g)))
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.array.min,
h = o.util.array.max;
o.Group || (o.Group = o.util.createClass(o.Object, o.Collection, {
type: "group",
strokeWidth: 0,
subTargetCheck: !1,
cacheProperties: [],
useSetOnGroup: !1,
initialize: function(l, u, f) {
u = u || {}, this._objects = [], f && this.callSuper("initialize", u), this._objects = l || [];
for (var p = this._objects.length; p--;) this._objects[p].group = this;
if (f) this._updateObjectsACoords();
else {
var m = u && u.centerPoint;
u.originX !== void 0 && (this.originX = u.originX), u.originY !== void 0 && (this.originY = u.originY), m || this._calcBounds(), this._updateObjectsCoords(m), delete u.centerPoint, this.callSuper("initialize", u)
}
this.setCoords()
},
_updateObjectsACoords: function() {
for (var l = !0, u = this._objects.length; u--;) this._objects[u].setCoords(l)
},
_updateObjectsCoords: function(u) {
for (var u = u || this.getCenterPoint(), f = this._objects.length; f--;) this._updateObjectCoords(this._objects[f], u)
},
_updateObjectCoords: function(l, u) {
var f = l.left,
p = l.top,
m = !0;
l.set({
left: f - u.x,
top: p - u.y
}), l.group = this, l.setCoords(m)
},
toString: function() {
return "#<fabric.Group: (" + this.complexity() + ")>"
},
addWithUpdate: function(l) {
var u = !!this.group;
return this._restoreObjectsState(), o.util.resetObjectTransform(this), l && (u && o.util.removeTransformFromObject(l, this.group.calcTransformMatrix()), this._objects.push(l), l.group = this, l._set("canvas", this.canvas)), this._calcBounds(), this._updateObjectsCoords(), this.dirty = !0, u ? this.group.addWithUpdate() : this.setCoords(), this
},
removeWithUpdate: function(l) {
return this._restoreObjectsState(), o.util.resetObjectTransform(this), this.remove(l), this._calcBounds(), this._updateObjectsCoords(), this.setCoords(), this.dirty = !0, this
},
_onObjectAdded: function(l) {
this.dirty = !0, l.group = this, l._set("canvas", this.canvas)
},
_onObjectRemoved: function(l) {
this.dirty = !0, delete l.group
},
_set: function(l, u) {
var f = this._objects.length;
if (this.useSetOnGroup)
for (; f--;) this._objects[f].setOnGroup(l, u);
if (l === "canvas")
for (; f--;) this._objects[f]._set(l, u);
o.Object.prototype._set.call(this, l, u)
},
toObject: function(l) {
var u = this.includeDefaultValues,
f = this._objects.filter(function(m) {
return !m.excludeFromExport
}).map(function(m) {
var g = m.includeDefaultValues;
m.includeDefaultValues = u;
var v = m.toObject(l);
return m.includeDefaultValues = g, v
}),
p = o.Object.prototype.toObject.call(this, l);
return p.objects = f, p
},
toDatalessObject: function(l) {
var u, f = this.sourcePath;
if (f) u = f;
else {
var p = this.includeDefaultValues;
u = this._objects.map(function(g) {
var v = g.includeDefaultValues;
g.includeDefaultValues = p;
var y = g.toDatalessObject(l);
return g.includeDefaultValues = v, y
})
}
var m = o.Object.prototype.toDatalessObject.call(this, l);
return m.objects = u, m
},
render: function(l) {
this._transformDone = !0, this.callSuper("render", l), this._transformDone = !1
},
shouldCache: function() {
var l = o.Object.prototype.shouldCache.call(this);
if (l) {
for (var u = 0, f = this._objects.length; u < f; u++)
if (this._objects[u].willDrawShadow()) return this.ownCaching = !1, !1
}
return l
},
willDrawShadow: function() {
if (o.Object.prototype.willDrawShadow.call(this)) return !0;
for (var l = 0, u = this._objects.length; l < u; l++)
if (this._objects[l].willDrawShadow()) return !0;
return !1
},
isOnACache: function() {
return this.ownCaching || this.group && this.group.isOnACache()
},
drawObject: function(l) {
for (var u = 0, f = this._objects.length; u < f; u++) this._objects[u].render(l);
this._drawClipPath(l, this.clipPath)
},
isCacheDirty: function(l) {
if (this.callSuper("isCacheDirty", l)) return !0;
if (!this.statefullCache) return !1;
for (var u = 0, f = this._objects.length; u < f; u++)
if (this._objects[u].isCacheDirty(!0)) {
if (this._cacheCanvas) {
var p = this.cacheWidth / this.zoomX,
m = this.cacheHeight / this.zoomY;
this._cacheContext.clearRect(-p / 2, -m / 2, p, m)
}
return !0
} return !1
},
_restoreObjectsState: function() {
var l = this.calcOwnMatrix();
return this._objects.forEach(function(u) {
o.util.addTransformToObject(u, l), delete u.group, u.setCoords()
}), this
},
destroy: function() {
return this._objects.forEach(function(l) {
l.set("dirty", !0)
}), this._restoreObjectsState()
},
dispose: function() {
this.callSuper("dispose"), this.forEachObject(function(l) {
l.dispose && l.dispose()
}), this._objects = []
},
toActiveSelection: function() {
if (!!this.canvas) {
var l = this._objects,
u = this.canvas;
this._objects = [];
var f = this.toObject();
delete f.objects;
var p = new o.ActiveSelection([]);
return p.set(f), p.type = "activeSelection", u.remove(this), l.forEach(function(m) {
m.group = p, m.dirty = !0, u.add(m)
}), p.canvas = u, p._objects = l, u._activeObject = p, p.setCoords(), p
}
},
ungroupOnCanvas: function() {
return this._restoreObjectsState()
},
setObjectsCoords: function() {
var l = !0;
return this.forEachObject(function(u) {
u.setCoords(l)
}), this
},
_calcBounds: function(l) {
for (var u = [], f = [], p, m, g, v = ["tr", "br", "bl", "tl"], y = 0, b = this._objects.length, w, x = v.length; y < b; ++y) {
for (p = this._objects[y], g = p.calcACoords(), w = 0; w < x; w++) m = v[w], u.push(g[m].x), f.push(g[m].y);
p.aCoords = g
}
this._getBounds(u, f, l)
},
_getBounds: function(l, u, f) {
var p = new o.Point(c(l), c(u)),
m = new o.Point(h(l), h(u)),
g = p.y || 0,
v = p.x || 0,
y = m.x - p.x || 0,
b = m.y - p.y || 0;
this.width = y, this.height = b, f || this.setPositionByOrigin({
x: v,
y: g
}, "left", "top")
},
_toSVG: function(l) {
for (var u = ["<g ", "COMMON_PARTS", ` >
`], f = 0, p = this._objects.length; f < p; f++) u.push(" ", this._objects[f].toSVG(l));
return u.push(`</g>
`), u
},
getSvgStyles: function() {
var l = typeof this.opacity < "u" && this.opacity !== 1 ? "opacity: " + this.opacity + ";" : "",
u = this.visible ? "" : " visibility: hidden;";
return [l, this.getSvgFilter(), u].join("")
},
toClipPathSVG: function(l) {
for (var u = [], f = 0, p = this._objects.length; f < p; f++) u.push(" ", this._objects[f].toClipPathSVG(l));
return this._createBaseClipPathSVGMarkup(u, {
reviver: l
})
}
}), o.Group.fromObject = function(l, u) {
var f = l.objects,
p = o.util.object.clone(l, !0);
if (delete p.objects, typeof f == "string") {
o.loadSVGFromURL(f, function(m) {
var g = o.util.groupSVGElements(m, l, f),
v = p.clipPath;
delete p.clipPath, g.set(p), v ? o.util.enlivenObjects([v], function(y) {
g.clipPath = y[0], u && u(g)
}) : u && u(g)
});
return
}
o.util.enlivenObjects(f, function(m) {
o.util.enlivenObjectEnlivables(l, p, function() {
u && u(new o.Group(m, p, !0))
})
})
})
}(t),
function(a) {
var o = a.fabric || (a.fabric = {});
o.ActiveSelection || (o.ActiveSelection = o.util.createClass(o.Group, {
type: "activeSelection",
initialize: function(c, h) {
h = h || {}, this._objects = c || [];
for (var l = this._objects.length; l--;) this._objects[l].group = this;
h.originX && (this.originX = h.originX), h.originY && (this.originY = h.originY), this._calcBounds(), this._updateObjectsCoords(), o.Object.prototype.initialize.call(this, h), this.setCoords()
},
toGroup: function() {
var c = this._objects.concat();
this._objects = [];
var h = o.Object.prototype.toObject.call(this),
l = new o.Group([]);
if (delete h.type, l.set(h), c.forEach(function(f) {
f.canvas.remove(f), f.group = l
}), l._objects = c, !this.canvas) return l;
var u = this.canvas;
return u.add(l), u._activeObject = l, l.setCoords(), l
},
onDeselect: function() {
return this.destroy(), !1
},
toString: function() {
return "#<fabric.ActiveSelection: (" + this.complexity() + ")>"
},
shouldCache: function() {
return !1
},
isOnACache: function() {
return !1
},
_renderControls: function(c, h, l) {
c.save(), c.globalAlpha = this.isMoving ? this.borderOpacityWhenMoving : 1, this.callSuper("_renderControls", c, h), l = l || {}, typeof l.hasControls > "u" && (l.hasControls = !1), l.forActiveSelection = !0;
for (var u = 0, f = this._objects.length; u < f; u++) this._objects[u]._renderControls(c, l);
c.restore()
}
}), o.ActiveSelection.fromObject = function(c, h) {
o.util.enlivenObjects(c.objects, function(l) {
delete c.objects, h && h(new o.ActiveSelection(l, c, !0))
})
})
}(t),
function(a) {
var o = e.util.object.extend;
if (a.fabric || (a.fabric = {}), a.fabric.Image) {
e.warn("fabric.Image is already defined.");
return
}
e.Image = e.util.createClass(e.Object, {
type: "image",
strokeWidth: 0,
srcFromAttribute: !1,
_lastScaleX: 1,
_lastScaleY: 1,
_filterScalingX: 1,
_filterScalingY: 1,
minimumScaleTrigger: .5,
stateProperties: e.Object.prototype.stateProperties.concat("cropX", "cropY"),
cacheProperties: e.Object.prototype.cacheProperties.concat("cropX", "cropY"),
cacheKey: "",
cropX: 0,
cropY: 0,
imageSmoothing: !0,
initialize: function(c, h) {
h || (h = {}), this.filters = [], this.cacheKey = "texture" + e.Object.__uid++, this.callSuper("initialize", h), this._initElement(c, h)
},
getElement: function() {
return this._element || {}
},
setElement: function(c, h) {
return this.removeTexture(this.cacheKey), this.removeTexture(this.cacheKey + "_filtered"), this._element = c, this._originalElement = c, this._initConfig(h), this.filters.length !== 0 && this.applyFilters(), this.resizeFilter && this.applyResizeFilters(), this
},
removeTexture: function(c) {
var h = e.filterBackend;
h && h.evictCachesForKey && h.evictCachesForKey(c)
},
dispose: function() {
this.callSuper("dispose"), this.removeTexture(this.cacheKey), this.removeTexture(this.cacheKey + "_filtered"), this._cacheContext = void 0, ["_originalElement", "_element", "_filteredEl", "_cacheCanvas"].forEach(function(c) {
e.util.cleanUpJsdomNode(this[c]), this[c] = void 0
}.bind(this))
},
getCrossOrigin: function() {
return this._originalElement && (this._originalElement.crossOrigin || null)
},
getOriginalSize: function() {
var c = this.getElement();
return {
width: c.naturalWidth || c.width,
height: c.naturalHeight || c.height
}
},
_stroke: function(c) {
if (!(!this.stroke || this.strokeWidth === 0)) {
var h = this.width / 2,
l = this.height / 2;
c.beginPath(), c.moveTo(-h, -l), c.lineTo(h, -l), c.lineTo(h, l), c.lineTo(-h, l), c.lineTo(-h, -l), c.closePath()
}
},
toObject: function(c) {
var h = [];
this.filters.forEach(function(u) {
u && h.push(u.toObject())
});
var l = o(this.callSuper("toObject", ["cropX", "cropY"].concat(c)), {
src: this.getSrc(),
crossOrigin: this.getCrossOrigin(),
filters: h
});
return this.resizeFilter && (l.resizeFilter = this.resizeFilter.toObject()), l
},
hasCrop: function() {
return this.cropX || this.cropY || this.width < this._element.width || this.height < this._element.height
},
_toSVG: function() {
var c = [],
h = [],
l, u = this._element,
f = -this.width / 2,
p = -this.height / 2,
m = "",
g = "";
if (!u) return [];
if (this.hasCrop()) {
var v = e.Object.__uid++;
c.push('<clipPath id="imageCrop_' + v + `">
`, ' <rect x="' + f + '" y="' + p + '" width="' + this.width + '" height="' + this.height + `" />
`, `</clipPath>
`), m = ' clip-path="url(#imageCrop_' + v + ')" '
}
if (this.imageSmoothing || (g = '" image-rendering="optimizeSpeed'), h.push(" <image ", "COMMON_PARTS", 'xlink:href="', this.getSvgSrc(!0), '" x="', f - this.cropX, '" y="', p - this.cropY, '" width="', u.width || u.naturalWidth, '" height="', u.height || u.height, g, '"', m, `></image>
`), this.stroke || this.strokeDashArray) {
var y = this.fill;
this.fill = null, l = [" <rect ", 'x="', f, '" y="', p, '" width="', this.width, '" height="', this.height, '" style="', this.getSvgStyles(), `"/>
`], this.fill = y
}
return this.paintFirst !== "fill" ? c = c.concat(l, h) : c = c.concat(h, l), c
},
getSrc: function(c) {
var h = c ? this._element : this._originalElement;
return h ? h.toDataURL ? h.toDataURL() : this.srcFromAttribute ? h.getAttribute("src") : h.src : this.src || ""
},
setSrc: function(c, h, l) {
return e.util.loadImage(c, function(u, f) {
this.setElement(u, l), this._setWidthHeight(), h && h(this, f)
}, this, l && l.crossOrigin), this
},
toString: function() {
return '#<fabric.Image: { src: "' + this.getSrc() + '" }>'
},
applyResizeFilters: function() {
var c = this.resizeFilter,
h = this.minimumScaleTrigger,
l = this.getTotalObjectScaling(),
u = l.scaleX,
f = l.scaleY,
p = this._filteredEl || this._originalElement;
if (this.group && this.set("dirty", !0), !c || u > h && f > h) {
this._element = p, this._filterScalingX = 1, this._filterScalingY = 1, this._lastScaleX = u, this._lastScaleY = f;
return
}
e.filterBackend || (e.filterBackend = e.initFilterBackend());
var m = e.util.createCanvasElement(),
g = this._filteredEl ? this.cacheKey + "_filtered" : this.cacheKey,
v = p.width,
y = p.height;
m.width = v, m.height = y, this._element = m, this._lastScaleX = c.scaleX = u, this._lastScaleY = c.scaleY = f, e.filterBackend.applyFilters([c], p, v, y, this._element, g), this._filterScalingX = m.width / this._originalElement.width, this._filterScalingY = m.height / this._originalElement.height
},
applyFilters: function(c) {
if (c = c || this.filters || [], c = c.filter(function(p) {
return p && !p.isNeutralState()
}), this.set("dirty", !0), this.removeTexture(this.cacheKey + "_filtered"), c.length === 0) return this._element = this._originalElement, this._filteredEl = null, this._filterScalingX = 1, this._filterScalingY = 1, this;
var h = this._originalElement,
l = h.naturalWidth || h.width,
u = h.naturalHeight || h.height;
if (this._element === this._originalElement) {
var f = e.util.createCanvasElement();
f.width = l, f.height = u, this._element = f, this._filteredEl = f
} else this._element = this._filteredEl, this._filteredEl.getContext("2d").clearRect(0, 0, l, u), this._lastScaleX = 1, this._lastScaleY = 1;
return e.filterBackend || (e.filterBackend = e.initFilterBackend()), e.filterBackend.applyFilters(c, this._originalElement, l, u, this._element, this.cacheKey), (this._originalElement.width !== this._element.width || this._originalElement.height !== this._element.height) && (this._filterScalingX = this._element.width / this._originalElement.width, this._filterScalingY = this._element.height / this._originalElement.height), this
},
_render: function(c) {
e.util.setImageSmoothing(c, this.imageSmoothing), this.isMoving !== !0 && this.resizeFilter && this._needsResize() && this.applyResizeFilters(), this._stroke(c), this._renderPaintInOrder(c)
},
drawCacheOnCanvas: function(c) {
e.util.setImageSmoothing(c, this.imageSmoothing), e.Object.prototype.drawCacheOnCanvas.call(this, c)
},
shouldCache: function() {
return this.needsItsOwnCache()
},
_renderFill: function(c) {
var h = this._element;
if (!!h) {
var l = this._filterScalingX,
u = this._filterScalingY,
f = this.width,
p = this.height,
m = Math.min,
g = Math.max,
v = g(this.cropX, 0),
y = g(this.cropY, 0),
b = h.naturalWidth || h.width,
w = h.naturalHeight || h.height,
x = v * l,
S = y * u,
T = m(f * l, b - x),
P = m(p * u, w - S),
I = -f / 2,
z = -p / 2,
H = m(f, b / l - v),
ee = m(p, w / u - y);
h && c.drawImage(h, x, S, T, P, I, z, H, ee)
}
},
_needsResize: function() {
var c = this.getTotalObjectScaling();
return c.scaleX !== this._lastScaleX || c.scaleY !== this._lastScaleY
},
_resetWidthHeight: function() {
this.set(this.getOriginalSize())
},
_initElement: function(c, h) {
this.setElement(e.util.getById(c), h), e.util.addClass(this.getElement(), e.Image.CSS_CANVAS)
},
_initConfig: function(c) {
c || (c = {}), this.setOptions(c), this._setWidthHeight(c)
},
_initFilters: function(c, h) {
c && c.length ? e.util.enlivenObjects(c, function(l) {
h && h(l)
}, "fabric.Image.filters") : h && h()
},
_setWidthHeight: function(c) {
c || (c = {});
var h = this.getElement();
this.width = c.width || h.naturalWidth || h.width || 0, this.height = c.height || h.naturalHeight || h.height || 0
},
parsePreserveAspectRatioAttribute: function() {
var c = e.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio || ""),
h = this._element.width,
l = this._element.height,
u = 1,
f = 1,
p = 0,
m = 0,
g = 0,
v = 0,
y, b = this.width,
w = this.height,
x = {
width: b,
height: w
};
return c && (c.alignX !== "none" || c.alignY !== "none") ? (c.meetOrSlice === "meet" && (u = f = e.util.findScaleToFit(this._element, x), y = (b - h * u) / 2, c.alignX === "Min" && (p = -y), c.alignX === "Max" && (p = y), y = (w - l * f) / 2, c.alignY === "Min" && (m = -y), c.alignY === "Max" && (m = y)), c.meetOrSlice === "slice" && (u = f = e.util.findScaleToCover(this._element, x), y = h - b / u, c.alignX === "Mid" && (g = y / 2), c.alignX === "Max" && (g = y), y = l - w / f, c.alignY === "Mid" && (v = y / 2), c.alignY === "Max" && (v = y), h = b / u, l = w / f)) : (u = b / h, f = w / l), {
width: h,
height: l,
scaleX: u,
scaleY: f,
offsetLeft: p,
offsetTop: m,
cropX: g,
cropY: v
}
}
}), e.Image.CSS_CANVAS = "canvas-img", e.Image.prototype.getSvgSrc = e.Image.prototype.getSrc, e.Image.fromObject = function(c, h) {
var l = e.util.object.clone(c);
e.util.loadImage(l.src, function(u, f) {
if (f) {
h && h(null, !0);
return
}
e.Image.prototype._initFilters.call(l, l.filters, function(p) {
l.filters = p || [], e.Image.prototype._initFilters.call(l, [l.resizeFilter], function(m) {
l.resizeFilter = m[0], e.util.enlivenObjectEnlivables(l, l, function() {
var g = new e.Image(u, l);
h(g, !1)
})
})
})
}, null, l.crossOrigin)
}, e.Image.fromURL = function(c, h, l) {
e.util.loadImage(c, function(u, f) {
h && h(new e.Image(u, l), f)
}, null, l && l.crossOrigin)
}, e.Image.ATTRIBUTE_NAMES = e.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ")), e.Image.fromElement = function(c, h, l) {
var u = e.parseAttributes(c, e.Image.ATTRIBUTE_NAMES);
e.Image.fromURL(u["xlink:href"], h, o(l ? e.util.object.clone(l) : {}, u))
}
}(t), e.util.object.extend(e.Object.prototype, {
_getAngleValueForStraighten: function() {
var a = this.angle % 360;
return a > 0 ? Math.round((a - 1) / 90) * 90 : Math.round(a / 90) * 90
},
straighten: function() {
return this.rotate(this._getAngleValueForStraighten())
},
fxStraighten: function(a) {
a = a || {};
var o = function() {},
c = a.onComplete || o,
h = a.onChange || o,
l = this;
return e.util.animate({
target: this,
startValue: this.get("angle"),
endValue: this._getAngleValueForStraighten(),
duration: this.FX_DURATION,
onChange: function(u) {
l.rotate(u), h()
},
onComplete: function() {
l.setCoords(), c()
}
})
}
}), e.util.object.extend(e.StaticCanvas.prototype, {
straightenObject: function(a) {
return a.straighten(), this.requestRenderAll(), this
},
fxStraightenObject: function(a) {
return a.fxStraighten({
onChange: this.requestRenderAllBound
})
}
}),
function() {
function a(c, h) {
var l = "precision " + h + ` float;
void main(){}`,
u = c.createShader(c.FRAGMENT_SHADER);
return c.shaderSource(u, l), c.compileShader(u), !!c.getShaderParameter(u, c.COMPILE_STATUS)
}
e.isWebglSupported = function(c) {
if (e.isLikelyNode) return !1;
c = c || e.WebglFilterBackend.prototype.tileSize;
var h = document.createElement("canvas"),
l = h.getContext("webgl") || h.getContext("experimental-webgl"),
u = !1;
if (l) {
e.maxTextureSize = l.getParameter(l.MAX_TEXTURE_SIZE), u = e.maxTextureSize >= c;
for (var f = ["highp", "mediump", "lowp"], p = 0; p < 3; p++)
if (a(l, f[p])) {
e.webGlPrecision = f[p];
break
}
}
return this.isSupported = u, u
}, e.WebglFilterBackend = o;
function o(c) {
c && c.tileSize && (this.tileSize = c.tileSize), this.setupGLContext(this.tileSize, this.tileSize), this.captureGPUInfo()
}
o.prototype = {
tileSize: 2048,
resources: {},
setupGLContext: function(c, h) {
this.dispose(), this.createWebGLCanvas(c, h), this.aPosition = new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]), this.chooseFastestCopyGLTo2DMethod(c, h)
},
chooseFastestCopyGLTo2DMethod: function(c, h) {
var l = typeof window.performance < "u",
u;
try {
new ImageData(1, 1), u = !0
} catch {
u = !1
}
var f = typeof ArrayBuffer < "u",
p = typeof Uint8ClampedArray < "u";
if (!!(l && u && f && p)) {
var m = e.util.createCanvasElement(),
g = new ArrayBuffer(c * h * 4);
if (e.forceGLPutImageData) {
this.imageBuffer = g, this.copyGLTo2D = d;
return
}
var v = {
imageBuffer: g,
destinationWidth: c,
destinationHeight: h,
targetCanvas: m
},
y, b, w;
m.width = c, m.height = h, y = window.performance.now(), s.call(v, this.gl, v), b = window.performance.now() - y, y = window.performance.now(), d.call(v, this.gl, v), w = window.performance.now() - y, b > w ? (this.imageBuffer = g, this.copyGLTo2D = d) : this.copyGLTo2D = s
}
},
createWebGLCanvas: function(c, h) {
var l = e.util.createCanvasElement();
l.width = c, l.height = h;
var u = {
alpha: !0,
premultipliedAlpha: !1,
depth: !1,
stencil: !1,
antialias: !1
},
f = l.getContext("webgl", u);
f || (f = l.getContext("experimental-webgl", u)), f && (f.clearColor(0, 0, 0, 0), this.canvas = l, this.gl = f)
},
applyFilters: function(c, h, l, u, f, p) {
var m = this.gl,
g;
p && (g = this.getCachedTexture(p, h));
var v = {
originalWidth: h.width || h.originalWidth,
originalHeight: h.height || h.originalHeight,
sourceWidth: l,
sourceHeight: u,
destinationWidth: l,
destinationHeight: u,
context: m,
sourceTexture: this.createTexture(m, l, u, !g && h),
targetTexture: this.createTexture(m, l, u),
originalTexture: g || this.createTexture(m, l, u, !g && h),
passes: c.length,
webgl: !0,
aPosition: this.aPosition,
programCache: this.programCache,
pass: 0,
filterBackend: this,
targetCanvas: f
},
y = m.createFramebuffer();
return m.bindFramebuffer(m.FRAMEBUFFER, y), c.forEach(function(b) {
b && b.applyTo(v)
}), i(v), this.copyGLTo2D(m, v), m.bindTexture(m.TEXTURE_2D, null), m.deleteTexture(v.sourceTexture), m.deleteTexture(v.targetTexture), m.deleteFramebuffer(y), f.getContext("2d").setTransform(1, 0, 0, 1, 0, 0), v
},
dispose: function() {
this.canvas && (this.canvas = null, this.gl = null), this.clearWebGLCaches()
},
clearWebGLCaches: function() {
this.programCache = {}, this.textureCache = {}
},
createTexture: function(c, h, l, u) {
var f = c.createTexture();
return c.bindTexture(c.TEXTURE_2D, f), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_MAG_FILTER, c.NEAREST), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_MIN_FILTER, c.NEAREST), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_WRAP_S, c.CLAMP_TO_EDGE), c.texParameteri(c.TEXTURE_2D, c.TEXTURE_WRAP_T, c.CLAMP_TO_EDGE), u ? c.texImage2D(c.TEXTURE_2D, 0, c.RGBA, c.RGBA, c.UNSIGNED_BYTE, u) : c.texImage2D(c.TEXTURE_2D, 0, c.RGBA, h, l, 0, c.RGBA, c.UNSIGNED_BYTE, null), f
},
getCachedTexture: function(c, h) {
if (this.textureCache[c]) return this.textureCache[c];
var l = this.createTexture(this.gl, h.width, h.height, h);
return this.textureCache[c] = l, l
},
evictCachesForKey: function(c) {
this.textureCache[c] && (this.gl.deleteTexture(this.textureCache[c]), delete this.textureCache[c])
},
copyGLTo2D: s,
captureGPUInfo: function() {
if (this.gpuInfo) return this.gpuInfo;
var c = this.gl,
h = {
renderer: "",
vendor: ""
};
if (!c) return h;
var l = c.getExtension("WEBGL_debug_renderer_info");
if (l) {
var u = c.getParameter(l.UNMASKED_RENDERER_WEBGL),
f = c.getParameter(l.UNMASKED_VENDOR_WEBGL);
u && (h.renderer = u.toLowerCase()), f && (h.vendor = f.toLowerCase())
}
return this.gpuInfo = h, h
}
}
}();
function i(a) {
var o = a.targetCanvas,
c = o.width,
h = o.height,
l = a.destinationWidth,
u = a.destinationHeight;
(c !== l || h !== u) && (o.width = l, o.height = u)
}
function s(a, o) {
var c = a.canvas,
h = o.targetCanvas,
l = h.getContext("2d");
l.translate(0, h.height), l.scale(1, -1);
var u = c.height - h.height;
l.drawImage(c, 0, u, h.width, h.height, 0, 0, h.width, h.height)
}
function d(a, o) {
var c = o.targetCanvas,
h = c.getContext("2d"),
l = o.destinationWidth,
u = o.destinationHeight,
f = l * u * 4,
p = new Uint8Array(this.imageBuffer, 0, f),
m = new Uint8ClampedArray(this.imageBuffer, 0, f);
a.readPixels(0, 0, l, u, a.RGBA, a.UNSIGNED_BYTE, p);
var g = new ImageData(m, l, u);
h.putImageData(g, 0, 0)
}(function() {
var a = function() {};
e.Canvas2dFilterBackend = o;
function o() {}
o.prototype = {
evictCachesForKey: a,
dispose: a,
clearWebGLCaches: a,
resources: {},
applyFilters: function(c, h, l, u, f) {
var p = f.getContext("2d");
p.drawImage(h, 0, 0, l, u);
var m = p.getImageData(0, 0, l, u),
g = p.getImageData(0, 0, l, u),
v = {
sourceWidth: l,
sourceHeight: u,
imageData: m,
originalEl: h,
originalImageData: g,
canvasEl: f,
ctx: p,
filterBackend: this
};
return c.forEach(function(y) {
y.applyTo(v)
}), (v.imageData.width !== l || v.imageData.height !== u) && (f.width = v.imageData.width, f.height = v.imageData.height), p.putImageData(v.imageData, 0, 0), v
}
}
})(), e.Image = e.Image || {}, e.Image.filters = e.Image.filters || {}, e.Image.filters.BaseFilter = e.util.createClass({
type: "BaseFilter",
vertexSource: `attribute vec2 aPosition;
varying vec2 vTexCoord;
void main() {
vTexCoord = aPosition;
gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);
}`,
fragmentSource: `precision highp float;
varying vec2 vTexCoord;
uniform sampler2D uTexture;
void main() {
gl_FragColor = texture2D(uTexture, vTexCoord);
}`,
initialize: function(a) {
a && this.setOptions(a)
},
setOptions: function(a) {
for (var o in a) this[o] = a[o]
},
createProgram: function(a, o, c) {
o = o || this.fragmentSource, c = c || this.vertexSource, e.webGlPrecision !== "highp" && (o = o.replace(/precision highp float/g, "precision " + e.webGlPrecision + " float"));
var h = a.createShader(a.VERTEX_SHADER);
if (a.shaderSource(h, c), a.compileShader(h), !a.getShaderParameter(h, a.COMPILE_STATUS)) throw new Error("Vertex shader compile error for " + this.type + ": " + a.getShaderInfoLog(h));
var l = a.createShader(a.FRAGMENT_SHADER);
if (a.shaderSource(l, o), a.compileShader(l), !a.getShaderParameter(l, a.COMPILE_STATUS)) throw new Error("Fragment shader compile error for " + this.type + ": " + a.getShaderInfoLog(l));
var u = a.createProgram();
if (a.attachShader(u, h), a.attachShader(u, l), a.linkProgram(u), !a.getProgramParameter(u, a.LINK_STATUS)) throw new Error('Shader link error for "${this.type}" ' + a.getProgramInfoLog(u));
var f = this.getAttributeLocations(a, u),
p = this.getUniformLocations(a, u) || {};
return p.uStepW = a.getUniformLocation(u, "uStepW"), p.uStepH = a.getUniformLocation(u, "uStepH"), {
program: u,
attributeLocations: f,
uniformLocations: p
}
},
getAttributeLocations: function(a, o) {
return {
aPosition: a.getAttribLocation(o, "aPosition")
}
},
getUniformLocations: function() {
return {}
},
sendAttributeData: function(a, o, c) {
var h = o.aPosition,
l = a.createBuffer();
a.bindBuffer(a.ARRAY_BUFFER, l), a.enableVertexAttribArray(h), a.vertexAttribPointer(h, 2, a.FLOAT, !1, 0, 0), a.bufferData(a.ARRAY_BUFFER, c, a.STATIC_DRAW)
},
_setupFrameBuffer: function(a) {
var o = a.context,
c, h;
a.passes > 1 ? (c = a.destinationWidth, h = a.destinationHeight, (a.sourceWidth !== c || a.sourceHeight !== h) && (o.deleteTexture(a.targetTexture), a.targetTexture = a.filterBackend.createTexture(o, c, h)), o.framebufferTexture2D(o.FRAMEBUFFER, o.COLOR_ATTACHMENT0, o.TEXTURE_2D, a.targetTexture, 0)) : (o.bindFramebuffer(o.FRAMEBUFFER, null), o.finish())
},
_swapTextures: function(a) {
a.passes--, a.pass++;
var o = a.targetTexture;
a.targetTexture = a.sourceTexture, a.sourceTexture = o
},
isNeutralState: function() {
var a = this.mainParameter,
o = e.Image.filters[this.type].prototype;
if (a)
if (Array.isArray(o[a])) {
for (var c = o[a].length; c--;)
if (this[a][c] !== o[a][c]) return !1;
return !0
} else return o[a] === this[a];
else return !1
},
applyTo: function(a) {
a.webgl ? (this._setupFrameBuffer(a), this.applyToWebGL(a), this._swapTextures(a)) : this.applyTo2d(a)
},
retrieveShader: function(a) {
return a.programCache.hasOwnProperty(this.type) || (a.programCache[this.type] = this.createProgram(a.context)), a.programCache[this.type]
},
applyToWebGL: function(a) {
var o = a.context,
c = this.retrieveShader(a);
a.pass === 0 && a.originalTexture ? o.bindTexture(o.TEXTURE_2D, a.originalTexture) : o.bindTexture(o.TEXTURE_2D, a.sourceTexture), o.useProgram(c.program), this.sendAttributeData(o, c.attributeLocations, a.aPosition), o.uniform1f(c.uniformLocations.uStepW, 1 / a.sourceWidth), o.uniform1f(c.uniformLocations.uStepH, 1 / a.sourceHeight), this.sendUniformData(o, c.uniformLocations), o.viewport(0, 0, a.destinationWidth, a.destinationHeight), o.drawArrays(o.TRIANGLE_STRIP, 0, 4)
},
bindAdditionalTexture: function(a, o, c) {
a.activeTexture(c), a.bindTexture(a.TEXTURE_2D, o), a.activeTexture(a.TEXTURE0)
},
unbindAdditionalTexture: function(a, o) {
a.activeTexture(o), a.bindTexture(a.TEXTURE_2D, null), a.activeTexture(a.TEXTURE0)
},
getMainParameter: function() {
return this[this.mainParameter]
},
setMainParameter: function(a) {
this[this.mainParameter] = a
},
sendUniformData: function() {},
createHelpLayer: function(a) {
if (!a.helpLayer) {
var o = document.createElement("canvas");
o.width = a.sourceWidth, o.height = a.sourceHeight, a.helpLayer = o
}
},
toObject: function() {
var a = {
type: this.type
},
o = this.mainParameter;
return o && (a[o] = this[o]), a
},
toJSON: function() {
return this.toObject()
}
}), e.Image.filters.BaseFilter.fromObject = function(a, o) {
var c = new e.Image.filters[a.type](a);
return o && o(c), c
},
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.ColorMatrix = h(c.BaseFilter, {
type: "ColorMatrix",
fragmentSource: `precision highp float;
uniform sampler2D uTexture;
varying vec2 vTexCoord;
uniform mat4 uColorMatrix;
uniform vec4 uConstants;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
color *= uColorMatrix;
color += uConstants;
gl_FragColor = color;
}`,
matrix: [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0],
mainParameter: "matrix",
colorsOnly: !0,
initialize: function(l) {
this.callSuper("initialize", l), this.matrix = this.matrix.slice(0)
},
applyTo2d: function(l) {
var u = l.imageData,
f = u.data,
p = f.length,
m = this.matrix,
g, v, y, b, w, x = this.colorsOnly;
for (w = 0; w < p; w += 4) g = f[w], v = f[w + 1], y = f[w + 2], x ? (f[w] = g * m[0] + v * m[1] + y * m[2] + m[4] * 255, f[w + 1] = g * m[5] + v * m[6] + y * m[7] + m[9] * 255, f[w + 2] = g * m[10] + v * m[11] + y * m[12] + m[14] * 255) : (b = f[w + 3], f[w] = g * m[0] + v * m[1] + y * m[2] + b * m[3] + m[4] * 255, f[w + 1] = g * m[5] + v * m[6] + y * m[7] + b * m[8] + m[9] * 255, f[w + 2] = g * m[10] + v * m[11] + y * m[12] + b * m[13] + m[14] * 255, f[w + 3] = g * m[15] + v * m[16] + y * m[17] + b * m[18] + m[19] * 255)
},
getUniformLocations: function(l, u) {
return {
uColorMatrix: l.getUniformLocation(u, "uColorMatrix"),
uConstants: l.getUniformLocation(u, "uConstants")
}
},
sendUniformData: function(l, u) {
var f = this.matrix,
p = [f[0], f[1], f[2], f[3], f[5], f[6], f[7], f[8], f[10], f[11], f[12], f[13], f[15], f[16], f[17], f[18]],
m = [f[4], f[9], f[14], f[19]];
l.uniformMatrix4fv(u.uColorMatrix, !1, p), l.uniform4fv(u.uConstants, m)
}
}), o.Image.filters.ColorMatrix.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.Brightness = h(c.BaseFilter, {
type: "Brightness",
fragmentSource: `precision highp float;
uniform sampler2D uTexture;
uniform float uBrightness;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
color.rgb += uBrightness;
gl_FragColor = color;
}`,
brightness: 0,
mainParameter: "brightness",
applyTo2d: function(l) {
if (this.brightness !== 0) {
var u = l.imageData,
f = u.data,
p, m = f.length,
g = Math.round(this.brightness * 255);
for (p = 0; p < m; p += 4) f[p] = f[p] + g, f[p + 1] = f[p + 1] + g, f[p + 2] = f[p + 2] + g
}
},
getUniformLocations: function(l, u) {
return {
uBrightness: l.getUniformLocation(u, "uBrightness")
}
},
sendUniformData: function(l, u) {
l.uniform1f(u.uBrightness, this.brightness)
}
}), o.Image.filters.Brightness.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.object.extend,
h = o.Image.filters,
l = o.util.createClass;
h.Convolute = l(h.BaseFilter, {
type: "Convolute",
opaque: !1,
matrix: [0, 0, 0, 0, 1, 0, 0, 0, 0],
fragmentSource: {
Convolute_3_1: `precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[9];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 3.0; h+=1.0) {
for (float w = 0.0; w < 3.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];
}
}
gl_FragColor = color;
}`,
Convolute_3_0: `precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[9];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 3.0; h+=1.0) {
for (float w = 0.0; w < 3.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`,
Convolute_5_1: `precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[25];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 5.0; h+=1.0) {
for (float w = 0.0; w < 5.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];
}
}
gl_FragColor = color;
}`,
Convolute_5_0: `precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[25];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 5.0; h+=1.0) {
for (float w = 0.0; w < 5.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`,
Convolute_7_1: `precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[49];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 7.0; h+=1.0) {
for (float w = 0.0; w < 7.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];
}
}
gl_FragColor = color;
}`,
Convolute_7_0: `precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[49];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 7.0; h+=1.0) {
for (float w = 0.0; w < 7.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`,
Convolute_9_1: `precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[81];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 0);
for (float h = 0.0; h < 9.0; h+=1.0) {
for (float w = 0.0; w < 9.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];
}
}
gl_FragColor = color;
}`,
Convolute_9_0: `precision highp float;
uniform sampler2D uTexture;
uniform float uMatrix[81];
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
vec4 color = vec4(0, 0, 0, 1);
for (float h = 0.0; h < 9.0; h+=1.0) {
for (float w = 0.0; w < 9.0; w+=1.0) {
vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];
}
}
float alpha = texture2D(uTexture, vTexCoord).a;
gl_FragColor = color;
gl_FragColor.a = alpha;
}`
},
retrieveShader: function(u) {
var f = Math.sqrt(this.matrix.length),
p = this.type + "_" + f + "_" + (this.opaque ? 1 : 0),
m = this.fragmentSource[p];
return u.programCache.hasOwnProperty(p) || (u.programCache[p] = this.createProgram(u.context, m)), u.programCache[p]
},
applyTo2d: function(u) {
var f = u.imageData,
p = f.data,
m = this.matrix,
g = Math.round(Math.sqrt(m.length)),
v = Math.floor(g / 2),
y = f.width,
b = f.height,
w = u.ctx.createImageData(y, b),
x = w.data,
S = this.opaque ? 1 : 0,
T, P, I, z, H, ee, te, ne, Z, ie, ce, V, C;
for (ce = 0; ce < b; ce++)
for (ie = 0; ie < y; ie++) {
for (H = (ce * y + ie) * 4, T = 0, P = 0, I = 0, z = 0, C = 0; C < g; C++)
for (V = 0; V < g; V++) te = ce + C - v, ee = ie + V - v, !(te < 0 || te >= b || ee < 0 || ee >= y) && (ne = (te * y + ee) * 4, Z = m[C * g + V], T += p[ne] * Z, P += p[ne + 1] * Z, I += p[ne + 2] * Z, S || (z += p[ne + 3] * Z));
x[H] = T, x[H + 1] = P, x[H + 2] = I, S ? x[H + 3] = p[H + 3] : x[H + 3] = z
}
u.imageData = w
},
getUniformLocations: function(u, f) {
return {
uMatrix: u.getUniformLocation(f, "uMatrix"),
uOpaque: u.getUniformLocation(f, "uOpaque"),
uHalfSize: u.getUniformLocation(f, "uHalfSize"),
uSize: u.getUniformLocation(f, "uSize")
}
},
sendUniformData: function(u, f) {
u.uniform1fv(f.uMatrix, this.matrix)
},
toObject: function() {
return c(this.callSuper("toObject"), {
opaque: this.opaque,
matrix: this.matrix
})
}
}), o.Image.filters.Convolute.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.Grayscale = h(c.BaseFilter, {
type: "Grayscale",
fragmentSource: {
average: `precision highp float;
uniform sampler2D uTexture;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float average = (color.r + color.b + color.g) / 3.0;
gl_FragColor = vec4(average, average, average, color.a);
}`,
lightness: `precision highp float;
uniform sampler2D uTexture;
uniform int uMode;
varying vec2 vTexCoord;
void main() {
vec4 col = texture2D(uTexture, vTexCoord);
float average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;
gl_FragColor = vec4(average, average, average, col.a);
}`,
luminosity: `precision highp float;
uniform sampler2D uTexture;
uniform int uMode;
varying vec2 vTexCoord;
void main() {
vec4 col = texture2D(uTexture, vTexCoord);
float average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;
gl_FragColor = vec4(average, average, average, col.a);
}`
},
mode: "average",
mainParameter: "mode",
applyTo2d: function(l) {
var u = l.imageData,
f = u.data,
p, m = f.length,
g, v = this.mode;
for (p = 0; p < m; p += 4) v === "average" ? g = (f[p] + f[p + 1] + f[p + 2]) / 3 : v === "lightness" ? g = (Math.min(f[p], f[p + 1], f[p + 2]) + Math.max(f[p], f[p + 1], f[p + 2])) / 2 : v === "luminosity" && (g = .21 * f[p] + .72 * f[p + 1] + .07 * f[p + 2]), f[p] = g, f[p + 1] = g, f[p + 2] = g
},
retrieveShader: function(l) {
var u = this.type + "_" + this.mode;
if (!l.programCache.hasOwnProperty(u)) {
var f = this.fragmentSource[this.mode];
l.programCache[u] = this.createProgram(l.context, f)
}
return l.programCache[u]
},
getUniformLocations: function(l, u) {
return {
uMode: l.getUniformLocation(u, "uMode")
}
},
sendUniformData: function(l, u) {
var f = 1;
l.uniform1i(u.uMode, f)
},
isNeutralState: function() {
return !1
}
}), o.Image.filters.Grayscale.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.Invert = h(c.BaseFilter, {
type: "Invert",
fragmentSource: `precision highp float;
uniform sampler2D uTexture;
uniform int uInvert;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
if (uInvert == 1) {
gl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);
} else {
gl_FragColor = color;
}
}`,
invert: !0,
mainParameter: "invert",
applyTo2d: function(l) {
var u = l.imageData,
f = u.data,
p, m = f.length;
for (p = 0; p < m; p += 4) f[p] = 255 - f[p], f[p + 1] = 255 - f[p + 1], f[p + 2] = 255 - f[p + 2]
},
isNeutralState: function() {
return !this.invert
},
getUniformLocations: function(l, u) {
return {
uInvert: l.getUniformLocation(u, "uInvert")
}
},
sendUniformData: function(l, u) {
l.uniform1i(u.uInvert, this.invert)
}
}), o.Image.filters.Invert.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.object.extend,
h = o.Image.filters,
l = o.util.createClass;
h.Noise = l(h.BaseFilter, {
type: "Noise",
fragmentSource: `precision highp float;
uniform sampler2D uTexture;
uniform float uStepH;
uniform float uNoise;
uniform float uSeed;
varying vec2 vTexCoord;
float rand(vec2 co, float seed, float vScale) {
return fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);
}
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
color.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;
gl_FragColor = color;
}`,
mainParameter: "noise",
noise: 0,
applyTo2d: function(u) {
if (this.noise !== 0) {
var f = u.imageData,
p = f.data,
m, g = p.length,
v = this.noise,
y;
for (m = 0, g = p.length; m < g; m += 4) y = (.5 - Math.random()) * v, p[m] += y, p[m + 1] += y, p[m + 2] += y
}
},
getUniformLocations: function(u, f) {
return {
uNoise: u.getUniformLocation(f, "uNoise"),
uSeed: u.getUniformLocation(f, "uSeed")
}
},
sendUniformData: function(u, f) {
u.uniform1f(f.uNoise, this.noise / 255), u.uniform1f(f.uSeed, Math.random())
},
toObject: function() {
return c(this.callSuper("toObject"), {
noise: this.noise
})
}
}), o.Image.filters.Noise.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.Pixelate = h(c.BaseFilter, {
type: "Pixelate",
blocksize: 4,
mainParameter: "blocksize",
fragmentSource: `precision highp float;
uniform sampler2D uTexture;
uniform float uBlocksize;
uniform float uStepW;
uniform float uStepH;
varying vec2 vTexCoord;
void main() {
float blockW = uBlocksize * uStepW;
float blockH = uBlocksize * uStepW;
int posX = int(vTexCoord.x / blockW);
int posY = int(vTexCoord.y / blockH);
float fposX = float(posX);
float fposY = float(posY);
vec2 squareCoords = vec2(fposX * blockW, fposY * blockH);
vec4 color = texture2D(uTexture, squareCoords);
gl_FragColor = color;
}`,
applyTo2d: function(l) {
var u = l.imageData,
f = u.data,
p = u.height,
m = u.width,
g, v, y, b, w, x, S, T, P, I, z;
for (v = 0; v < p; v += this.blocksize)
for (y = 0; y < m; y += this.blocksize)
for (g = v * 4 * m + y * 4, b = f[g], w = f[g + 1], x = f[g + 2], S = f[g + 3], I = Math.min(v + this.blocksize, p), z = Math.min(y + this.blocksize, m), T = v; T < I; T++)
for (P = y; P < z; P++) g = T * 4 * m + P * 4, f[g] = b, f[g + 1] = w, f[g + 2] = x, f[g + 3] = S
},
isNeutralState: function() {
return this.blocksize === 1
},
getUniformLocations: function(l, u) {
return {
uBlocksize: l.getUniformLocation(u, "uBlocksize"),
uStepW: l.getUniformLocation(u, "uStepW"),
uStepH: l.getUniformLocation(u, "uStepH")
}
},
sendUniformData: function(l, u) {
l.uniform1f(u.uBlocksize, this.blocksize)
}
}), o.Image.filters.Pixelate.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.object.extend,
h = o.Image.filters,
l = o.util.createClass;
h.RemoveColor = l(h.BaseFilter, {
type: "RemoveColor",
color: "#FFFFFF",
fragmentSource: `precision highp float;
uniform sampler2D uTexture;
uniform vec4 uLow;
uniform vec4 uHigh;
varying vec2 vTexCoord;
void main() {
gl_FragColor = texture2D(uTexture, vTexCoord);
if(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {
gl_FragColor.a = 0.0;
}
}`,
distance: .02,
useAlpha: !1,
applyTo2d: function(u) {
var f = u.imageData,
p = f.data,
m, g = this.distance * 255,
v, y, b, w = new o.Color(this.color).getSource(),
x = [w[0] - g, w[1] - g, w[2] - g],
S = [w[0] + g, w[1] + g, w[2] + g];
for (m = 0; m < p.length; m += 4) v = p[m], y = p[m + 1], b = p[m + 2], v > x[0] && y > x[1] && b > x[2] && v < S[0] && y < S[1] && b < S[2] && (p[m + 3] = 0)
},
getUniformLocations: function(u, f) {
return {
uLow: u.getUniformLocation(f, "uLow"),
uHigh: u.getUniformLocation(f, "uHigh")
}
},
sendUniformData: function(u, f) {
var p = new o.Color(this.color).getSource(),
m = parseFloat(this.distance),
g = [0 + p[0] / 255 - m, 0 + p[1] / 255 - m, 0 + p[2] / 255 - m, 1],
v = [p[0] / 255 + m, p[1] / 255 + m, p[2] / 255 + m, 1];
u.uniform4fv(f.uLow, g), u.uniform4fv(f.uHigh, v)
},
toObject: function() {
return c(this.callSuper("toObject"), {
color: this.color,
distance: this.distance
})
}
}), o.Image.filters.RemoveColor.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass,
l = {
Brownie: [.5997, .34553, -.27082, 0, .186, -.0377, .86095, .15059, 0, -.1449, .24113, -.07441, .44972, 0, -.02965, 0, 0, 0, 1, 0],
Vintage: [.62793, .32021, -.03965, 0, .03784, .02578, .64411, .03259, 0, .02926, .0466, -.08512, .52416, 0, .02023, 0, 0, 0, 1, 0],
Kodachrome: [1.12855, -.39673, -.03992, 0, .24991, -.16404, 1.08352, -.05498, 0, .09698, -.16786, -.56034, 1.60148, 0, .13972, 0, 0, 0, 1, 0],
Technicolor: [1.91252, -.85453, -.09155, 0, .04624, -.30878, 1.76589, -.10601, 0, -.27589, -.2311, -.75018, 1.84759, 0, .12137, 0, 0, 0, 1, 0],
Polaroid: [1.438, -.062, -.062, 0, 0, -.122, 1.378, -.122, 0, 0, -.016, -.016, 1.483, 0, 0, 0, 0, 0, 1, 0],
Sepia: [.393, .769, .189, 0, 0, .349, .686, .168, 0, 0, .272, .534, .131, 0, 0, 0, 0, 0, 1, 0],
BlackWhite: [1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 0, 0, 0, 1, 0]
};
for (var u in l) c[u] = h(c.ColorMatrix, {
type: u,
matrix: l[u],
mainParameter: !1,
colorsOnly: !0
}), o.Image.filters[u].fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric,
c = o.Image.filters,
h = o.util.createClass;
c.BlendColor = h(c.BaseFilter, {
type: "BlendColor",
color: "#F95C63",
mode: "multiply",
alpha: 1,
fragmentSource: {
multiply: `gl_FragColor.rgb *= uColor.rgb;
`,
screen: `gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);
`,
add: `gl_FragColor.rgb += uColor.rgb;
`,
diff: `gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);
`,
subtract: `gl_FragColor.rgb -= uColor.rgb;
`,
lighten: `gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);
`,
darken: `gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);
`,
exclusion: `gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);
`,
overlay: `if (uColor.r < 0.5) {
gl_FragColor.r *= 2.0 * uColor.r;
} else {
gl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);
}
if (uColor.g < 0.5) {
gl_FragColor.g *= 2.0 * uColor.g;
} else {
gl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);
}
if (uColor.b < 0.5) {
gl_FragColor.b *= 2.0 * uColor.b;
} else {
gl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);
}
`,
tint: `gl_FragColor.rgb *= (1.0 - uColor.a);
gl_FragColor.rgb += uColor.rgb;
`
},
buildSource: function(l) {
return `precision highp float;
uniform sampler2D uTexture;
uniform vec4 uColor;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
gl_FragColor = color;
if (color.a > 0.0) {
` + this.fragmentSource[l] + `}
}`
},
retrieveShader: function(l) {
var u = this.type + "_" + this.mode,
f;
return l.programCache.hasOwnProperty(u) || (f = this.buildSource(this.mode), l.programCache[u] = this.createProgram(l.context, f)), l.programCache[u]
},
applyTo2d: function(l) {
var u = l.imageData,
f = u.data,
p = f.length,
m, g, v, y, b, w, x, S = 1 - this.alpha;
x = new o.Color(this.color).getSource(), m = x[0] * this.alpha, g = x[1] * this.alpha, v = x[2] * this.alpha;
for (var T = 0; T < p; T += 4) switch (y = f[T], b = f[T + 1], w = f[T + 2], this.mode) {
case "multiply":
f[T] = y * m / 255, f[T + 1] = b * g / 255, f[T + 2] = w * v / 255;
break;
case "screen":
f[T] = 255 - (255 - y) * (255 - m) / 255, f[T + 1] = 255 - (255 - b) * (255 - g) / 255, f[T + 2] = 255 - (255 - w) * (255 - v) / 255;
break;
case "add":
f[T] = y + m, f[T + 1] = b + g, f[T + 2] = w + v;
break;
case "diff":
case "difference":
f[T] = Math.abs(y - m), f[T + 1] = Math.abs(b - g), f[T + 2] = Math.abs(w - v);
break;
case "subtract":
f[T] = y - m, f[T + 1] = b - g, f[T + 2] = w - v;
break;
case "darken":
f[T] = Math.min(y, m), f[T + 1] = Math.min(b, g), f[T + 2] = Math.min(w, v);
break;
case "lighten":
f[T] = Math.max(y, m), f[T + 1] = Math.max(b, g), f[T + 2] = Math.max(w, v);
break;
case "overlay":
f[T] = m < 128 ? 2 * y * m / 255 : 255 - 2 * (255 - y) * (255 - m) / 255, f[T + 1] = g < 128 ? 2 * b * g / 255 : 255 - 2 * (255 - b) * (255 - g) / 255, f[T + 2] = v < 128 ? 2 * w * v / 255 : 255 - 2 * (255 - w) * (255 - v) / 255;
break;
case "exclusion":
f[T] = m + y - 2 * m * y / 255, f[T + 1] = g + b - 2 * g * b / 255, f[T + 2] = v + w - 2 * v * w / 255;
break;
case "tint":
f[T] = m + y * S, f[T + 1] = g + b * S, f[T + 2] = v + w * S
}
},
getUniformLocations: function(l, u) {
return {
uColor: l.getUniformLocation(u, "uColor")
}
},
sendUniformData: function(l, u) {
var f = new o.Color(this.color).getSource();
f[0] = this.alpha * f[0] / 255, f[1] = this.alpha * f[1] / 255, f[2] = this.alpha * f[2] / 255, f[3] = this.alpha, l.uniform4fv(u.uColor, f)
},
toObject: function() {
return {
type: this.type,
color: this.color,
mode: this.mode,
alpha: this.alpha
}
}
}), o.Image.filters.BlendColor.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric,
c = o.Image.filters,
h = o.util.createClass;
c.BlendImage = h(c.BaseFilter, {
type: "BlendImage",
image: null,
mode: "multiply",
alpha: 1,
vertexSource: `attribute vec2 aPosition;
varying vec2 vTexCoord;
varying vec2 vTexCoord2;
uniform mat3 uTransformMatrix;
void main() {
vTexCoord = aPosition;
vTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;
gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);
}`,
fragmentSource: {
multiply: `precision highp float;
uniform sampler2D uTexture;
uniform sampler2D uImage;
uniform vec4 uColor;
varying vec2 vTexCoord;
varying vec2 vTexCoord2;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
vec4 color2 = texture2D(uImage, vTexCoord2);
color.rgba *= color2.rgba;
gl_FragColor = color;
}`,
mask: `precision highp float;
uniform sampler2D uTexture;
uniform sampler2D uImage;
uniform vec4 uColor;
varying vec2 vTexCoord;
varying vec2 vTexCoord2;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
vec4 color2 = texture2D(uImage, vTexCoord2);
color.a = color2.a;
gl_FragColor = color;
}`
},
retrieveShader: function(l) {
var u = this.type + "_" + this.mode,
f = this.fragmentSource[this.mode];
return l.programCache.hasOwnProperty(u) || (l.programCache[u] = this.createProgram(l.context, f)), l.programCache[u]
},
applyToWebGL: function(l) {
var u = l.context,
f = this.createTexture(l.filterBackend, this.image);
this.bindAdditionalTexture(u, f, u.TEXTURE1), this.callSuper("applyToWebGL", l), this.unbindAdditionalTexture(u, u.TEXTURE1)
},
createTexture: function(l, u) {
return l.getCachedTexture(u.cacheKey, u._element)
},
calculateMatrix: function() {
var l = this.image,
u = l._element.width,
f = l._element.height;
return [1 / l.scaleX, 0, 0, 0, 1 / l.scaleY, 0, -l.left / u, -l.top / f, 1]
},
applyTo2d: function(l) {
var u = l.imageData,
f = l.filterBackend.resources,
p = u.data,
m = p.length,
g = u.width,
v = u.height,
y, b, w, x, S, T, P, I, z, H, ee = this.image,
te;
f.blendImage || (f.blendImage = o.util.createCanvasElement()), z = f.blendImage, H = z.getContext("2d"), z.width !== g || z.height !== v ? (z.width = g, z.height = v) : H.clearRect(0, 0, g, v), H.setTransform(ee.scaleX, 0, 0, ee.scaleY, ee.left, ee.top), H.drawImage(ee._element, 0, 0, g, v), te = H.getImageData(0, 0, g, v).data;
for (var ne = 0; ne < m; ne += 4) switch (S = p[ne], T = p[ne + 1], P = p[ne + 2], I = p[ne + 3], y = te[ne], b = te[ne + 1], w = te[ne + 2], x = te[ne + 3], this.mode) {
case "multiply":
p[ne] = S * y / 255, p[ne + 1] = T * b / 255, p[ne + 2] = P * w / 255, p[ne + 3] = I * x / 255;
break;
case "mask":
p[ne + 3] = x;
break
}
},
getUniformLocations: function(l, u) {
return {
uTransformMatrix: l.getUniformLocation(u, "uTransformMatrix"),
uImage: l.getUniformLocation(u, "uImage")
}
},
sendUniformData: function(l, u) {
var f = this.calculateMatrix();
l.uniform1i(u.uImage, 1), l.uniformMatrix3fv(u.uTransformMatrix, !1, f)
},
toObject: function() {
return {
type: this.type,
image: this.image && this.image.toObject(),
mode: this.mode,
alpha: this.alpha
}
}
}), o.Image.filters.BlendImage.fromObject = function(l, u) {
o.Image.fromObject(l.image, function(f) {
var p = o.util.object.clone(l);
p.image = f, u(new o.Image.filters.BlendImage(p))
})
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = Math.pow,
h = Math.floor,
l = Math.sqrt,
u = Math.abs,
f = Math.round,
p = Math.sin,
m = Math.ceil,
g = o.Image.filters,
v = o.util.createClass;
g.Resize = v(g.BaseFilter, {
type: "Resize",
resizeType: "hermite",
scaleX: 1,
scaleY: 1,
lanczosLobes: 3,
getUniformLocations: function(y, b) {
return {
uDelta: y.getUniformLocation(b, "uDelta"),
uTaps: y.getUniformLocation(b, "uTaps")
}
},
sendUniformData: function(y, b) {
y.uniform2fv(b.uDelta, this.horizontal ? [1 / this.width, 0] : [0, 1 / this.height]), y.uniform1fv(b.uTaps, this.taps)
},
retrieveShader: function(y) {
var b = this.getFilterWindow(),
w = this.type + "_" + b;
if (!y.programCache.hasOwnProperty(w)) {
var x = this.generateShader(b);
y.programCache[w] = this.createProgram(y.context, x)
}
return y.programCache[w]
},
getFilterWindow: function() {
var y = this.tempScale;
return Math.ceil(this.lanczosLobes / y)
},
getTaps: function() {
for (var y = this.lanczosCreate(this.lanczosLobes), b = this.tempScale, w = this.getFilterWindow(), x = new Array(w), S = 1; S <= w; S++) x[S - 1] = y(S * b);
return x
},
generateShader: function(x) {
for (var b = new Array(x), w = this.fragmentSourceTOP, x, S = 1; S <= x; S++) b[S - 1] = S + ".0 * uDelta";
return w += "uniform float uTaps[" + x + `];
`, w += `void main() {
`, w += ` vec4 color = texture2D(uTexture, vTexCoord);
`, w += ` float sum = 1.0;
`, b.forEach(function(T, P) {
w += " color += texture2D(uTexture, vTexCoord + " + T + ") * uTaps[" + P + `];
`, w += " color += texture2D(uTexture, vTexCoord - " + T + ") * uTaps[" + P + `];
`, w += " sum += 2.0 * uTaps[" + P + `];
`
}), w += ` gl_FragColor = color / sum;
`, w += "}", w
},
fragmentSourceTOP: `precision highp float;
uniform sampler2D uTexture;
uniform vec2 uDelta;
varying vec2 vTexCoord;
`,
applyTo: function(y) {
y.webgl ? (y.passes++, this.width = y.sourceWidth, this.horizontal = !0, this.dW = Math.round(this.width * this.scaleX), this.dH = y.sourceHeight, this.tempScale = this.dW / this.width, this.taps = this.getTaps(), y.destinationWidth = this.dW, this._setupFrameBuffer(y), this.applyToWebGL(y), this._swapTextures(y), y.sourceWidth = y.destinationWidth, this.height = y.sourceHeight, this.horizontal = !1, this.dH = Math.round(this.height * this.scaleY), this.tempScale = this.dH / this.height, this.taps = this.getTaps(), y.destinationHeight = this.dH, this._setupFrameBuffer(y), this.applyToWebGL(y), this._swapTextures(y), y.sourceHeight = y.destinationHeight) : this.applyTo2d(y)
},
isNeutralState: function() {
return this.scaleX === 1 && this.scaleY === 1
},
lanczosCreate: function(y) {
return function(b) {
if (b >= y || b <= -y) return 0;
if (b < 11920929e-14 && b > -11920929e-14) return 1;
b *= Math.PI;
var w = b / y;
return p(b) / b * p(w) / w
}
},
applyTo2d: function(y) {
var b = y.imageData,
w = this.scaleX,
x = this.scaleY;
this.rcpScaleX = 1 / w, this.rcpScaleY = 1 / x;
var S = b.width,
T = b.height,
P = f(S * w),
I = f(T * x),
z;
this.resizeType === "sliceHack" ? z = this.sliceByTwo(y, S, T, P, I) : this.resizeType === "hermite" ? z = this.hermiteFastResize(y, S, T, P, I) : this.resizeType === "bilinear" ? z = this.bilinearFiltering(y, S, T, P, I) : this.resizeType === "lanczos" && (z = this.lanczosResize(y, S, T, P, I)), y.imageData = z
},
sliceByTwo: function(y, b, w, x, S) {
var T = y.imageData,
P = .5,
I = !1,
z = !1,
H = b * P,
ee = w * P,
te = o.filterBackend.resources,
ne, Z, ie = 0,
ce = 0,
V = b,
C = 0;
for (te.sliceByTwo || (te.sliceByTwo = document.createElement("canvas")), ne = te.sliceByTwo, (ne.width < b * 1.5 || ne.height < w) && (ne.width = b * 1.5, ne.height = w), Z = ne.getContext("2d"), Z.clearRect(0, 0, b * 1.5, w), Z.putImageData(T, 0, 0), x = h(x), S = h(S); !I || !z;) b = H, w = ee, x < h(H * P) ? H = h(H * P) : (H = x, I = !0), S < h(ee * P) ? ee = h(ee * P) : (ee = S, z = !0), Z.drawImage(ne, ie, ce, b, w, V, C, H, ee), ie = V, ce = C, C += ee;
return Z.getImageData(ie, ce, x, S)
},
lanczosResize: function(y, b, w, x, S) {
function T(M) {
var D, $, R, O, F, N, G, W, X, B, re;
for (C.x = (M + .5) * ee, k.x = h(C.x), D = 0; D < S; D++) {
for (C.y = (D + .5) * te, k.y = h(C.y), F = 0, N = 0, G = 0, W = 0, X = 0, $ = k.x - ie; $ <= k.x + ie; $++)
if (!($ < 0 || $ >= b)) {
B = h(1e3 * u($ - C.x)), V[B] || (V[B] = {});
for (var U = k.y - ce; U <= k.y + ce; U++) U < 0 || U >= w || (re = h(1e3 * u(U - C.y)), V[B][re] || (V[B][re] = H(l(c(B * ne, 2) + c(re * Z, 2)) / 1e3)), R = V[B][re], R > 0 && (O = (U * b + $) * 4, F += R, N += R * P[O], G += R * P[O + 1], W += R * P[O + 2], X += R * P[O + 3]))
} O = (D * x + M) * 4, z[O] = N / F, z[O + 1] = G / F, z[O + 2] = W / F, z[O + 3] = X / F
}
return ++M < x ? T(M) : I
}
var P = y.imageData.data,
I = y.ctx.createImageData(x, S),
z = I.data,
H = this.lanczosCreate(this.lanczosLobes),
ee = this.rcpScaleX,
te = this.rcpScaleY,
ne = 2 / this.rcpScaleX,
Z = 2 / this.rcpScaleY,
ie = m(ee * this.lanczosLobes / 2),
ce = m(te * this.lanczosLobes / 2),
V = {},
C = {},
k = {};
return T(0)
},
bilinearFiltering: function(y, b, w, x, S) {
var T, P, I, z, H, ee, te, ne, Z, ie, ce, V, C = 0,
k, M = this.rcpScaleX,
D = this.rcpScaleY,
$ = 4 * (b - 1),
R = y.imageData,
O = R.data,
F = y.ctx.createImageData(x, S),
N = F.data;
for (te = 0; te < S; te++)
for (ne = 0; ne < x; ne++)
for (H = h(M * ne), ee = h(D * te), Z = M * ne - H, ie = D * te - ee, k = 4 * (ee * b + H), ce = 0; ce < 4; ce++) T = O[k + ce], P = O[k + 4 + ce], I = O[k + $ + ce], z = O[k + $ + 4 + ce], V = T * (1 - Z) * (1 - ie) + P * Z * (1 - ie) + I * ie * (1 - Z) + z * Z * ie, N[C++] = V;
return F
},
hermiteFastResize: function(y, b, w, x, S) {
for (var T = this.rcpScaleX, P = this.rcpScaleY, I = m(T / 2), z = m(P / 2), H = y.imageData, ee = H.data, te = y.ctx.createImageData(x, S), ne = te.data, Z = 0; Z < S; Z++)
for (var ie = 0; ie < x; ie++) {
for (var ce = (ie + Z * x) * 4, V = 0, C = 0, k = 0, M = 0, D = 0, $ = 0, R = 0, O = (Z + .5) * P, F = h(Z * P); F < (Z + 1) * P; F++)
for (var N = u(O - (F + .5)) / z, G = (ie + .5) * T, W = N * N, X = h(ie * T); X < (ie + 1) * T; X++) {
var B = u(G - (X + .5)) / I,
re = l(W + B * B);
re > 1 && re < -1 || (V = 2 * re * re * re - 3 * re * re + 1, V > 0 && (B = 4 * (X + F * b), R += V * ee[B + 3], k += V, ee[B + 3] < 255 && (V = V * ee[B + 3] / 250), M += V * ee[B], D += V * ee[B + 1], $ += V * ee[B + 2], C += V))
}
ne[ce] = M / C, ne[ce + 1] = D / C, ne[ce + 2] = $ / C, ne[ce + 3] = R / k
}
return te
},
toObject: function() {
return {
type: this.type,
scaleX: this.scaleX,
scaleY: this.scaleY,
resizeType: this.resizeType,
lanczosLobes: this.lanczosLobes
}
}
}), o.Image.filters.Resize.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.Contrast = h(c.BaseFilter, {
type: "Contrast",
fragmentSource: `precision highp float;
uniform sampler2D uTexture;
uniform float uContrast;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));
color.rgb = contrastF * (color.rgb - 0.5) + 0.5;
gl_FragColor = color;
}`,
contrast: 0,
mainParameter: "contrast",
applyTo2d: function(l) {
if (this.contrast !== 0) {
var u = l.imageData,
f, m, p = u.data,
m = p.length,
g = Math.floor(this.contrast * 255),
v = 259 * (g + 255) / (255 * (259 - g));
for (f = 0; f < m; f += 4) p[f] = v * (p[f] - 128) + 128, p[f + 1] = v * (p[f + 1] - 128) + 128, p[f + 2] = v * (p[f + 2] - 128) + 128
}
},
getUniformLocations: function(l, u) {
return {
uContrast: l.getUniformLocation(u, "uContrast")
}
},
sendUniformData: function(l, u) {
l.uniform1f(u.uContrast, this.contrast)
}
}), o.Image.filters.Contrast.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.Saturation = h(c.BaseFilter, {
type: "Saturation",
fragmentSource: `precision highp float;
uniform sampler2D uTexture;
uniform float uSaturation;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float rgMax = max(color.r, color.g);
float rgbMax = max(rgMax, color.b);
color.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;
color.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;
color.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;
gl_FragColor = color;
}`,
saturation: 0,
mainParameter: "saturation",
applyTo2d: function(l) {
if (this.saturation !== 0) {
var u = l.imageData,
f = u.data,
p = f.length,
m = -this.saturation,
g, v;
for (g = 0; g < p; g += 4) v = Math.max(f[g], f[g + 1], f[g + 2]), f[g] += v !== f[g] ? (v - f[g]) * m : 0, f[g + 1] += v !== f[g + 1] ? (v - f[g + 1]) * m : 0, f[g + 2] += v !== f[g + 2] ? (v - f[g + 2]) * m : 0
}
},
getUniformLocations: function(l, u) {
return {
uSaturation: l.getUniformLocation(u, "uSaturation")
}
},
sendUniformData: function(l, u) {
l.uniform1f(u.uSaturation, -this.saturation)
}
}), o.Image.filters.Saturation.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.Vibrance = h(c.BaseFilter, {
type: "Vibrance",
fragmentSource: `precision highp float;
uniform sampler2D uTexture;
uniform float uVibrance;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
float max = max(color.r, max(color.g, color.b));
float avg = (color.r + color.g + color.b) / 3.0;
float amt = (abs(max - avg) * 2.0) * uVibrance;
color.r += max != color.r ? (max - color.r) * amt : 0.00;
color.g += max != color.g ? (max - color.g) * amt : 0.00;
color.b += max != color.b ? (max - color.b) * amt : 0.00;
gl_FragColor = color;
}`,
vibrance: 0,
mainParameter: "vibrance",
applyTo2d: function(l) {
if (this.vibrance !== 0) {
var u = l.imageData,
f = u.data,
p = f.length,
m = -this.vibrance,
g, v, y, b;
for (g = 0; g < p; g += 4) v = Math.max(f[g], f[g + 1], f[g + 2]), y = (f[g] + f[g + 1] + f[g + 2]) / 3, b = Math.abs(v - y) * 2 / 255 * m, f[g] += v !== f[g] ? (v - f[g]) * b : 0, f[g + 1] += v !== f[g + 1] ? (v - f[g + 1]) * b : 0, f[g + 2] += v !== f[g + 2] ? (v - f[g + 2]) * b : 0
}
},
getUniformLocations: function(l, u) {
return {
uVibrance: l.getUniformLocation(u, "uVibrance")
}
},
sendUniformData: function(l, u) {
l.uniform1f(u.uVibrance, -this.vibrance)
}
}), o.Image.filters.Vibrance.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.Blur = h(c.BaseFilter, {
type: "Blur",
fragmentSource: `precision highp float;
uniform sampler2D uTexture;
uniform vec2 uDelta;
varying vec2 vTexCoord;
const float nSamples = 15.0;
vec3 v3offset = vec3(12.9898, 78.233, 151.7182);
float random(vec3 scale) {
return fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);
}
void main() {
vec4 color = vec4(0.0);
float total = 0.0;
float offset = random(v3offset);
for (float t = -nSamples; t <= nSamples; t++) {
float percent = (t + offset - 0.5) / nSamples;
float weight = 1.0 - abs(percent);
color += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;
total += weight;
}
gl_FragColor = color / total;
}`,
blur: 0,
mainParameter: "blur",
applyTo: function(l) {
l.webgl ? (this.aspectRatio = l.sourceWidth / l.sourceHeight, l.passes++, this._setupFrameBuffer(l), this.horizontal = !0, this.applyToWebGL(l), this._swapTextures(l), this._setupFrameBuffer(l), this.horizontal = !1, this.applyToWebGL(l), this._swapTextures(l)) : this.applyTo2d(l)
},
applyTo2d: function(l) {
l.imageData = this.simpleBlur(l)
},
simpleBlur: function(l) {
var u = l.filterBackend.resources,
f, p, m = l.imageData.width,
g = l.imageData.height;
u.blurLayer1 || (u.blurLayer1 = o.util.createCanvasElement(), u.blurLayer2 = o.util.createCanvasElement()), f = u.blurLayer1, p = u.blurLayer2, (f.width !== m || f.height !== g) && (p.width = f.width = m, p.height = f.height = g);
var v = f.getContext("2d"),
y = p.getContext("2d"),
b = 15,
w, x, S, T, P = this.blur * .06 * .5;
for (v.putImageData(l.imageData, 0, 0), y.clearRect(0, 0, m, g), T = -b; T <= b; T++) w = (Math.random() - .5) / 4, x = T / b, S = P * x * m + w, y.globalAlpha = 1 - Math.abs(x), y.drawImage(f, S, w), v.drawImage(p, 0, 0), y.globalAlpha = 1, y.clearRect(0, 0, p.width, p.height);
for (T = -b; T <= b; T++) w = (Math.random() - .5) / 4, x = T / b, S = P * x * g + w, y.globalAlpha = 1 - Math.abs(x), y.drawImage(f, w, S), v.drawImage(p, 0, 0), y.globalAlpha = 1, y.clearRect(0, 0, p.width, p.height);
l.ctx.drawImage(f, 0, 0);
var I = l.ctx.getImageData(0, 0, f.width, f.height);
return v.globalAlpha = 1, v.clearRect(0, 0, f.width, f.height), I
},
getUniformLocations: function(l, u) {
return {
delta: l.getUniformLocation(u, "uDelta")
}
},
sendUniformData: function(l, u) {
var f = this.chooseRightDelta();
l.uniform2fv(u.delta, f)
},
chooseRightDelta: function() {
var l = 1,
u = [0, 0],
f;
return this.horizontal ? this.aspectRatio > 1 && (l = 1 / this.aspectRatio) : this.aspectRatio < 1 && (l = this.aspectRatio), f = l * this.blur * .12, this.horizontal ? u[0] = f : u[1] = f, u
}
}), c.Blur.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.Gamma = h(c.BaseFilter, {
type: "Gamma",
fragmentSource: `precision highp float;
uniform sampler2D uTexture;
uniform vec3 uGamma;
varying vec2 vTexCoord;
void main() {
vec4 color = texture2D(uTexture, vTexCoord);
vec3 correction = (1.0 / uGamma);
color.r = pow(color.r, correction.r);
color.g = pow(color.g, correction.g);
color.b = pow(color.b, correction.b);
gl_FragColor = color;
gl_FragColor.rgb *= color.a;
}`,
gamma: [1, 1, 1],
mainParameter: "gamma",
initialize: function(l) {
this.gamma = [1, 1, 1], c.BaseFilter.prototype.initialize.call(this, l)
},
applyTo2d: function(l) {
var u = l.imageData,
f = u.data,
p = this.gamma,
m = f.length,
g = 1 / p[0],
v = 1 / p[1],
y = 1 / p[2],
b;
for (this.rVals || (this.rVals = new Uint8Array(256), this.gVals = new Uint8Array(256), this.bVals = new Uint8Array(256)), b = 0, m = 256; b < m; b++) this.rVals[b] = Math.pow(b / 255, g) * 255, this.gVals[b] = Math.pow(b / 255, v) * 255, this.bVals[b] = Math.pow(b / 255, y) * 255;
for (b = 0, m = f.length; b < m; b += 4) f[b] = this.rVals[f[b]], f[b + 1] = this.gVals[f[b + 1]], f[b + 2] = this.bVals[f[b + 2]]
},
getUniformLocations: function(l, u) {
return {
uGamma: l.getUniformLocation(u, "uGamma")
}
},
sendUniformData: function(l, u) {
l.uniform3fv(u.uGamma, this.gamma)
}
}), o.Image.filters.Gamma.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.Composed = h(c.BaseFilter, {
type: "Composed",
subFilters: [],
initialize: function(l) {
this.callSuper("initialize", l), this.subFilters = this.subFilters.slice(0)
},
applyTo: function(l) {
l.passes += this.subFilters.length - 1, this.subFilters.forEach(function(u) {
u.applyTo(l)
})
},
toObject: function() {
return o.util.object.extend(this.callSuper("toObject"), {
subFilters: this.subFilters.map(function(l) {
return l.toObject()
})
})
},
isNeutralState: function() {
return !this.subFilters.some(function(l) {
return !l.isNeutralState()
})
}
}), o.Image.filters.Composed.fromObject = function(l, u) {
var f = l.subFilters || [],
p = f.map(function(g) {
return new o.Image.filters[g.type](g)
}),
m = new o.Image.filters.Composed({
subFilters: p
});
return u && u(m), m
}
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.Image.filters,
h = o.util.createClass;
c.HueRotation = h(c.ColorMatrix, {
type: "HueRotation",
rotation: 0,
mainParameter: "rotation",
calculateMatrix: function() {
var l = this.rotation * Math.PI,
u = o.util.cos(l),
f = o.util.sin(l),
p = 1 / 3,
m = Math.sqrt(p) * f,
g = 1 - u;
this.matrix = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], this.matrix[0] = u + g / 3, this.matrix[1] = p * g - m, this.matrix[2] = p * g + m, this.matrix[5] = p * g + m, this.matrix[6] = u + p * g, this.matrix[7] = p * g - m, this.matrix[10] = p * g - m, this.matrix[11] = p * g + m, this.matrix[12] = u + p * g
},
isNeutralState: function(l) {
return this.calculateMatrix(), c.BaseFilter.prototype.isNeutralState.call(this, l)
},
applyTo: function(l) {
this.calculateMatrix(), c.BaseFilter.prototype.applyTo.call(this, l)
}
}), o.Image.filters.HueRotation.fromObject = o.Image.filters.BaseFilter.fromObject
}(t),
function(a) {
var o = a.fabric || (a.fabric = {}),
c = o.util.object.clone;
if (o.Text) {
o.warn("fabric.Text is already defined");
return
}
var h = "fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide pathAlign".split(" ");
o.Text = o.util.createClass(o.Object, {
_dimensionAffectingProps: ["fontSize", "fontWeight", "fontFamily", "fontStyle", "lineHeight", "text", "charSpacing", "textAlign", "styles", "path", "pathStartOffset", "pathSide", "pathAlign"],
_reNewline: /\r?\n/,
_reSpacesAndTabs: /[ \t\r]/g,
_reSpaceAndTab: /[ \t\r]/,
_reWords: /\S+/g,
type: "text",
fontSize: 40,
fontWeight: "normal",
fontFamily: "Times New Roman",
underline: !1,
overline: !1,
linethrough: !1,
textAlign: "left",
fontStyle: "normal",
lineHeight: 1.16,
superscript: {
size: .6,
baseline: -.35
},
subscript: {
size: .6,
baseline: .11
},
textBackgroundColor: "",
stateProperties: o.Object.prototype.stateProperties.concat(h),
cacheProperties: o.Object.prototype.cacheProperties.concat(h),
stroke: null,
shadow: null,
path: null,
pathStartOffset: 0,
pathSide: "left",
pathAlign: "baseline",
_fontSizeFraction: .222,
offsets: {
underline: .1,
linethrough: -.315,
overline: -.88
},
_fontSizeMult: 1.13,
charSpacing: 0,
styles: null,
_measuringContext: null,
deltaY: 0,
direction: "ltr",
_styleProperties: ["stroke", "strokeWidth", "fill", "fontFamily", "fontSize", "fontWeight", "fontStyle", "underline", "overline", "linethrough", "deltaY", "textBackgroundColor"],
__charBounds: [],
CACHE_FONT_SIZE: 400,
MIN_TEXT_WIDTH: 2,
initialize: function(l, u) {
this.styles = u ? u.styles || {} : {}, this.text = l, this.__skipDimension = !0, this.callSuper("initialize", u), this.path && this.setPathInfo(), this.__skipDimension = !1, this.initDimensions(), this.setCoords(), this.setupState({
propertySet: "_dimensionAffectingProps"
})
},
setPathInfo: function() {
var l = this.path;
l && (l.segmentsInfo = o.util.getPathSegmentsInfo(l.path))
},
getMeasuringContext: function() {
return o._measuringContext || (o._measuringContext = this.canvas && this.canvas.contextCache || o.util.createCanvasElement().getContext("2d")), o._measuringContext
},
_splitText: function() {
var l = this._splitTextIntoLines(this.text);
return this.textLines = l.lines, this._textLines = l.graphemeLines, this._unwrappedTextLines = l._unwrappedLines, this._text = l.graphemeText, l
},
initDimensions: function() {
this.__skipDimension || (this._splitText(), this._clearCache(), this.path ? (this.width = this.path.width, this.height = this.path.height) : (this.width = this.calcTextWidth() || this.cursorWidth || this.MIN_TEXT_WIDTH, this.height = this.calcTextHeight()), this.textAlign.indexOf("justify") !== -1 && this.enlargeSpaces(), this.saveState({
propertySet: "_dimensionAffectingProps"
}))
},
enlargeSpaces: function() {
for (var l, u, f, p, m, g, v, y = 0, b = this._textLines.length; y < b; y++)
if (!(this.textAlign !== "justify" && (y === b - 1 || this.isEndOfWrapping(y))) && (p = 0, m = this._textLines[y], u = this.getLineWidth(y), u < this.width && (v = this.textLines[y].match(this._reSpacesAndTabs)))) {
f = v.length, l = (this.width - u) / f;
for (var w = 0, x = m.length; w <= x; w++) g = this.__charBounds[y][w], this._reSpaceAndTab.test(m[w]) ? (g.width += l, g.kernedWidth += l, g.left += p, p += l) : g.left += p
}
},
isEndOfWrapping: function(l) {
return l === this._textLines.length - 1
},
missingNewlineOffset: function() {
return 1
},
toString: function() {
return "#<fabric.Text (" + this.complexity() + '): { "text": "' + this.text + '", "fontFamily": "' + this.fontFamily + '" }>'
},
_getCacheCanvasDimensions: function() {
var l = this.callSuper("_getCacheCanvasDimensions"),
u = this.fontSize;
return l.width += u * l.zoomX, l.height += u * l.zoomY, l
},
_render: function(l) {
var u = this.path;
u && !u.isNotVisible() && u._render(l), this._setTextStyles(l), this._renderTextLinesBackground(l), this._renderTextDecoration(l, "underline"), this._renderText(l), this._renderTextDecoration(l, "overline"), this._renderTextDecoration(l, "linethrough")
},
_renderText: function(l) {
this.paintFirst === "stroke" ? (this._renderTextStroke(l), this._renderTextFill(l)) : (this._renderTextFill(l), this._renderTextStroke(l))
},
_setTextStyles: function(l, u, f) {
if (l.textBaseline = "alphabetical", this.path) switch (this.pathAlign) {
case "center":
l.textBaseline = "middle";
break;
case "ascender":
l.textBaseline = "top";
break;
case "descender":
l.textBaseline = "bottom";
break
}
l.font = this._getFontDeclaration(u, f)
},
calcTextWidth: function() {
for (var l = this.getLineWidth(0), u = 1, f = this._textLines.length; u < f; u++) {
var p = this.getLineWidth(u);
p > l && (l = p)
}
return l
},
_renderTextLine: function(l, u, f, p, m, g) {
this._renderChars(l, u, f, p, m, g)
},
_renderTextLinesBackground: function(l) {
if (!(!this.textBackgroundColor && !this.styleHas("textBackgroundColor"))) {
for (var u, f, p = l.fillStyle, m, g, v = this._getLeftOffset(), y = this._getTopOffset(), b = 0, w = 0, x, S, T = this.path, P, I = 0, z = this._textLines.length; I < z; I++) {
if (u = this.getHeightOfLine(I), !this.textBackgroundColor && !this.styleHas("textBackgroundColor", I)) {
y += u;
continue
}
m = this._textLines[I], f = this._getLineLeftOffset(I), w = 0, b = 0, g = this.getValueOfPropertyAt(I, 0, "textBackgroundColor");
for (var H = 0, ee = m.length; H < ee; H++) x = this.__charBounds[I][H], S = this.getValueOfPropertyAt(I, H, "textBackgroundColor"), T ? (l.save(), l.translate(x.renderLeft, x.renderTop), l.rotate(x.angle), l.fillStyle = S, S && l.fillRect(-x.width / 2, -u / this.lineHeight * (1 - this._fontSizeFraction), x.width, u / this.lineHeight), l.restore()) : S !== g ? (P = v + f + b, this.direction === "rtl" && (P = this.width - P - w), l.fillStyle = g, g && l.fillRect(P, y, w, u / this.lineHeight), b = x.left, w = x.width, g = S) : w += x.kernedWidth;
S && !T && (P = v + f + b, this.direction === "rtl" && (P = this.width - P - w), l.fillStyle = S, l.fillRect(P, y, w, u / this.lineHeight)), y += u
}
l.fillStyle = p, this._removeShadow(l)
}
},
getFontCache: function(l) {
var u = l.fontFamily.toLowerCase();
o.charWidthsCache[u] || (o.charWidthsCache[u] = {});
var f = o.charWidthsCache[u],
p = l.fontStyle.toLowerCase() + "_" + (l.fontWeight + "").toLowerCase();
return f[p] || (f[p] = {}), f[p]
},
_measureChar: function(l, u, f, p) {
var m = this.getFontCache(u),
g = this._getFontDeclaration(u),
v = this._getFontDeclaration(p),
y = f + l,
b = g === v,
w, x, S, T = u.fontSize / this.CACHE_FONT_SIZE,
P;
if (f && m[f] !== void 0 && (S = m[f]), m[l] !== void 0 && (P = w = m[l]), b && m[y] !== void 0 && (x = m[y], P = x - S), w === void 0 || S === void 0 || x === void 0) {
var I = this.getMeasuringContext();
this._setTextStyles(I, u, !0)
}
return w === void 0 && (P = w = I.measureText(l).width, m[l] = w), S === void 0 && b && f && (S = I.measureText(f).width, m[f] = S), b && x === void 0 && (x = I.measureText(y).width, m[y] = x, P = x - S), {
width: w * T,
kernedWidth: P * T
}
},
getHeightOfChar: function(l, u) {
return this.getValueOfPropertyAt(l, u, "fontSize")
},
measureLine: function(l) {
var u = this._measureLine(l);
return this.charSpacing !== 0 && (u.width -= this._getWidthOfCharSpacing()), u.width < 0 && (u.width = 0), u
},
_measureLine: function(l) {
var u = 0,
f, p, m = this._textLines[l],
g, v, y = 0,
b = new Array(m.length),
w = 0,
x, S, T = this.path,
P = this.pathSide === "right";
for (this.__charBounds[l] = b, f = 0; f < m.length; f++) p = m[f], v = this._getGraphemeBox(p, l, f, g), b[f] = v, u += v.kernedWidth, g = p;
if (b[f] = {
left: v ? v.left + v.width : 0,
width: 0,
kernedWidth: 0,
height: this.fontSize
}, T) {
switch (S = T.segmentsInfo[T.segmentsInfo.length - 1].length, x = o.util.getPointOnPath(T.path, 0, T.segmentsInfo), x.x += T.pathOffset.x, x.y += T.pathOffset.y, this.textAlign) {
case "left":
w = P ? S - u : 0;
break;
case "center":
w = (S - u) / 2;
break;
case "right":
w = P ? 0 : S - u;
break
}
for (w += this.pathStartOffset * (P ? -1 : 1), f = P ? m.length - 1 : 0; P ? f >= 0 : f < m.length; P ? f-- : f++) v = b[f], w > S ? w %= S : w < 0 && (w += S), this._setGraphemeOnPath(w, v, x), w += v.kernedWidth
}
return {
width: u,
numOfSpaces: y
}
},
_setGraphemeOnPath: function(l, u, f) {
var p = l + u.kernedWidth / 2,
m = this.path,
g = o.util.getPointOnPath(m.path, p, m.segmentsInfo);
u.renderLeft = g.x - f.x, u.renderTop = g.y - f.y, u.angle = g.angle + (this.pathSide === "right" ? Math.PI : 0)
},
_getGraphemeBox: function(l, u, f, p, m) {
var g = this.getCompleteStyleDeclaration(u, f),
v = p ? this.getCompleteStyleDeclaration(u, f - 1) : {},
y = this._measureChar(l, g, p, v),
b = y.kernedWidth,
w = y.width,
x;
this.charSpacing !== 0 && (x = this._getWidthOfCharSpacing(), w += x, b += x);
var S = {
width: w,
left: 0,
height: g.fontSize,
kernedWidth: b,
deltaY: g.deltaY
};
if (f > 0 && !m) {
var T = this.__charBounds[u][f - 1];
S.left = T.left + T.width + y.kernedWidth - y.width
}
return S
},
getHeightOfLine: function(l) {
if (this.__lineHeights[l]) return this.__lineHeights[l];
for (var u = this._textLines[l], f = this.getHeightOfChar(l, 0), p = 1, m = u.length; p < m; p++) f = Math.max(this.getHeightOfChar(l, p), f);
return this.__lineHeights[l] = f * this.lineHeight * this._fontSizeMult
},
calcTextHeight: function() {
for (var l, u = 0, f = 0, p = this._textLines.length; f < p; f++) l = this.getHeightOfLine(f), u += f === p - 1 ? l / this.lineHeight : l;
return u
},
_getLeftOffset: function() {
return this.direction === "ltr" ? -this.width / 2 : this.width / 2
},
_getTopOffset: function() {
return -this.height / 2
},
_renderTextCommon: function(l, u) {
l.save();
for (var f = 0, p = this._getLeftOffset(), m = this._getTopOffset(), g = 0, v = this._textLines.length; g < v; g++) {
var y = this.getHeightOfLine(g),
b = y / this.lineHeight,
w = this._getLineLeftOffset(g);
this._renderTextLine(u, l, this._textLines[g], p + w, m + f + b, g), f += y
}
l.restore()
},
_renderTextFill: function(l) {
!this.fill && !this.styleHas("fill") || this._renderTextCommon(l, "fillText")
},
_renderTextStroke: function(l) {
(!this.stroke || this.strokeWidth === 0) && this.isEmptyStyles() || (this.shadow && !this.shadow.affectStroke && this._removeShadow(l), l.save(), this._setLineDash(l, this.strokeDashArray), l.beginPath(), this._renderTextCommon(l, "strokeText"), l.closePath(), l.restore())
},
_renderChars: function(l, u, f, p, m, g) {
var v = this.getHeightOfLine(g),
y = this.textAlign.indexOf("justify") !== -1,
b, w, x = "",
S, T = 0,
P, I = this.path,
z = !y && this.charSpacing === 0 && this.isEmptyStyles(g) && !I,
H = this.direction === "ltr",
ee = this.direction === "ltr" ? 1 : -1,
te, ne = u.canvas.getAttribute("dir");
if (u.save(), ne !== this.direction && (u.canvas.setAttribute("dir", H ? "ltr" : "rtl"), u.direction = H ? "ltr" : "rtl", u.textAlign = H ? "left" : "right"), m -= v * this._fontSizeFraction / this.lineHeight, z) {
this._renderChar(l, u, g, 0, f.join(""), p, m, v), u.restore();
return
}
for (var Z = 0, ie = f.length - 1; Z <= ie; Z++) P = Z === ie || this.charSpacing || I, x += f[Z], S = this.__charBounds[g][Z], T === 0 ? (p += ee * (S.kernedWidth - S.width), T += S.width) : T += S.kernedWidth, y && !P && this._reSpaceAndTab.test(f[Z]) && (P = !0), P || (b = b || this.getCompleteStyleDeclaration(g, Z), w = this.getCompleteStyleDeclaration(g, Z + 1), P = o.util.hasStyleChanged(b, w, !1)), P && (I ? (u.save(), u.translate(S.renderLeft, S.renderTop), u.rotate(S.angle), this._renderChar(l, u, g, Z, x, -T / 2, 0, v), u.restore()) : (te = p, this._renderChar(l, u, g, Z, x, te, m, v)), x = "", b = w, p += ee * T, T = 0);
u.restore()
},
_applyPatternGradientTransformText: function(l) {
var u = o.util.createCanvasElement(),
f, p = this.width + this.strokeWidth,
m = this.height + this.strokeWidth;
return u.width = p, u.height = m, f = u.getContext("2d"), f.beginPath(), f.moveTo(0, 0), f.lineTo(p, 0), f.lineTo(p, m), f.lineTo(0, m), f.closePath(), f.translate(p / 2, m / 2), f.fillStyle = l.toLive(f), this._applyPatternGradientTransform(f, l), f.fill(), f.createPattern(u, "no-repeat")
},
handleFiller: function(l, u, f) {
var p, m;
return f.toLive ? f.gradientUnits === "percentage" || f.gradientTransform || f.patternTransform ? (p = -this.width / 2, m = -this.height / 2, l.translate(p, m), l[u] = this._applyPatternGradientTransformText(f), {
offsetX: p,
offsetY: m
}) : (l[u] = f.toLive(l, this), this._applyPatternGradientTransform(l, f)) : (l[u] = f, {
offsetX: 0,
offsetY: 0
})
},
_setStrokeStyles: function(l, u) {
return l.lineWidth = u.strokeWidth, l.lineCap = this.strokeLineCap, l.lineDashOffset = this.strokeDashOffset, l.lineJoin = this.strokeLineJoin, l.miterLimit = this.strokeMiterLimit, this.handleFiller(l, "strokeStyle", u.stroke)
},
_setFillStyles: function(l, u) {
return this.handleFiller(l, "fillStyle", u.fill)
},
_renderChar: function(l, u, f, p, m, g, v) {
var y = this._getStyleDeclaration(f, p),
b = this.getCompleteStyleDeclaration(f, p),
w = l === "fillText" && b.fill,
x = l === "strokeText" && b.stroke && b.strokeWidth,
S, T;
!x && !w || (u.save(), w && (S = this._setFillStyles(u, b)), x && (T = this._setStrokeStyles(u, b)), u.font = this._getFontDeclaration(b), y && y.textBackgroundColor && this._removeShadow(u), y && y.deltaY && (v += y.deltaY), w && u.fillText(m, g - S.offsetX, v - S.offsetY), x && u.strokeText(m, g - T.offsetX, v - T.offsetY), u.restore())
},
setSuperscript: function(l, u) {
return this._setScript(l, u, this.superscript)
},
setSubscript: function(l, u) {
return this._setScript(l, u, this.subscript)
},
_setScript: function(l, u, f) {
var p = this.get2DCursorLocation(l, !0),
m = this.getValueOfPropertyAt(p.lineIndex, p.charIndex, "fontSize"),
g = this.getValueOfPropertyAt(p.lineIndex, p.charIndex, "deltaY"),
v = {
fontSize: m * f.size,
deltaY: g + m * f.baseline
};
return this.setSelectionStyles(v, l, u), this
},
_getLineLeftOffset: function(l) {
var u = this.getLineWidth(l),
f = this.width - u,
p = this.textAlign,
m = this.direction,
v, g = 0,
v = this.isEndOfWrapping(l);
return p === "justify" || p === "justify-center" && !v || p === "justify-right" && !v || p === "justify-left" && !v ? 0 : (p === "center" && (g = f / 2), p === "right" && (g = f), p === "justify-center" && (g = f / 2), p === "justify-right" && (g = f), m === "rtl" && (g -= f), g)
},
_clearCache: function() {
this.__lineWidths = [], this.__lineHeights = [], this.__charBounds = []
},
_shouldClearDimensionCache: function() {
var l = this._forceClearCache;
return l || (l = this.hasStateChanged("_dimensionAffectingProps")), l && (this.dirty = !0, this._forceClearCache = !1), l
},
getLineWidth: function(l) {
if (this.__lineWidths[l] !== void 0) return this.__lineWidths[l];
var u = this.measureLine(l),
f = u.width;
return this.__lineWidths[l] = f, f
},
_getWidthOfCharSpacing: function() {
return this.charSpacing !== 0 ? this.fontSize * this.charSpacing / 1e3 : 0
},
getValueOfPropertyAt: function(l, u, f) {
var p = this._getStyleDeclaration(l, u);
return p && typeof p[f] < "u" ? p[f] : this[f]
},
_renderTextDecoration: function(l, u) {
if (!(!this[u] && !this.styleHas(u))) {
for (var f, p, m, g, v, y, b, w, x = this._getLeftOffset(), S = this._getTopOffset(), T, P, I, z, H, ee, te, ne, Z = this.path, ie = this._getWidthOfCharSpacing(), ce = this.offsets[u], V = 0, C = this._textLines.length; V < C; V++) {
if (f = this.getHeightOfLine(V), !this[u] && !this.styleHas(u, V)) {
S += f;
continue
}
b = this._textLines[V], ee = f / this.lineHeight, g = this._getLineLeftOffset(V), P = 0, I = 0, w = this.getValueOfPropertyAt(V, 0, u), ne = this.getValueOfPropertyAt(V, 0, "fill"), T = S + ee * (1 - this._fontSizeFraction), p = this.getHeightOfChar(V, 0), v = this.getValueOfPropertyAt(V, 0, "deltaY");
for (var k = 0, M = b.length; k < M; k++)
if (z = this.__charBounds[V][k], H = this.getValueOfPropertyAt(V, k, u), te = this.getValueOfPropertyAt(V, k, "fill"), m = this.getHeightOfChar(V, k), y = this.getValueOfPropertyAt(V, k, "deltaY"), Z && H && te) l.save(), l.fillStyle = ne, l.translate(z.renderLeft, z.renderTop), l.rotate(z.angle), l.fillRect(-z.kernedWidth / 2, ce * m + y, z.kernedWidth, this.fontSize / 15), l.restore();
else if ((H !== w || te !== ne || m !== p || y !== v) && I > 0) {
var D = x + g + P;
this.direction === "rtl" && (D = this.width - D - I), w && ne && (l.fillStyle = ne, l.fillRect(D, T + ce * p + v, I, this.fontSize / 15)), P = z.left, I = z.width, w = H, ne = te, p = m, v = y
} else I += z.kernedWidth;
var D = x + g + P;
this.direction === "rtl" && (D = this.width - D - I), l.fillStyle = te, H && te && l.fillRect(D, T + ce * p + v, I - ie, this.fontSize / 15), S += f
}
this._removeShadow(l)
}
},
_getFontDeclaration: function(l, u) {
var f = l || this,
p = this.fontFamily,
m = o.Text.genericFonts.indexOf(p.toLowerCase()) > -1,
g = p === void 0 || p.indexOf("'") > -1 || p.indexOf(",") > -1 || p.indexOf('"') > -1 || m ? f.fontFamily : '"' + f.fontFamily + '"';
return [o.isLikelyNode ? f.fontWeight : f.fontStyle, o.isLikelyNode ? f.fontStyle : f.fontWeight, u ? this.CACHE_FONT_SIZE + "px" : f.fontSize + "px", g].join(" ")
},
render: function(l) {
!this.visible || this.canvas && this.canvas.skipOffscreen && !this.group && !this.isOnScreen() || (this._shouldClearDimensionCache() && this.initDimensions(), this.callSuper("render", l))
},
_splitTextIntoLines: function(l) {
for (var u = l.split(this._reNewline), f = new Array(u.length), p = [`
`], m = [], g = 0; g < u.length; g++) f[g] = o.util.string.graphemeSplit(u[g]), m = m.concat(f[g], p);
return m.pop(), {
_unwrappedLines: f,
lines: u,
graphemeText: m,
graphemeLines: f
}
},
toObject: function(l) {
var u = h.concat(l),
f = this.callSuper("toObject", u);
return f.styles = o.util.stylesToArray(this.styles, this.text), f.path && (f.path = this.path.toObject()), f
},
set: function(l, u) {
this.callSuper("set", l, u);
var f = !1,
p = !1;
if (typeof l == "object")
for (var m in l) m === "path" && this.setPathInfo(), f = f || this._dimensionAffectingProps.indexOf(m) !== -1, p = p || m === "path";
else f = this._dimensionAffectingProps.indexOf(l) !== -1, p = l === "path";
return p && this.setPathInfo(), f && (this.initDimensions(), this.setCoords()), this
},
complexity: function() {
return 1
}
}), o.Text.ATTRIBUTE_NAMES = o.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ")), o.Text.DEFAULT_SVG_FONT_SIZE = 16, o.Text.fromElement = function(l, u, f) {
if (!l) return u(null);
var p = o.parseAttributes(l, o.Text.ATTRIBUTE_NAMES),
m = p.textAnchor || "left";
if (f = o.util.object.extend(f ? c(f) : {}, p), f.top = f.top || 0, f.left = f.left || 0, p.textDecoration) {
var g = p.textDecoration;
g.indexOf("underline") !== -1 && (f.underline = !0), g.indexOf("overline") !== -1 && (f.overline = !0), g.indexOf("line-through") !== -1 && (f.linethrough = !0), delete f.textDecoration
}
"dx" in p && (f.left += p.dx), "dy" in p && (f.top += p.dy), "fontSize" in f || (f.fontSize = o.Text.DEFAULT_SVG_FONT_SIZE);
var v = "";
"textContent" in l ? v = l.textContent : "firstChild" in l && l.firstChild !== null && "data" in l.firstChild && l.firstChild.data !== null && (v = l.firstChild.data), v = v.replace(/^\s+|\s+$|\n+/g, "").replace(/\s+/g, " ");
var y = f.strokeWidth;
f.strokeWidth = 0;
var b = new o.Text(v, f),
w = b.getScaledHeight() / b.height,
x = (b.height + b.strokeWidth) * b.lineHeight - b.height,
S = x * w,
T = b.getScaledHeight() + S,
P = 0;
m === "center" && (P = b.getScaledWidth() / 2), m === "right" && (P = b.getScaledWidth()), b.set({
left: b.left - P,
top: b.top - (T - b.fontSize * (.07 + b._fontSizeFraction)) / b.lineHeight,
strokeWidth: typeof y < "u" ? y : 1
}), u(b)
}, o.Text.fromObject = function(l, u) {
var f = c(l),
p = l.path;
return delete f.path, o.Object._fromObject("Text", f, function(m) {
m.styles = o.util.stylesFromArray(l.styles, l.text), p ? o.Object._fromObject("Path", p, function(g) {
m.set("path", g), u(m)
}, "path") : u(m)
}, "text")
}, o.Text.genericFonts = ["sans-serif", "serif", "cursive", "fantasy", "monospace"], o.util.createAccessors && o.util.createAccessors(o.Text)
}(t),
function() {
e.util.object.extend(e.Text.prototype, {
isEmptyStyles: function(a) {
if (!this.styles || typeof a < "u" && !this.styles[a]) return !0;
var o = typeof a > "u" ? this.styles : {
line: this.styles[a]
};
for (var c in o)
for (var h in o[c])
for (var l in o[c][h]) return !1;
return !0
},
styleHas: function(a, o) {
if (!this.styles || !a || a === "" || typeof o < "u" && !this.styles[o]) return !1;
var c = typeof o > "u" ? this.styles : {
0: this.styles[o]
};
for (var h in c)
for (var l in c[h])
if (typeof c[h][l][a] < "u") return !0;
return !1
},
cleanStyle: function(a) {
if (!this.styles || !a || a === "") return !1;
var o = this.styles,
c = 0,
h, l, u = !0,
f = 0,
p;
for (var m in o) {
h = 0;
for (var g in o[m]) {
var p = o[m][g],
v = p.hasOwnProperty(a);
c++, v ? (l ? p[a] !== l && (u = !1) : l = p[a], p[a] === this[a] && delete p[a]) : u = !1, Object.keys(p).length !== 0 ? h++ : delete o[m][g]
}
h === 0 && delete o[m]
}
for (var y = 0; y < this._textLines.length; y++) f += this._textLines[y].length;
u && c === f && (this[a] = l, this.removeStyle(a))
},
removeStyle: function(a) {
if (!(!this.styles || !a || a === "")) {
var o = this.styles,
c, h, l;
for (h in o) {
c = o[h];
for (l in c) delete c[l][a], Object.keys(c[l]).length === 0 && delete c[l];
Object.keys(c).length === 0 && delete o[h]
}
}
},
_extendStyles: function(a, o) {
var c = this.get2DCursorLocation(a);
this._getLineStyle(c.lineIndex) || this._setLineStyle(c.lineIndex), this._getStyleDeclaration(c.lineIndex, c.charIndex) || this._setStyleDeclaration(c.lineIndex, c.charIndex, {}), e.util.object.extend(this._getStyleDeclaration(c.lineIndex, c.charIndex), o)
},
get2DCursorLocation: function(a, o) {
typeof a > "u" && (a = this.selectionStart);
for (var c = o ? this._unwrappedTextLines : this._textLines, h = c.length, l = 0; l < h; l++) {
if (a <= c[l].length) return {
lineIndex: l,
charIndex: a
};
a -= c[l].length + this.missingNewlineOffset(l)
}
return {
lineIndex: l - 1,
charIndex: c[l - 1].length < a ? c[l - 1].length : a
}
},
getSelectionStyles: function(a, o, c) {
typeof a > "u" && (a = this.selectionStart || 0), typeof o > "u" && (o = this.selectionEnd || a);
for (var h = [], l = a; l < o; l++) h.push(this.getStyleAtPosition(l, c));
return h
},
getStyleAtPosition: function(a, o) {
var c = this.get2DCursorLocation(a),
h = o ? this.getCompleteStyleDeclaration(c.lineIndex, c.charIndex) : this._getStyleDeclaration(c.lineIndex, c.charIndex);
return h || {}
},
setSelectionStyles: function(a, o, c) {
typeof o > "u" && (o = this.selectionStart || 0), typeof c > "u" && (c = this.selectionEnd || o);
for (var h = o; h < c; h++) this._extendStyles(h, a);
return this._forceClearCache = !0, this
},
_getStyleDeclaration: function(a, o) {
var c = this.styles && this.styles[a];
return c ? c[o] : null
},
getCompleteStyleDeclaration: function(a, o) {
for (var c = this._getStyleDeclaration(a, o) || {}, h = {}, l, u = 0; u < this._styleProperties.length; u++) l = this._styleProperties[u], h[l] = typeof c[l] > "u" ? this[l] : c[l];
return h
},
_setStyleDeclaration: function(a, o, c) {
this.styles[a][o] = c
},
_deleteStyleDeclaration: function(a, o) {
delete this.styles[a][o]
},
_getLineStyle: function(a) {
return !!this.styles[a]
},
_setLineStyle: function(a) {
this.styles[a] = {}
},
_deleteLineStyle: function(a) {
delete this.styles[a]
}
})
}(),
function() {
function a(o) {
o.textDecoration && (o.textDecoration.indexOf("underline") > -1 && (o.underline = !0), o.textDecoration.indexOf("line-through") > -1 && (o.linethrough = !0), o.textDecoration.indexOf("overline") > -1 && (o.overline = !0), delete o.textDecoration)
}
e.IText = e.util.createClass(e.Text, e.Observable, {
type: "i-text",
selectionStart: 0,
selectionEnd: 0,
selectionColor: "rgba(17,119,255,0.3)",
isEditing: !1,
editable: !0,
editingBorderColor: "rgba(102,153,255,0.25)",
cursorWidth: 2,
cursorColor: "",
cursorDelay: 1e3,
cursorDuration: 600,
caching: !0,
hiddenTextareaContainer: null,
_reSpace: /\s|\n/,
_currentCursorOpacity: 0,
_selectionDirection: null,
_abortCursorAnimation: !1,
__widthOfSpace: [],
inCompositionMode: !1,
initialize: function(o, c) {
this.callSuper("initialize", o, c), this.initBehavior()
},
setSelectionStart: function(o) {
o = Math.max(o, 0), this._updateAndFire("selectionStart", o)
},
setSelectionEnd: function(o) {
o = Math.min(o, this.text.length), this._updateAndFire("selectionEnd", o)
},
_updateAndFire: function(o, c) {
this[o] !== c && (this._fireSelectionChanged(), this[o] = c), this._updateTextarea()
},
_fireSelectionChanged: function() {
this.fire("selection:changed"), this.canvas && this.canvas.fire("text:selection:changed", {
target: this
})
},
initDimensions: function() {
this.isEditing && this.initDelayedCursor(), this.clearContextTop(), this.callSuper("initDimensions")
},
render: function(o) {
this.clearContextTop(), this.callSuper("render", o), this.cursorOffsetCache = {}, this.renderCursorOrSelection()
},
_render: function(o) {
this.callSuper("_render", o)
},
clearContextTop: function(o) {
if (!(!this.isEditing || !this.canvas || !this.canvas.contextTop)) {
var c = this.canvas.contextTop,
h = this.canvas.viewportTransform;
c.save(), c.transform(h[0], h[1], h[2], h[3], h[4], h[5]), this.transform(c), this._clearTextArea(c), o || c.restore()
}
},
renderCursorOrSelection: function() {
if (!(!this.isEditing || !this.canvas || !this.canvas.contextTop)) {
var o = this._getCursorBoundaries(),
c = this.canvas.contextTop;
this.clearContextTop(!0), this.selectionStart === this.selectionEnd ? this.renderCursor(o, c) : this.renderSelection(o, c), c.restore()
}
},
_clearTextArea: function(o) {
var c = this.width + 4,
h = this.height + 4;
o.clearRect(-c / 2, -h / 2, c, h)
},
_getCursorBoundaries: function(o) {
typeof o > "u" && (o = this.selectionStart);
var c = this._getLeftOffset(),
h = this._getTopOffset(),
l = this._getCursorBoundariesOffsets(o);
return {
left: c,
top: h,
leftOffset: l.left,
topOffset: l.top
}
},
_getCursorBoundariesOffsets: function(o) {
if (this.cursorOffsetCache && "top" in this.cursorOffsetCache) return this.cursorOffsetCache;
var c, h, l, u = 0,
f = 0,
p, m = this.get2DCursorLocation(o);
l = m.charIndex, h = m.lineIndex;
for (var g = 0; g < h; g++) u += this.getHeightOfLine(g);
c = this._getLineLeftOffset(h);
var v = this.__charBounds[h][l];
return v && (f = v.left), this.charSpacing !== 0 && l === this._textLines[h].length && (f -= this._getWidthOfCharSpacing()), p = {
top: u,
left: c + (f > 0 ? f : 0)
}, this.direction === "rtl" && (p.left *= -1), this.cursorOffsetCache = p, this.cursorOffsetCache
},
renderCursor: function(o, c) {
var h = this.get2DCursorLocation(),
l = h.lineIndex,
u = h.charIndex > 0 ? h.charIndex - 1 : 0,
f = this.getValueOfPropertyAt(l, u, "fontSize"),
p = this.scaleX * this.canvas.getZoom(),
m = this.cursorWidth / p,
g = o.topOffset,
v = this.getValueOfPropertyAt(l, u, "deltaY");
g += (1 - this._fontSizeFraction) * this.getHeightOfLine(l) / this.lineHeight - f * (1 - this._fontSizeFraction), this.inCompositionMode && this.renderSelection(o, c), c.fillStyle = this.cursorColor || this.getValueOfPropertyAt(l, u, "fill"), c.globalAlpha = this.__isMousedown ? 1 : this._currentCursorOpacity, c.fillRect(o.left + o.leftOffset - m / 2, g + o.top + v, m, f)
},
renderSelection: function(o, c) {
for (var h = this.inCompositionMode ? this.hiddenTextarea.selectionStart : this.selectionStart, l = this.inCompositionMode ? this.hiddenTextarea.selectionEnd : this.selectionEnd, u = this.textAlign.indexOf("justify") !== -1, f = this.get2DCursorLocation(h), p = this.get2DCursorLocation(l), m = f.lineIndex, g = p.lineIndex, v = f.charIndex < 0 ? 0 : f.charIndex, y = p.charIndex < 0 ? 0 : p.charIndex, b = m; b <= g; b++) {
var w = this._getLineLeftOffset(b) || 0,
x = this.getHeightOfLine(b),
S = 0,
T = 0,
P = 0;
if (b === m && (T = this.__charBounds[m][v].left), b >= m && b < g) P = u && !this.isEndOfWrapping(b) ? this.width : this.getLineWidth(b) || 5;
else if (b === g)
if (y === 0) P = this.__charBounds[g][y].left;
else {
var I = this._getWidthOfCharSpacing();
P = this.__charBounds[g][y - 1].left + this.__charBounds[g][y - 1].width - I
} S = x, (this.lineHeight < 1 || b === g && this.lineHeight > 1) && (x /= this.lineHeight);
var z = o.left + w + T,
H = P - T,
ee = x,
te = 0;
this.inCompositionMode ? (c.fillStyle = this.compositionColor || "black", ee = 1, te = x) : c.fillStyle = this.selectionColor, this.direction === "rtl" && (z = this.width - z - H), c.fillRect(z, o.top + o.topOffset + te, H, ee), o.topOffset += S
}
},
getCurrentCharFontSize: function() {
var o = this._getCurrentCharIndex();
return this.getValueOfPropertyAt(o.l, o.c, "fontSize")
},
getCurrentCharColor: function() {
var o = this._getCurrentCharIndex();
return this.getValueOfPropertyAt(o.l, o.c, "fill")
},
_getCurrentCharIndex: function() {
var o = this.get2DCursorLocation(this.selectionStart, !0),
c = o.charIndex > 0 ? o.charIndex - 1 : 0;
return {
l: o.lineIndex,
c
}
}
}), e.IText.fromObject = function(o, c) {
var h = e.util.stylesFromArray(o.styles, o.text),
l = Object.assign({}, o, {
styles: h
});
if (a(l), l.styles)
for (var u in l.styles)
for (var f in l.styles[u]) a(l.styles[u][f]);
e.Object._fromObject("IText", l, c, "text")
}
}(),
function() {
var a = e.util.object.clone;
e.util.object.extend(e.IText.prototype, {
initBehavior: function() {
this.initAddedHandler(), this.initRemovedHandler(), this.initCursorSelectionHandlers(), this.initDoubleClickSimulation(), this.mouseMoveHandler = this.mouseMoveHandler.bind(this)
},
onDeselect: function() {
this.isEditing && this.exitEditing(), this.selected = !1
},
initAddedHandler: function() {
var o = this;
this.on("added", function() {
var c = o.canvas;
c && (c._hasITextHandlers || (c._hasITextHandlers = !0, o._initCanvasHandlers(c)), c._iTextInstances = c._iTextInstances || [], c._iTextInstances.push(o))
})
},
initRemovedHandler: function() {
var o = this;
this.on("removed", function() {
var c = o.canvas;
c && (c._iTextInstances = c._iTextInstances || [], e.util.removeFromArray(c._iTextInstances, o), c._iTextInstances.length === 0 && (c._hasITextHandlers = !1, o._removeCanvasHandlers(c)))
})
},
_initCanvasHandlers: function(o) {
o._mouseUpITextHandler = function() {
o._iTextInstances && o._iTextInstances.forEach(function(c) {
c.__isMousedown = !1
})
}, o.on("mouse:up", o._mouseUpITextHandler)
},
_removeCanvasHandlers: function(o) {
o.off("mouse:up", o._mouseUpITextHandler)
},
_tick: function() {
this._currentTickState = this._animateCursor(this, 1, this.cursorDuration, "_onTickComplete")
},
_animateCursor: function(o, c, h, l) {
var u;
return u = {
isAborted: !1,
abort: function() {
this.isAborted = !0
}
}, o.animate("_currentCursorOpacity", c, {
duration: h,
onComplete: function() {
u.isAborted || o[l]()
},
onChange: function() {
o.canvas && o.selectionStart === o.selectionEnd && o.renderCursorOrSelection()
},
abort: function() {
return u.isAborted
}
}), u
},
_onTickComplete: function() {
var o = this;
this._cursorTimeout1 && clearTimeout(this._cursorTimeout1), this._cursorTimeout1 = setTimeout(function() {
o._currentTickCompleteState = o._animateCursor(o, 0, this.cursorDuration / 2, "_tick")
}, 100)
},
initDelayedCursor: function(o) {
var c = this,
h = o ? 0 : this.cursorDelay;
this.abortCursorAnimation(), this._currentCursorOpacity = 1, this._cursorTimeout2 = setTimeout(function() {
c._tick()
}, h)
},
abortCursorAnimation: function() {
var o = this._currentTickState || this._currentTickCompleteState,
c = this.canvas;
this._currentTickState && this._currentTickState.abort(), this._currentTickCompleteState && this._currentTickCompleteState.abort(), clearTimeout(this._cursorTimeout1), clearTimeout(this._cursorTimeout2), this._currentCursorOpacity = 0, o && c && c.clearContext(c.contextTop || c.contextContainer)
},
selectAll: function() {
return this.selectionStart = 0, this.selectionEnd = this._text.length, this._fireSelectionChanged(), this._updateTextarea(), this
},
getSelectedText: function() {
return this._text.slice(this.selectionStart, this.selectionEnd).join("")
},
findWordBoundaryLeft: function(o) {
var c = 0,
h = o - 1;
if (this._reSpace.test(this._text[h]))
for (; this._reSpace.test(this._text[h]);) c++, h--;
for (;
/\S/.test(this._text[h]) && h > -1;) c++, h--;
return o - c
},
findWordBoundaryRight: function(o) {
var c = 0,
h = o;
if (this._reSpace.test(this._text[h]))
for (; this._reSpace.test(this._text[h]);) c++, h++;
for (;
/\S/.test(this._text[h]) && h < this._text.length;) c++, h++;
return o + c
},
findLineBoundaryLeft: function(o) {
for (var c = 0, h = o - 1; !/\n/.test(this._text[h]) && h > -1;) c++, h--;
return o - c
},
findLineBoundaryRight: function(o) {
for (var c = 0, h = o; !/\n/.test(this._text[h]) && h < this._text.length;) c++, h++;
return o + c
},
searchWordBoundary: function(o, c) {
for (var h = this._text, l = this._reSpace.test(h[o]) ? o - 1 : o, u = h[l], f = e.reNonWord; !f.test(u) && l > 0 && l < h.length;) l += c, u = h[l];
return f.test(u) && (l += c === 1 ? 0 : 1), l
},
selectWord: function(o) {
o = o || this.selectionStart;
var c = this.searchWordBoundary(o, -1),
h = this.searchWordBoundary(o, 1);
this.selectionStart = c, this.selectionEnd = h, this._fireSelectionChanged(), this._updateTextarea(), this.renderCursorOrSelection()
},
selectLine: function(o) {
o = o || this.selectionStart;
var c = this.findLineBoundaryLeft(o),
h = this.findLineBoundaryRight(o);
return this.selectionStart = c, this.selectionEnd = h, this._fireSelectionChanged(), this._updateTextarea(), this
},
enterEditing: function(o) {
if (!(this.isEditing || !this.editable)) return this.canvas && (this.canvas.calcOffset(), this.exitEditingOnOthers(this.canvas)), this.isEditing = !0, this.initHiddenTextarea(o), this.hiddenTextarea.focus(), this.hiddenTextarea.value = this.text, this._updateTextarea(), this._saveEditingProps(), this._setEditingProps(), this._textBeforeEdit = this.text, this._tick(), this.fire("editing:entered"), this._fireSelectionChanged(), this.canvas ? (this.canvas.fire("text:editing:entered", {
target: this
}), this.initMouseMoveHandler(), this.canvas.requestRenderAll(), this) : this
},
exitEditingOnOthers: function(o) {
o._iTextInstances && o._iTextInstances.forEach(function(c) {
c.selected = !1, c.isEditing && c.exitEditing()
})
},
initMouseMoveHandler: function() {
this.canvas.on("mouse:move", this.mouseMoveHandler)
},
mouseMoveHandler: function(o) {
if (!(!this.__isMousedown || !this.isEditing)) {
document.activeElement !== this.hiddenTextarea && this.hiddenTextarea.focus();
var c = this.getSelectionStartFromPointer(o.e),
h = this.selectionStart,
l = this.selectionEnd;
(c !== this.__selectionStartOnMouseDown || h === l) && (h === c || l === c) || (c > this.__selectionStartOnMouseDown ? (this.selectionStart = this.__selectionStartOnMouseDown, this.selectionEnd = c) : (this.selectionStart = c, this.selectionEnd = this.__selectionStartOnMouseDown), (this.selectionStart !== h || this.selectionEnd !== l) && (this.restartCursorIfNeeded(), this._fireSelectionChanged(), this._updateTextarea(), this.renderCursorOrSelection()))
}
},
_setEditingProps: function() {
this.hoverCursor = "text", this.canvas && (this.canvas.defaultCursor = this.canvas.moveCursor = "text"), this.borderColor = this.editingBorderColor, this.hasControls = this.selectable = !1, this.lockMovementX = this.lockMovementY = !0
},
fromStringToGraphemeSelection: function(o, c, h) {
var l = h.slice(0, o),
u = e.util.string.graphemeSplit(l).length;
if (o === c) return {
selectionStart: u,
selectionEnd: u
};
var f = h.slice(o, c),
p = e.util.string.graphemeSplit(f).length;
return {
selectionStart: u,
selectionEnd: u + p
}
},
fromGraphemeToStringSelection: function(o, c, h) {
var l = h.slice(0, o),
u = l.join("").length;
if (o === c) return {
selectionStart: u,
selectionEnd: u
};
var f = h.slice(o, c),
p = f.join("").length;
return {
selectionStart: u,
selectionEnd: u + p
}
},
_updateTextarea: function() {
if (this.cursorOffsetCache = {}, !!this.hiddenTextarea) {
if (!this.inCompositionMode) {
var o = this.fromGraphemeToStringSelection(this.selectionStart, this.selectionEnd, this._text);
this.hiddenTextarea.selectionStart = o.selectionStart, this.hiddenTextarea.selectionEnd = o.selectionEnd
}
this.updateTextareaPosition()
}
},
updateFromTextArea: function() {
if (!!this.hiddenTextarea) {
this.cursorOffsetCache = {}, this.text = this.hiddenTextarea.value, this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords());
var o = this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart, this.hiddenTextarea.selectionEnd, this.hiddenTextarea.value);
this.selectionEnd = this.selectionStart = o.selectionEnd, this.inCompositionMode || (this.selectionStart = o.selectionStart), this.updateTextareaPosition()
}
},
updateTextareaPosition: function() {
if (this.selectionStart === this.selectionEnd) {
var o = this._calcTextareaPosition();
this.hiddenTextarea.style.left = o.left, this.hiddenTextarea.style.top = o.top
}
},
_calcTextareaPosition: function() {
if (!this.canvas) return {
x: 1,
y: 1
};
var o = this.inCompositionMode ? this.compositionStart : this.selectionStart,
c = this._getCursorBoundaries(o),
h = this.get2DCursorLocation(o),
l = h.lineIndex,
u = h.charIndex,
f = this.getValueOfPropertyAt(l, u, "fontSize") * this.lineHeight,
p = c.leftOffset,
m = this.calcTransformMatrix(),
g = {
x: c.left + p,
y: c.top + c.topOffset + f
},
v = this.canvas.getRetinaScaling(),
y = this.canvas.upperCanvasEl,
b = y.width / v,
w = y.height / v,
x = b - f,
S = w - f,
T = y.clientWidth / b,
P = y.clientHeight / w;
return g = e.util.transformPoint(g, m), g = e.util.transformPoint(g, this.canvas.viewportTransform), g.x *= T, g.y *= P, g.x < 0 && (g.x = 0), g.x > x && (g.x = x), g.y < 0 && (g.y = 0), g.y > S && (g.y = S), g.x += this.canvas._offset.left, g.y += this.canvas._offset.top, {
left: g.x + "px",
top: g.y + "px",
fontSize: f + "px",
charHeight: f
}
},
_saveEditingProps: function() {
this._savedProps = {
hasControls: this.hasControls,
borderColor: this.borderColor,
lockMovementX: this.lockMovementX,
lockMovementY: this.lockMovementY,
hoverCursor: this.hoverCursor,
selectable: this.selectable,
defaultCursor: this.canvas && this.canvas.defaultCursor,
moveCursor: this.canvas && this.canvas.moveCursor
}
},
_restoreEditingProps: function() {
!this._savedProps || (this.hoverCursor = this._savedProps.hoverCursor, this.hasControls = this._savedProps.hasControls, this.borderColor = this._savedProps.borderColor, this.selectable = this._savedProps.selectable, this.lockMovementX = this._savedProps.lockMovementX, this.lockMovementY = this._savedProps.lockMovementY, this.canvas && (this.canvas.defaultCursor = this._savedProps.defaultCursor, this.canvas.moveCursor = this._savedProps.moveCursor))
},
exitEditing: function() {
var o = this._textBeforeEdit !== this.text,
c = this.hiddenTextarea;
return this.selected = !1, this.isEditing = !1, this.selectionEnd = this.selectionStart, c && (c.blur && c.blur(), c.parentNode && c.parentNode.removeChild(c)), this.hiddenTextarea = null, this.abortCursorAnimation(), this._restoreEditingProps(), this._currentCursorOpacity = 0, this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this.fire("editing:exited"), o && this.fire("modified"), this.canvas && (this.canvas.off("mouse:move", this.mouseMoveHandler), this.canvas.fire("text:editing:exited", {
target: this
}), o && this.canvas.fire("object:modified", {
target: this
})), this
},
_removeExtraneousStyles: function() {
for (var o in this.styles) this._textLines[o] || delete this.styles[o]
},
removeStyleFromTo: function(o, c) {
var h = this.get2DCursorLocation(o, !0),
l = this.get2DCursorLocation(c, !0),
u = h.lineIndex,
f = h.charIndex,
p = l.lineIndex,
m = l.charIndex,
g, v;
if (u !== p) {
if (this.styles[u])
for (g = f; g < this._unwrappedTextLines[u].length; g++) delete this.styles[u][g];
if (this.styles[p])
for (g = m; g < this._unwrappedTextLines[p].length; g++) v = this.styles[p][g], v && (this.styles[u] || (this.styles[u] = {}), this.styles[u][f + g - m] = v);
for (g = u + 1; g <= p; g++) delete this.styles[g];
this.shiftLineStyles(p, u - p)
} else if (this.styles[u]) {
v = this.styles[u];
var y = m - f,
b, w;
for (g = f; g < m; g++) delete v[g];
for (w in this.styles[u]) b = parseInt(w, 10), b >= m && (v[b - y] = v[w], delete v[w])
}
},
shiftLineStyles: function(o, c) {
var h = a(this.styles);
for (var l in this.styles) {
var u = parseInt(l, 10);
u > o && (this.styles[u + c] = h[u], h[u - c] || delete this.styles[u])
}
},
restartCursorIfNeeded: function() {
(!this._currentTickState || this._currentTickState.isAborted || !this._currentTickCompleteState || this._currentTickCompleteState.isAborted) && this.initDelayedCursor()
},
insertNewlineStyleObject: function(o, c, h, l) {
var u, f = {},
p = !1,
m = this._unwrappedTextLines[o].length === c;
h || (h = 1), this.shiftLineStyles(o, h), this.styles[o] && (u = this.styles[o][c === 0 ? c : c - 1]);
for (var g in this.styles[o]) {
var v = parseInt(g, 10);
v >= c && (p = !0, f[v - c] = this.styles[o][g], m && c === 0 || delete this.styles[o][g])
}
var y = !1;
for (p && !m && (this.styles[o + h] = f, y = !0), y && h--; h > 0;) l && l[h - 1] ? this.styles[o + h] = {
0: a(l[h - 1])
} : u ? this.styles[o + h] = {
0: a(u)
} : delete this.styles[o + h], h--;
this._forceClearCache = !0
},
insertCharStyleObject: function(o, c, h, l) {
this.styles || (this.styles = {});
var u = this.styles[o],
f = u ? a(u) : {};
h || (h = 1);
for (var p in f) {
var m = parseInt(p, 10);
m >= c && (u[m + h] = f[m], f[m - h] || delete u[m])
}
if (this._forceClearCache = !0, l) {
for (; h--;) !Object.keys(l[h]).length || (this.styles[o] || (this.styles[o] = {}), this.styles[o][c + h] = a(l[h]));
return
}
if (!!u)
for (var g = u[c ? c - 1 : 1]; g && h--;) this.styles[o][c + h] = a(g)
},
insertNewStyleBlock: function(o, c, h) {
for (var l = this.get2DCursorLocation(c, !0), u = [0], f = 0, p = 0; p < o.length; p++) o[p] === `
` ? (f++, u[f] = 0) : u[f]++;
u[0] > 0 && (this.insertCharStyleObject(l.lineIndex, l.charIndex, u[0], h), h = h && h.slice(u[0] + 1)), f && this.insertNewlineStyleObject(l.lineIndex, l.charIndex + u[0], f);
for (var p = 1; p < f; p++) u[p] > 0 ? this.insertCharStyleObject(l.lineIndex + p, 0, u[p], h) : h && this.styles[l.lineIndex + p] && h[0] && (this.styles[l.lineIndex + p][0] = h[0]), h = h && h.slice(u[p] + 1);
u[p] > 0 && this.insertCharStyleObject(l.lineIndex + p, 0, u[p], h)
},
setSelectionStartEndWithShift: function(o, c, h) {
h <= o ? (c === o ? this._selectionDirection = "left" : this._selectionDirection === "right" && (this._selectionDirection = "left", this.selectionEnd = o), this.selectionStart = h) : h > o && h < c ? this._selectionDirection === "right" ? this.selectionEnd = h : this.selectionStart = h : (c === o ? this._selectionDirection = "right" : this._selectionDirection === "left" && (this._selectionDirection = "right", this.selectionStart = c), this.selectionEnd = h)
},
setSelectionInBoundaries: function() {
var o = this.text.length;
this.selectionStart > o ? this.selectionStart = o : this.selectionStart < 0 && (this.selectionStart = 0), this.selectionEnd > o ? this.selectionEnd = o : this.selectionEnd < 0 && (this.selectionEnd = 0)
}
})
}(), e.util.object.extend(e.IText.prototype, {
initDoubleClickSimulation: function() {
this.__lastClickTime = +new Date, this.__lastLastClickTime = +new Date, this.__lastPointer = {}, this.on("mousedown", this.onMouseDown)
},
onMouseDown: function(a) {
if (!!this.canvas) {
this.__newClickTime = +new Date;
var o = a.pointer;
this.isTripleClick(o) && (this.fire("tripleclick", a), this._stopEvent(a.e)), this.__lastLastClickTime = this.__lastClickTime, this.__lastClickTime = this.__newClickTime, this.__lastPointer = o, this.__lastIsEditing = this.isEditing, this.__lastSelected = this.selected
}
},
isTripleClick: function(a) {
return this.__newClickTime - this.__lastClickTime < 500 && this.__lastClickTime - this.__lastLastClickTime < 500 && this.__lastPointer.x === a.x && this.__lastPointer.y === a.y
},
_stopEvent: function(a) {
a.preventDefault && a.preventDefault(), a.stopPropagation && a.stopPropagation()
},
initCursorSelectionHandlers: function() {
this.initMousedownHandler(), this.initMouseupHandler(), this.initClicks()
},
doubleClickHandler: function(a) {
!this.isEditing || this.selectWord(this.getSelectionStartFromPointer(a.e))
},
tripleClickHandler: function(a) {
!this.isEditing || this.selectLine(this.getSelectionStartFromPointer(a.e))
},
initClicks: function() {
this.on("mousedblclick", this.doubleClickHandler), this.on("tripleclick", this.tripleClickHandler)
},
_mouseDownHandler: function(a) {
!this.canvas || !this.editable || a.e.button && a.e.button !== 1 || (this.__isMousedown = !0, this.selected && (this.inCompositionMode = !1, this.setCursorByClick(a.e)), this.isEditing && (this.__selectionStartOnMouseDown = this.selectionStart, this.selectionStart === this.selectionEnd && this.abortCursorAnimation(), this.renderCursorOrSelection()))
},
_mouseDownHandlerBefore: function(a) {
!this.canvas || !this.editable || a.e.button && a.e.button !== 1 || (this.selected = this === this.canvas._activeObject)
},
initMousedownHandler: function() {
this.on("mousedown", this._mouseDownHandler), this.on("mousedown:before", this._mouseDownHandlerBefore)
},
initMouseupHandler: function() {
this.on("mouseup", this.mouseUpHandler)
},
mouseUpHandler: function(a) {
if (this.__isMousedown = !1, !(!this.editable || this.group || a.transform && a.transform.actionPerformed || a.e.button && a.e.button !== 1)) {
if (this.canvas) {
var o = this.canvas._activeObject;
if (o && o !== this) return
}
this.__lastSelected && !this.__corner ? (this.selected = !1, this.__lastSelected = !1, this.enterEditing(a.e), this.selectionStart === this.selectionEnd ? this.initDelayedCursor(!0) : this.renderCursorOrSelection()) : this.selected = !0
}
},
setCursorByClick: function(a) {
var o = this.getSelectionStartFromPointer(a),
c = this.selectionStart,
h = this.selectionEnd;
a.shiftKey ? this.setSelectionStartEndWithShift(c, h, o) : (this.selectionStart = o, this.selectionEnd = o), this.isEditing && (this._fireSelectionChanged(), this._updateTextarea())
},
getSelectionStartFromPointer: function(a) {
for (var o = this.getLocalPointer(a), c = 0, h = 0, l = 0, u = 0, f = 0, p, m, g = 0, v = this._textLines.length; g < v && l <= o.y; g++) l += this.getHeightOfLine(g) * this.scaleY, f = g, g > 0 && (u += this._textLines[g - 1].length + this.missingNewlineOffset(g - 1));
p = this._getLineLeftOffset(f), h = p * this.scaleX, m = this._textLines[f], this.direction === "rtl" && (o.x = this.width * this.scaleX - o.x + h);
for (var y = 0, b = m.length; y < b && (c = h, h += this.__charBounds[f][y].kernedWidth * this.scaleX, h <= o.x); y++) u++;
return this._getNewSelectionStartFromOffset(o, c, h, u, b)
},
_getNewSelectionStartFromOffset: function(a, o, c, h, l) {
var u = a.x - o,
f = c - a.x,
p = f > u || f < 0 ? 0 : 1,
m = h + p;
return this.flipX && (m = l - m), m > this._text.length && (m = this._text.length), m
}
}), e.util.object.extend(e.IText.prototype, {
initHiddenTextarea: function() {
this.hiddenTextarea = e.document.createElement("textarea"), this.hiddenTextarea.setAttribute("autocapitalize", "off"), this.hiddenTextarea.setAttribute("autocorrect", "off"), this.hiddenTextarea.setAttribute("autocomplete", "off"), this.hiddenTextarea.setAttribute("spellcheck", "false"), this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea", ""), this.hiddenTextarea.setAttribute("wrap", "off");
var a = this._calcTextareaPosition();
this.hiddenTextarea.style.cssText = "position: absolute; top: " + a.top + "; left: " + a.left + "; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding\uFF70top: " + a.fontSize + ";", this.hiddenTextareaContainer ? this.hiddenTextareaContainer.appendChild(this.hiddenTextarea) : e.document.body.appendChild(this.hiddenTextarea), e.util.addListener(this.hiddenTextarea, "keydown", this.onKeyDown.bind(this)), e.util.addListener(this.hiddenTextarea, "keyup", this.onKeyUp.bind(this)), e.util.addListener(this.hiddenTextarea, "input", this.onInput.bind(this)), e.util.addListener(this.hiddenTextarea, "copy", this.copy.bind(this)), e.util.addListener(this.hiddenTextarea, "cut", this.copy.bind(this)), e.util.addListener(this.hiddenTextarea, "paste", this.paste.bind(this)), e.util.addListener(this.hiddenTextarea, "compositionstart", this.onCompositionStart.bind(this)), e.util.addListener(this.hiddenTextarea, "compositionupdate", this.onCompositionUpdate.bind(this)), e.util.addListener(this.hiddenTextarea, "compositionend", this.onCompositionEnd.bind(this)), !this._clickHandlerInitialized && this.canvas && (e.util.addListener(this.canvas.upperCanvasEl, "click", this.onClick.bind(this)), this._clickHandlerInitialized = !0)
},
keysMap: {
9: "exitEditing",
27: "exitEditing",
33: "moveCursorUp",
34: "moveCursorDown",
35: "moveCursorRight",
36: "moveCursorLeft",
37: "moveCursorLeft",
38: "moveCursorUp",
39: "moveCursorRight",
40: "moveCursorDown"
},
keysMapRtl: {
9: "exitEditing",
27: "exitEditing",
33: "moveCursorUp",
34: "moveCursorDown",
35: "moveCursorLeft",
36: "moveCursorRight",
37: "moveCursorRight",
38: "moveCursorUp",
39: "moveCursorLeft",
40: "moveCursorDown"
},
ctrlKeysMapUp: {
67: "copy",
88: "cut"
},
ctrlKeysMapDown: {
65: "selectAll"
},
onClick: function() {
this.hiddenTextarea && this.hiddenTextarea.focus()
},
onKeyDown: function(a) {
if (!!this.isEditing) {
var o = this.direction === "rtl" ? this.keysMapRtl : this.keysMap;
if (a.keyCode in o) this[o[a.keyCode]](a);
else if (a.keyCode in this.ctrlKeysMapDown && (a.ctrlKey || a.metaKey)) this[this.ctrlKeysMapDown[a.keyCode]](a);
else return;
a.stopImmediatePropagation(), a.preventDefault(), a.keyCode >= 33 && a.keyCode <= 40 ? (this.inCompositionMode = !1, this.clearContextTop(), this.renderCursorOrSelection()) : this.canvas && this.canvas.requestRenderAll()
}
},
onKeyUp: function(a) {
if (!this.isEditing || this._copyDone || this.inCompositionMode) {
this._copyDone = !1;
return
}
if (a.keyCode in this.ctrlKeysMapUp && (a.ctrlKey || a.metaKey)) this[this.ctrlKeysMapUp[a.keyCode]](a);
else return;
a.stopImmediatePropagation(), a.preventDefault(), this.canvas && this.canvas.requestRenderAll()
},
onInput: function(a) {
var o = this.fromPaste;
if (this.fromPaste = !1, a && a.stopPropagation(), !!this.isEditing) {
var c = this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,
h = this._text.length,
l = c.length,
u, f, p = l - h,
m = this.selectionStart,
g = this.selectionEnd,
v = m !== g,
y, b, w;
if (this.hiddenTextarea.value === "") {
this.styles = {}, this.updateFromTextArea(), this.fire("changed"), this.canvas && (this.canvas.fire("text:changed", {
target: this
}), this.canvas.requestRenderAll());
return
}
var x = this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart, this.hiddenTextarea.selectionEnd, this.hiddenTextarea.value),
S = m > x.selectionStart;
v ? (u = this._text.slice(m, g), p += g - m) : l < h && (S ? u = this._text.slice(g + p, g) : u = this._text.slice(m, m - p)), f = c.slice(x.selectionEnd - p, x.selectionEnd), u && u.length && (f.length && (y = this.getSelectionStyles(m, m + 1, !1), y = f.map(function() {
return y[0]
})), v ? (b = m, w = g) : S ? (b = g - u.length, w = g) : (b = g, w = g + u.length), this.removeStyleFromTo(b, w)), f.length && (o && f.join("") === e.copiedText && !e.disableStyleCopyPaste && (y = e.copiedTextStyle), this.insertNewStyleBlock(f, m, y)), this.updateFromTextArea(), this.fire("changed"), this.canvas && (this.canvas.fire("text:changed", {
target: this
}), this.canvas.requestRenderAll())
}
},
onCompositionStart: function() {
this.inCompositionMode = !0
},
onCompositionEnd: function() {
this.inCompositionMode = !1
},
onCompositionUpdate: function(a) {
this.compositionStart = a.target.selectionStart, this.compositionEnd = a.target.selectionEnd, this.updateTextareaPosition()
},
copy: function() {
this.selectionStart !== this.selectionEnd && (e.copiedText = this.getSelectedText(), e.disableStyleCopyPaste ? e.copiedTextStyle = null : e.copiedTextStyle = this.getSelectionStyles(this.selectionStart, this.selectionEnd, !0), this._copyDone = !0)
},
paste: function() {
this.fromPaste = !0
},
_getClipboardData: function(a) {
return a && a.clipboardData || e.window.clipboardData
},
_getWidthBeforeCursor: function(a, o) {
var c = this._getLineLeftOffset(a),
h;
return o > 0 && (h = this.__charBounds[a][o - 1], c += h.left + h.width), c
},
getDownCursorOffset: function(a, o) {
var c = this._getSelectionForOffset(a, o),
h = this.get2DCursorLocation(c),
l = h.lineIndex;
if (l === this._textLines.length - 1 || a.metaKey || a.keyCode === 34) return this._text.length - c;
var u = h.charIndex,
f = this._getWidthBeforeCursor(l, u),
p = this._getIndexOnLine(l + 1, f),
m = this._textLines[l].slice(u);
return m.length + p + 1 + this.missingNewlineOffset(l)
},
_getSelectionForOffset: function(a, o) {
return a.shiftKey && this.selectionStart !== this.selectionEnd && o ? this.selectionEnd : this.selectionStart
},
getUpCursorOffset: function(a, o) {
var c = this._getSelectionForOffset(a, o),
h = this.get2DCursorLocation(c),
l = h.lineIndex;
if (l === 0 || a.metaKey || a.keyCode === 33) return -c;
var u = h.charIndex,
f = this._getWidthBeforeCursor(l, u),
p = this._getIndexOnLine(l - 1, f),
m = this._textLines[l].slice(0, u),
g = this.missingNewlineOffset(l - 1);
return -this._textLines[l - 1].length + p - m.length + (1 - g)
},
_getIndexOnLine: function(a, o) {
for (var c = this._textLines[a], h = this._getLineLeftOffset(a), l = h, u = 0, f, p, m = 0, g = c.length; m < g; m++)
if (f = this.__charBounds[a][m].width, l += f, l > o) {
p = !0;
var v = l - f,
y = l,
b = Math.abs(v - o),
w = Math.abs(y - o);
u = w < b ? m : m - 1;
break
} return p || (u = c.length - 1), u
},
moveCursorDown: function(a) {
this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length || this._moveCursorUpOrDown("Down", a)
},
moveCursorUp: function(a) {
this.selectionStart === 0 && this.selectionEnd === 0 || this._moveCursorUpOrDown("Up", a)
},
_moveCursorUpOrDown: function(a, o) {
var c = "get" + a + "CursorOffset",
h = this[c](o, this._selectionDirection === "right");
o.shiftKey ? this.moveCursorWithShift(h) : this.moveCursorWithoutShift(h), h !== 0 && (this.setSelectionInBoundaries(), this.abortCursorAnimation(), this._currentCursorOpacity = 1, this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea())
},
moveCursorWithShift: function(a) {
var o = this._selectionDirection === "left" ? this.selectionStart + a : this.selectionEnd + a;
return this.setSelectionStartEndWithShift(this.selectionStart, this.selectionEnd, o), a !== 0
},
moveCursorWithoutShift: function(a) {
return a < 0 ? (this.selectionStart += a, this.selectionEnd = this.selectionStart) : (this.selectionEnd += a, this.selectionStart = this.selectionEnd), a !== 0
},
moveCursorLeft: function(a) {
this.selectionStart === 0 && this.selectionEnd === 0 || this._moveCursorLeftOrRight("Left", a)
},
_move: function(a, o, c) {
var h;
if (a.altKey) h = this["findWordBoundary" + c](this[o]);
else if (a.metaKey || a.keyCode === 35 || a.keyCode === 36) h = this["findLineBoundary" + c](this[o]);
else return this[o] += c === "Left" ? -1 : 1, !0;
if (typeof h < "u" && this[o] !== h) return this[o] = h, !0
},
_moveLeft: function(a, o) {
return this._move(a, o, "Left")
},
_moveRight: function(a, o) {
return this._move(a, o, "Right")
},
moveCursorLeftWithoutShift: function(a) {
var o = !0;
return this._selectionDirection = "left", this.selectionEnd === this.selectionStart && this.selectionStart !== 0 && (o = this._moveLeft(a, "selectionStart")), this.selectionEnd = this.selectionStart, o
},
moveCursorLeftWithShift: function(a) {
if (this._selectionDirection === "right" && this.selectionStart !== this.selectionEnd) return this._moveLeft(a, "selectionEnd");
if (this.selectionStart !== 0) return this._selectionDirection = "left", this._moveLeft(a, "selectionStart")
},
moveCursorRight: function(a) {
this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length || this._moveCursorLeftOrRight("Right", a)
},
_moveCursorLeftOrRight: function(a, o) {
var c = "moveCursor" + a + "With";
this._currentCursorOpacity = 1, o.shiftKey ? c += "Shift" : c += "outShift", this[c](o) && (this.abortCursorAnimation(), this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea())
},
moveCursorRightWithShift: function(a) {
if (this._selectionDirection === "left" && this.selectionStart !== this.selectionEnd) return this._moveRight(a, "selectionStart");
if (this.selectionEnd !== this._text.length) return this._selectionDirection = "right", this._moveRight(a, "selectionEnd")
},
moveCursorRightWithoutShift: function(a) {
var o = !0;
return this._selectionDirection = "right", this.selectionStart === this.selectionEnd ? (o = this._moveRight(a, "selectionStart"), this.selectionEnd = this.selectionStart) : this.selectionStart = this.selectionEnd, o
},
removeChars: function(a, o) {
typeof o > "u" && (o = a + 1), this.removeStyleFromTo(a, o), this._text.splice(a, o - a), this.text = this._text.join(""), this.set("dirty", !0), this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this._removeExtraneousStyles()
},
insertChars: function(a, o, c, h) {
typeof h > "u" && (h = c), h > c && this.removeStyleFromTo(c, h);
var l = e.util.string.graphemeSplit(a);
this.insertNewStyleBlock(l, c, o), this._text = [].concat(this._text.slice(0, c), l, this._text.slice(h)), this.text = this._text.join(""), this.set("dirty", !0), this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this._removeExtraneousStyles()
}
}),
function() {
var a = e.util.toFixed,
o = / +/g;
e.util.object.extend(e.Text.prototype, {
_toSVG: function() {
var c = this._getSVGLeftTopOffsets(),
h = this._getSVGTextAndBg(c.textTop, c.textLeft);
return this._wrapSVGTextAndBg(h)
},
toSVG: function(c) {
return this._createBaseSVGMarkup(this._toSVG(), {
reviver: c,
noStyle: !0,
withShadow: !0
})
},
_getSVGLeftTopOffsets: function() {
return {
textLeft: -this.width / 2,
textTop: -this.height / 2,
lineTop: this.getHeightOfLine(0)
}
},
_wrapSVGTextAndBg: function(c) {
var h = !0,
l = this.getSvgTextDecoration(this);
return [c.textBgRects.join(""), ' <text xml:space="preserve" ', this.fontFamily ? 'font-family="' + this.fontFamily.replace(/"/g, "'") + '" ' : "", this.fontSize ? 'font-size="' + this.fontSize + '" ' : "", this.fontStyle ? 'font-style="' + this.fontStyle + '" ' : "", this.fontWeight ? 'font-weight="' + this.fontWeight + '" ' : "", l ? 'text-decoration="' + l + '" ' : "", 'style="', this.getSvgStyles(h), '"', this.addPaintOrder(), " >", c.textSpans.join(""), `</text>
`]
},
_getSVGTextAndBg: function(c, h) {
var l = [],
u = [],
f = c,
p;
this._setSVGBg(u);
for (var m = 0, g = this._textLines.length; m < g; m++) p = this._getLineLeftOffset(m), (this.textBackgroundColor || this.styleHas("textBackgroundColor", m)) && this._setSVGTextLineBg(u, m, h + p, f), this._setSVGTextLineText(l, m, h + p, f), f += this.getHeightOfLine(m);
return {
textSpans: l,
textBgRects: u
}
},
_createTextCharSpan: function(c, h, l, u) {
var f = c !== c.trim() || c.match(o),
p = this.getSvgSpanStyles(h, f),
m = p ? 'style="' + p + '"' : "",
g = h.deltaY,
v = "",
y = e.Object.NUM_FRACTION_DIGITS;
return g && (v = ' dy="' + a(g, y) + '" '), ['<tspan x="', a(l, y), '" y="', a(u, y), '" ', v, m, ">", e.util.string.escapeXml(c), "</tspan>"].join("")
},
_setSVGTextLineText: function(c, h, l, u) {
var f = this.getHeightOfLine(h),
p = this.textAlign.indexOf("justify") !== -1,
m, g, v = "",
y, b, w = 0,
x = this._textLines[h],
S;
u += f * (1 - this._fontSizeFraction) / this.lineHeight;
for (var T = 0, P = x.length - 1; T <= P; T++) S = T === P || this.charSpacing, v += x[T], y = this.__charBounds[h][T], w === 0 ? (l += y.kernedWidth - y.width, w += y.width) : w += y.kernedWidth, p && !S && this._reSpaceAndTab.test(x[T]) && (S = !0), S || (m = m || this.getCompleteStyleDeclaration(h, T), g = this.getCompleteStyleDeclaration(h, T + 1), S = e.util.hasStyleChanged(m, g, !0)), S && (b = this._getStyleDeclaration(h, T) || {}, c.push(this._createTextCharSpan(v, b, l, u)), v = "", m = g, l += w, w = 0)
},
_pushTextBgRect: function(c, h, l, u, f, p) {
var m = e.Object.NUM_FRACTION_DIGITS;
c.push(" <rect ", this._getFillAttributes(h), ' x="', a(l, m), '" y="', a(u, m), '" width="', a(f, m), '" height="', a(p, m), `"></rect>
`)
},
_setSVGTextLineBg: function(c, h, l, u) {
for (var f = this._textLines[h], p = this.getHeightOfLine(h) / this.lineHeight, m = 0, g = 0, v, y, b = this.getValueOfPropertyAt(h, 0, "textBackgroundColor"), w = 0, x = f.length; w < x; w++) v = this.__charBounds[h][w], y = this.getValueOfPropertyAt(h, w, "textBackgroundColor"), y !== b ? (b && this._pushTextBgRect(c, b, l + g, u, m, p), g = v.left, m = v.width, b = y) : m += v.kernedWidth;
y && this._pushTextBgRect(c, y, l + g, u, m, p)
},
_getFillAttributes: function(c) {
var h = c && typeof c == "string" ? new e.Color(c) : "";
return !h || !h.getSource() || h.getAlpha() === 1 ? 'fill="' + c + '"' : 'opacity="' + h.getAlpha() + '" fill="' + h.setAlpha(1).toRgb() + '"'
},
_getSVGLineTopOffset: function(c) {
for (var h = 0, l = 0, u = 0; u < c; u++) h += this.getHeightOfLine(u);
return l = this.getHeightOfLine(u), {
lineTop: h,
offset: (this._fontSizeMult - this._fontSizeFraction) * l / (this.lineHeight * this._fontSizeMult)
}
},
getSvgStyles: function(c) {
var h = e.Object.prototype.getSvgStyles.call(this, c);
return h + " white-space: pre;"
}
})
}(),
function(a) {
var o = a.fabric || (a.fabric = {});
o.Textbox = o.util.createClass(o.IText, o.Observable, {
type: "textbox",
minWidth: 20,
dynamicMinWidth: 2,
__cachedLines: null,
lockScalingFlip: !0,
noScaleCache: !1,
_dimensionAffectingProps: o.Text.prototype._dimensionAffectingProps.concat("width"),
_wordJoiners: /[ \t\r]/,
splitByGrapheme: !1,
initDimensions: function() {
this.__skipDimension || (this.isEditing && this.initDelayedCursor(), this.clearContextTop(), this._clearCache(), this.dynamicMinWidth = 0, this._styleMap = this._generateStyleMap(this._splitText()), this.dynamicMinWidth > this.width && this._set("width", this.dynamicMinWidth), this.textAlign.indexOf("justify") !== -1 && this.enlargeSpaces(), this.height = this.calcTextHeight(), this.saveState({
propertySet: "_dimensionAffectingProps"
}))
},
_generateStyleMap: function(c) {
for (var h = 0, l = 0, u = 0, f = {}, p = 0; p < c.graphemeLines.length; p++) c.graphemeText[u] === `
` && p > 0 ? (l = 0, u++, h++) : !this.splitByGrapheme && this._reSpaceAndTab.test(c.graphemeText[u]) && p > 0 && (l++, u++), f[p] = {
line: h,
offset: l
}, u += c.graphemeLines[p].length, l += c.graphemeLines[p].length;
return f
},
styleHas: function(c, h) {
if (this._styleMap && !this.isWrapping) {
var l = this._styleMap[h];
l && (h = l.line)
}
return o.Text.prototype.styleHas.call(this, c, h)
},
isEmptyStyles: function(c) {
if (!this.styles) return !0;
var h = 0,
l = c + 1,
u, f, p = !1,
m = this._styleMap[c],
g = this._styleMap[c + 1];
m && (c = m.line, h = m.offset), g && (l = g.line, p = l === c, u = g.offset), f = typeof c > "u" ? this.styles : {
line: this.styles[c]
};
for (var v in f)
for (var y in f[v])
if (y >= h && (!p || y < u))
for (var b in f[v][y]) return !1;
return !0
},
_getStyleDeclaration: function(c, h) {
if (this._styleMap && !this.isWrapping) {
var l = this._styleMap[c];
if (!l) return null;
c = l.line, h = l.offset + h
}
return this.callSuper("_getStyleDeclaration", c, h)
},
_setStyleDeclaration: function(c, h, l) {
var u = this._styleMap[c];
c = u.line, h = u.offset + h, this.styles[c][h] = l
},
_deleteStyleDeclaration: function(c, h) {
var l = this._styleMap[c];
c = l.line, h = l.offset + h, delete this.styles[c][h]
},
_getLineStyle: function(c) {
var h = this._styleMap[c];
return !!this.styles[h.line]
},
_setLineStyle: function(c) {
var h = this._styleMap[c];
this.styles[h.line] = {}
},
_wrapText: function(c, h) {
var l = [],
u;
for (this.isWrapping = !0, u = 0; u < c.length; u++) l = l.concat(this._wrapLine(c[u], u, h));
return this.isWrapping = !1, l
},
_measureWord: function(c, h, l) {
var u = 0,
f, p = !0;
l = l || 0;
for (var m = 0, g = c.length; m < g; m++) {
var v = this._getGraphemeBox(c[m], h, m + l, f, p);
u += v.kernedWidth, f = c[m]
}
return u
},
_wrapLine: function(c, h, l, z) {
var f = 0,
p = this.splitByGrapheme,
m = [],
g = [],
v = p ? o.util.string.graphemeSplit(c) : c.split(this._wordJoiners),
y = "",
b = 0,
w = p ? "" : " ",
x = 0,
S = 0,
T = 0,
P = !0,
I = this._getWidthOfCharSpacing(),
z = z || 0;
v.length === 0 && v.push([]), l -= z;
for (var H = 0; H < v.length; H++) y = p ? v[H] : o.util.string.graphemeSplit(v[H]), x = this._measureWord(y, h, b), b += y.length, f += S + x - I, f > l && !P ? (m.push(g), g = [], f = x, P = !0) : f += I, !P && !p && g.push(w), g = g.concat(y), S = p ? 0 : this._measureWord([w], h, b), b++, P = !1, x > T && (T = x);
return H && m.push(g), T + z > this.dynamicMinWidth && (this.dynamicMinWidth = T - I + z), m
},
isEndOfWrapping: function(c) {
return !this._styleMap[c + 1] || this._styleMap[c + 1].line !== this._styleMap[c].line
},
missingNewlineOffset: function(c) {
return this.splitByGrapheme ? this.isEndOfWrapping(c) ? 1 : 0 : 1
},
_splitTextIntoLines: function(c) {
for (var h = o.Text.prototype._splitTextIntoLines.call(this, c), l = this._wrapText(h.lines, this.width), u = new Array(l.length), f = 0; f < l.length; f++) u[f] = l[f].join("");
return h.lines = u, h.graphemeLines = l, h
},
getMinWidth: function() {
return Math.max(this.minWidth, this.dynamicMinWidth)
},
_removeExtraneousStyles: function() {
var c = {};
for (var h in this._styleMap) this._textLines[h] && (c[this._styleMap[h].line] = 1);
for (var h in this.styles) c[h] || delete this.styles[h]
},
toObject: function(c) {
return this.callSuper("toObject", ["minWidth", "splitByGrapheme"].concat(c))
}
}), o.Textbox.fromObject = function(c, h) {
var l = o.util.stylesFromArray(c.styles, c.text),
u = Object.assign({}, c, {
styles: l
});
return o.Object._fromObject("Textbox", u, h, "text")
}
}(t),
function() {
var a = e.controlsUtils,
o = a.scaleSkewCursorStyleHandler,
c = a.scaleCursorStyleHandler,
h = a.scalingEqually,
l = a.scalingYOrSkewingX,
u = a.scalingXOrSkewingY,
f = a.scaleOrSkewActionName,
p = e.Object.prototype.controls;
if (p.ml = new e.Control({
x: -.5,
y: 0,
cursorStyleHandler: o,
actionHandler: u,
getActionName: f
}), p.mr = new e.Control({
x: .5,
y: 0,
cursorStyleHandler: o,
actionHandler: u,
getActionName: f
}), p.mb = new e.Control({
x: 0,
y: .5,
cursorStyleHandler: o,
actionHandler: l,
getActionName: f
}), p.mt = new e.Control({
x: 0,
y: -.5,
cursorStyleHandler: o,
actionHandler: l,
getActionName: f
}), p.tl = new e.Control({
x: -.5,
y: -.5,
cursorStyleHandler: c,
actionHandler: h
}), p.tr = new e.Control({
x: .5,
y: -.5,
cursorStyleHandler: c,
actionHandler: h
}), p.bl = new e.Control({
x: -.5,
y: .5,
cursorStyleHandler: c,
actionHandler: h
}), p.br = new e.Control({
x: .5,
y: .5,
cursorStyleHandler: c,
actionHandler: h
}), p.mtr = new e.Control({
x: 0,
y: -.5,
actionHandler: a.rotationWithSnapping,
cursorStyleHandler: a.rotationStyleHandler,
offsetY: -40,
withConnection: !0,
actionName: "rotate"
}), e.Textbox) {
var m = e.Textbox.prototype.controls = {};
m.mtr = p.mtr, m.tr = p.tr, m.br = p.br, m.tl = p.tl, m.bl = p.bl, m.mt = p.mt, m.mb = p.mb, m.mr = new e.Control({
x: .5,
y: 0,
actionHandler: a.changeWidth,
cursorStyleHandler: o,
actionName: "resizing"
}), m.ml = new e.Control({
x: -.5,
y: 0,
actionHandler: a.changeWidth,
cursorStyleHandler: o,
actionName: "resizing"
})
}
}()
})(be);
const Iw = {
lockScalingFlip: !0,
originY: "center",
originX: "center",
lockMovementX: !0,
lockMovementY: !0,
borderColor: "transparent"
};
function _p(t = 36) {
let e = "";
const n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (let r = 0; r < t; r += 1) e += n.charAt(Math.floor(Math.random() * n.length));
return e
}
function QM(t) {
var d;
const e = new be.fabric.Canvas(t, {
width: 1,
height: 1
});
e.preserveObjectStacking = !0, e.selection = !1, e.renderOnAddRemove = !1;
const n = A().config.textureSize;
n && (be.fabric.textureSize = n);
const i = {
...(d = A().config.objectDefaults) == null ? void 0 : d.global,
...Iw
};
Object.keys(i).forEach(a => {
be.fabric.Object.prototype[a] = i[a]
}), e.on("object:added", a => {
var o, c;
a.target && !((c = (o = a.target) == null ? void 0 : o.data) != null && c.id) && (a.target.data || (a.target.data = {}), a.target.data.id = _p(10))
});
const s = be.fabric.Object.prototype.controls;
return Object.keys(s).forEach(a => {
delete s[a]
}), e
}
let Sp = null;
function ko(t) {
Sp = t
}
class JM {
constructor() {
Ce(this, "maxZoom", 2);
Ce(this, "minZoom", 1);
Ce(this, "step", .05);
this.allowUserZoom && this.bindMouseWheel(), ae.subscribe(e => e.stageSize, () => {
setTimeout(() => {
this.fitToScreen()
}, 1)
})
}
get allowUserZoom() {
var e, n, r, i;
return (i = (r = (n = (e = A().config) == null ? void 0 : e.tools) == null ? void 0 : n.zoom) == null ? void 0 : r.allowUserZoom) != null ? i : !0
}
get currentZoom() {
return A().zoom
}
zoomIn(e = this.step) {
this.set(this.currentZoom + e)
}
canZoomIn(e = this.step) {
return this.currentZoom + e <= this.maxZoom
}
canZoomOut(e = this.step) {
return this.currentZoom - e >= this.minZoom
}
zoomOut(e = this.step) {
this.set(this.currentZoom - e)
}
set(e, n = !0) {
if (e < this.minZoom || e > this.maxZoom) return;
const r = bu.round(A().original.width * e, 0),
i = bu.round(A().original.height * e, 0);
de().setZoom(e), n && de().setDimensions({
width: r,
height: i
}), A().setZoom(e)
}
fitToScreen() {
var s, d;
if (!((d = (s = A().config.tools) == null ? void 0 : s.zoom) != null && d.fitImageToScreen)) return;
const {
width: e,
height: n
} = A().stageSize, r = Math.max(n, 1), i = Math.max(e, 1);
if (A().original.height > r || A().original.width > i) {
const a = Math.min(r / A().original.height, i / A().original.width);
this.minZoom = Math.min(a, 1)
} else this.minZoom = 1;
this.set(this.minZoom)
}
bindMouseWheel() {
de().on("mouse:wheel", e => {
e.e.preventDefault(), e.e.stopPropagation(), Sp == null && (e.e.deltaY < 0 ? this.zoomIn() : this.zoomOut())
})
}
}
function Lw(t) {
return new Promise(e => {
be.fabric.util.loadImage(t, n => e(new be.fabric.Image(n)), null, A().config.crossOrigin ? "anonymous" : void 0)
})
}
class eA {
constructor() {
Ce(this, "minWidth", 50);
Ce(this, "minHeight", 50)
}
resize(e, n, {
applyZoom: r = !1,
resizeHelper: i = !0
} = {}) {
const s = A().zoom;
de().setWidth(e * (r ? s : 1)), de().setHeight(n * (r ? s : 1)), A().setOriginal(e, n), i && L().transform.resetStraightenAnchor()
}
async addMainImage(e, n = "mainImage") {
var i, s;
A().toggleLoading(n);
const r = await Lw(e);
if (!!r) return this.clear(), r.set(Ur), r.name = Ge.MainImage, de().add(r), this.resize(r.width, r.height), r.center(), r.setCoords(), L().zoom.fitToScreen(), A().toggleLoading(!1), (s = (i = A().config).onMainImageLoaded) == null || s.call(i, r), r
}
openNew(e, n, r) {
return e = Math.max(this.minWidth, e), n = Math.max(this.minHeight, n), this.clear(), this.resize(e, n), de().backgroundColor = r, L().zoom.fitToScreen(), A().toggleLoading("newCanvas"), requestAnimationFrame(() => {
A().toggleLoading(!1)
}), Promise.resolve({
width: e,
height: n
})
}
getMainImage() {
return de().getObjects().find(e => e.name === Ge.MainImage)
}
render() {
de().requestRenderAll()
}
async loadInitialContent() {
var i, s;
const e = A().config.image,
n = A().config.blankCanvasSize,
r = A().config.state;
if (e && e.endsWith("json")) {
const d = await Ya(e);
await L().import.loadState(d)
} else e && e.startsWith('{"canvas') ? await L().import.loadState(e) : e ? await this.addMainImage(e) : r ? await L().import.loadState(r) : n && await this.openNew(n.width, n.height);
return Cf() && ((s = (i = A().config.ui) == null ? void 0 : i.openImageDialog) == null ? void 0 : s.show) && A().togglePanel("newImage", !0), new Promise(d => {
setTimeout(() => {
L().history.addInitial(), d()
}, 10)
})
}
clear() {
de().clear(), L().frame.remove(), L().transform.resetStraightenAnchor()
}
}
function tA(t) {
return t.name === Ge.Sticker && "forEachObject" in t
}
const nA = ["fontSize", "fontFamily", "left", "top", "width", "height", "scaleX", "scaleY", "flipX", "flipY", "angle", "src", "strokeWidth"];
function Fw(t = {}) {
de().fire("object:modified", rA(t))
}
function rA(t) {
return {
values: t,
sizeOrPositionChanged: iA(t)
}
}
function iA(t) {
return Object.keys(t).some(e => nA.includes(e))
}
function oA() {
A().fabric.on("selection:created", t => {
var e;
((e = t.selected) == null ? void 0 : e[0]) && !zw(t) && Cp(t.selected[0])
}), A().fabric.on("selection:updated", t => {
var e;
zw(t) || Cp((e = t.selected) == null ? void 0 : e[0])
}), A().fabric.on("selection:cleared", () => {
Cp()
})
}
function zw(t) {
var r, i;
const [e] = Ov((r = t.selected) == null ? void 0 : r[0]), n = e === A().activeTool;
return A().dirty && (!((i = t.selected) != null && i[0]) || !n) ? (t.deselected && L().objects.select(t.deselected[0]), !0) : !1
}
function Cp(t) {
(t == null ? void 0 : t.data.id) !== A().objects.active.id && (A().objects.setActive(t != null ? t : null), A().activeTool !== Me.DRAW && Sf())
}
class sA {
constructor() {
this.syncObjects(), oA(), A().fabric.on("text:editing:entered", () => {
A().objects.setIsEditingText(!0)
}), A().fabric.on("text:editing:exited", () => {
A().objects.setIsEditingText(!1)
}), A().fabric.on("object:added", () => {
this.syncObjects()
}), A().fabric.on("object:removed", () => {
this.syncObjects()
})
}
getAll() {
return de().getObjects().filter(e => {
var n;
return !((n = e == null ? void 0 : e.data) != null && n.pixieInternal)
})
}
get(e) {
return this.getAll().find(n => n.name === e)
}
getById(e) {
return this.getAll().find(n => n.data.id === e)
}
isActive(e) {
var r;
const n = typeof e == "string" ? e : e.data.id;
return ((r = A().objects.active) == null ? void 0 : r.id) === n
}
getActive() {
return de().getActiveObject()
}
has(e) {
return this.getAll().findIndex(n => n.name === e) > -1
}
select(e) {
const n = typeof e == "string" ? this.getById(e) : e;
!n || (de().setActiveObject(n), de().requestRenderAll())
}
deselectActive() {
de().discardActiveObject(), de().requestRenderAll()
}
setValues(e, n) {
if (n = n || this.getActive(), !n) return;
let r = !1;
tA(n) && e.fill !== n.fill && n.forEachObject(i => i.set("fill", e.fill)), ir(n) ? ((e.fontFamily !== n.fontFamily || e.fontSize !== n.fontSize) && (r = !0), n.selectionStart !== n.selectionEnd ? n.setSelectionStyles(e) : n.set(e)) : n.set(e), r ? setTimeout(() => {
de().requestRenderAll()
}, 50) : de().requestRenderAll(), A().objects.setActive(n), Fw(e)
}
move(e, n = 1, r) {
r = r || this.getActive(), r && (e === "up" ? this.setValues({
top: r.top - n
}) : e === "down" ? this.setValues({
top: r.top + n
}) : e === "left" ? this.setValues({
left: r.left - n
}) : e === "right" && this.setValues({
left: r.left + n
}), L().canvas.render())
}
bringToFront(e) {
e = e || this.getActive(), e && (e.bringToFront(), L().canvas.render())
}
sendToBack(e) {
e = e || this.getActive(), e && (e.sendToBack(), L().canvas.render())
}
flipHorizontally(e) {
e = e || this.getActive(), e && (this.setValues({
flipX: !e.flipX
}), L().canvas.render())
}
duplicate(e) {
const n = e || this.getActive();
!n || (this.deselectActive(), n.clone(r => {
r.set({
left: n.left + 40,
top: n.top + 40,
data: {
...n.data,
id: _p(10)
},
name: n.name
}), de().add(r), this.select(r), L().canvas.render()
}))
}
delete(e) {
e = e || this.getActive(), e && (this.deselectActive(), de().remove(e), de().requestRenderAll(), L().history.addHistoryItem({
name: "deletedObject"
}))
}
syncObjects() {
const e = this.getAll().map(n => {
var r;
return {
name: n.name,
selectable: (r = n.selectable) != null ? r : !1,
id: n.data.id
}
});
ae.setState({
objects: {
...A().objects,
all: e
}
})
}
}
const aA = {
frame: null,
fonts: []
};
function Nw(t) {
return t.state || (t.state = Xa()), {
...t.state || Xa(),
name: t.name,
id: _p(15)
}
}
const jw = 15;
class lA {
constructor() {
Ce(this, "minWidth", 250)
}
add(e, n = {}) {
var s, d, a;
if (e = e || ((d = (s = A().config.tools) == null ? void 0 : s.text) == null ? void 0 : d.defaultText), !e) return;
const r = {
...(a = A().config.objectDefaults) == null ? void 0 : a.text,
...n,
name: Ge.Text,
padding: jw,
editingBorderColor: Qu.fill
},
i = new be.fabric.IText(e, r);
de().add(i), this.autoPositionText(i), L().objects.select(i)
}
autoPositionText(e) {
const n = de().getWidth(),
r = de().getHeight(),
i = Math.min(de().getWidth(), this.minWidth);
e.scaleToWidth(Math.max(n / 3, i)), e.getScaledHeight() > r && e.scaleToHeight(r - e.getScaledHeight() - 20), e.viewportCenter(), de().getObjects("i-text").forEach(s => {
if (s !== e && s.intersectsWithObject(e)) {
const d = s.top - e.top + s.getScaledHeight();
let a = e.top + d;
a > A().original.height - s.getScaledHeight() && (a = 0), e.set("top", a), e.setCoords()
}
})
}
selectOrAddText(e, n = {}) {
if (A().objects.active.isText) return !1;
const r = L().objects.getAll().find(i => ir(i));
return r ? (L().objects.select(r), !1) : (this.add(e, n), !0)
}
}
function Bw(t, e) {
const n = t.map(async r => {
const i = Array.from(document.fonts.values()).find(d => d.family === r.family);
if (i) return i.loaded;
const s = new FontFace(r.family, `url(${e?e(r.src):r.src})`, r.descriptors);
return document.fonts.add(s), s.load()
});
return Promise.all(n)
}
function cA(t) {
return t ? /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(t) : !1
}
function Wt(t) {
return t ? cA(t) ? t : `${A().config.baseUrl?`${A().config.baseUrl}/`:""}${t}` : ""
}
class uA {
async undo() {
if (this.canUndo()) {
const e = A().history.items[A().history.pointer - 1];
await this.load(e)
}
}
async redo() {
if (this.canRedo()) {
const e = A().history.items[A().history.pointer + 1];
await this.load(e)
}
}
canUndo() {
return A().history.canUndo
}
canRedo() {
return A().history.canRedo
}
reload() {
return this.load(A().history.items[A().history.pointer])
}
replaceCurrent() {
const e = A().history.items[A().history.pointer],
n = [...A().history.items];
n[A().history.pointer] = Nw({
name: e.name,
state: e
})
}
addHistoryItem(e) {
const n = Nw(e),
i = [...A().history.items.slice(0, A().history.pointer + 1), n];
A().history.update(i.length - 1, i)
}
load(e) {
return e = {
...e,
editor: e.editor || aA
}, new Promise(n => {
Bw(fA(e.canvas.objects), Wt).finally(() => {
de().loadFromJSON(e.canvas, () => {
L().zoom.set(1), e.canvasWidth && e.canvasHeight && L().canvas.resize(e.canvasWidth, e.canvasHeight, {
resizeHelper: !1,
applyZoom: !1
}), L().frame.remove(), e.editor.frame && L().frame.add(e.editor.frame.name, e.editor.frame.sizePercent), L().objects.syncObjects(), L().objects.getAll().forEach(r => {
if (!r.data.pixieInternal && r.originX === "left" && r.originY === "top") {
const i = r.getPointByOrigin("center", "center");
r.set("left", i.x), r.set("top", i.y)
}
r.set({
...Iw
}), r.type === "i-text" && (r.padding = jw)
}), L().canvas.render(), de().calcOffset(), L().zoom.fitToScreen(), A().history.updatePointerById(e.id), L().transform.resetStraightenAnchor(), n()
})
})
})
}
addInitial(e) {
!A().history.items.find(r => r.name === "initial") && (e || !Cf()) && this.addHistoryItem({
name: "initial",
state: e
})
}
}
function fA(t) {
const e = [];
return t.forEach(n => {
var i, s, d;
if (!ir(n)) return;
const r = (d = (s = (i = A().config.tools) == null ? void 0 : i.text) == null ? void 0 : s.items) == null ? void 0 : d.find(a => a.family === n.fontFamily);
r && e.push(r)
}), e
}
class hA {
canMerge() {
return L().objects.getAll().filter(e => e.name !== Ge.MainImage).length > 0
}
async apply() {
A().toggleLoading("merge");
const e = L().export.getDataUrl();
e && await L().canvas.addMainImage(e, "merge")
}
}
const kc = [{
name: "grayscale"
}, {
name: "blackWhite",
fabricType: "blackwhite"
}, {
name: "sharpen",
uses: "Convolute",
matrix: [0, -1, 0, -1, 5, -1, 0, -1, 0]
}, {
name: "invert"
}, {
name: "vintage"
}, {
name: "polaroid"
}, {
name: "kodachrome"
}, {
name: "technicolor"
}, {
name: "brownie"
}, {
name: "sepia"
}, {
name: "removeColor",
fabricType: "removecolor",
options: {
distance: {
type: "slider",
current: .1,
min: 0,
max: 1,
step: .01
},
color: {
current: "#fff",
type: "colorPicker"
}
}
}, {
name: "brightness",
options: {
brightness: {
type: "slider",
current: .1,
min: -1,
max: 1,
step: .1
}
}
}, {
name: "gamma",
options: {
red: {
type: "slider",
current: .1,
min: .2,
max: 2.2,
step: .003921
},
green: {
type: "slider",
current: .1,
min: .2,
max: 2.2,
step: .003921
},
blue: {
type: "slider",
current: .1,
min: .2,
max: 2.2,
step: .003921
}
},
apply: t => {
t.gamma = [t.red, t.green, t.blue]
}
}, {
name: "noise",
options: {
noise: {
type: "slider",
current: 40,
min: 1,
max: 600
}
}
}, {
name: "pixelate",
options: {
blocksize: {
type: "slider",
min: 1,
max: 40,
current: 6
}
}
}, {
name: "blur",
uses: "Convolute",
matrix: [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9]
}, {
name: "emboss",
uses: "Convolute",
matrix: [1, 1, 1, 1, .7, -1, -1, -1, -1]
}, {
name: "blendColor",
fabricType: "blendcolor",
options: {
alpha: {
type: "slider",
current: .5,
min: .1,
max: 1,
step: .1
},
mode: {
current: "add",
type: "select",
available: [{
key: "add"
}, {
key: "multiply"
}, {
key: "subtract"
}, {
key: "diff"
}, {
key: "screen"
}, {
key: "lighten"
}, {
key: "darken"
}]
},
color: {
type: "colorPicker",
current: "#FF4081"
}
}
}],
dA = {
grayscale: fe("grayscale"),
blackWhite: fe("Black & White"),
sharpen: fe("Sharpen"),
invert: fe("Invert"),
vintage: fe("Vintage"),
polaroid: fe("Polaroid"),
kodachrome: fe("Kodachrome"),
technicolor: fe("Technicolor"),
brownie: fe("Brownie"),
sepia: fe("Sepia"),
removeColor: fe("Remove Color"),
brightness: fe("Brightness"),
gamma: fe("Gamma"),
noise: fe("Noise"),
pixelate: fe("Pixelate"),
blur: fe("Blur"),
emboss: fe("Emboss"),
blendColor: fe("Blend Color")
},
Tp = {
distance: fe("distance"),
color: fe("color"),
brightness: fe("brightness"),
red: fe("red"),
green: fe("green"),
blue: fe("blue"),
noise: fe("noise"),
blocksize: fe("blocksize"),
mode: fe("mode"),
alpha: fe("alpha")
};
function Ec(t) {
return t && t.charAt(0).toUpperCase() + t.slice(1)
}
class pA {
constructor() {
ae.subscribe(e => e.history.pointer, () => {
this.syncState()
})
}
apply(e) {
A().filter.select(e, this.hasOptions(e));
const n = this.getByName(e);
if (this.isApplied(n.name)) {
this.remove(n.name);
return
}
const r = this.create(n);
this.getImages().forEach(i => {
var s;
(s = i.filters) == null || s.push(r), i.applyFilters()
}), this.syncState(), L().canvas.render()
}
remove(e) {
A().filter.deselect(e);
const n = this.getByName(e);
this.getImages().forEach(r => {
var s;
const i = this.findFilterIndex(n.name, r.filters);
(s = r.filters) == null || s.splice(i, 1), r.applyFilters()
}), this.syncState(), L().canvas.render()
}
getAll() {
return kc
}
getByName(e) {
return kc.find(n => n.name === e)
}
isApplied(e) {
const n = L().canvas.getMainImage();
return n ? this.findFilterIndex(e, n.filters) > -1 : !1
}
applyValue(e, n, r) {
const i = this.getByName(e);
this.getImages().forEach(s => {
const d = (s.filters || []).find(a => a.type.toLowerCase() === i.name.toLowerCase());
!d || (d[n] = r, i.apply && i.apply(d, n, r), s.applyFilters())
}), L().canvas.render()
}
addCustom(e, n, r, i) {
const s = be.fabric.Image.filters;
s[Ec(e)] = be.fabric.util.createClass(s.BaseFilter, n), s[Ec(e)].fromObject = s.BaseFilter.fromObject, kc.push({
name: e,
options: r,
initialConfig: i
})
}
create(e) {
const n = e.initialConfig || {};
let r;
return e.uses ? (n.matrix = e.matrix, r = new be.fabric.Image.filters[Ec(e.uses)](n)) : (Object.entries(e.options || {}).forEach(([i, s]) => {
n[i] = s.current
}), r = new be.fabric.Image.filters[Ec(e.name)](n)), r.name = e.name, r
}
hasOptions(e) {
return !!this.getByName(e).options
}
findFilterIndex(e, n) {
if (!(n != null && n.length)) return -1;
const r = this.getByName(e);
return n.findIndex(i => this.configMatchesFabricFilter(r, i))
}
syncState() {
var r;
const e = [];
(((r = this.getImages()[0]) == null ? void 0 : r.filters) || []).forEach(i => {
const s = this.getByFabricFilter(i);
s && e.push(s.name)
}), ae.setState({
filter: {
...A().filter,
applied: e
}
})
}
getByFabricFilter(e) {
return kc.find(n => this.configMatchesFabricFilter(n, e))
}
configMatchesFabricFilter(e, n) {
const r = n.type.toLowerCase().replace(" ", "");
return r === e.fabricType || r === e.name ? !0 : r === "convolute" && this.matrixAreEqual(e.matrix, n.matrix)
}
matrixAreEqual(e, n) {
if (!e || !n || e.length !== n.length) return !1;
for (let r = e.length; r--;)
if (e[r] !== n[r]) return !1;
return !0
}
getImages() {
return L().objects.getAll().filter(e => e.name === Ge.Image || Ge.MainImage)
}
}
function gA(t) {
return t.width < $w(t.usePercentages) && (t.width = $w(t.usePercentages), t.maintainAspect && (t.height = Oc(t.width, t.usePercentages))), t.width > Vw(t.usePercentages) && (t.width = Vw(t.usePercentages), t.maintainAspect && (t.height = Oc(t.width, t.usePercentages))), t.height < Hw(t.usePercentages) && (t.height = Hw(t.usePercentages), t.maintainAspect && (t.width = kp(t.height, t.usePercentages))), t.height > Uw(t.usePercentages) && (t.height = Uw(t.usePercentages), t.maintainAspect && (t.width = kp(t.height, t.usePercentages))), t
}
function $w(t) {
var n, r;
const e = ((r = (n = A().config.tools) == null ? void 0 : n.resize) == null ? void 0 : r.minWidth) || 50;
return t ? Math.ceil(e * 100 / A().original.width) : e
}
function Vw(t) {
var n, r;
const e = ((r = (n = A().config.tools) == null ? void 0 : n.resize) == null ? void 0 : r.maxWidth) || 2400;
return t ? Math.ceil(e * 100 / A().original.width) : e
}
function Hw(t) {
var n, r;
const e = ((r = (n = A().config.tools) == null ? void 0 : n.resize) == null ? void 0 : r.minHeight) || 50;
return t ? Math.ceil(e * 100 / A().original.height) : e
}
function Uw(t) {
var n, r;
const e = ((r = (n = A().config.tools) == null ? void 0 : n.resize) == null ? void 0 : r.maxHeight) || 2400;
return t ? Math.ceil(e * 100 / A().original.height) : e
}
function kp(t, e) {
if (e) return t;
const n = A().original.height / t;
return Math.floor(A().original.width / n)
}
function Oc(t, e) {
if (e) return t;
const n = A().original.width / t;
return Math.floor(A().original.height / n)
}
class mA {
apply(e) {
const {
width: n,
height: r,
usePercentages: i
} = gA(e), s = Math.ceil(A().original.width), d = Math.ceil(A().original.height), a = Math.ceil(n), o = Math.ceil(r);
let c, h;
i ? (c = n / 100, h = r / 100) : (c = n / A().original.width, h = r / A().original.height), !(s === a && d === o) && this.resize(c, h)
}
resize(e, n) {
L().zoom.set(1, !1);
const r = Math.round(A().original.height * n),
i = Math.round(A().original.width * e);
L().canvas.resize(i, r, {
applyZoom: !1,
resizeHelper: !0
}), L().objects.getAll().forEach(s => {
const d = s.scaleX || 1,
a = s.scaleY || 1,
o = s.left || 0,
c = s.top || 0,
h = d * e,
l = a * n,
u = o * e,
f = c * n;
s.scaleX = h, s.scaleY = l, s.left = u, s.top = f, s.setCoords()
}), L().zoom.fitToScreen(), de().requestRenderAll()
}
}
function vA(t, e) {
e.innerZone !== null && (e = e, yA(t, e), bA(t, e), wA(t, e))
}
function yA(t, e) {
e.innerZone.style.width = `${t.width}px`, e.innerZone.style.height = `${t.height}px`, e.innerZone.style.transform = `translate(${t.left}px, ${t.top}px)`
}
function bA(t, e) {
const n = A().canvasSize.width,
r = A().canvasSize.height;
e.maskTop.style.height = `${t.top}px`, e.maskTop.style.width = `${n}px`, e.maskLeft.style.top = `${t.top}px`, e.maskLeft.style.height = `${t.height}px`, e.maskLeft.style.width = `${t.left}px`;
const i = t.left + t.width;
e.maskRight.style.left = `${i}px`, e.maskRight.style.top = `${t.top}px`, e.maskRight.style.height = `${t.height}px`, e.maskRight.style.width = `${n-i}px`, e.maskBottom.style.height = `${r-(t.top+t.height)}px`, e.maskBottom.style.width = `${n}px`
}
function wA(t, e) {
const n = (t.width - 2) / 3;
e.lineVer1.style.height = `${t.height}px`, e.lineVer1.style.transform = `translate(${n}px, 0)`, e.lineVer2.style.height = `${t.height}px`, e.lineVer2.style.transform = `translate(${n*2}px, 0)`;
const r = (t.height - 2) / 3;
e.lineHor1.style.width = `${t.width}px`, e.lineHor1.style.transform = `translate(0, ${r}px)`, e.lineHor2.style.width = `${t.width}px`, e.lineHor2.style.transform = `translate(0, ${r*2}px)`
}
function Ep(t, e, n) {
let r = e,
i = n;
return t && (n * t > e ? i = e / t : r = n * t), {
width: Math.floor(r),
height: Math.floor(i)
}
}
function Op(t) {
if (!t) return null;
const e = t.split(":");
return parseInt(e[0]) / parseInt(e[1])
}
function xA(t, e = null) {
const n = {
width: t.width,
height: t.height,
top: 0,
left: 0,
angle: 0
};
if (e) {
const r = Ep(e, n.width, n.height);
n.width = r.width, n.height = r.height
}
return n.left = (t.width - n.width) / 2, n.top = (t.height - n.height) / 2, n
}
class _A {
constructor() {
Ce(this, "refs", null)
}
apply(e) {
var i;
const n = (i = L().frame.active.config) == null ? void 0 : i.name,
r = L().frame.active.currentSizeInPercent;
return L().frame.active.hide(), L().merge.apply().then(() => {
L().canvas.resize(Math.round(e.width), Math.round(e.height), {
applyZoom: !0,
resizeHelper: !0
});
const s = L().canvas.getMainImage();
s.cropX = Math.round(e.left), s.cropY = Math.round(e.top), s.width = Math.round(e.width), s.height = Math.round(e.height), s.viewportCenter(), n && L().frame.add(n, r), L().zoom.fitToScreen(), L().canvas.render()
})
}
drawZone(e) {
var n;
(n = this.refs) != null && n.current && (A().crop.setCropzoneRect(e), vA(e, this.refs.current))
}
resetCropzone(e) {
const n = A().canvasSize,
r = Op(e);
if (!n) return;
A().crop.setAspectRatio(e);
const i = xA(n, r);
this.drawZone(i)
}
registerRefs(e) {
this.refs = e
}
}
class SA {
getShapeByName(e) {
var r, i;
const n = (i = (r = A().config.tools) == null ? void 0 : r.shapes) == null ? void 0 : i.items;
return (n == null ? void 0 : n.find(s => s.name === e)) || null
}
addBasicShape(e) {
var o;
const n = this.getShapeByName(e);
if (!n) return null;
const {
width: r,
height: i,
...s
} = ((o = A().config.objectDefaults) == null ? void 0 : o.shape) || {}, d = {
...s,
...n.options
};
let a;
if (n.name === "circle") a = new be.fabric.Circle({
...d,
radius: 100
});
else if (n.name === "ellipse") a = new be.fabric.Ellipse({
...d,
rx: 100,
ry: 50
});
else if (n.type === "Path") a = new be.fabric.Path(d.path, {
displayName: n.name,
...d
});
else {
const c = n.type;
a = new be.fabric[c]({
...d,
width: 150,
height: 150
})
}
return this.addAndPositionShape(a, Ge.Shape, {
width: r,
height: i
}), a
}
addSticker(e, n) {
var i, s, d;
const r = (d = (s = (i = A().config.tools) == null ? void 0 : i.stickers) == null ? void 0 : s.items) == null ? void 0 : d.find(a => a.name === e);
if (!r) return Promise.resolve();
if (r.type === "svg") {
const a = Pp(r, n);
return this.addSvgSticker(a)
}
return this.addRegularSticker(r, n)
}
addRegularSticker(e, n) {
return new Promise(r => {
be.fabric.util.loadImage(Pp(e, n), i => {
var c;
const {
width: s,
height: d,
...a
} = ((c = A().config.objectDefaults) == null ? void 0 : c.sticker) || {}, o = new be.fabric.Image(i, a);
this.addAndPositionShape(o, Ge.Sticker, {
width: s,
height: d
}), r()
})
})
}
addSvgSticker(e, n = Ge.Sticker) {
return new Promise(r => {
be.fabric.loadSVGFromURL(e, (i, s) => {
var h;
const {
width: d,
height: a,
...o
} = ((h = A().config.objectDefaults) == null ? void 0 : h.sticker) || {}, c = be.fabric.util.groupSVGElements(i, s);
c.set(o), this.addAndPositionShape(c, n, {
width: d,
height: a
}), r()
})
})
}
addAndPositionShape(e, n, {
width: r
}) {
e.name = n, e.scaleX = 1, e.scaleY = 1, de().add(e);
const i = r || A().original.width * A().zoom / 4;
e.scaleToWidth(Math.min(150, i)), e.viewportCenter(), e.setCoords(), L().canvas.render(), de().setActiveObject(e)
}
}
function Pp(t, e) {
return Wt(`images/stickers/${t.name}/${e}.${t.type}`)
}
class CA {
constructor(e) {
Ce(this, "patternCache", []);
this.activeFrame = e
}
fillParts(e) {
this.patternCache.forEach(n => {
this.fillPartWithPattern(n, e)
})
}
fillPartWithPattern(e, n) {
if (!this.activeFrame.parts) return;
e.canvas = new be.fabric.StaticCanvas(null), e.canvas.add(e.img);
const r = new be.fabric.Pattern({
source: e.canvas.getElement(),
repeat: n === "repeat" ? "repeat" : "no-repeat"
});
this.activeFrame.parts[e.name] && this.activeFrame.parts[e.name].set("fill", r)
}
scale(e) {
if (!this.activeFrame.config || !this.patternCache) return;
const n = this.activeFrame.config.mode;
e /= de().getRetinaScaling(), this.patternCache.forEach(r => {
!this.activeFrame.parts || (r.name === "top" || r.name === "bottom" ? n === "stretch" ? (this.scalePatternToWidth(r.img, this.activeFrame.parts.top.getScaledWidth()), this.scalePatternToHeight(r.img, e)) : r.img.scaleToHeight(e) : r.name === "left" || r.name === "right" ? n === "stretch" ? (this.scalePatternToWidth(r.img, e), this.scalePatternToHeight(r.img, this.activeFrame.parts.left.getScaledHeight())) : r.img.scaleToWidth(e) : n === "stretch" ? (this.scalePatternToWidth(r.img, e), this.scalePatternToHeight(r.img, e)) : r.img.scaleToWidth(e), r.canvas.setDimensions({
width: r.img.getScaledWidth(),
height: r.img.getScaledHeight()
}))
}), L().canvas.render()
}
scalePatternToWidth(e, n) {
if (!e.width) return;
const r = e.getBoundingRect().width / e.getScaledWidth();
e.set("scaleX", n / e.width / r), e.setCoords()
}
scalePatternToHeight(e, n) {
if (!e.height) return;
const r = e.getBoundingRect().height / e.getScaledHeight();
e.set("scaleY", n / e.height / r), e.setCoords()
}
load(e) {
const n = this.activeFrame.getPartNames().map(r => new Promise(i => {
const s = {
...Ur,
originX: "left",
originY: "top"
};
A().config.crossOrigin && (s.crossOrigin = "anonymous"), be.fabric.Image.fromURL(this.getPartUrl(e, r), d => {
i({
name: r,
img: d
})
}, s)
}));
return Promise.all(n).then(r => {
this.patternCache = r, this.fillParts(e.mode)
})
}
getPartUrl(e, n) {
return Wt(`images/frames/${e.name}/${n}.png`)
}
}
class TA {
constructor(e, n) {
this.activeFrame = e, this.patterns = n
}
get defaultColor() {
var e, n;
return (n = (e = A().config.objectDefaults) == null ? void 0 : e.global) == null ? void 0 : n.fill
}
build(e, n) {
if (this.createParts(e), this.resize(n), this.activeFrame.config = e, e.mode === "basic") {
L().canvas.render();
return
}
this.patterns.load(e).then(() => {
this.patterns.scale(n), L().canvas.render()
})
}
createParts(e) {
const n = {};
this.activeFrame.getPartNames().forEach(r => {
const i = e.mode === "basic" ? this.defaultColor : void 0;
n[r] = new be.fabric.Rect({
...Ur,
fill: i,
originX: "left",
originY: "top",
name: `frame.rect.${r}`,
objectCaching: !1,
data: {
pixieInternal: !0
}
}), de().add(n[r])
}), this.activeFrame.parts = n
}
resize(e) {
const n = A().original.width,
r = A().original.height,
i = this.activeFrame,
s = e;
!i.parts || (i.parts.topLeft.set({
width: s,
height: s
}), i.parts.topRight.set({
left: n - i.parts.topLeft.getScaledWidth(),
width: s,
height: s
}), i.parts.top.set({
left: i.parts.topLeft.getScaledWidth() - 1,
width: n - i.parts.topLeft.getScaledWidth() - i.parts.topRight.getScaledWidth() + 3,
height: s
}), i.parts.bottomLeft.set({
top: r - i.parts.topLeft.getScaledHeight(),
width: s,
height: s
}), i.parts.left.set({
top: i.parts.topLeft.getScaledHeight() - 1,
width: s,
height: r - i.parts.topLeft.getScaledHeight() - i.parts.bottomLeft.getScaledHeight() + 3
}), i.parts.bottomRight.set({
left: n - i.parts.bottomLeft.getScaledWidth(),
top: r - i.parts.topRight.getScaledWidth(),
width: s,
height: s
}), i.parts.bottom.set({
left: i.parts.top.left,
top: r - i.parts.top.getScaledHeight(),
width: i.parts.top.getScaledWidth(),
height: s
}), i.parts.right.set({
left: n - i.parts.left.getScaledWidth(),
top: i.parts.left.top,
width: i.parts.left.width,
height: i.parts.left.getScaledHeight()
}))
}
}
class kA {
constructor() {
Ce(this, "corners", ["topLeft", "topRight", "bottomLeft", "bottomRight"]);
Ce(this, "sides", ["top", "right", "bottom", "left"]);
Ce(this, "parts", null);
Ce(this, "config", null);
Ce(this, "currentSizeInPercent", 100)
}
getPartNames() {
return [...this.corners, ...this.sides]
}
hide() {
!this.parts || (Object.values(this.parts).forEach(e => e.set({
visible: !1
})), L().canvas.render())
}
show() {
!this.parts || (Object.values(this.parts).forEach(e => e.set({
visible: !0
})), L().canvas.render())
}
remove() {
!this.parts || (this.config = null, Object.values(this.parts).forEach(e => {
de().remove(e)
}), this.parts = null, L().canvas.render())
}
is(e) {
return this.config ? this.config.name === e.name : !1
}
changeColor(e) {
var n;
((n = this.config) == null ? void 0 : n.mode) !== "basic" || !this.parts || (Object.values(this.parts).forEach(r => {
r.set("fill", e)
}), L().canvas.render())
}
getMinSize() {
var e, n;
return (n = (e = this.config) == null ? void 0 : e.size.min) != null ? n : 1
}
getMaxSize() {
var e, n;
return (n = (e = this.config) == null ? void 0 : e.size.max) != null ? n : 35
}
}
class EA {
constructor() {
Ce(this, "patterns");
Ce(this, "builder");
Ce(this, "active");
this.active = new kA, this.patterns = new CA(this.active), this.builder = new TA(this.active, this.patterns), de().on("object:added", () => {
Object.values(this.active.parts || []).forEach(e => e.moveTo(98))
})
}
add(e, n) {
const r = this.getByName(e);
if (!r || this.active.is(r)) return;
this.active.remove(), this.active.currentSizeInPercent = n != null ? n : r.size.default;
const i = this.calcFrameSizeInPixels(this.active.currentSizeInPercent);
this.builder.build(r, i), A().frame.select(r)
}
resize(e) {
if (!this.active.parts || !this.active.config) return;
e ? this.active.currentSizeInPercent = e : e = this.active.currentSizeInPercent;
const n = this.calcFrameSizeInPixels(e);
this.builder.resize(n), this.patterns.scale(n), L().canvas.render()
}
changeColor(e) {
this.active.changeColor(e)
}
remove() {
this.active.remove(), A().frame.deselect()
}
getByName(e) {
var r, i;
const n = (i = (r = A().config.tools) == null ? void 0 : r.frame) == null ? void 0 : i.items;
if (n) return n.find(s => s.name === e)
}
getActiveFrameConfig() {
return this.active.config
}
calcFrameSizeInPixels(e) {
const n = Math.min(A().original.width, A().original.height);
return Math.ceil(e / 100 * n)
}
}
const OA = t => {
const e = new be.fabric.PatternBrush(t);
return e.getPatternSrc = function() {
const r = be.fabric.document.createElement("canvas");
r.width = 10, r.height = 10;
const i = r.getContext("2d");
return i.strokeStyle = this.color, i.lineWidth = 5, i.beginPath(), i.moveTo(0, 5), i.lineTo(10, 5), i.closePath(), i.stroke(), r
}, e
},
PA = t => {
const e = new be.fabric.PatternBrush(t);
return e.getPatternSrc = function() {
const r = document.createElement("canvas");
r.width = 10, r.height = 10;
const i = r.getContext("2d");
return i.strokeStyle = this.color, i.lineWidth = 5, i.beginPath(), i.moveTo(5, 0), i.lineTo(5, 10), i.closePath(), i.stroke(), r
}, e
},
MA = t => {
const e = new be.fabric.PatternBrush(t);
return e.getPatternSrc = function() {
const r = this.width / 2,
i = 5,
s = document.createElement("canvas"),
d = new be.fabric.Rect({
width: r,
height: r,
angle: 45,
fill: this.color
}),
a = d.getBoundingRect().width;
s.width = a + i, s.height = a + i, d.set({
left: a / 2,
top: a / 2
});
const o = s.getContext("2d");
return d.render(o), s
}, e
},
AA = t => {
const e = new be.fabric.PatternBrush(t);
return e.getPatternSrc = function() {
const s = document.createElement("canvas");
s.width = 10 + 2, s.height = 10 + 2;
const d = s.getContext("2d");
return d.fillStyle = this.color, d.fillRect(0, 0, 10, 10), s
}, e
};
class DA {
constructor() {
Ce(this, "customBrushes", {
VLineBrush: OA,
HLineBrush: PA,
DiamondBrush: MA,
SquareBrush: AA
});
Ce(this, "currentBrush", {
type: "PencilBrush",
color: (N_ = (z_ = A().config.objectDefaults) == null ? void 0 : z_.global) == null ? void 0 : N_.fill,
width: jm[1]
});
Ce(this, "onPathCreated", e => {
e.path.name = Ge.Drawing, e.path.set(RA()), A().setDirty(!0)
})
}
enable() {
de().on("path:created", this.onPathCreated), de().isDrawingMode = !0, this.setBrushType(this.currentBrush.type), this.setBrushSize(this.currentBrush.width)
}
disable() {
de().off("path:created", this.onPathCreated), de().isDrawingMode = !1
}
getBrushType() {
return this.currentBrush.type
}
setBrushType(e) {
this.currentBrush.type = e, de().freeDrawingBrush = e in be.fabric ? new be.fabric[e](de()) : this.customBrushes[e](de()), this.applyBrushStyles()
}
applyBrushStyles() {
Object.keys(this.currentBrush).forEach(n => {
de().freeDrawingBrush[n] = this.currentBrush[n]
});
const e = de().freeDrawingBrush;
e.getPatternSrc && (e.source = e.getPatternSrc.call(e))
}
setBrushSize(e) {
this.currentBrush.width = e, this.applyBrushStyles()
}
getBrushSize() {
return this.currentBrush.width
}
setBrushColor(e) {
this.currentBrush.color = e, this.applyBrushStyles()
}
getBrushColor() {
return this.currentBrush.color
}
}
function RA() {
const t = {
...Ur
};
return delete t.strokeWidth, t
}
function Ww(t) {
var n;
return ((n = /(?:\.([^.]+))?$/.exec(t)) == null ? void 0 : n[1]) || ""
}
function IA(t) {
const e = {
md: "text/markdown",
markdown: "text/markdown",
mp4: "video/mp4",
mp3: "audio/mp3",
svg: "image/svg+xml",
jpg: "image/jpeg",
png: "image/png",
gif: "image/gif",
yaml: "text/yaml",
yml: "text/yaml"
},
n = t.name ? Ww(t.name) : null;
return t.type ? t.type : n && n in e ? e[n] : "application/octet-stream"
}
let LA = 0;
function FA() {
return LA
}
class na {
constructor(e, n) {
Ce(this, "id");
Ce(this, "fingerprint");
Ce(this, "name");
Ce(this, "relativePath", "");
Ce(this, "size");
Ce(this, "mime", "");
Ce(this, "extension", "");
Ce(this, "native");
Ce(this, "lastModified");
Ce(this, "cachedData");
this.id = Pv(), this.name = e.name, this.size = e.size, this.mime = IA(e), this.lastModified = e.lastModified, this.extension = Ww(e.name) || "bin", this.native = e, n = n || e.webkitRelativePath || "", n = n.replace(/^\/+/g, ""), n && n.split("/").length > 1 && (this.relativePath = n), this.fingerprint = zA({
name: this.name,
size: this.size,
mime: this.mime,
lastModified: this.lastModified
})
}
get data() {
return new Promise(e => {
this.cachedData && e(this.cachedData);
const n = new FileReader;
n.addEventListener("load", () => {
this.cachedData = n.result, e(this.cachedData)
}), this.extension === "json" ? n.readAsText(this.native) : n.readAsDataURL(this.native)
})
}
}
function zA({
name: t,
mime: e,
size: n,
relativePath: r,
lastModified: i
}) {
let s = "be";
return typeof t == "string" && (s += `-${Yw(t.toLowerCase())}`), e && (s += `-${e}`), typeof r == "string" && (s += `-${Yw(r.toLowerCase())}`), n !== void 0 && (s += `-${n}`), i !== void 0 && (s += `-${i}`), s += `${FA()}`, `${s}-v1`
}
function NA(t) {
return t.charCodeAt(0).toString(32)
}
function Yw(t) {
let e = "";
return t.replace(/[^A-Z0-9]/gi, n => (e += `-${NA(n)}`, "/")) + e
}
function jA(t = {}) {
var r;
const e = document.querySelector("#hidden-file-upload-input");
e && e.remove();
const n = document.createElement("input");
return n.type = "file", n.multiple = (r = t.multiple) != null ? r : !1, n.classList.add("hidden"), n.style.display = "none", n.style.visibility = "hidden", n.id = "hidden-file-upload-input", n.accept = BA(t), t.directory && (n.webkitdirectory = !0), document.body.appendChild(n), n
}
function BA({
extensions: t = [],
types: e = []
}) {
const n = [];
return t != null && t.length && (t = t.map(r => r.startsWith(".") ? r : `.${r}`), n.push(t.join(","))), e != null && e.length && n.push(e.join(",")), n.join(",")
}
function $A(t = {}) {
return new Promise(e => {
const n = jA(t);
n.onchange = r => {
const i = r.target.files;
if (!i) return e([]);
const s = Array.from(i).filter(d => d.name !== ".DS_Store").map(d => new na(d));
e(s), n.remove()
}, document.body.appendChild(n), n.click()
})
}
async function VA(t, e = !0) {
const n = await Lw(t);
if (!!n) return new Promise(r => {
n.name = Ge.Image, n.opacity = 0;
const i = A().original.width,
s = A().original.height;
if (e && (n.width >= i || n.height >= s)) {
const d = i - .1 * i,
a = s - .1 * s,
o = 1 / Math.min(a / n.getScaledHeight(), d / n.getScaledWidth());
n.scaleX *= 1 / o, n.scaleY *= 1 / o
}
A().fabric.add(n), A().fabric.setActiveObject(n), n.viewportCenter(), n.setCoords(), A().fabric.requestRenderAll(), L().zoom.fitToScreen(), n.animate("opacity", "1", {
duration: 425,
onChange: () => {
A().fabric.requestRenderAll()
},
onComplete: () => {
r(n)
}
})
})
}
var Mp = (t => (t.image = "image/*", t.audio = "audio/*", t.json = "application/json", t.video = "video/mp4,video/mpeg,video/x-m4v,video/*", t))(Mp || {});
function HA(t) {
if (t == null || Number.isNaN(t)) return "";
const e = t < 0,
n = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
if (e && (t = -t), t < 1) return `${(e?"-":"")+t} B`;
const r = Math.min(Math.floor(Math.log(t) / Math.log(1024)), n.length - 1);
t = Number(t / Math.pow(1024, r));
const i = n[r];
return t >= 10 || t % 1 === 0 ? `${(e?"-":"")+t.toFixed(0)} ${i}` : `${(e?"-":"")+t.toFixed(1)} ${i}`
}
function Xw(t, e) {
this.text = t = t || "", this.hasWild = ~t.indexOf("*"), this.separator = e, this.parts = t.split(e)
}
Xw.prototype.match = function(t) {
var e = !0,
n = this.parts,
r, i = n.length,
s;
if (typeof t == "string" || t instanceof String)
if (!this.hasWild && this.text != t) e = !1;
else {
for (s = (t || "").split(this.separator), r = 0; e && r < i; r++) n[r] !== "*" && (r < s.length ? e = n[r] === s[r] : e = !1);
e = e && s
}
else if (typeof t.splice == "function")
for (e = [], r = t.length; r--;) this.match(t[r]) && (e[e.length] = t[r]);
else if (typeof t == "object") {
e = {};
for (var d in t) this.match(d) && (e[d] = t[d])
}
return e
};
var UA = function(t, e, n) {
var r = new Xw(t, n || /[\/\.]/);
return typeof e < "u" ? r.match(e) : r
},
WA = UA,
YA = /[\/\+\.]/,
XA = function(t, e) {
function n(r) {
var i = WA(r, t, YA);
return i && i.length >= 2
}
return e ? n(e.split(";")[0]) : n
};
function GA(t, e) {
if (!e) return;
const {
maxFileSize: n,
allowedFileTypes: r,
blockedFileTypes: i
} = e;
if (n && t.size != null && t.size > n) return fe("`:file` exceeds maximum allowed size of :size", {
values: {
file: t.name,
size: HA(n)
}
});
if (r != null && r.length && !Gw(t, r) || i != null && i.length && Gw(t, i)) return fe("This file type is not allowed")
}
function Gw(t, e) {
return e.some(n => n.includes("/") ? t.mime ? XA(t.mime.replace(/;.*?$/, ""), n) : !1 : n.replace(".", "") && t.extension ? t.extension.toLowerCase() === n.toLowerCase() : !1)
}
function KA(t, e) {
if (t == null) return 0;
switch (e) {
case "KB":
return t * 1024;
case "MB":
return t * 1024 ** 2;
case "GB":
return t * 1024 ** 3;
case "TB":
return t * 1024 ** 4;
case "PB":
return t * 1024 ** 5;
default:
return t
}
}
class qA {
async uploadAndAddImage() {
const e = await this.openUploadWindow();
await this.openUploadedFile(e)
}
async uploadAndReplaceMainImage() {
const e = await this.openUploadWindow();
e && await this.openBackgroundImage(e)
}
async uploadAndOpenStateFile() {
const e = await this.openUploadWindow(QA);
e && await this.loadState(await e.data)
}
async openUploadedFile(e) {
var r, i, s;
if (!e) return;
const n = await e.data;
switch (e.extension) {
case "json":
await this.loadState(n);
break;
case "svg":
await L().shape.addSvgSticker(n, Ge.Image), L().history.addHistoryItem({
name: "overlayImage"
});
break;
default:
await VA(n, (s = (i = (r = A().config.tools) == null ? void 0 : r.import) == null ? void 0 : i.fitOverlayToScreen) != null ? s : !0), L().history.addHistoryItem({
name: "overlayImage"
})
}
}
async loadState(e) {
A().toggleLoading("state"), await _f();
let n;
typeof e == "string" ? e.endsWith(".json") ? n = await Ya(e) : n = JSON.parse(e) : n = e, await L().history.addInitial(n), await L().history.reload(), A().toggleLoading(!1)
}
async openUploadWindow(e) {
var r, i;
e = e || ZA();
const n = (await $A(e))[0];
return this.fileIsValid(n) ? ((i = (r = A().config).onFileOpen) == null || i.call(r, n), n) : null
}
async openBackgroundImage(e) {
await _f();
let n;
e instanceof HTMLImageElement ? n = e.src : e instanceof na ? n = await e.data : n = e;
const r = await L().canvas.addMainImage(n);
return await L().history.addInitial(), r
}
fileIsValid(e) {
var s, d, a, o, c, h;
const n = (a = (d = (s = A().config.tools) == null ? void 0 : s.import) == null ? void 0 : d.maxFileSize) != null ? a : KA(10, "MB"),
r = [...(h = (c = (o = A().config.tools) == null ? void 0 : o.import) == null ? void 0 : c.validImgExtensions) != null ? h : [], "json"],
i = GA(e, {
maxFileSize: n,
allowedFileTypes: r
});
return i ? (Qo.danger(i), !1) : !0
}
}
function ZA() {
var e, n;
const t = (n = (e = A().config.tools) == null ? void 0 : e.import) == null ? void 0 : n.validImgExtensions;
return t ? {
extensions: t
} : {
types: [Mp.image]
}
}
const QA = {
types: [".json", Mp.json]
};
class JA {
constructor() {
Ce(this, "watermark", null);
Ce(this, "lineStyle", {
stroke: "rgba(255,255,255,0.3)",
strokeWidth: 5,
strokeLineCap: "round",
strokeLineJoin: "round"
})
}
add(e) {
this.createGroup(), this.addText(e), this.addLines(), de().add(this.watermark), L().canvas.render()
}
remove() {
!this.watermark || (de().remove(this.watermark), this.watermark = null, L().canvas.render())
}
createGroup() {
this.watermark = new be.fabric.Group(void 0, {
...Ur,
width: A().original.width,
height: A().original.height,
excludeFromExport: !0,
top: 0,
left: 0,
originX: "left",
originY: "top"
})
}
addText(e) {
var r;
const n = new be.fabric.Text(e, {
fill: "rgba(255,255,255,0.3)",
strokeWidth: 2,
stroke: "rgba(255,255,255,0.4)",
originX: "center",
originY: "center",
fontWeight: 600,
fontSize: 150,
fontFamily: "Courier New"
});
n.scaleToWidth(A().original.width / 2), (r = this.watermark) == null || r.add(n)
}
addLines() {
var h;
if (!this.watermark) return;
const e = (h = this.watermark) == null ? void 0 : h.getObjects("text")[0],
n = A().original.width / 2,
r = A().original.height / 2,
i = 100,
s = e.width / 4,
d = new be.fabric.Line(void 0, this.lineStyle),
a = new be.fabric.Line(void 0, this.lineStyle),
o = new be.fabric.Line(void 0, this.lineStyle),
c = new be.fabric.Line(void 0, this.lineStyle);
this.watermark.add(d, a, o, c), d.set({
x1: s,
y1: -i,
x2: n,
y2: -r
}), a.set({
x1: s,
y1: i,
x2: n,
y2: r
}), o.set({
x1: -s,
y1: -i,
x2: -n,
y2: -r
}), c.set({
x1: -s,
y1: i,
x2: -n,
y2: r
})
}
}
var Kw = {
exports: {}
};
(function(t, e) {
(function(n, r) {
r()
})(it, function() {
function n(c, h) {
return typeof h > "u" ? h = {
autoBom: !1
} : typeof h != "object" && (console.warn("Deprecated: Expected third argument to be a object"), h = {
autoBom: !h
}), h.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type) ? new Blob(["\uFEFF", c], {
type: c.type
}) : c
}
function r(c, h, l) {
var u = new XMLHttpRequest;
u.open("GET", c), u.responseType = "blob", u.onload = function() {
o(u.response, h, l)
}, u.onerror = function() {
console.error("could not download file")
}, u.send()
}
function i(c) {
var h = new XMLHttpRequest;
h.open("HEAD", c, !1);
try {
h.send()
} catch {}
return 200 <= h.status && 299 >= h.status
}
function s(c) {
try {
c.dispatchEvent(new MouseEvent("click"))
} catch {
var h = document.createEvent("MouseEvents");
h.initMouseEvent("click", !0, !0, window, 0, 0, 0, 80, 20, !1, !1, !1, !1, 0, null), c.dispatchEvent(h)
}
}
var d = typeof window == "object" && window.window === window ? window : typeof self == "object" && self.self === self ? self : typeof it == "object" && it.global === it ? it : void 0,
a = d.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent),
o = d.saveAs || (typeof window != "object" || window !== d ? function() {} : "download" in HTMLAnchorElement.prototype && !a ? function(c, h, l) {
var u = d.URL || d.webkitURL,
f = document.createElement("a");
h = h || c.name || "download", f.download = h, f.rel = "noopener", typeof c == "string" ? (f.href = c, f.origin === location.origin ? s(f) : i(f.href) ? r(c, h, l) : s(f, f.target = "_blank")) : (f.href = u.createObjectURL(c), setTimeout(function() {
u.revokeObjectURL(f.href)
}, 4e4), setTimeout(function() {
s(f)
}, 0))
} : "msSaveOrOpenBlob" in navigator ? function(c, h, l) {
if (h = h || c.name || "download", typeof c != "string") navigator.msSaveOrOpenBlob(n(c, l), h);
else if (i(c)) r(c, h, l);
else {
var u = document.createElement("a");
u.href = c, u.target = "_blank", setTimeout(function() {
s(u)
})
}
} : function(c, h, l, u) {
if (u = u || open("", "_blank"), u && (u.document.title = u.document.body.innerText = "downloading..."), typeof c == "string") return r(c, h, l);
var f = c.type === "application/octet-stream",
p = /constructor/i.test(d.HTMLElement) || d.safari,
m = /CriOS\/[\d]+/.test(navigator.userAgent);
if ((m || f && p || a) && typeof FileReader < "u") {
var g = new FileReader;
g.onloadend = function() {
var b = g.result;
b = m ? b : b.replace(/^data:[^;]*;/, "data:attachment/file;"), u ? u.location.href = b : location = b, u = null
}, g.readAsDataURL(c)
} else {
var v = d.URL || d.webkitURL,
y = v.createObjectURL(c);
u ? u.location = y : location.href = y, u = null, setTimeout(function() {
v.revokeObjectURL(y)
}, 4e4)
}
});
d.saveAs = o.saveAs = o, t.exports = o
})
})(Kw);
function eD(t, e, n) {
e = e || "", n = n || 512;
const r = atob(t),
i = [];
for (let s = 0; s < r.length; s += n) {
const d = r.slice(s, s + n),
a = new Array(d.length);
for (let c = 0; c < d.length; c++) a[c] = d.charCodeAt(c);
const o = new Uint8Array(a);
i.push(o)
}
return new Blob(i, {
type: e
})
}
class tD {
save2(e, n, r) {
var spinner = document.querySelector('#dialog-background');
spinner.style.display = 'block';
spinner.style.visibility = 'visible';
var a, o, c;
const i = (a = A().config.tools) == null ? void 0 : a.export;
e = e || (i == null ? void 0 : i.defaultName), n = this.getFormat(n), r = this.getQuality(r);
const s = `${e}.${n}`;
this.applyWaterMark();
const d = n === "json" ? this.getJsonState() : this.getDataUrl(n, r);
if (L().watermark.remove(), !!d)
if (A().config.saveUrl) fetch(A().config.saveUrl, {
method: "POST",
body: JSON.stringify({
data: d,
filename: s,
format: n
})
});
const h = this.getCanvasBlob(n, d);
Kw.exports.saveAs(h, s);
var spinner = document.querySelector('#dialog-background');
spinner.style.display = 'none';
spinner.style.visibility = 'hidden';
}
save(e, n, r) {
var a, o, c;
const i = (a = A().config.tools) == null ? void 0 : a.export;
e = e || (i == null ? void 0 : i.defaultName), n = this.getFormat(n), r = this.getQuality(r);
const s = `${e}.${n}`;
this.applyWaterMark();
const d = n === "json" ? this.getJsonState() : this.getDataUrl(n, r);
if (L().watermark.remove(), !!d)
if (A().config.saveUrl) fetch(A().config.saveUrl, {
method: "POST",
body: JSON.stringify({
data: d,
filename: s,
format: n
})
});
else if (A().config.onSave)(c = (o = A().config).onSave) == null || c.call(o, d, s, n);
else {
const h = this.getCanvasBlob(n, d);
Kw.exports.saveAs(h, s)
}
}
getDataUrl(e, n) {
this.prepareCanvas();
try {
return e === "svg" ? de().toSVG() : de().toDataURL({
format: this.getFormat(e),
quality: this.getQuality(n),
multiplier: Math.max(A().original.width / de().width, A().original.height / de().height)
})
} catch (r) {
r.message.toLowerCase().includes("tainted") && Qo.danger(fe("Could not export canvas with external image."))
}
return null
}
getCanvasBlob(e, n) {
if (e === "json") return new Blob([n], {
type: "application/json"
});
if (e === "svg") return new Blob([n], {
type: "image/svg+xml"
});
const r = `image/${e}`;
return n = n.replace(/data:image\/([a-z]*)?;base64,/, ""), eD(n, r)
}
getJsonState() {
return JSON.stringify(Xa())
}
prepareCanvas() {
de().discardActiveObject()
}
applyWaterMark() {
const e = A().config.watermarkText;
e && L().watermark.add(e)
}
getFormat(e) {
var r;
const n = (r = A().config.tools) == null ? void 0 : r.export;
return e = e || (n == null ? void 0 : n.defaultFormat) || "png", e === "jpg" && (e = "jpeg"), e
}
getQuality(e) {
var r;
const n = (r = A().config.tools) == null ? void 0 : r.export;
return e = e || (n == null ? void 0 : n.defaultQuality) || .8, e
}
}
class nD {
constructor() {
Ce(this, "previewRect", null)
}
async apply(e) {
this.previewRect || this.showPreview(), this.updatePreview(e), de().remove(this.previewRect), de().clipPath = this.previewRect;
const n = L().export.getDataUrl();
n && L().canvas.clear(), this.hidePreview(), n && await L().canvas.addMainImage(n), de().clipPath = void 0
}
getPreviewRadius() {
var e;
return ((e = this.previewRect) == null ? void 0 : e.rx) || 0
}
updatePreview(e) {
!this.previewRect || (this.previewRect.set({
rx: e,
ry: e
}), L().canvas.render())
}
showPreview() {
this.previewRect = new be.fabric.Rect({
width: A().original.width,
height: A().original.height,
rx: 50,
ry: 50,
objectCaching: !1,
fill: "transparent",
name: "round.rect",
data: {
pixieInternal: !0
},
stroke: "rgba(255,255,255,0.8)",
strokeWidth: 3,
strokeDashArray: [4, 4],
selectable: !1,
evented: !1
}), de().add(this.previewRect), this.previewRect.moveTo(99), this.previewRect.viewportCenter(), L().canvas.render()
}
hidePreview() {
!this.previewRect || (de().remove(this.previewRect), L().canvas.render(), this.previewRect = null)
}
}
class rD {
get straightenAnchor() {
return de().getObjects().find(e => e.name === Ge.StraightenAnchor)
}
rotateLeft() {
this.rotateFixed(-90)
}
rotateRight() {
this.rotateFixed(90)
}
straighten(e) {
this.storeObjectsRelationToHelper(), L().objects.deselectActive();
const n = (this.straightenAnchor.data.rotateAngle || 0) + e,
r = this.getImageScale(n, this.straightenAnchor);
this.straightenAnchor.angle = n, this.straightenAnchor.scaleX = r, this.straightenAnchor.scaleY = r, this.straightenAnchor.data.straightenAngle = e, this.transformObjectsBasedOnHelper()
}
flip(e) {
const n = e === "horizontal" ? "flipY" : "flipX";
L().objects.getAll().forEach(r => {
r[n] = !r[n]
}), L().canvas.render()
}
rotateFixed(e) {
L().zoom.set(1, !1), L().objects.deselectActive();
const n = this.straightenAnchor.data.rotateAngle || 0;
e = Math.round(e / 90) * 90;
const r = n + (this.straightenAnchor.data.straightenAngle || 0) + e;
L().canvas.resize(A().original.height, A().original.width, {
applyZoom: !1,
resizeHelper: !1
}), this.storeObjectsRelationToHelper(), this.straightenAnchor.rotate(r), this.straightenAnchor.data.rotateAngle = n + e, this.straightenAnchor.center(), this.transformObjectsBasedOnHelper(), L().frame.resize(L().frame.active.currentSizeInPercent), requestAnimationFrame(() => {
L().zoom.fitToScreen()
})
}
getImageScale(e, n) {
e = be.fabric.util.degreesToRadians(e);
const r = A().original.width,
i = A().original.height,
s = r / 2,
d = i / 2,
a = n.width / 2,
o = n.height / 2,
c = Math.sqrt(s ** 2 + d ** 2),
h = Math.asin(d / c);
let l = (e % (Math.PI * 2) + Math.PI * 4) % (Math.PI * 2);
l > Math.PI && (l -= Math.PI), l > Math.PI / 2 && l <= Math.PI && (l = Math.PI / 2 - (l - Math.PI / 2));
const u = Math.PI / 2 - h - Math.abs(l),
f = Math.abs(h - Math.abs(l)),
p = Math.cos(u) * c,
m = Math.cos(f) * c;
return Math.max(m / a, p / o)
}
storeObjectsRelationToHelper() {
L().objects.getAll().forEach(e => {
if (e !== this.straightenAnchor) {
const n = be.fabric.util.multiplyTransformMatrices(be.fabric.util.invertTransform(this.straightenAnchor.calcTransformMatrix()), e.calcTransformMatrix());
e.data = {
...e.data,
relationToCanvas: n
}
}
})
}
transformObjectsBasedOnHelper() {
L().objects.getAll().forEach(e => {
if (e.data.relationToCanvas) {
const n = be.fabric.util.multiplyTransformMatrices(this.straightenAnchor.calcTransformMatrix(), e.data.relationToCanvas),
r = be.fabric.util.qrDecompose(n);
e.set({
flipX: !1,
flipY: !1
}), e.setPositionByOrigin({
x: r.translateX,
y: r.translateY
}, "center", "center"), e.set(r), e.setCoords(), e.data.relationToCanvas = null
}
})
}
resetStraightenAnchor() {
const e = this.straightenAnchor;
e && de().remove(e);
const n = new be.fabric.Rect({
...Ur,
name: Ge.StraightenAnchor,
visible: !1,
width: A().original.width,
height: A().original.height,
data: {
pixieInternal: !0,
straightenAngle: 0,
rotateAngle: 0
}
});
de().add(n), n.viewportCenter()
}
}
function iD(t) {
const e = QM(t);
A().editor.fabric = e, ae.setState({
fabric: e
}), A().editor.tools = {
canvas: new eA,
objects: new sA,
zoom: new JM,
history: new uA,
filter: new pA,
resize: new mA,
crop: new _A,
merge: new hA,
shape: new SA,
frame: new EA,
text: new lA,
draw: new DA,
transform: new rD,
import: new qA,
watermark: new JA,
export: new tD,
corners: new nD
}
}
function qw(t, e) {
const n = new ResizeObserver(r => {
const i = r[0].contentRect;
e({
width: i.width,
height: i.height
})
});
return t.current && n.observe(t.current), () => {
t.current && n.unobserve(t.current)
}
}
function Zw(t) {
const e = t.getBoundingClientRect();
return {
top: e.top,
right: e.right,
bottom: e.bottom,
left: e.left,
width: e.width,
height: e.height
}
}
const Qw = "flex flex-shrink-0 items-center justify-between px-12 py-[9px] w-full h-[54px]",
Jw = {
initial: {
opacity: 0
},
animate: {
opacity: 1
},
exit: {
opacity: 0,
position: "absolute"
},
transition: {
type: "tween",
duration: .15
}
};
function Ap(t, {
padding: e,
equalWidth: n,
variant: r
} = {}) {
switch (t) {
case "xs":
return r === "link" ? "text-xs" : `text-xs h-30 ${n?"w-30":e||"px-14"}`;
case "sm":
return r === "link" ? "text-sm" : `text-sm h-36 ${n?"w-36":e||"px-18"}`;
case "md":
return r === "link" ? "text-base" : `text-base h-42 ${n?"w-42":e||"px-22"}`;
case "lg":
return r === "link" ? "text-lg" : `text-base h-50 ${n?"w-50":e||"px-26"}`;
case "xl":
return r === "link" ? "text-xl" : `text-lg h-60 ${n?"w-60":e||"px-32"}`;
default:
return t || ""
}
}
function oD(t) {
switch (t) {
case "xs":
return "icon-xs";
case "sm":
return "icon-sm";
case "md":
return "icon-sm";
case "lg":
return "icon-lg";
case "xl":
return "icon-xl";
default:
return ""
}
}
function sD(t) {
const {
variant: e
} = t, n = {
...t,
border: t.border || "border"
};
let r = [];
return e === "outline" ? r = aD(n) : e === "text" ? r = lD(n) : e === "flat" || e === "raised" ? r = uD(n) : e === "link" && (r = cD(n)), [...r, e === "raised" && "shadow-md", e && "align-middle whitespace-nowrap inline-flex items-center transition-button duration-200", "select-none appearance-none no-underline outline-none disabled:pointer-events-none disabled:cursor-default"]
}
function aD({
color: t,
border: e
}) {
const n = "disabled:text-disabled disabled:bg-transparent disabled:border-disabled-bg";
switch (t) {
case "primary":
return [`text-primary bg-transparent ${e} border-primary/50`, "hover:bg-primary/hover hover:border-primary", n];
case "danger":
return [`text-danger bg-transparent ${e} border-danger/50`, "hover:bg-danger/4 hover:border-danger", n];
case "paper":
return [`text bg-paper ${e}`, "hover:bg-hover", n];
default:
return [`bg-transparent ${e}`, "hover:bg-hover", n]
}
}
function lD({
color: t
}) {
const e = "disabled:text-disabled disabled:bg-transparent";
switch (t) {
case "primary":
return ["text-primary bg-transparent border-transparent", "hover:bg-primary/4", e];
case "danger":
return ["text-danger bg-transparent border-transparent", "hover:bg-danger/4", e];
default:
return ["bg-transparent border-transparent", "hover:bg-hover", e]
}
}
function cD({
color: t
}) {
switch (t) {
case "primary":
return ["text-primary", "hover:underline", "disabled:text-disabled"];
case "danger":
return ["text-danger", "hover:underline", "disabled:text-disabled"];
default:
return ["text-main", "hover:underline", "disabled:text-disabled"]
}
}
function uD({
color: t,
border: e
}) {
const n = "disabled:text-disabled disabled:bg-disabled disabled:border-transparent disabled:shadow-none";
switch (t) {
case "primary":
return [`text-on-primary bg-primary ${e} border-primary`, "hover:bg-primary-dark hover:border-primary-dark", n];
case "danger":
return [`text-white bg-danger ${e} border-danger`, "hover:bg-danger/90 hover:border-danger/90", n];
case "chip":
return [`text-main bg-chip ${e} border-chip`, "hover:bg-chip/90 hover:border-chip/90", n];
case "paper":
return [`text-main bg-paper ${e} border-paper`, "hover:bg-paper/90 hover:bg-paper-90", n];
default:
return [`bg ${e} border-background`, "hover:bg-hover", n]
}
}
function $n(t) {
if (!!t) return e => {
e.currentTarget.contains(e.target) && t(e)
}
}
const Vn = E.exports.forwardRef((t, e) => {
const {
children: n,
color: r = null,
variant: i,
radius: s,
justify: d = "justify-center",
className: a,
href: o,
form: c,
border: h,
elementType: l,
to: u,
replace: f,
end: p,
type: m = "button",
onClick: g,
onPointerDown: v,
onPointerUp: y,
onKeyDown: b,
...w
} = t, x = l || (o ? "a" : "button"), S = x === "a";
return _(x, {
ref: e,
form: S ? void 0 : c,
href: o,
to: u,
type: S ? void 0 : m,
replace: f,
end: p,
onPointerDown: $n(v),
onPointerUp: $n(y),
onClick: $n(g),
onKeyDown: $n(b),
className: he("focus-visible:ring", sD({
variant: i,
color: r,
border: h
}), s, d, a),
...w,
children: n
})
}),
bt = ue.forwardRef(({
children: t,
startIcon: e,
endIcon: n,
size: r = "sm",
className: i,
equalWidth: s = !1,
radius: d = "rounded",
variant: a = "text",
...o
}, c) => {
const h = he("font-semibold", Ap(r, {
equalWidth: s,
variant: a
}), i);
return se(Vn, {
className: h,
ref: c,
radius: d,
variant: a,
...o,
children: [e && _(ex, {
position: "start",
icon: e,
size: r
}), t, n && _(ex, {
position: "end",
icon: n,
size: r
})]
})
});
function ex({
icon: t,
position: e,
size: n
}) {
const r = he("m-auto", {
"-ml-4 mr-8": e === "start",
"-mr-4 ml-8": e === "end"
}, t.props.className);
return ue.cloneElement(t, {
className: r,
size: n
})
}
var tx = {
exports: {}
};
(function(t) {
(function() {
var e = Object.assign;
typeof e != "function" && (e = function() {
var i = arguments,
s = arguments[0];
if (s == null) throw new TypeError("Cannot convert undefined or null to object");
s = Object(s);
for (var d = 1; d < i.length; d++)
if (i[d] && typeof i[d] == "object")
for (var a in i[d]) s[a] = i[d][a];
return s
});
function n(i) {
var s = i + "",
d = s.indexOf("...");
return d >= 0 && (d < s.indexOf(")") || s.indexOf("arguments") >= 0)
}
function r(i, s) {
s || (s = {});
var d = s.vargs || n(i),
a = Object.create(null),
o = [],
c = [],
h = new WeakMap,
l = function(y, b, w) {
return setTimeout(function() {
if (w) {
b.splice(y, 1), w.splice(y, 1);
return
}
b instanceof WeakMap ? b.delete(y) : delete b[y]
}, s.maxAge)
},
u = s.maxAge > 0 && s.maxAge < 1 / 0 ? l : 0,
f = s.equals ? s.equals : function(y, b) {
return y === b
},
p = s.maxArgs,
m = s.serializer,
g, v;
return i.length === 1 && !s.equals && !d ? (g = function(y) {
var b = typeof y;
if (!m && (b === "object" && y || b === "function")) {
var w;
return h.get(y) || (!u || u(y, h), h.set(y, w = i.call(this, y)), w)
}
var x = b === "number" || b === "boolean" || y == null ? y : b === "string" ? JSON.stringify(y) : m(y);
return a[x] || (!u || u(x, a), a[x] = i.call(this, y))
}.bind(this), v = 1) : g = function() {
var y = p || arguments.length,
b;
for (b = o.length - 1; b >= 0; b--)
if (!(!p && o[b].length !== y)) {
for (var w = y - 1; w >= 0 && f(o[b][w], arguments[w]); w--)
if (w === 0) return c[b]
} return b = o.length - (b + 1), !u || u(b, c, o), c[b] = i.apply(this, o[b] = arguments)
}.bind(this), g.clear = function() {
h = new WeakMap, a = Object.create(null), o = [], c = []
}, g.keys = function() {
return v ? null : o.slice()
}, g.values = function() {
return v ? null : c.slice()
}, g.keyValues = function() {
return v ? {
primitives: e({}, a),
objects: h
} : null
}, g
}
t.exports = r, typeof window < "u" && (window.nanomemoize = r)
}).call(it)
})(tx);
const ra = tx.exports;
function fD({
children: t,
label: e,
index: n
}) {
const r = E.exports.useId();
return se("div", {
role: "group",
className: he(n !== 0 && "border-t my-4"),
"aria-labelledby": e ? `be-select-${r}` : void 0,
children: [e && _("div", {
className: "block uppercase text-muted text-xs px-16 py-10",
role: "presentation",
id: `be-select-${r}`,
"aria-hidden": "true",
children: e
}), t]
})
}
const hD = ra(({
maxItems: t,
children: e,
items: n,
inputValue: r
}) => {
let i = pD({
children: e,
items: n
}),
s = dD({
collection: i,
inputValue: r
});
return t && (i = new Map([...i.entries()].slice(0, t)), s = new Map([...s.entries()].slice(0, t))), {
collection: i,
filteredCollection: s
}
}),
dD = ra(({
collection: t,
inputValue: e
}) => {
let n = new Map;
const r = e ? `${e}`.toLowerCase().trim() : "";
if (!r) n = t;
else {
let i = 0;
t.forEach((s, d) => {
(s.item ? JSON.stringify(s.item) : s.textLabel).toLowerCase().trim().includes(r) && n.set(d, {
...s,
index: i++
})
})
}
return n
}),
pD = ra(({
children: t,
items: e
}) => {
let n;
e && typeof t == "function" ? n = e.map(d => t(d)) : n = t;
const r = new Map;
let i = 0;
const s = (d, a, o, c) => {
const h = i++,
l = a ? e == null ? void 0 : e[o].items[c] : e == null ? void 0 : e[h];
r.set(d.props.value, {
index: h,
element: d,
textLabel: gD(d),
item: l,
section: a,
isDisabled: d.props.isDisabled,
value: d.props.value
})
};
return E.exports.Children.forEach(n, (d, a) => {
!E.exports.isValidElement(d) || (d.type === fD ? E.exports.Children.forEach(d.props.children, (o, c) => {
s(o, d, a, c)
}) : s(d))
}), r
});
function gD(t) {
var n;
const e = t.props.children;
return t.props.textLabel ? t.props.textLabel : e && ((n = e.props) == null ? void 0 : n.defaultMessage) ? e.props.defaultMessage[0].value : `${e}` || ""
}
function Eo(t) {
return t.split("-")[0]
}
function ia(t) {
return t.split("-")[1]
}
function oa(t) {
return ["top", "bottom"].includes(Eo(t)) ? "x" : "y"
}
function Dp(t) {
return t === "y" ? "height" : "width"
}
function nx(t, e, n) {
let {
reference: r,
floating: i
} = t;
const s = r.x + r.width / 2 - i.width / 2,
d = r.y + r.height / 2 - i.height / 2,
a = oa(e),
o = Dp(a),
c = r[o] / 2 - i[o] / 2,
h = Eo(e),
l = a === "x";
let u;
switch (h) {
case "top":
u = {
x: s,
y: r.y - i.height
};
break;
case "bottom":
u = {
x: s,
y: r.y + r.height
};
break;
case "right":
u = {
x: r.x + r.width,
y: d
};
break;
case "left":
u = {
x: r.x - i.width,
y: d
};
break;
default:
u = {
x: r.x,
y: r.y
}
}
switch (ia(e)) {
case "start":
u[a] -= c * (n && l ? -1 : 1);
break;
case "end":
u[a] += c * (n && l ? -1 : 1);
break
}
return u
}
const mD = async (t, e, n) => {
const {
placement: r = "bottom",
strategy: i = "absolute",
middleware: s = [],
platform: d
} = n, a = await (d.isRTL == null ? void 0 : d.isRTL(e));
let o = await d.getElementRects({
reference: t,
floating: e,
strategy: i
}),
{
x: c,
y: h
} = nx(o, r, a),
l = r,
u = {},
f = 0;
for (let p = 0; p < s.length; p++) {
const {
name: m,
fn: g
} = s[p], {
x: v,
y,
data: b,
reset: w
} = await g({
x: c,
y: h,
initialPlacement: r,
placement: l,
strategy: i,
middlewareData: u,
rects: o,
platform: d,
elements: {
reference: t,
floating: e
}
});
if (c = v != null ? v : c, h = y != null ? y : h, u = {
...u,
[m]: {
...u[m],
...b
}
}, w && f <= 50) {
f++, typeof w == "object" && (w.placement && (l = w.placement), w.rects && (o = w.rects === !0 ? await d.getElementRects({
reference: t,
floating: e,
strategy: i
}) : w.rects), {
x: c,
y: h
} = nx(o, l, a)), p = -1;
continue
}
}
return {
x: c,
y: h,
placement: l,
strategy: i,
middlewareData: u
}
};
function vD(t) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...t
}
}
function rx(t) {
return typeof t != "number" ? vD(t) : {
top: t,
right: t,
bottom: t,
left: t
}
}
function Pc(t) {
return {
...t,
top: t.y,
left: t.x,
right: t.x + t.width,
bottom: t.y + t.height
}
}
async function Rp(t, e) {
var n;
e === void 0 && (e = {});
const {
x: r,
y: i,
platform: s,
rects: d,
elements: a,
strategy: o
} = t, {
boundary: c = "clippingAncestors",
rootBoundary: h = "viewport",
elementContext: l = "floating",
altBoundary: u = !1,
padding: f = 0
} = e, p = rx(f), g = a[u ? l === "floating" ? "reference" : "floating" : l], v = Pc(await s.getClippingRect({
element: (n = await (s.isElement == null ? void 0 : s.isElement(g))) == null || n ? g : g.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(a.floating)),
boundary: c,
rootBoundary: h,
strategy: o
})), y = Pc(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
rect: l === "floating" ? {
...d.floating,
x: r,
y: i
} : d.reference,
offsetParent: await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a.floating)),
strategy: o
}) : d[l]);
return {
top: v.top - y.top + p.top,
bottom: y.bottom - v.bottom + p.bottom,
left: v.left - y.left + p.left,
right: y.right - v.right + p.right
}
}
const yD = Math.min,
pi = Math.max;
function Ip(t, e, n) {
return pi(t, yD(e, n))
}
const ix = t => ({
name: "arrow",
options: t,
async fn(e) {
const {
element: n,
padding: r = 0
} = t != null ? t : {}, {
x: i,
y: s,
placement: d,
rects: a,
platform: o
} = e;
if (n == null) return {};
const c = rx(r),
h = {
x: i,
y: s
},
l = oa(d),
u = ia(d),
f = Dp(l),
p = await o.getDimensions(n),
m = l === "y" ? "top" : "left",
g = l === "y" ? "bottom" : "right",
v = a.reference[f] + a.reference[l] - h[l] - a.floating[f],
y = h[l] - a.reference[l],
b = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(n));
let w = b ? l === "y" ? b.clientHeight || 0 : b.clientWidth || 0 : 0;
w === 0 && (w = a.floating[f]);
const x = v / 2 - y / 2,
S = c[m],
T = w - p[f] - c[g],
P = w / 2 - p[f] / 2 + x,
I = Ip(S, P, T),
ee = (u === "start" ? c[m] : c[g]) > 0 && P !== I && a.reference[f] <= a.floating[f] ? P < S ? S - P : T - P : 0;
return {
[l]: h[l] - ee,
data: {
[l]: I,
centerOffset: P - I
}
}
}
}),
bD = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
};
function Mc(t) {
return t.replace(/left|right|bottom|top/g, e => bD[e])
}
function wD(t, e, n) {
n === void 0 && (n = !1);
const r = ia(t),
i = oa(t),
s = Dp(i);
let d = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
return e.reference[s] > e.floating[s] && (d = Mc(d)), {
main: d,
cross: Mc(d)
}
}
const xD = {
start: "end",
end: "start"
};
function ox(t) {
return t.replace(/start|end/g, e => xD[e])
}
function _D(t) {
const e = Mc(t);
return [ox(t), e, ox(e)]
}
const SD = function(t) {
return t === void 0 && (t = {}), {
name: "flip",
options: t,
async fn(e) {
var n;
const {
placement: r,
middlewareData: i,
rects: s,
initialPlacement: d,
platform: a,
elements: o
} = e, {
mainAxis: c = !0,
crossAxis: h = !0,
fallbackPlacements: l,
fallbackStrategy: u = "bestFit",
flipAlignment: f = !0,
...p
} = t, m = Eo(r), v = l || (m === d || !f ? [Mc(d)] : _D(d)), y = [d, ...v], b = await Rp(e, p), w = [];
let x = ((n = i.flip) == null ? void 0 : n.overflows) || [];
if (c && w.push(b[m]), h) {
const {
main: I,
cross: z
} = wD(r, s, await (a.isRTL == null ? void 0 : a.isRTL(o.floating)));
w.push(b[I], b[z])
}
if (x = [...x, {
placement: r,
overflows: w
}], !w.every(I => I <= 0)) {
var S, T;
const I = ((S = (T = i.flip) == null ? void 0 : T.index) != null ? S : 0) + 1,
z = y[I];
if (z) return {
data: {
index: I,
overflows: x
},
reset: {
placement: z
}
};
let H = "bottom";
switch (u) {
case "bestFit": {
var P;
const ee = (P = x.map(te => [te, te.overflows.filter(ne => ne > 0).reduce((ne, Z) => ne + Z, 0)]).sort((te, ne) => te[1] - ne[1])[0]) == null ? void 0 : P[0].placement;
ee && (H = ee);
break
}
case "initialPlacement":
H = d;
break
}
if (r !== H) return {
reset: {
placement: H
}
}
}
return {}
}
}
};
async function CD(t, e) {
const {
placement: n,
platform: r,
elements: i
} = t, s = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), d = Eo(n), a = ia(n), o = oa(n) === "x", c = ["left", "top"].includes(d) ? -1 : 1, h = s && o ? -1 : 1, l = typeof e == "function" ? e(t) : e;
let {
mainAxis: u,
crossAxis: f,
alignmentAxis: p
} = typeof l == "number" ? {
mainAxis: l,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: 0,
crossAxis: 0,
alignmentAxis: null,
...l
};
return a && typeof p == "number" && (f = a === "end" ? p * -1 : p), o ? {
x: f * h,
y: u * c
} : {
x: u * c,
y: f * h
}
}
const TD = function(t) {
return t === void 0 && (t = 0), {
name: "offset",
options: t,
async fn(e) {
const {
x: n,
y: r
} = e, i = await CD(e, t);
return {
x: n + i.x,
y: r + i.y,
data: i
}
}
}
};
function kD(t) {
return t === "x" ? "y" : "x"
}
const ED = function(t) {
return t === void 0 && (t = {}), {
name: "shift",
options: t,
async fn(e) {
const {
x: n,
y: r,
placement: i
} = e, {
mainAxis: s = !0,
crossAxis: d = !1,
limiter: a = {
fn: g => {
let {
x: v,
y
} = g;
return {
x: v,
y
}
}
},
...o
} = t, c = {
x: n,
y: r
}, h = await Rp(e, o), l = oa(Eo(i)), u = kD(l);
let f = c[l],
p = c[u];
if (s) {
const g = l === "y" ? "top" : "left",
v = l === "y" ? "bottom" : "right",
y = f + h[g],
b = f - h[v];
f = Ip(y, f, b)
}
if (d) {
const g = u === "y" ? "top" : "left",
v = u === "y" ? "bottom" : "right",
y = p + h[g],
b = p - h[v];
p = Ip(y, p, b)
}
const m = a.fn({
...e,
[l]: f,
[u]: p
});
return {
...m,
data: {
x: m.x - n,
y: m.y - r
}
}
}
}
},
OD = function(t) {
return t === void 0 && (t = {}), {
name: "size",
options: t,
async fn(e) {
const {
placement: n,
rects: r,
platform: i,
elements: s
} = e, {
apply: d = () => {},
...a
} = t, o = await Rp(e, a), c = Eo(n), h = ia(n);
let l, u;
c === "top" || c === "bottom" ? (l = c, u = h === (await (i.isRTL == null ? void 0 : i.isRTL(s.floating)) ? "start" : "end") ? "left" : "right") : (u = c, l = h === "end" ? "top" : "bottom");
const f = pi(o.left, 0),
p = pi(o.right, 0),
m = pi(o.top, 0),
g = pi(o.bottom, 0),
v = {
availableHeight: r.floating.height - (["left", "right"].includes(n) ? 2 * (m !== 0 || g !== 0 ? m + g : pi(o.top, o.bottom)) : o[l]),
availableWidth: r.floating.width - (["top", "bottom"].includes(n) ? 2 * (f !== 0 || p !== 0 ? f + p : pi(o.left, o.right)) : o[u])
};
await d({
...e,
...v
});
const y = await i.getDimensions(s.floating);
return r.floating.width !== y.width || r.floating.height !== y.height ? {
reset: {
rects: !0
}
} : {}
}
}
};
function sx(t) {
return t && t.document && t.location && t.alert && t.setInterval
}
function Hn(t) {
if (t == null) return window;
if (!sx(t)) {
const e = t.ownerDocument;
return e && e.defaultView || window
}
return t
}
function Pr(t) {
return Hn(t).getComputedStyle(t)
}
function Un(t) {
return sx(t) ? "" : t ? (t.nodeName || "").toLowerCase() : ""
}
function ax() {
const t = navigator.userAgentData;
return t != null && t.brands ? t.brands.map(e => e.brand + "/" + e.version).join(" ") : navigator.userAgent
}
function Sn(t) {
return t instanceof Hn(t).HTMLElement
}
function Mr(t) {
return t instanceof Hn(t).Element
}
function PD(t) {
return t instanceof Hn(t).Node
}
function Ac(t) {
if (typeof ShadowRoot > "u") return !1;
const e = Hn(t).ShadowRoot;
return t instanceof e || t instanceof ShadowRoot
}
function Dc(t) {
const {
overflow: e,
overflowX: n,
overflowY: r
} = Pr(t);
return /auto|scroll|overlay|hidden/.test(e + r + n)
}
function MD(t) {
return ["table", "td", "th"].includes(Un(t))
}
function lx(t) {
const e = /firefox/i.test(ax()),
n = Pr(t);
return n.transform !== "none" || n.perspective !== "none" || n.contain === "paint" || ["transform", "perspective"].includes(n.willChange) || e && n.willChange === "filter" || e && (n.filter ? n.filter !== "none" : !1)
}
function cx() {
return !/^((?!chrome|android).)*safari/i.test(ax())
}
const ux = Math.min,
sa = Math.max,
Rc = Math.round;
function Wn(t, e, n) {
var r, i, s, d;
e === void 0 && (e = !1), n === void 0 && (n = !1);
const a = t.getBoundingClientRect();
let o = 1,
c = 1;
e && Sn(t) && (o = t.offsetWidth > 0 && Rc(a.width) / t.offsetWidth || 1, c = t.offsetHeight > 0 && Rc(a.height) / t.offsetHeight || 1);
const h = Mr(t) ? Hn(t) : window,
l = !cx() && n,
u = (a.left + (l && (r = (i = h.visualViewport) == null ? void 0 : i.offsetLeft) != null ? r : 0)) / o,
f = (a.top + (l && (s = (d = h.visualViewport) == null ? void 0 : d.offsetTop) != null ? s : 0)) / c,
p = a.width / o,
m = a.height / c;
return {
width: p,
height: m,
top: f,
right: u + p,
bottom: f + m,
left: u,
x: u,
y: f
}
}
function Ar(t) {
return ((PD(t) ? t.ownerDocument : t.document) || window.document).documentElement
}
function Ic(t) {
return Mr(t) ? {
scrollLeft: t.scrollLeft,
scrollTop: t.scrollTop
} : {
scrollLeft: t.pageXOffset,
scrollTop: t.pageYOffset
}
}
function fx(t) {
return Wn(Ar(t)).left + Ic(t).scrollLeft
}
function AD(t) {
const e = Wn(t);
return Rc(e.width) !== t.offsetWidth || Rc(e.height) !== t.offsetHeight
}
function DD(t, e, n) {
const r = Sn(e),
i = Ar(e),
s = Wn(t, r && AD(e), n === "fixed");
let d = {
scrollLeft: 0,
scrollTop: 0
};
const a = {
x: 0,
y: 0
};
if (r || !r && n !== "fixed")
if ((Un(e) !== "body" || Dc(i)) && (d = Ic(e)), Sn(e)) {
const o = Wn(e, !0);
a.x = o.x + e.clientLeft, a.y = o.y + e.clientTop
} else i && (a.x = fx(i));
return {
x: s.left + d.scrollLeft - a.x,
y: s.top + d.scrollTop - a.y,
width: s.width,
height: s.height
}
}
function hx(t) {
return Un(t) === "html" ? t : t.assignedSlot || t.parentNode || (Ac(t) ? t.host : null) || Ar(t)
}
function dx(t) {
return !Sn(t) || Pr(t).position === "fixed" ? null : t.offsetParent
}
function RD(t) {
let e = hx(t);
for (Ac(e) && (e = e.host); Sn(e) && !["html", "body"].includes(Un(e));) {
if (lx(e)) return e; {
const n = e.parentNode;
e = Ac(n) ? n.host : n
}
}
return null
}
function Lp(t) {
const e = Hn(t);
let n = dx(t);
for (; n && MD(n) && Pr(n).position === "static";) n = dx(n);
return n && (Un(n) === "html" || Un(n) === "body" && Pr(n).position === "static" && !lx(n)) ? e : n || RD(t) || e
}
function px(t) {
if (Sn(t)) return {
width: t.offsetWidth,
height: t.offsetHeight
};
const e = Wn(t);
return {
width: e.width,
height: e.height
}
}
function ID(t) {
let {
rect: e,
offsetParent: n,
strategy: r
} = t;
const i = Sn(n),
s = Ar(n);
if (n === s) return e;
let d = {
scrollLeft: 0,
scrollTop: 0
};
const a = {
x: 0,
y: 0
};
if ((i || !i && r !== "fixed") && ((Un(n) !== "body" || Dc(s)) && (d = Ic(n)), Sn(n))) {
const o = Wn(n, !0);
a.x = o.x + n.clientLeft, a.y = o.y + n.clientTop
}
return {
...e,
x: e.x - d.scrollLeft + a.x,
y: e.y - d.scrollTop + a.y
}
}
function LD(t, e) {
const n = Hn(t),
r = Ar(t),
i = n.visualViewport;
let s = r.clientWidth,
d = r.clientHeight,
a = 0,
o = 0;
if (i) {
s = i.width, d = i.height;
const c = cx();
(c || !c && e === "fixed") && (a = i.offsetLeft, o = i.offsetTop)
}
return {
width: s,
height: d,
x: a,
y: o
}
}
function FD(t) {
var e;
const n = Ar(t),
r = Ic(t),
i = (e = t.ownerDocument) == null ? void 0 : e.body,
s = sa(n.scrollWidth, n.clientWidth, i ? i.scrollWidth : 0, i ? i.clientWidth : 0),
d = sa(n.scrollHeight, n.clientHeight, i ? i.scrollHeight : 0, i ? i.clientHeight : 0);
let a = -r.scrollLeft + fx(t);
const o = -r.scrollTop;
return Pr(i || n).direction === "rtl" && (a += sa(n.clientWidth, i ? i.clientWidth : 0) - s), {
width: s,
height: d,
x: a,
y: o
}
}
function gx(t) {
const e = hx(t);
return ["html", "body", "#document"].includes(Un(e)) ? t.ownerDocument.body : Sn(e) && Dc(e) ? e : gx(e)
}
function Lc(t, e) {
var n;
e === void 0 && (e = []);
const r = gx(t),
i = r === ((n = t.ownerDocument) == null ? void 0 : n.body),
s = Hn(r),
d = i ? [s].concat(s.visualViewport || [], Dc(r) ? r : []) : r,
a = e.concat(d);
return i ? a : a.concat(Lc(d))
}
function zD(t, e) {
const n = e.getRootNode == null ? void 0 : e.getRootNode();
if (t.contains(e)) return !0;
if (n && Ac(n)) {
let r = e;
do {
if (r && t === r) return !0;
r = r.parentNode || r.host
} while (r)
}
return !1
}
function ND(t, e) {
const n = Wn(t, !1, e === "fixed"),
r = n.top + t.clientTop,
i = n.left + t.clientLeft;
return {
top: r,
left: i,
x: i,
y: r,
right: i + t.clientWidth,
bottom: r + t.clientHeight,
width: t.clientWidth,
height: t.clientHeight
}
}
function mx(t, e, n) {
return e === "viewport" ? Pc(LD(t, n)) : Mr(e) ? ND(e, n) : Pc(FD(Ar(t)))
}
function jD(t) {
const e = Lc(t),
r = ["absolute", "fixed"].includes(Pr(t).position) && Sn(t) ? Lp(t) : t;
return Mr(r) ? e.filter(i => Mr(i) && zD(i, r) && Un(i) !== "body") : []
}
function BD(t) {
let {
element: e,
boundary: n,
rootBoundary: r,
strategy: i
} = t;
const d = [...n === "clippingAncestors" ? jD(e) : [].concat(n), r],
a = d[0],
o = d.reduce((c, h) => {
const l = mx(e, h, i);
return c.top = sa(l.top, c.top), c.right = ux(l.right, c.right), c.bottom = ux(l.bottom, c.bottom), c.left = sa(l.left, c.left), c
}, mx(e, a, i));
return {
width: o.right - o.left,
height: o.bottom - o.top,
x: o.left,
y: o.top
}
}
const $D = {
getClippingRect: BD,
convertOffsetParentRelativeRectToViewportRelativeRect: ID,
isElement: Mr,
getDimensions: px,
getOffsetParent: Lp,
getDocumentElement: Ar,
getElementRects: t => {
let {
reference: e,
floating: n,
strategy: r
} = t;
return {
reference: DD(e, Lp(n), r),
floating: {
...px(n),
x: 0,
y: 0
}
}
},
getClientRects: t => Array.from(t.getClientRects()),
isRTL: t => Pr(t).direction === "rtl"
};
function VD(t, e, n, r) {
r === void 0 && (r = {});
const {
ancestorScroll: i = !0,
ancestorResize: s = !0,
elementResize: d = !0,
animationFrame: a = !1
} = r, o = i && !a, c = s && !a, h = o || c ? [...Mr(t) ? Lc(t) : [], ...Lc(e)] : [];
h.forEach(m => {
o && m.addEventListener("scroll", n, {
passive: !0
}), c && m.addEventListener("resize", n)
});
let l = null;
if (d) {
let m = !0;
l = new ResizeObserver(() => {
m || n(), m = !1
}), Mr(t) && !a && l.observe(t), l.observe(e)
}
let u, f = a ? Wn(t) : null;
a && p();
function p() {
const m = Wn(t);
f && (m.x !== f.x || m.y !== f.y || m.width !== f.width || m.height !== f.height) && n(), f = m, u = requestAnimationFrame(p)
}
return n(), () => {
var m;
h.forEach(g => {
o && g.removeEventListener("scroll", n), c && g.removeEventListener("resize", n)
}), (m = l) == null || m.disconnect(), l = null, a && cancelAnimationFrame(u)
}
}
const HD = (t, e, n) => mD(t, e, {
platform: $D,
...n
});
var Fp = typeof document < "u" ? E.exports.useLayoutEffect : E.exports.useEffect;
function Fc(t, e) {
if (t === e) return !0;
if (typeof t != typeof e) return !1;
if (typeof t == "function" && t.toString() === e.toString()) return !0;
let n, r, i;
if (t && e && typeof t == "object") {
if (Array.isArray(t)) {
if (n = t.length, n != e.length) return !1;
for (r = n; r-- !== 0;)
if (!Fc(t[r], e[r])) return !1;
return !0
}
if (i = Object.keys(t), n = i.length, n !== Object.keys(e).length) return !1;
for (r = n; r-- !== 0;)
if (!Object.prototype.hasOwnProperty.call(e, i[r])) return !1;
for (r = n; r-- !== 0;) {
const s = i[r];
if (!(s === "_owner" && t.$$typeof) && !Fc(t[s], e[s])) return !1
}
return !0
}
return t !== t && e !== e
}
function UD(t) {
const e = E.exports.useRef(t);
return Fp(() => {
e.current = t
}), e
}
function WD(t) {
let {
middleware: e,
placement: n = "bottom",
strategy: r = "absolute",
whileElementsMounted: i
} = t === void 0 ? {} : t;
const [s, d] = E.exports.useState({
x: null,
y: null,
strategy: r,
placement: n,
middlewareData: {}
}), [a, o] = E.exports.useState(e);
Fc(a == null ? void 0 : a.map(w => {
let {
name: x,
options: S
} = w;
return {
name: x,
options: S
}
}), e == null ? void 0 : e.map(w => {
let {
name: x,
options: S
} = w;
return {
name: x,
options: S
}
})) || o(e);
const c = E.exports.useRef(null),
h = E.exports.useRef(null),
l = E.exports.useRef(null),
u = E.exports.useRef(s),
f = UD(i),
p = E.exports.useCallback(() => {
!c.current || !h.current || HD(c.current, h.current, {
middleware: a,
placement: n,
strategy: r
}).then(w => {
m.current && !Fc(u.current, w) && (u.current = w, Jo.exports.flushSync(() => {
d(w)
}))
})
}, [a, n, r]);
Fp(() => {
m.current && p()
}, [p]);
const m = E.exports.useRef(!1);
Fp(() => (m.current = !0, () => {
m.current = !1
}), []);
const g = E.exports.useCallback(() => {
if (typeof l.current == "function" && (l.current(), l.current = null), c.current && h.current)
if (f.current) {
const w = f.current(c.current, h.current, p);
l.current = w
} else p()
}, [p, f]),
v = E.exports.useCallback(w => {
c.current = w, g()
}, [g]),
y = E.exports.useCallback(w => {
h.current = w, g()
}, [g]),
b = E.exports.useMemo(() => ({
reference: c,
floating: h
}), []);
return E.exports.useMemo(() => ({
...s,
update: p,
refs: b,
reference: v,
floating: y
}), [s, p, b, v, y])
}
const YD = t => {
const {
element: e,
padding: n
} = t;
function r(i) {
return Object.prototype.hasOwnProperty.call(i, "current")
}
return {
name: "arrow",
options: t,
fn(i) {
return r(e) ? e.current != null ? ix({
element: e.current,
padding: n
}).fn(i) : {} : e ? ix({
element: e,
padding: n
}).fn(i) : {}
}
}
};
function XD(t) {
return e => {
t.forEach(n => {
typeof n == "function" ? n(e) : n != null && (n.current = e)
})
}
}
function vx({
floatingWidth: t,
ref: e,
disablePositioning: n = !1,
placement: r = "bottom",
offset: i = 2,
showArrow: s = !1
}) {
const d = E.exports.useRef(null),
a = {
placement: r
};
n || (a.whileElementsMounted = VD, a.middleware = [TD(i), SD({
padding: 16
}), ED({
padding: 16
}), OD({
apply({
rects: p,
availableHeight: m,
availableWidth: g,
elements: v
}) {
t === "matchTrigger" && Object.assign(v.floating.style, {
width: `${p.reference.width}px`,
maxWidth: `${g}`,
maxHeight: `${Math.min(m,420)}px`
})
},
padding: 16
})], s && a.middleware.push(YD({
element: d
})));
const o = WD(a),
c = E.exports.useMemo(() => XD([e, o.reference]), [o.reference, e]),
{
x: h,
y: l
} = o.middlewareData.arrow || {},
u = {
top: "bottom",
right: "left",
bottom: "top",
left: "right"
} [o.placement.split("-")[0]],
f = {
left: h,
top: l,
right: "",
bottom: "",
[u]: "-4px"
};
return {
...o,
reference: c,
arrowRef: d,
arrowStyle: f
}
}
function yx(t, e) {
const {
children: n,
items: r,
role: i = "listbox",
virtualFocus: s,
loopFocus: d = !1,
onItemSelected: a,
clearInputOnItemSelection: o,
floatingWidth: c = "matchTrigger",
floatingMinWidth: h,
offset: l,
placement: u,
showCheckmark: f,
showEmptyMessage: p,
maxItems: m,
isAsync: g
} = t, v = t.selectionMode || "none", b = `${E.exports.useId()}-listbox`, [w, x] = fi(t.inputValue, t.defaultInputValue || "", t.onInputValueChange), [S, T] = E.exports.useState("all"), P = hD({
children: n,
items: r,
inputValue: w,
maxItems: m
}), I = S === "all" ? P.collection : P.filteredCollection, z = E.exports.useRef([]), H = E.exports.useMemo(() => [...I.values()].map(X => X.isDisabled ? null : X.textLabel), [I]), {
selectedValues: ee,
selectValues: te
} = KD(t), [ne, Z] = fi(t.isOpen, t.defaultIsOpen, t.onOpenChange), [ie, ce] = E.exports.useState(null), V = vx({
floatingWidth: c,
ref: e,
placement: u,
offset: l
}), {
refs: C,
floating: k,
strategy: M,
x: D,
y: $
} = V, R = v === "none" ? void 0 : I.get(ee[0]), O = v === "none" || R == null ? void 0 : R.index, F = X => {
if (v !== "none") {
const B = [...I.values()][X];
B && te(B.value)
}
}, N = E.exports.useCallback((X, B) => {
var K, q;
const re = [...I.values()],
U = !re.find(Y => !Y.isDisabled),
j = I.size - 1;
if (B == null || !I.size || B > j || B < 0 || U) {
ce(null);
return
}
B = GD(re, B, d, X), ce(B), s ? (K = z.current[B]) == null || K.scrollIntoView({
block: "nearest"
}) : (q = z.current[B]) == null || q.focus()
}, [I, s, d]), G = E.exports.useCallback(X => {
x(X.target.value), g || T(X.target.value.trim() ? "filtered" : "all"), X.target.value ? Z(!0) : te("")
}, [x, Z, T, te, g]);
return {
handleItemSelection: X => {
if (v !== "none") te(X);
else {
const B = C.reference.current;
B && "focus" in B && B.focus()
}
s && x(o ? "" : `${X}`), Z(!1), ce(null), a == null || a(X)
},
onInputChange: G,
loopFocus: d,
floatingWidth: c,
floatingMinWidth: h,
showCheckmark: f,
collection: I,
virtualFocus: s,
focusItem: N,
showEmptyMessage: p,
refs: C,
reference: V.reference,
floating: k,
positionStyle: {
position: M,
top: $ != null ? $ : "",
left: D != null ? D : ""
},
listContent: H,
listItemsRef: z,
listboxId: b,
role: i,
state: {
activeIndex: ie,
setActiveIndex: ce,
selectedIndex: O,
setSelectedIndex: F,
selectionMode: v,
selectedValues: ee,
selectValues: te,
inputValue: w,
setInputValue: x,
isOpen: ne,
setIsOpen: Z,
setActiveCollection: T
}
}
}
function GD(t, e, n, r) {
var s;
const i = t.length - 1;
for (;
(s = t[e]) != null && s.isDisabled;)
if (r === "increment") {
if (e++, e >= i)
if (n) e = 0;
else return e - 1
} else if (e--, e < 0)
if (n) e = i;
else return e + 1;
return e
}
function KD(t) {
const {
selectionMode: e,
allowEmptySelection: n
} = t, r = e === "single" || e === "multiple", [i, s] = fi(r ? t.selectedValue : void 0, r ? t.defaultSelectedValue : void 0, r ? t.onSelectionChange : void 0), d = E.exports.useMemo(() => i == null || i === "" ? [] : Array.isArray(i) ? i : [i], [i]), a = E.exports.useCallback(o => {
const c = Array.isArray(o) ? o : [o];
e === "single" ? s(c[0]) : c.forEach(h => {
const l = d.indexOf(h);
l === -1 ? (d.push(h), s([...d])) : (d.length > 1 || n) && (d.splice(l, 1), s([...d]))
})
}, [n, d, e, s]);
return {
selectedValues: d,
selectValues: a
}
}
const bx = E.exports.createContext(null);
function wx() {
return E.exports.useContext(bx)
}
const zp = ye(_("path", {
d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"
}), "CheckOutlined"),
qD = ue.forwardRef((t, e) => {
let {
startIcon: n,
capitalizeFirst: r,
children: i,
description: s,
endIcon: d,
endSection: a,
isDisabled: o,
isActive: c,
isSelected: h,
showCheckmark: l,
...u
} = t;
!n && l && (n = _(zp, {
size: "sm",
className: he("text-primary", !h && "invisible")
}));
const f = he("icon-sm rounded overflow-hidden flex-shrink-0", !o && "text-muted");
return se("div", {
...u,
"aria-disabled": o,
className: ZD(t),
ref: e,
children: [n && _("div", {
className: f,
children: n
}), se("div", {
className: he("mr-auto", r && "first-letter:capitalize"),
children: [i, s && _("div", {
className: he("text-xs mt-4 whitespace-normal", o ? "text-disabled" : "text-muted"),
children: s
})]
}), (d || a) && _("div", {
className: d ? f : "text-muted",
children: d || a
})]
})
});
function ZD({
className: t,
isSelected: e,
isActive: n,
isDisabled: r,
showCheckmark: i
}) {
let s = "";
return r ? s = "text-disabled pointer-events-none" : e ? n ? s = "bg-primary/focus" : s = "bg-primary/selected hover:bg-primary/focus" : n ? s = "hover:bg-fg-base/15 bg-focus" : s = "hover:bg-hover", he("w-full select-none outline-none cursor-pointer", "py-8 text-sm truncate flex items-center gap-10 text-main", i ? "px-8" : "px-20", s, t)
}
function zc({
children: t,
value: e,
startIcon: n,
endIcon: r,
endSection: i,
description: s,
capitalizeFirst: d,
textLabel: a,
isDisabled: o,
onSelected: c,
onClick: h,
...l
}) {
var z;
const {
collection: u,
showCheckmark: f,
virtualFocus: p,
listboxId: m,
role: g,
listItemsRef: v,
handleItemSelection: y,
state: {
selectedValues: b,
activeIndex: w,
setActiveIndex: x
}
} = wx(), S = b.includes(e), T = (z = u.get(e)) == null ? void 0 : z.index, P = w === T;
if (T == null) return null;
const I = P && !o ? -1 : 0;
return _(qD, {
...l,
onFocus: () => {
p || x(T)
},
onPointerEnter: H => {
x(T), p || H.currentTarget.focus()
},
onPointerDown: H => {
p && H.preventDefault()
},
onKeyDown: H => {
(H.key === "Enter" || H.key === " ") && (H.preventDefault(), y(e), c == null || c())
},
onClick: H => {
y(e), c == null || c(), h == null || h(H)
},
ref: H => v.current[T] = H,
id: `${m}-${T}`,
role: g === "menu" ? "menuitem" : "option",
tabIndex: p ? void 0 : I,
"aria-selected": P && S,
showCheckmark: f,
isDisabled: o,
isActive: P,
isSelected: S,
startIcon: n,
description: s,
endIcon: r,
endSection: i,
capitalizeFirst: d,
children: t
})
}
const QD = 768;
function JD() {
return HM() || typeof window > "u" ? !1 : window.screen.width <= QD
}
const Np = {
initial: {
opacity: 0,
y: 5
},
animate: {
opacity: 1,
y: 0
},
exit: {
opacity: 0,
y: 5
},
transition: {
type: "tween",
duration: .125
}
};
function jp() {
const {
width: t,
height: e
} = qM();
return {
"--be-viewport-height": `${e}px`,
"--be-viewport-width": `${t}px`
}
}
function eR(t) {
return t.mozInputSource === 0 && t.isTrusted ? !0 : t.detail === 0 && !t.pointerType
}
class tR {
isDefaultPrevented() {
return this.nativeEvent.defaultPrevented
}
preventDefault() {
this.defaultPrevented = !0, this.nativeEvent.preventDefault()
}
stopPropagation() {
this.nativeEvent.stopPropagation(), this.isPropagationStopped = () => !0
}
isPropagationStopped() {
return !1
}
persist() {}
constructor(e, n) {
this.nativeEvent = n, this.target = n.target, this.currentTarget = n.currentTarget, this.relatedTarget = n.relatedTarget, this.bubbles = n.bubbles, this.cancelable = n.cancelable, this.defaultPrevented = n.defaultPrevented, this.eventPhase = n.eventPhase, this.isTrusted = n.isTrusted, this.timeStamp = n.timeStamp, this.type = e
}
}
function nR(t) {
let e = E.exports.useRef({
isFocused: !1,
onBlur: t,
observer: null
});
return e.current.onBlur = t, Bn(() => {
const n = e.current;
return () => {
n.observer && (n.observer.disconnect(), n.observer = null)
}
}, []), E.exports.useCallback(n => {
if (n.target instanceof HTMLButtonElement || n.target instanceof HTMLInputElement || n.target instanceof HTMLTextAreaElement || n.target instanceof HTMLSelectElement) {
e.current.isFocused = !0;
let r = n.target,
i = s => {
var d, a;
e.current.isFocused = !1, r.disabled && ((a = (d = e.current).onBlur) === null || a === void 0 || a.call(d, new tR("blur", s))), e.current.observer && (e.current.observer.disconnect(), e.current.observer = null)
};
r.addEventListener("focusout", i, {
once: !0
}), e.current.observer = new MutationObserver(() => {
e.current.isFocused && r.disabled && (e.current.observer.disconnect(), r.dispatchEvent(new FocusEvent("blur")), r.dispatchEvent(new FocusEvent("focusout", {
bubbles: !0
})))
}), e.current.observer.observe(r, {
attributes: !0,
attributeFilter: ["disabled"]
})
}
}, [])
}
const rR = ue.createContext(null);
rR.displayName = "PressResponderContext";
let aa = null,
iR = new Set,
xx = !1,
gi = !1,
Bp = !1;
function $p(t, e) {
for (let n of iR) n(t, e)
}
function oR(t) {
return !(t.metaKey || !Rw() && t.altKey || t.ctrlKey || t.key === "Control" || t.key === "Shift" || t.key === "Meta")
}
function _x(t) {
gi = !0, oR(t) && (aa = "keyboard", $p("keyboard", t))
}
function Oo(t) {
aa = "pointer", (t.type === "mousedown" || t.type === "pointerdown") && (gi = !0, $p("pointer", t))
}
function sR(t) {
eR(t) && (gi = !0, aa = "virtual")
}
function aR(t) {
t.target === window || t.target === document || (!gi && !Bp && (aa = "virtual", $p("virtual", t)), gi = !1, Bp = !1)
}
function lR() {
gi = !1, Bp = !0
}
function Sx() {
if (typeof window > "u" || xx) return;
let t = HTMLElement.prototype.focus;
HTMLElement.prototype.focus = function() {
gi = !0, t.apply(this, arguments)
}, document.addEventListener("keydown", _x, !0), document.addEventListener("keyup", _x, !0), document.addEventListener("click", sR, !0), window.addEventListener("focus", aR, !0), window.addEventListener("blur", lR, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown", Oo, !0), document.addEventListener("pointermove", Oo, !0), document.addEventListener("pointerup", Oo, !0)) : (document.addEventListener("mousedown", Oo, !0), document.addEventListener("mousemove", Oo, !0), document.addEventListener("mouseup", Oo, !0)), xx = !0
}
typeof document < "u" && (document.readyState !== "loading" ? Sx() : document.addEventListener("DOMContentLoaded", Sx));
function cR() {
return aa
}
function uR(t) {
let {
isDisabled: e,
onBlurWithin: n,
onFocusWithin: r,
onFocusWithinChange: i
} = t, s = E.exports.useRef({
isFocusWithin: !1
}), d = E.exports.useCallback(c => {
s.current.isFocusWithin && !c.currentTarget.contains(c.relatedTarget) && (s.current.isFocusWithin = !1, n && n(c), i && i(!1))
}, [n, i, s]), a = nR(d), o = E.exports.useCallback(c => {
s.current.isFocusWithin || (r && r(c), i && i(!0), s.current.isFocusWithin = !0, a(c))
}, [r, i, a]);
return e ? {
focusWithinProps: {
onFocus: null,
onBlur: null
}
} : {
focusWithinProps: {
onFocus: o,
onBlur: d
}
}
}
function fR(t) {
let {
ref: e,
onInteractOutside: n,
isDisabled: r,
onInteractOutsideStart: i
} = t, d = E.exports.useRef({
isPointerDown: !1,
ignoreEmulatedMouseEvents: !1,
onInteractOutside: n,
onInteractOutsideStart: i
}).current;
d.onInteractOutside = n, d.onInteractOutsideStart = i, E.exports.useEffect(() => {
if (r) return;
let a = o => {
Nc(o, e) && d.onInteractOutside && (d.onInteractOutsideStart && d.onInteractOutsideStart(o), d.isPointerDown = !0)
};
if (typeof PointerEvent < "u") {
let o = c => {
d.isPointerDown && d.onInteractOutside && Nc(c, e) && (d.isPointerDown = !1, d.onInteractOutside(c))
};
return document.addEventListener("pointerdown", a, !0), document.addEventListener("pointerup", o, !0), () => {
document.removeEventListener("pointerdown", a, !0), document.removeEventListener("pointerup", o, !0)
}
} else {
let o = h => {
d.ignoreEmulatedMouseEvents ? d.ignoreEmulatedMouseEvents = !1 : d.isPointerDown && d.onInteractOutside && Nc(h, e) && (d.isPointerDown = !1, d.onInteractOutside(h))
},
c = h => {
d.ignoreEmulatedMouseEvents = !0, d.onInteractOutside && d.isPointerDown && Nc(h, e) && (d.isPointerDown = !1, d.onInteractOutside(h))
};
return document.addEventListener("mousedown", a, !0), document.addEventListener("mouseup", o, !0), document.addEventListener("touchstart", a, !0), document.addEventListener("touchend", c, !0), () => {
document.removeEventListener("mousedown", a, !0), document.removeEventListener("mouseup", o, !0), document.removeEventListener("touchstart", a, !0), document.removeEventListener("touchend", c, !0)
}
}
}, [e, d, r])
}
function Nc(t, e) {
if (t.button > 0) return !1;
if (t.target) {
const n = t.target.ownerDocument;
if (!n || !n.documentElement.contains(t.target)) return !1
}
return e.current && !e.current.contains(t.target)
}
function hR(t) {
if (cR() === "virtual") {
let e = document.activeElement;
KM(() => {
document.activeElement === e && document.contains(t) && Mw(t)
})
} else Mw(t)
}
function dR(t) {
if (!(t instanceof HTMLElement) && !(t instanceof SVGElement)) return !1;
let {
display: e,
visibility: n
} = t.style, r = e !== "none" && n !== "hidden" && n !== "collapse";
if (r) {
const {
getComputedStyle: i
} = t.ownerDocument.defaultView;
let {
display: s,
visibility: d
} = i(t);
r = s !== "none" && d !== "hidden" && d !== "collapse"
}
return r
}
function pR(t, e) {
return !t.hasAttribute("hidden") && (t.nodeName === "DETAILS" && e && e.nodeName !== "SUMMARY" ? t.hasAttribute("open") : !0)
}
function Cx(t, e) {
return t.nodeName !== "#comment" && dR(t) && pR(t, e) && (!t.parentElement || Cx(t.parentElement, t))
}
const Vp = ue.createContext(null);
let Ot = null,
Po = new Map;
function jc(t) {
let {
children: e,
contain: n,
restoreFocus: r,
autoFocus: i
} = t, s = E.exports.useRef(), d = E.exports.useRef(), a = E.exports.useRef([]), o = E.exports.useContext(Vp), c = o == null ? void 0 : o.scopeRef;
Bn(() => {
let l = s.current.nextSibling,
u = [];
for (; l && l !== d.current;) u.push(l), l = l.nextSibling;
a.current = u
}, [e, c]), Bn(() => (Po.set(a, c), () => {
(a === Ot || Bc(a, Ot)) && (!c || Po.has(c)) && (Ot = c), Po.delete(a)
}), [a, c]), bR(a, n), _R(a, r, n), xR(a, i);
let h = mR(a);
return ue.createElement(Vp.Provider, {
value: {
scopeRef: a,
focusManager: h
}
}, ue.createElement("span", {
"data-focus-scope-start": !0,
hidden: !0,
ref: s
}), e, ue.createElement("span", {
"data-focus-scope-end": !0,
hidden: !0,
ref: d
}))
}
function gR() {
var t;
return (t = E.exports.useContext(Vp)) === null || t === void 0 ? void 0 : t.focusManager
}
function mR(t) {
return {
focusNext(e = {}) {
let n = t.current,
{
from: r,
tabbable: i,
wrap: s,
accept: d
} = e,
a = r || document.activeElement,
o = n[0].previousElementSibling,
c = Dr(Mo(n), {
tabbable: i,
accept: d
}, n);
c.currentNode = hn(a, n) ? a : o;
let h = c.nextNode();
return !h && s && (c.currentNode = o, h = c.nextNode()), h && Yn(h, !0), h
},
focusPrevious(e = {}) {
let n = t.current,
{
from: r,
tabbable: i,
wrap: s,
accept: d
} = e,
a = r || document.activeElement,
o = n[n.length - 1].nextElementSibling,
c = Dr(Mo(n), {
tabbable: i,
accept: d
}, n);
c.currentNode = hn(a, n) ? a : o;
let h = c.previousNode();
return !h && s && (c.currentNode = o, h = c.previousNode()), h && Yn(h, !0), h
},
focusFirst(e = {}) {
let n = t.current,
{
tabbable: r,
accept: i
} = e,
s = Dr(Mo(n), {
tabbable: r,
accept: i
}, n);
s.currentNode = n[0].previousElementSibling;
let d = s.nextNode();
return d && Yn(d, !0), d
},
focusLast(e = {}) {
let n = t.current,
{
tabbable: r,
accept: i
} = e,
s = Dr(Mo(n), {
tabbable: r,
accept: i
}, n);
s.currentNode = n[n.length - 1].nextElementSibling;
let d = s.previousNode();
return d && Yn(d, !0), d
}
}
}
const Hp = ["input:not([disabled]):not([type=hidden])", "select:not([disabled])", "textarea:not([disabled])", "button:not([disabled])", "a[href]", "area[href]", "summary", "iframe", "object", "embed", "audio[controls]", "video[controls]", "[contenteditable]"],
vR = Hp.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
Hp.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
const yR = Hp.join(':not([hidden]):not([tabindex="-1"]),');
function Mo(t) {
return t[0].parentElement
}
function bR(t, e) {
let n = E.exports.useRef(),
r = E.exports.useRef(null);
Bn(() => {
let i = t.current;
if (!e) {
r.current && (cancelAnimationFrame(r.current), r.current = null);
return
}
let s = o => {
if (o.key !== "Tab" || o.altKey || o.ctrlKey || o.metaKey || t !== Ot) return;
let c = document.activeElement,
h = t.current;
if (!hn(c, h)) return;
let l = Dr(Mo(h), {
tabbable: !0
}, h);
l.currentNode = c;
let u = o.shiftKey ? l.previousNode() : l.nextNode();
u || (l.currentNode = o.shiftKey ? h[h.length - 1].nextElementSibling : h[0].previousElementSibling, u = o.shiftKey ? l.previousNode() : l.nextNode()), o.preventDefault(), u && Yn(u, !0)
},
d = o => {
!Ot || Bc(Ot, t) ? (Ot = t, n.current = o.target) : t === Ot && !Tx(o.target, t) ? n.current ? n.current.focus() : Ot && kx(Ot.current) : t === Ot && (n.current = o.target)
},
a = o => {
r.current = requestAnimationFrame(() => {
t === Ot && !Tx(document.activeElement, t) && (Ot = t, n.current = o.target, n.current.focus())
})
};
return document.addEventListener("keydown", s, !1), document.addEventListener("focusin", d, !1), i.forEach(o => o.addEventListener("focusin", d, !1)), i.forEach(o => o.addEventListener("focusout", a, !1)), () => {
document.removeEventListener("keydown", s, !1), document.removeEventListener("focusin", d, !1), i.forEach(o => o.removeEventListener("focusin", d, !1)), i.forEach(o => o.removeEventListener("focusout", a, !1))
}
}, [t, e]), E.exports.useEffect(() => () => {
r.current && cancelAnimationFrame(r.current)
}, [r])
}
function wR(t) {
for (let e of Po.keys())
if (hn(t, e.current)) return !0;
return !1
}
function hn(t, e) {
return e.some(n => n.contains(t))
}
function Tx(t, e) {
for (let n of Po.keys())
if ((n === e || Bc(e, n)) && hn(t, n.current)) return !0;
return !1
}
function Bc(t, e) {
let n = Po.get(e);
return n ? n === t ? !0 : Bc(t, n) : !1
}
function Yn(t, e = !1) {
if (t != null && !e) try {
hR(t)
} catch {} else if (t != null) try {
t.focus()
} catch {}
}
function kx(t) {
let e = t[0].previousElementSibling,
n = Dr(Mo(t), {
tabbable: !0
}, t);
n.currentNode = e, Yn(n.nextNode())
}
function xR(t, e) {
const n = ue.useRef(e);
E.exports.useEffect(() => {
n.current && (Ot = t, hn(document.activeElement, Ot.current) || kx(t.current)), n.current = !1
}, [])
}
function _R(t, e, n) {
const r = E.exports.useRef(typeof document < "u" ? document.activeElement : null);
Bn(() => {
let i = r.current;
if (!e) return;
let s = d => {
if (d.key !== "Tab" || d.altKey || d.ctrlKey || d.metaKey) return;
let a = document.activeElement;
if (!hn(a, t.current)) return;
let o = Dr(document.body, {
tabbable: !0
});
o.currentNode = a;
let c = d.shiftKey ? o.previousNode() : o.nextNode();
if ((!document.body.contains(i) || i === document.body) && (i = null), (!c || !hn(c, t.current)) && i) {
o.currentNode = i;
do c = d.shiftKey ? o.previousNode() : o.nextNode(); while (hn(c, t.current));
d.preventDefault(), d.stopPropagation(), c ? Yn(c, !0) : wR(i) ? Yn(i, !0) : a.blur()
}
};
return n || document.addEventListener("keydown", s, !0), () => {
n || document.removeEventListener("keydown", s, !0), e && i && hn(document.activeElement, t.current) && requestAnimationFrame(() => {
document.body.contains(i) && document.activeElement === document.body && Yn(i)
})
}
}, [t, e, n])
}
function Dr(t, e, n) {
let r = e != null && e.tabbable ? yR : vR,
i = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, {
acceptNode(s) {
var d;
return !(e == null || (d = e.from) === null || d === void 0) && d.contains(s) ? NodeFilter.FILTER_REJECT : s.matches(r) && Cx(s) && (!n || hn(s, n)) && (!(e != null && e.accept) || e.accept(s)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
}
});
return e != null && e.from && (i.currentNode = e.from), i
}
class SR {
getStringForLocale(e, n) {
let r = this.strings[n];
r || (r = CR(n, this.strings, this.defaultLocale), this.strings[n] = r);
let i = r[e];
if (!i) throw new Error(`Could not find intl message ${e} in ${n} locale`);
return i
}
constructor(e, n = "en-US") {
this.strings = {
...e
}, this.defaultLocale = n
}
}
function CR(t, e, n = "en-US") {
if (e[t]) return e[t];
let r = TR(t);
if (e[r]) return e[r];
for (let i in e)
if (i.startsWith(r + "-")) return e[i];
return e[n]
}
function TR(t) {
return Intl.Locale ? new Intl.Locale(t).language : t.split("-")[0]
}
let Up = new Map,
Wp = !1;
try {
Wp = new Intl.NumberFormat("de-DE", {
signDisplay: "exceptZero"
}).resolvedOptions().signDisplay === "exceptZero"
} catch {}
let $c = !1;
try {
$c = new Intl.NumberFormat("de-DE", {
style: "unit",
unit: "degree"
}).resolvedOptions().style === "unit"
} catch {}
const Ex = {
degree: {
narrow: {
default: "\xB0",
"ja-JP": " \u5EA6",
"zh-TW": "\u5EA6",
"sl-SI": " \xB0"
}
}
};
class Vc {
format(e) {
let n = "";
if (!Wp && this.options.signDisplay != null ? n = ER(this.numberFormatter, this.options.signDisplay, e) : n = this.numberFormatter.format(e), this.options.style === "unit" && !$c) {
var r;
let {
unit: i,
unitDisplay: s = "short",
locale: d
} = this.resolvedOptions(), a = (r = Ex[i]) === null || r === void 0 ? void 0 : r[s];
n += a[d] || a.default
}
return n
}
formatToParts(e) {
return this.numberFormatter.formatToParts(e)
}
formatRange(e, n) {
if (typeof this.numberFormatter.formatRange == "function") return this.numberFormatter.formatRange(e, n);
if (n < e) throw new RangeError("End date must be >= start date");
return `${this.format(e)} \u2013 ${this.format(n)}`
}
formatRangeToParts(e, n) {
if (typeof this.numberFormatter.formatRangeToParts == "function") return this.numberFormatter.formatRangeToParts(e, n);
if (n < e) throw new RangeError("End date must be >= start date");
let r = this.numberFormatter.formatToParts(e),
i = this.numberFormatter.formatToParts(n);
return [...r.map(s => ({
...s,
source: "startRange"
})), {
type: "literal",
value: " \u2013 ",
source: "shared"
}, ...i.map(s => ({
...s,
source: "endRange"
}))]
}
resolvedOptions() {
let e = this.numberFormatter.resolvedOptions();
return !Wp && this.options.signDisplay != null && (e = {
...e,
signDisplay: this.options.signDisplay
}), !$c && this.options.style === "unit" && (e = {
...e,
style: "unit",
unit: this.options.unit,
unitDisplay: this.options.unitDisplay
}), e
}
constructor(e, n = {}) {
this.numberFormatter = kR(e, n), this.options = n
}
}
function kR(t, e = {}) {
let {
numberingSystem: n
} = e;
if (n && t.indexOf("-u-nu-") === -1 && (t = `${t}-u-nu-${n}`), e.style === "unit" && !$c) {
var r;
let {
unit: d,
unitDisplay: a = "short"
} = e;
if (!d) throw new Error('unit option must be provided with style: "unit"');
if (!(!((r = Ex[d]) === null || r === void 0) && r[a])) throw new Error(`Unsupported unit ${d} with unitDisplay = ${a}`);
e = {
...e,
style: "decimal"
}
}
let i = t + (e ? Object.entries(e).sort((d, a) => d[0] < a[0] ? -1 : 1).join() : "");
if (Up.has(i)) return Up.get(i);
let s = new Intl.NumberFormat(t, e);
return Up.set(i, s), s
}
function ER(t, e, n) {
if (e === "auto") return t.format(n);
if (e === "never") return t.format(Math.abs(n)); {
let r = !1;
if (e === "always" ? r = n > 0 || Object.is(n, 0) : e === "exceptZero" && (Object.is(n, -0) || Object.is(n, 0) ? n = Math.abs(n) : r = n > 0), r) {
let i = t.format(-n),
s = t.format(n),
d = i.replace(s, "").replace(/\u200e|\u061C/, "");
return [...d].length !== 1 && console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"), i.replace(s, "!!!").replace(d, "+").replace("!!!", s)
} else return t.format(n)
}
}
const Xn = [];
function OR(t, e) {
let {
onClose: n,
shouldCloseOnBlur: r,
isOpen: i,
isDismissable: s = !1,
isKeyboardDismissDisabled: d = !1,
shouldCloseOnInteractOutside: a
} = t;
E.exports.useEffect(() => (i && Xn.push(e), () => {
let p = Xn.indexOf(e);
p >= 0 && Xn.splice(p, 1)
}), [i, e]);
let o = () => {
Xn[Xn.length - 1] === e && n && n()
},
c = p => {
(!a || a(p.target)) && Xn[Xn.length - 1] === e && (p.stopPropagation(), p.preventDefault())
},
h = p => {
(!a || a(p.target)) && (Xn[Xn.length - 1] === e && (p.stopPropagation(), p.preventDefault()), o())
},
l = p => {
p.key === "Escape" && !d && (p.stopPropagation(), p.preventDefault(), o())
};
fR({
ref: e,
onInteractOutside: s ? h : null,
onInteractOutsideStart: c
});
let {
focusWithinProps: u
} = uR({
isDisabled: !r,
onBlurWithin: p => {
(!a || a(p.relatedTarget)) && n()
}
}), f = p => {
p.target === p.currentTarget && p.preventDefault()
};
return {
overlayProps: {
onKeyDown: l,
...u
},
underlayProps: {
onPointerDown: f
}
}
}
const Hc = E.exports.forwardRef(({
children: t,
style: e,
autoFocus: n = !1,
restoreFocus: r = !0,
isDismissable: i,
isOpen: s,
onClose: d,
triggerRef: a,
arrowRef: o,
arrowStyle: c
}, h) => {
const l = jp(),
u = di(h),
{
overlayProps: f
} = OR({
isDismissable: i,
isOpen: s,
onClose: d,
shouldCloseOnInteractOutside: p => {
var m, g;
return a.current ? !((g = (m = a.current).contains) != null && g.call(m, p)) : !0
}
}, u);
return E.exports.useEffect(() => {
if (!s) return;
const p = m => {
const g = m.target;
if (!!a.current) {
if (!(a.current instanceof Node)) {
d();
return
}(!(g instanceof Node) || g.contains(a.current)) && d()
}
};
return requestAnimationFrame(() => {
window.addEventListener("scroll", p, !0)
}), () => {
window.removeEventListener("scroll", p, !0)
}
}, [s, d, a]), _(Et.div, {
className: "z-popover isolate",
role: "presentation",
ref: u,
style: Co(l, e),
...Np,
...f,
children: _(jc, {
restoreFocus: r,
autoFocus: n,
contain: !1,
children: t
})
})
}),
PR = {
initial: {
opacity: 0
},
animate: {
opacity: 1
},
exit: {
opacity: 0
}
};
function Yp({
position: t = "absolute",
className: e,
isTransparent: n = !1,
disableInitialTransition: r,
...i
}) {
return _(Et.div, {
...i,
className: he(e, !n && "bg-black/30", "w-full h-full inset-0 z-10", t),
"aria-hidden": !0,
initial: r ? void 0 : {
opacity: 0
},
animate: {
opacity: 1
},
exit: {
opacity: 0
},
...PR,
transition: {
duration: .3
}
})
}
const Ox = E.exports.forwardRef(({
children: t,
autoFocus: e = !1,
restoreFocus: n = !0,
isDismissable: r,
isOpen: i,
onClose: s
}, d) => {
const a = jp(),
o = di(d);
return se("div", {
className: "isolate z-tray fixed inset-0",
style: a,
children: [_(Yp, {
onClick: () => {
r && s()
}
}, "tray-underlay"), _(Et.div, {
ref: o,
className: "absolute bottom-0 left-0 right-0 w-full z-20 rounded-t overflow-hidden max-w-375 max-h-tray mx-auto pb-safe-area",
role: "presentation",
initial: {
opacity: 0,
y: "100%"
},
animate: {
opacity: 1,
y: 0
},
exit: {
opacity: 0,
y: "100%"
},
transition: {
type: "tween",
duration: .2
},
children: _(jc, {
restoreFocus: n,
autoFocus: e,
contain: !0,
children: t
})
})]
})
});
function Xp(t, e) {
if (t === e) return !0;
if (!t || !e) return !1;
const n = Object.keys(t),
r = Object.keys(e),
i = n.length;
if (r.length !== i) return !1;
for (let s = 0; s < i; s++) {
const d = n[s];
if (t[d] !== e[d] || !Object.prototype.hasOwnProperty.call(e, d)) return !1
}
return !0
}
const Px = E.exports.createContext(null);
function MR() {
return E.exports.useContext(Px)
}
function Uc() {
const {
data: {
i18n: t
}
} = MR();
return {
locale: t,
localeCode: (t == null ? void 0 : t.language) || "en",
lines: t == null ? void 0 : t.lines
}
}
function Mx(t, {
message: e,
values: n
}) {
const r = e.match(/\[(.+?)]/),
i = n == null ? void 0 : n.count;
if (r && r[1] && !Number.isNaN(i)) {
const [s, d] = r, a = d.split("|");
if (!a.length) return e;
const c = AR(t).select(i);
let h = a.find(u => u.startsWith(c));
h || (h = a[0]);
const l = h.substring(h.indexOf(" ") + 1);
return e.replace(s, l)
}
return e
}
const AR = ra(t => new Intl.PluralRules(t)),
_e = E.exports.memo(t => {
const {
message: e,
values: n
} = t, {
lines: r,
localeCode: i
} = Uc();
let s = (r == null ? void 0 : r[e]) || e;
if (!n) return _(E.exports.Fragment, {
children: s
});
s = Mx(i, {
message: s,
values: n
});
const d = [],
a = [];
if (Object.entries(n).forEach(([o, c]) => {
typeof c == "function" ? a.push(o) : E.exports.isValidElement(c) ? d.push(o) : c != null && (s = s.replace(`:${o}`, `${c}`))
}), a.length || d.length) {
const o = [];
if (a.length) {
const u = a.join("");
o.push(`(<[${u}]>.+?<\\/[${u}]>)`)
}
if (d.length) {
const u = d.join("|");
o.push(`(:(?:${u}))`)
}
const c = new RegExp(o.join("|"), "gm"),
l = s.split(c).filter(Boolean).map((u, f) => {
if (u.startsWith("<") && u.endsWith(">")) {
const p = u.match(/<([a-z]+)>(.+?)<\/([a-z]+)>/);
if (p) {
const [, m, g] = p, v = n == null ? void 0 : n[m];
if (typeof v == "function") {
const y = v(g);
return E.exports.cloneElement(y, {
key: f
})
}
}
}
if (u.startsWith(":")) {
const p = u.replace(":", ""),
m = n == null ? void 0 : n[p];
if (E.exports.isValidElement(m)) return E.exports.cloneElement(m, {
key: f
})
}
return u
});
return _(E.exports.Fragment, {
children: l
})
}
return _(E.exports.Fragment, {
children: s
})
}, DR);
function DR(t, e) {
const {
values: n,
...r
} = t, {
values: i,
...s
} = e;
return Xp(i, n) && Xp(r, s)
}
function Ax({
listbox: t,
children: e,
isLoading: n,
mobileOverlay: r = Ox,
...i
}) {
const s = JD(),
{
floatingWidth: d,
floatingMinWidth: a = "min-w-180",
collection: o,
showEmptyMessage: c,
state: {
isOpen: h,
setIsOpen: l
},
positionStyle: u,
floating: f,
refs: p
} = t,
m = s ? r : Hc,
g = he("py-4 text-base sm:text-sm outline-none bg-paper shadow-xl border max-h-inherit overflow-x-auto", m === Hc && "rounded", m === Hc && d === "auto" ? `max-w-288 ${a}` : ""),
v = E.exports.useMemo(() => {
let y = 0;
const b = [];
return [...o.values()].reduce((w, x) => {
if (!x.section) w.push(E.exports.cloneElement(x.element, {
key: x.element.key || x.element.props.value
}));
else if (!b.includes(x.section)) {
const S = E.exports.cloneElement(x.section, {
key: x.section.key || y,
index: y
});
w.push(S), b.push(x.section), y++
}
return w
}, [])
}, [o]);
return se(bx.Provider, {
value: t,
children: [e, mn && Jo.exports.createPortal(_(Or, {
children: h && (v.length > 0 || c) && _(m, {
triggerRef: p.reference,
restoreFocus: !0,
isOpen: h,
onClose: () => {
l(!1)
},
isDismissable: !0,
style: u,
ref: f,
children: _(RR, {
isLoading: n,
className: g,
...i,
children: v
})
})
}), mn)]
})
}
function RR({
className: t,
children: e,
isLoading: n,
...r
}) {
const {
role: i,
listboxId: s,
virtualFocus: d,
focusItem: a,
state: {
activeIndex: o,
setActiveIndex: c
}
} = wx(), h = E.exports.useRef(!0), l = E.exports.useRef(null);
return E.exports.useEffect(() => () => c(null), [c]), E.exports.useEffect(() => {
h.current && (o == null && !d ? requestAnimationFrame(() => {
var u;
(u = l.current) == null || u.focus({
preventScroll: !0
})
}) : o != null && requestAnimationFrame(() => {
a("increment", o)
})), h.current = !1
}, [o, a, d]), _("div", {
tabIndex: -1,
role: i,
id: s,
className: t,
ref: l,
...r,
children: e.length ? e : _(IR, {
isLoading: n
})
})
}
function IR({
isLoading: t
}) {
return _("div", {
className: "italic px-8 py-4 text-sm text-muted",
children: t ? _(_e, {
message: "Loading..."
}) : _(_e, {
message: "There are no items matching your query"
})
})
}
function Dx({
state: {
isOpen: t,
setIsOpen: e,
selectedIndex: n,
activeIndex: r
},
loopFocus: i,
collection: s,
focusItem: d
}) {
return {
handleTriggerKeyDown: c => {
if (!(t || !c.currentTarget.contains(c.target))) {
if (c.key === "ArrowDown") return c.preventDefault(), e(!0), d("increment", n != null ? n : 0), !0;
if (c.key === "ArrowUp") return c.preventDefault(), e(!0), d("decrement", n != null ? n : s.size - 1), !0;
if (c.key === "Enter" || c.key === "Space") return c.preventDefault(), e(!0), d("increment", n != null ? n : 0), !0
}
},
handleListboxKeyboardNavigation: c => {
const h = Math.max(0, s.size - 1);
if (!(!t || !c.currentTarget.contains(c.target))) switch (c.key) {
case "ArrowDown":
return c.preventDefault(), r == null ? d("increment", 0) : r >= h ? i && d("increment", 0) : d("increment", r + 1), !0;
case "ArrowUp":
return c.preventDefault(), r == null ? d("decrement", h) : r <= 0 ? i && d("decrement", h) : d("decrement", r - 1), !0;
case "Home":
return c.preventDefault(), d("increment", 0), !0;
case "End":
return c.preventDefault(), d("decrement", h), !0;
case "Tab":
return e(!1), !0
}
}
}
}
const Gp = new Map;
function LR(t) {
const {
localeCode: e
} = Uc(), n = e + (t ? Object.entries(t).sort((i, s) => i[0] < s[0] ? -1 : 1).join() : "");
if (Gp.has(n)) return Gp.get(n);
const r = new Intl.Collator(e, t);
return Gp.set(n, r), r
}
function Rx() {
const t = LR({
usage: "search",
sensitivity: "base"
}),
e = E.exports.useRef({
search: "",
timeout: void 0
}).current,
n = (i, s) => {
let d = s != null ? s : 0;
for (; d != null;) {
const a = i[d],
o = a == null ? void 0 : a.slice(0, e.search.length);
if (o && t.compare(o, e.search) === 0) return d;
if (d < i.length - 1) d++;
else return null
}
return null
};
return {
findMatchingItem: (i, s, d = 0) => {
const a = FR(i.key);
if (!a || i.ctrlKey || i.metaKey) return null;
a === " " && e.search.trim().length > 0 && (i.preventDefault(), i.stopPropagation()), e.search += a;
let o = n(s, d);
return o == null && (o = n(s, 0)), clearTimeout(e.timeout), e.timeout = setTimeout(() => {
e.search = ""
}, 500), o != null ? o : null
}
}
}
function FR(t) {
return t.length === 1 || !/^[A-Z]/i.test(t) ? t : ""
}
function zR(t, {
noSSR: e
} = {
noSSR: !0
}) {
const n = typeof window < "u" && typeof window.matchMedia == "function",
[r, i] = E.exports.useState(e ? () => n ? window.matchMedia(t).matches : !1 : null);
return E.exports.useEffect(() => {
if (!n) return;
const s = window.matchMedia(t),
d = () => {
i(s.matches)
};
return s.addEventListener("change", d), e || d(), () => {
s.removeEventListener("change", d)
}
}, [n, t, e]), typeof window > "u" ? null : r
}
function Wc(t) {
return zR("(max-width: 768px)", t)
}
const NR = E.exports.forwardRef((t, e) => {
const {
children: [n, r],
floatingWidth: i = "auto"
} = t, s = E.exports.useId(), d = Wc(), a = yx({
...t,
floatingWidth: d ? i : "auto",
role: "menu",
loopFocus: !0,
children: r.props.children
}, e), {
state: {
isOpen: o,
setIsOpen: c,
activeIndex: h
},
listboxId: l,
focusItem: u,
listContent: f,
reference: p
} = a, {
handleTriggerKeyDown: m,
handleListboxKeyboardNavigation: g
} = Dx(a), {
findMatchingItem: v
} = Rx();
return _(Ax, {
listbox: a,
"aria-labelledby": s,
onKeyDownCapture: y => {
if (!o) return;
const b = v(y, f, h);
b && u("increment", b)
},
onKeyDown: g,
children: E.exports.cloneElement(n, {
id: s,
"aria-expanded": o ? "true" : "false",
"aria-haspopup": "menu",
"aria-controls": o ? l : void 0,
ref: p,
onKeyDown: m,
onClick: $n(y => {
var b, w;
(w = (b = n.props) == null ? void 0 : b.onClick) == null || w.call(b, y), c(!o)
})
})
})
});
function jR({
children: t
}) {
return t
}
function BR({
item: t,
button: e
}) {
return se(NR, {
children: [e, _(jR, {
children: (t.menuItems || []).map(n => _(zc, {
value: n.label,
onSelected: () => {
n.action(A().editor)
},
children: n.label
}, n.label))
})]
})
}
const Re = E.exports.forwardRef(({
children: t,
size: e = "md",
iconSize: n = e || "md",
variant: r = "text",
radius: i = "rounded-full",
className: s,
padding: d,
equalWidth: a = !0,
...o
}, c) => {
const h = he(Ap(e, {
padding: d,
equalWidth: a,
variant: r
}), s);
return _(Vn, {
...o,
ref: c,
radius: i,
variant: r,
className: h,
children: ue.cloneElement(t, {
size: n
})
})
});
function $R({
icon: t,
className: e,
size: n
}) {
let r;
return ue.isValidElement(t) ? r = ue.cloneElement(t, {
className: "svg-iconEl"
}) : typeof t == "string" ? r = _("img", {
className: "w-font h-font",
src: t,
alt: ""
}) : Array.isArray(t) ? r = ue.createElement(s5(t), {
size: n
}) : r = ue.createElement(t, {
size: n
}), _("span", {
className: he(e, "leading-none"),
children: r
})
}
const Kp = ue.memo($R);
function qp({
value: t
}) {
return t ? typeof t == "string" ? _(E.exports.Fragment, {
children: t
}) : _(_e, {
...t
}) : null
}
function VR({
item: t
}) {
const e = t.label ? _(UR, {
item: t
}) : _(HR, {
item: t
});
return t.menuItems ? _(BR, {
item: t,
button: e
}) : ue.cloneElement(e, {
onClick: () => {
var n;
(n = t.action) == null || n.call(t, A().editor)
}
})
}
const HR = E.exports.forwardRef(({
item: t,
...e
}, n) => _(Re, {
ref: n,
radius: "rounded-full",
size: "sm",
...e,
children: _(Kp, {
icon: t.icon
})
})),
UR = E.exports.forwardRef(({
item: t,
...e
}, n) => _(bt, {
ref: n,
radius: "rounded-full",
size: "xs",
color: t.buttonColor || "primary",
variant: t.buttonVariant || "flat",
startIcon: t.icon && _(Kp, {
icon: t.icon
}),
...e,
children: _(qp, {
value: t.label
})
}));
function Yc({
children: t,
color: e,
variant: n,
radius: r,
size: i,
className: s,
value: d,
onChange: a,
multiple: o,
disabled: c
}) {
const h = f => d === void 0 ? !1 : o ? d.includes(f) : f === d,
l = f => {
const p = [...d],
m = d.indexOf(f);
return m > -1 ? p.splice(m, 1) : p.push(f), p
},
u = ue.Children.map(t, (f, p) => {
if (ue.isValidElement(f)) {
const m = h(f.props.value),
g = m ? "primary" : e;
return ue.cloneElement(f, {
color: m ? "primary" : e,
variant: n,
size: i,
radius: null,
disabled: f.props.disabled || c,
...f.props,
onClick: v => {
f.props.onClick && f.props.onClick(v), a && (o ? a == null || a(l(f.props.value)) : a == null || a(f.props.value))
},
className: he(f.props.className, m ? "z-20" : "z-10", WR(p, t, r, g))
})
}
});
return _("div", {
className: he(r, "inline-flex isolate", s),
children: u
})
}
function WR(t, e, n, r) {
return t === 0 ? he(n, "rounded-tr-none rounded-br-none", !r && "border-r-transparent disabled:border-r-transparent") : t === e.length - 1 ? he(n, "rounded-tl-none rounded-bl-none -ml-1") : he("rounded-none -ml-1", !r && "border-r-transparent disabled:border-r-transparent")
}
const YR = ye(_("path", {
d: "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"
}), "UndoOutlined"),
XR = ye(_("path", {
d: "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"
}), "RedoOutlined");
function GR() {
const t = ae(n => n.history.canUndo),
e = ae(n => n.history.canRedo);
return se(Yc, {
variant: "outline",
children: [_(Re, {
equalWidth: !1,
size: "xs",
padding: "pl-12 pr-10",
radius: "rounded-full",
disabled: !t,
onClick: () => {
L().history.undo()
},
children: _(YR, {})
}), _(Re, {
equalWidth: !1,
padding: "pl-10 pr-12",
size: "xs",
radius: "rounded-full",
disabled: !e,
onClick: () => {
L().history.redo()
},
children: _(XR, {})
})]
})
}
const KR = ye(_("path", {
d: "M19 13H5v-2h14v2z"
}), "RemoveOutlined"),
qR = ye(_("path", {
d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
}), "AddOutlined");
function ZR() {
var n, r, i;
const t = ae(s => s.zoom) || 1;
return ((n = ae(s => {
var d, a;
return (a = (d = s.config.tools) == null ? void 0 : d.zoom) == null ? void 0 : a.allowUserZoom
})) != null ? n : !0) ? se("div", {
className: "flex items-center select-none",
children: [_(Re, {
size: "sm",
disabled: !((r = L().zoom) != null && r.canZoomOut()),
onClick: () => {
L().zoom.zoomOut(L().zoom.step)
},
children: _(KR, {})
}), se("div", {
className: "w-[4ch] text-sm text-center",
children: [Math.round(t * 100), "%"]
}), _(Re, {
size: "sm",
disabled: !((i = L().zoom) != null && i.canZoomIn()),
onClick: () => {
L().zoom.zoomIn(L().zoom.step)
},
children: _(qR, {})
})]
}) : null
}
function Zp({
item: t
}) {
switch (t.type) {
case "undoWidget":
return _(GR, {});
case "zoomWidget":
return _(ZR, {});
case "button":
return _(VR, {
item: t
});
case "image":
return _("img", {
className: "h-30 object-cover",
src: Wt(t.src),
alt: ""
});
default:
return null
}
}
const Rr = ye(_("path", {
d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
}), "CloseOutlined");
function Xc() {
var r;
let t = ae(i => {
var s;
return ((s = i.config.ui) == null ? void 0 : s.mode) === Zu.OVERLAY
});
const {
width: e
} = ae(i => i.stageSize), n = e <= 700;
return n && ((r = A().config.ui) == null ? void 0 : r.forceOverlayModeOnMobile) && (t = !0), {
isModal: t,
isMobile: n
}
}
function QR() {
var o;
const {
isModal: t,
isMobile: e
} = Xc(), n = (o = ae(c => {
var h;
return (h = c.config.ui) == null ? void 0 : h.allowEditorClose
})) != null ? o : !0, r = ae(c => {
var h, l;
return (l = (h = c.config.ui) == null ? void 0 : h.menubar) == null ? void 0 : l.items
}), {
left: i,
center: s,
right: d
} = E.exports.useMemo(() => JR(r || [], e), [r, e]), a = t && e && n && _(Re, {
size: "sm",
className: "ml-10",
onClick: () => {
A().editor.close()
},
children: _(Rr, {})
});
return se(Et.div, {
className: Qw,
...Jw,
children: [_("div", {
className: "mr-auto flex items-center gap-8",
children: i.map((c, h) => _(Zp, {
item: c
}, h))
}), _("div", {
className: "flex items-center gap-10",
children: s.map((c, h) => _(Zp, {
item: c
}, h))
}), _("div", {
className: "ml-auto flex items-center gap-8",
children: d.map((c, h) => _(Zp, {
item: c
}, h))
}), a]
})
}
function JR(t, e) {
const n = {
left: [],
center: [],
right: []
};
(t || []).filter(i => !e && !i.mobileOnly || e && !i.desktopOnly).forEach(i => {
var s, d, a;
i.align === "left" ? n.left.push({
...i,
position: (s = i.position) != null ? s : 1
}) : i.align === "right" ? n.right.push({
...i,
position: (d = i.position) != null ? d : 1
}) : n.center.push({
...i,
position: (a = i.position) != null ? a : 1
})
});
const r = Object.entries(n).map(([i, s]) => [i, s.sort((d, a) => {
var o, c;
return ((o = d.position) != null ? o : 0) - ((c = a.position) != null ? c : 0)
})]);
return Object.fromEntries(r)
}
function eI() {
const t = ae(n => {
var r;
return (r = n.crop.zoneRect) == null ? void 0 : r.width
}) || 1,
e = ae(n => {
var r;
return (r = n.crop.zoneRect) == null ? void 0 : r.height
}) || 1;
return _("div", {
className: "text-sm",
children: `${t}x${e}`
})
}
function tI() {
const t = ae(e => e.activeTool);
return se(Et.div, {
className: Qw,
...Jw,
children: [_(nI, {}), rI(t), _(iI, {})]
})
}
function nI() {
const {
isMobile: t
} = Xc(), e = ae(n => n.dirty);
return t ? _(Re, {
size: "sm",
onClick: () => {
A().cancelChanges()
},
children: _(Rr, {})
}) : _(bt, {
variant: "outline",
size: "xs",
startIcon: _(Rr, {}),
radius: "rounded-full",
onClick: () => {
A().cancelChanges()
},
children: e ? _(_e, {
message: "Cancel"
}) : _(_e, {
message: "Close"
})
})
}
function rI(t) {
var n, r, i;
const e = _("div", {
className: "capitalize text-sm",
children: t
});
switch (t) {
case Me.CROP:
return ((i = (r = (n = A().config.tools) == null ? void 0 : n.crop) == null ? void 0 : r.allowCustomRatio) != null ? i : !0) ? _(eI, {}) : e;
default:
return e
}
}
function iI() {
const {
isMobile: t
} = Xc(), e = ae(n => n.dirty);
return t ? _(Re, {
size: "sm",
disabled: !e,
onClick: () => {
A().applyChanges()
},
children: _(zp, {})
}) : _(bt, {
variant: "flat",
color: "primary",
size: "xs",
disabled: !e,
startIcon: _(zp, {}),
radius: "rounded-full",
onClick: () => {
A().applyChanges()
},
children: _(_e, {
message: "Apply"
})
})
}
function Ix() {
const t = ae(e => e.activeTool);
return _(Or, {
initial: !1,
children: t ? _(tI, {}, "activeToolbar") : _(QR, {}, "mainToolbar")
})
}
const oI = {
newCanvas: fe("Loading Canvas"),
mainImage: fe("Loading Image"),
state: fe("Loading State"),
merge: fe("Processing Image")
};
function sI() {
const [t, e] = E.exports.useState(!1);
return E.exports.useEffect(() => {
ae.subscribe(n => n.loading, n => {
n && e(n)
})
}, []), _(Or, {
children: t && _(Et.div, {
initial: {
y: "60%",
opacity: 0
},
animate: {
y: 0,
opacity: 1
},
exit: {
y: "-60%",
opacity: 0
},
transition: {
type: "tween",
duration: .3
},
onAnimationComplete: () => {
setTimeout(() => {
e(!1)
}, 400)
},
className: "absolute z-loading-indicator inset-0 m-auto p-6 w-144 h-32 text-center text-sm bg-paper rounded-full shadow-lg",
children: _(_e, {
...oI[t]
})
})
})
}
function aI(t, e, n) {
return Math.max(e, Math.min(t, n))
}
const rt = {
toVector(t, e) {
return t === void 0 && (t = e), Array.isArray(t) ? t : [t, t]
},
add(t, e) {
return [t[0] + e[0], t[1] + e[1]]
},
sub(t, e) {
return [t[0] - e[0], t[1] - e[1]]
},
addTo(t, e) {
t[0] += e[0], t[1] += e[1]
},
subTo(t, e) {
t[0] -= e[0], t[1] -= e[1]
}
};
function Lx(t, e, n) {
return e === 0 || Math.abs(e) === 1 / 0 ? Math.pow(t, n * 5) : t * e * n / (e + n * t)
}
function Fx(t, e, n, r = .15) {
return r === 0 ? aI(t, e, n) : t < e ? -Lx(e - t, n - e, r) + e : t > n ? +Lx(t - n, n - e, r) + n : t
}
function lI(t, [e, n], [r, i]) {
const [
[s, d],
[a, o]
] = t;
return [Fx(e, s, d, r), Fx(n, a, o, i)]
}
function wt(t, e, n) {
return e in t ? Object.defineProperty(t, e, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : t[e] = n, t
}
function zx(t, e) {
var n = Object.keys(t);
if (Object.getOwnPropertySymbols) {
var r = Object.getOwnPropertySymbols(t);
e && (r = r.filter(function(i) {
return Object.getOwnPropertyDescriptor(t, i).enumerable
})), n.push.apply(n, r)
}
return n
}
function Ue(t) {
for (var e = 1; e < arguments.length; e++) {
var n = arguments[e] != null ? arguments[e] : {};
e % 2 ? zx(Object(n), !0).forEach(function(r) {
wt(t, r, n[r])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : zx(Object(n)).forEach(function(r) {
Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r))
})
}
return t
}
const Nx = {
pointer: {
start: "down",
change: "move",
end: "up"
},
mouse: {
start: "down",
change: "move",
end: "up"
},
touch: {
start: "start",
change: "move",
end: "end"
},
gesture: {
start: "start",
change: "change",
end: "end"
}
};
function jx(t) {
return t ? t[0].toUpperCase() + t.slice(1) : ""
}
const cI = ["enter", "leave"];
function uI(t = !1, e) {
return t && !cI.includes(e)
}
function fI(t, e = "", n = !1) {
const r = Nx[t],
i = r && r[e] || e;
return "on" + jx(t) + jx(i) + (uI(n, i) ? "Capture" : "")
}
const hI = ["gotpointercapture", "lostpointercapture"];
function dI(t) {
let e = t.substring(2).toLowerCase();
const n = !!~e.indexOf("passive");
n && (e = e.replace("passive", ""));
const r = hI.includes(e) ? "capturecapture" : "capture",
i = !!~e.indexOf(r);
return i && (e = e.replace("capture", "")), {
device: e,
capture: i,
passive: n
}
}
function pI(t, e = "") {
const n = Nx[t],
r = n && n[e] || e;
return t + r
}
function Gc(t) {
return "touches" in t
}
function Bx(t) {
return Gc(t) ? "touch" : "pointerType" in t ? t.pointerType : "mouse"
}
function gI(t) {
return Array.from(t.touches).filter(e => {
var n, r;
return e.target === t.currentTarget || ((n = t.currentTarget) === null || n === void 0 || (r = n.contains) === null || r === void 0 ? void 0 : r.call(n, e.target))
})
}
function mI(t) {
return t.type === "touchend" || t.type === "touchcancel" ? t.changedTouches : t.targetTouches
}
function $x(t) {
return Gc(t) ? mI(t)[0] : t
}
function Qp(t, e) {
const n = e.clientX - t.clientX,
r = e.clientY - t.clientY,
i = (e.clientX + t.clientX) / 2,
s = (e.clientY + t.clientY) / 2,
d = Math.hypot(n, r);
return {
angle: -(Math.atan2(n, r) * 180) / Math.PI,
distance: d,
origin: [i, s]
}
}
function vI(t) {
return gI(t).map(e => e.identifier)
}
function Vx(t, e) {
const [n, r] = Array.from(t.touches).filter(i => e.includes(i.identifier));
return Qp(n, r)
}
function Jp(t) {
const e = $x(t);
return Gc(t) ? e.identifier : e.pointerId
}
function Hx(t) {
const e = $x(t);
return [e.clientX, e.clientY]
}
const Ux = 40,
Wx = 800;
function yI(t) {
let {
deltaX: e,
deltaY: n,
deltaMode: r
} = t;
return r === 1 ? (e *= Ux, n *= Ux) : r === 2 && (e *= Wx, n *= Wx), [e, n]
}
function bI(t) {
const e = {};
if ("buttons" in t && (e.buttons = t.buttons), "shiftKey" in t) {
const {
shiftKey: n,
altKey: r,
metaKey: i,
ctrlKey: s
} = t;
Object.assign(e, {
shiftKey: n,
altKey: r,
metaKey: i,
ctrlKey: s
})
}
return e
}
function Kc(t, ...e) {
return typeof t == "function" ? t(...e) : t
}
function wI() {}
function xI(...t) {
return t.length === 0 ? wI : t.length === 1 ? t[0] : function() {
let e;
for (const n of t) e = n.apply(this, arguments) || e;
return e
}
}
function Yx(t, e) {
return Object.assign({}, e, t || {})
}
const _I = 32;
class Xx {
constructor(e, n, r) {
this.ctrl = e, this.args = n, this.key = r, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset())
}
get state() {
return this.ctrl.state[this.key]
}
set state(e) {
this.ctrl.state[this.key] = e
}
get shared() {
return this.ctrl.state.shared
}
get eventStore() {
return this.ctrl.gestureEventStores[this.key]
}
get timeoutStore() {
return this.ctrl.gestureTimeoutStores[this.key]
}
get config() {
return this.ctrl.config[this.key]
}
get sharedConfig() {
return this.ctrl.config.shared
}
get handler() {
return this.ctrl.handlers[this.key]
}
reset() {
const {
state: e,
shared: n,
ingKey: r,
args: i
} = this;
n[r] = e._active = e.active = e._blocked = e._force = !1, e._step = [!1, !1], e.intentional = !1, e._movement = [0, 0], e._distance = [0, 0], e._direction = [0, 0], e._delta = [0, 0], e._bounds = [
[-1 / 0, 1 / 0],
[-1 / 0, 1 / 0]
], e.args = i, e.axis = void 0, e.memo = void 0, e.elapsedTime = 0, e.direction = [0, 0], e.distance = [0, 0], e.overflow = [0, 0], e._movementBound = [!1, !1], e.velocity = [0, 0], e.movement = [0, 0], e.delta = [0, 0], e.timeStamp = 0
}
start(e) {
const n = this.state,
r = this.config;
n._active || (this.reset(), this.computeInitial(), n._active = !0, n.target = e.target, n.currentTarget = e.currentTarget, n.lastOffset = r.from ? Kc(r.from, n) : n.offset, n.offset = n.lastOffset), n.startTime = n.timeStamp = e.timeStamp
}
computeValues(e) {
const n = this.state;
n._values = e, n.values = this.config.transform(e)
}
computeInitial() {
const e = this.state;
e._initial = e._values, e.initial = e.values
}
compute(e) {
const {
state: n,
config: r,
shared: i
} = this;
n.args = this.args;
let s = 0;
if (e && (n.event = e, r.preventDefault && e.cancelable && n.event.preventDefault(), n.type = e.type, i.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, i.locked = !!document.pointerLockElement, Object.assign(i, bI(e)), i.down = i.pressed = i.buttons % 2 === 1 || i.touches > 0, s = e.timeStamp - n.timeStamp, n.timeStamp = e.timeStamp, n.elapsedTime = n.timeStamp - n.startTime), n._active) {
const S = n._delta.map(Math.abs);
rt.addTo(n._distance, S)
}
this.axisIntent && this.axisIntent(e);
const [d, a] = n._movement, [o, c] = r.threshold, {
_step: h,
values: l
} = n;
if (r.hasCustomTransform ? (h[0] === !1 && (h[0] = Math.abs(d) >= o && l[0]), h[1] === !1 && (h[1] = Math.abs(a) >= c && l[1])) : (h[0] === !1 && (h[0] = Math.abs(d) >= o && Math.sign(d) * o), h[1] === !1 && (h[1] = Math.abs(a) >= c && Math.sign(a) * c)), n.intentional = h[0] !== !1 || h[1] !== !1, !n.intentional) return;
const u = [0, 0];
if (r.hasCustomTransform) {
const [S, T] = l;
u[0] = h[0] !== !1 ? S - h[0] : 0, u[1] = h[1] !== !1 ? T - h[1] : 0
} else u[0] = h[0] !== !1 ? d - h[0] : 0, u[1] = h[1] !== !1 ? a - h[1] : 0;
this.restrictToAxis && !n._blocked && this.restrictToAxis(u);
const f = n.offset,
p = n._active && !n._blocked || n.active;
p && (n.first = n._active && !n.active, n.last = !n._active && n.active, n.active = i[this.ingKey] = n._active, e && (n.first && ("bounds" in r && (n._bounds = Kc(r.bounds, n)), this.setup && this.setup()), n.movement = u, this.computeOffset()));
const [m, g] = n.offset, [
[v, y],
[b, w]
] = n._bounds;
n.overflow = [m < v ? -1 : m > y ? 1 : 0, g < b ? -1 : g > w ? 1 : 0], n._movementBound[0] = n.overflow[0] ? n._movementBound[0] === !1 ? n._movement[0] : n._movementBound[0] : !1, n._movementBound[1] = n.overflow[1] ? n._movementBound[1] === !1 ? n._movement[1] : n._movementBound[1] : !1;
const x = n._active ? r.rubberband || [0, 0] : [0, 0];
if (n.offset = lI(n._bounds, n.offset, x), n.delta = rt.sub(n.offset, f), this.computeMovement(), p && (!n.last || s > _I)) {
n.delta = rt.sub(n.offset, f);
const S = n.delta.map(Math.abs);
rt.addTo(n.distance, S), n.direction = n.delta.map(Math.sign), n._direction = n._delta.map(Math.sign), !n.first && s > 0 && (n.velocity = [S[0] / s, S[1] / s])
}
}
emit() {
const e = this.state,
n = this.shared,
r = this.config;
if (e._active || this.clean(), (e._blocked || !e.intentional) && !e._force && !r.triggerAllEvents) return;
const i = this.handler(Ue(Ue(Ue({}, n), e), {}, {
[this.aliasKey]: e.values
}));
i !== void 0 && (e.memo = i)
}
clean() {
this.eventStore.clean(), this.timeoutStore.clean()
}
}
function SI([t, e], n) {
const r = Math.abs(t),
i = Math.abs(e);
if (r > i && r > n) return "x";
if (i > r && i > n) return "y"
}
class CI extends Xx {
constructor(...e) {
super(...e), wt(this, "aliasKey", "xy")
}
reset() {
super.reset(), this.state.axis = void 0
}
init() {
this.state.offset = [0, 0], this.state.lastOffset = [0, 0]
}
computeOffset() {
this.state.offset = rt.add(this.state.lastOffset, this.state.movement)
}
computeMovement() {
this.state.movement = rt.sub(this.state.offset, this.state.lastOffset)
}
axisIntent(e) {
const n = this.state,
r = this.config;
if (!n.axis && e) {
const i = typeof r.axisThreshold == "object" ? r.axisThreshold[Bx(e)] : r.axisThreshold;
n.axis = SI(n._movement, i)
}
n._blocked = (r.lockDirection || !!r.axis) && !n.axis || !!r.axis && r.axis !== n.axis
}
restrictToAxis(e) {
if (this.config.axis || this.config.lockDirection) switch (this.state.axis) {
case "x":
e[1] = 0;
break;
case "y":
e[0] = 0;
break
}
}
}
const TI = t => t,
Gx = .15,
Kx = {
enabled(t = !0) {
return t
},
eventOptions(t, e, n) {
return Ue(Ue({}, n.shared.eventOptions), t)
},
preventDefault(t = !1) {
return t
},
triggerAllEvents(t = !1) {
return t
},
rubberband(t = 0) {
switch (t) {
case !0:
return [Gx, Gx];
case !1:
return [0, 0];
default:
return rt.toVector(t)
}
},
from(t) {
if (typeof t == "function") return t;
if (t != null) return rt.toVector(t)
},
transform(t, e, n) {
const r = t || n.shared.transform;
return this.hasCustomTransform = !!r, r || TI
},
threshold(t) {
return rt.toVector(t, 0)
}
},
kI = 0,
la = Ue(Ue({}, Kx), {}, {
axis(t, e, {
axis: n
}) {
if (this.lockDirection = n === "lock", !this.lockDirection) return n
},
axisThreshold(t = kI) {
return t
},
bounds(t = {}) {
if (typeof t == "function") return s => la.bounds(t(s));
if ("current" in t) return () => t.current;
if (typeof HTMLElement == "function" && t instanceof HTMLElement) return t;
const {
left: e = -1 / 0,
right: n = 1 / 0,
top: r = -1 / 0,
bottom: i = 1 / 0
} = t;
return [
[e, n],
[r, i]
]
}
}),
qc = 10,
qx = {
ArrowRight: (t = 1) => [qc * t, 0],
ArrowLeft: (t = 1) => [-qc * t, 0],
ArrowUp: (t = 1) => [0, -qc * t],
ArrowDown: (t = 1) => [0, qc * t]
};
class EI extends CI {
constructor(...e) {
super(...e), wt(this, "ingKey", "dragging")
}
reset() {
super.reset();
const e = this.state;
e._pointerId = void 0, e._pointerActive = !1, e._keyboardActive = !1, e._preventScroll = !1, e._delayed = !1, e.swipe = [0, 0], e.tap = !1, e.canceled = !1, e.cancel = this.cancel.bind(this)
}
setup() {
const e = this.state;
if (e._bounds instanceof HTMLElement) {
const n = e._bounds.getBoundingClientRect(),
r = e.currentTarget.getBoundingClientRect(),
i = {
left: n.left - r.left + e.offset[0],
right: n.right - r.right + e.offset[0],
top: n.top - r.top + e.offset[1],
bottom: n.bottom - r.bottom + e.offset[1]
};
e._bounds = la.bounds(i)
}
}
cancel() {
const e = this.state;
e.canceled || (e.canceled = !0, e._active = !1, setTimeout(() => {
this.compute(), this.emit()
}, 0))
}
setActive() {
this.state._active = this.state._pointerActive || this.state._keyboardActive
}
clean() {
this.pointerClean(), this.state._pointerActive = !1, this.state._keyboardActive = !1, super.clean()
}
pointerDown(e) {
const n = this.config,
r = this.state;
if (e.buttons != null && (Array.isArray(n.pointerButtons) ? !n.pointerButtons.includes(e.buttons) : n.pointerButtons !== -1 && n.pointerButtons !== e.buttons)) return;
const i = this.ctrl.setEventIds(e);
n.pointerCapture && e.target.setPointerCapture(e.pointerId), !(i && i.size > 1 && r._pointerActive) && (this.start(e), this.setupPointer(e), r._pointerId = Jp(e), r._pointerActive = !0, this.computeValues(Hx(e)), this.computeInitial(), n.preventScrollAxis && Bx(e) !== "mouse" ? (r._active = !1, this.setupScrollPrevention(e)) : n.delay > 0 ? (this.setupDelayTrigger(e), n.triggerAllEvents && (this.compute(e), this.emit())) : this.startPointerDrag(e))
}
startPointerDrag(e) {
const n = this.state;
n._active = !0, n._preventScroll = !0, n._delayed = !1, this.compute(e), this.emit()
}
pointerMove(e) {
const n = this.state,
r = this.config;
if (!n._pointerActive || n.type === e.type && e.timeStamp === n.timeStamp) return;
const i = Jp(e);
if (n._pointerId !== void 0 && i !== n._pointerId) return;
const s = Hx(e);
if (document.pointerLockElement === e.target ? n._delta = [e.movementX, e.movementY] : (n._delta = rt.sub(s, n._values), this.computeValues(s)), rt.addTo(n._movement, n._delta), this.compute(e), n._delayed && n.intentional) {
this.timeoutStore.remove("dragDelay"), n.active = !1, this.startPointerDrag(e);
return
}
if (r.preventScrollAxis && !n._preventScroll)
if (n.axis)
if (n.axis === r.preventScrollAxis || r.preventScrollAxis === "xy") {
n._active = !1, this.clean();
return
} else {
this.timeoutStore.remove("startPointerDrag"), this.startPointerDrag(e);
return
}
else return;
this.emit()
}
pointerUp(e) {
this.ctrl.setEventIds(e);
try {
this.config.pointerCapture && e.target.hasPointerCapture(e.pointerId) && e.target.releasePointerCapture(e.pointerId)
} catch {}
const n = this.state,
r = this.config;
if (!n._active || !n._pointerActive) return;
const i = Jp(e);
if (n._pointerId !== void 0 && i !== n._pointerId) return;
this.state._pointerActive = !1, this.setActive(), this.compute(e);
const [s, d] = n._distance;
if (n.tap = s <= r.tapsThreshold && d <= r.tapsThreshold, n.tap && r.filterTaps) n._force = !0;
else {
const [a, o] = n.direction, [c, h] = n.velocity, [l, u] = n.movement, [f, p] = r.swipe.velocity, [m, g] = r.swipe.distance, v = r.swipe.duration;
n.elapsedTime < v && (Math.abs(c) > f && Math.abs(l) > m && (n.swipe[0] = a), Math.abs(h) > p && Math.abs(u) > g && (n.swipe[1] = o))
}
this.emit()
}
pointerClick(e) {
!this.state.tap && e.detail > 0 && (e.preventDefault(), e.stopPropagation())
}
setupPointer(e) {
const n = this.config,
r = n.device;
n.pointerLock && e.currentTarget.requestPointerLock(), n.pointerCapture || (this.eventStore.add(this.sharedConfig.window, r, "change", this.pointerMove.bind(this)), this.eventStore.add(this.sharedConfig.window, r, "end", this.pointerUp.bind(this)), this.eventStore.add(this.sharedConfig.window, r, "cancel", this.pointerUp.bind(this)))
}
pointerClean() {
this.config.pointerLock && document.pointerLockElement === this.state.currentTarget && document.exitPointerLock()
}
preventScroll(e) {
this.state._preventScroll && e.cancelable && e.preventDefault()
}
setupScrollPrevention(e) {
this.state._preventScroll = !1, OI(e);
const n = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
passive: !1
});
this.eventStore.add(this.sharedConfig.window, "touch", "end", n), this.eventStore.add(this.sharedConfig.window, "touch", "cancel", n), this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay, e)
}
setupDelayTrigger(e) {
this.state._delayed = !0, this.timeoutStore.add("dragDelay", () => {
this.state._step = [0, 0], this.startPointerDrag(e)
}, this.config.delay)
}
keyDown(e) {
const n = qx[e.key];
if (n) {
const r = this.state,
i = e.shiftKey ? 10 : e.altKey ? .1 : 1;
this.start(e), r._delta = n(i), r._keyboardActive = !0, rt.addTo(r._movement, r._delta), this.compute(e), this.emit()
}
}
keyUp(e) {
e.key in qx && (this.state._keyboardActive = !1, this.setActive(), this.compute(e), this.emit())
}
bind(e) {
const n = this.config.device;
e(n, "start", this.pointerDown.bind(this)), this.config.pointerCapture && (e(n, "change", this.pointerMove.bind(this)), e(n, "end", this.pointerUp.bind(this)), e(n, "cancel", this.pointerUp.bind(this)), e("lostPointerCapture", "", this.pointerUp.bind(this))), this.config.keys && (e("key", "down", this.keyDown.bind(this)), e("key", "up", this.keyUp.bind(this))), this.config.filterTaps && e("click", "", this.pointerClick.bind(this), {
capture: !0,
passive: !1
})
}
}
function OI(t) {
"persist" in t && typeof t.persist == "function" && t.persist()
}
const ca = typeof window < "u" && window.document && window.document.createElement;
function PI() {
return ca && "ontouchstart" in window
}
function Zx() {
return PI() || ca && window.navigator.maxTouchPoints > 1
}
function MI() {
return ca && "onpointerdown" in window
}
function AI() {
return ca && "exitPointerLock" in window.document
}
function DI() {
try {
return "constructor" in GestureEvent
} catch {
return !1
}
}
const Jt = {
isBrowser: ca,
gesture: DI(),
touch: Zx(),
touchscreen: Zx(),
pointer: MI(),
pointerLock: AI()
},
RI = 250,
II = 180,
LI = .5,
FI = 50,
zI = 250,
Qx = {
mouse: 0,
touch: 0,
pen: 8
},
NI = Ue(Ue({}, la), {}, {
device(t, e, {
pointer: {
touch: n = !1,
lock: r = !1,
mouse: i = !1
} = {}
}) {
return this.pointerLock = r && Jt.pointerLock, Jt.touch && n ? "touch" : this.pointerLock ? "mouse" : Jt.pointer && !i ? "pointer" : Jt.touch ? "touch" : "mouse"
},
preventScrollAxis(t, e, {
preventScroll: n
}) {
if (this.preventScrollDelay = typeof n == "number" ? n : n || n === void 0 && t ? RI : void 0, !(!Jt.touchscreen || n === !1)) return t || (n !== void 0 ? "y" : void 0)
},
pointerCapture(t, e, {
pointer: {
capture: n = !0,
buttons: r = 1
} = {}
}) {
return this.pointerButtons = r, !this.pointerLock && this.device === "pointer" && n
},
keys(t = !0) {
return t
},
threshold(t, e, {
filterTaps: n = !1,
tapsThreshold: r = 3,
axis: i = void 0
}) {
const s = rt.toVector(t, n ? r : i ? 1 : 0);
return this.filterTaps = n, this.tapsThreshold = r, s
},
swipe({
velocity: t = LI,
distance: e = FI,
duration: n = zI
} = {}) {
return {
velocity: this.transform(rt.toVector(t)),
distance: this.transform(rt.toVector(e)),
duration: n
}
},
delay(t = 0) {
switch (t) {
case !0:
return II;
case !1:
return 0;
default:
return t
}
},
axisThreshold(t) {
return t ? Ue(Ue({}, Qx), t) : Qx
}
}),
jI = 30,
BI = 100;
class $I extends Xx {
constructor(...e) {
super(...e), wt(this, "ingKey", "pinching"), wt(this, "aliasKey", "da")
}
init() {
this.state.offset = [1, 0], this.state.lastOffset = [1, 0], this.state._pointerEvents = new Map
}
reset() {
super.reset();
const e = this.state;
e._touchIds = [], e.canceled = !1, e.cancel = this.cancel.bind(this), e.turns = 0
}
computeOffset() {
const {
type: e,
movement: n,
lastOffset: r
} = this.state;
e === "wheel" ? this.state.offset = rt.add(n, r) : this.state.offset = [(1 + n[0]) * r[0], n[1] + r[1]]
}
computeMovement() {
const {
offset: e,
lastOffset: n
} = this.state;
this.state.movement = [e[0] / n[0], e[1] - n[1]]
}
axisIntent() {
const e = this.state,
[n, r] = e._movement;
if (!e.axis) {
const i = Math.abs(n) * jI - Math.abs(r);
i < 0 ? e.axis = "angle" : i > 0 && (e.axis = "scale")
}
}
restrictToAxis(e) {
this.config.lockDirection && (this.state.axis === "scale" ? e[1] = 0 : this.state.axis === "angle" && (e[0] = 0))
}
cancel() {
const e = this.state;
e.canceled || setTimeout(() => {
e.canceled = !0, e._active = !1, this.compute(), this.emit()
}, 0)
}
touchStart(e) {
this.ctrl.setEventIds(e);
const n = this.state,
r = this.ctrl.touchIds;
if (n._active && n._touchIds.every(s => r.has(s)) || r.size < 2) return;
this.start(e), n._touchIds = Array.from(r).slice(0, 2);
const i = Vx(e, n._touchIds);
this.pinchStart(e, i)
}
pointerStart(e) {
if (e.buttons != null && e.buttons % 2 !== 1) return;
this.ctrl.setEventIds(e), e.target.setPointerCapture(e.pointerId);
const n = this.state,
r = n._pointerEvents,
i = this.ctrl.pointerIds;
if (n._active && Array.from(r.keys()).every(d => i.has(d)) || (r.size < 2 && r.set(e.pointerId, e), n._pointerEvents.size < 2)) return;
this.start(e);
const s = Qp(...Array.from(r.values()));
this.pinchStart(e, s)
}
pinchStart(e, n) {
const r = this.state;
r.origin = n.origin, this.computeValues([n.distance, n.angle]), this.computeInitial(), this.compute(e), this.emit()
}
touchMove(e) {
if (!this.state._active) return;
const n = Vx(e, this.state._touchIds);
this.pinchMove(e, n)
}
pointerMove(e) {
const n = this.state._pointerEvents;
if (n.has(e.pointerId) && n.set(e.pointerId, e), !this.state._active) return;
const r = Qp(...Array.from(n.values()));
this.pinchMove(e, r)
}
pinchMove(e, n) {
const r = this.state,
i = r._values[1],
s = n.angle - i;
let d = 0;
Math.abs(s) > 270 && (d += Math.sign(s)), this.computeValues([n.distance, n.angle - 360 * d]), r.origin = n.origin, r.turns = d, r._movement = [r._values[0] / r._initial[0] - 1, r._values[1] - r._initial[1]], this.compute(e), this.emit()
}
touchEnd(e) {
this.ctrl.setEventIds(e), !!this.state._active && this.state._touchIds.some(n => !this.ctrl.touchIds.has(n)) && (this.state._active = !1, this.compute(e), this.emit())
}
pointerEnd(e) {
const n = this.state;
this.ctrl.setEventIds(e);
try {
e.target.releasePointerCapture(e.pointerId)
} catch {}
n._pointerEvents.has(e.pointerId) && n._pointerEvents.delete(e.pointerId), !!n._active && n._pointerEvents.size < 2 && (n._active = !1, this.compute(e), this.emit())
}
gestureStart(e) {
e.cancelable && e.preventDefault();
const n = this.state;
n._active || (this.start(e), this.computeValues([e.scale, e.rotation]), n.origin = [e.clientX, e.clientY], this.compute(e), this.emit())
}
gestureMove(e) {
if (e.cancelable && e.preventDefault(), !this.state._active) return;
const n = this.state;
this.computeValues([e.scale, e.rotation]), n.origin = [e.clientX, e.clientY];
const r = n._movement;
n._movement = [e.scale - 1, e.rotation], n._delta = rt.sub(n._movement, r), this.compute(e), this.emit()
}
gestureEnd(e) {
!this.state._active || (this.state._active = !1, this.compute(e), this.emit())
}
wheel(e) {
const n = this.config.modifierKey;
n && !e[n] || (this.state._active ? this.wheelChange(e) : this.wheelStart(e), this.timeoutStore.add("wheelEnd", this.wheelEnd.bind(this)))
}
wheelStart(e) {
this.start(e), this.wheelChange(e)
}
wheelChange(e) {
"uv" in e || e.cancelable && e.preventDefault();
const r = this.state;
r._delta = [-yI(e)[1] / BI * r.offset[0], 0], rt.addTo(r._movement, r._delta), this.state.origin = [e.clientX, e.clientY], this.compute(e), this.emit()
}
wheelEnd() {
!this.state._active || (this.state._active = !1, this.compute(), this.emit())
}
bind(e) {
const n = this.config.device;
n && (e(n, "start", this[n + "Start"].bind(this)), e(n, "change", this[n + "Move"].bind(this)), e(n, "end", this[n + "End"].bind(this)), e(n, "cancel", this[n + "End"].bind(this))), e("wheel", "", this.wheel.bind(this), {
passive: !1
})
}
}
const VI = Ue(Ue({}, Kx), {}, {
device(t, e, {
shared: n,
pointer: {
touch: r = !1
} = {}
}) {
if (n.target && !Jt.touch && Jt.gesture) return "gesture";
if (Jt.touch && r) return "touch";
if (Jt.touchscreen) {
if (Jt.pointer) return "pointer";
if (Jt.touch) return "touch"
}
},
bounds(t, e, {
scaleBounds: n = {},
angleBounds: r = {}
}) {
const i = d => {
const a = Yx(Kc(n, d), {
min: -1 / 0,
max: 1 / 0
});
return [a.min, a.max]
},
s = d => {
const a = Yx(Kc(r, d), {
min: -1 / 0,
max: 1 / 0
});
return [a.min, a.max]
};
return typeof n != "function" && typeof r != "function" ? [i(), s()] : d => [i(d), s(d)]
},
threshold(t, e, n) {
return this.lockDirection = n.axis === "lock", rt.toVector(t, this.lockDirection ? [.1, 3] : 0)
},
modifierKey(t) {
return t === void 0 ? "ctrlKey" : t
}
});
Ue(Ue({}, la), {}, {
mouseOnly: (t = !0) => t
}), Ue(Ue({}, la), {}, {
mouseOnly: (t = !0) => t
});
const eg = new Map,
tg = new Map;
function HI(t) {
eg.set(t.key, t.engine), tg.set(t.key, t.resolver)
}
const UI = {
key: "drag",
engine: EI,
resolver: NI
},
WI = {
key: "pinch",
engine: $I,
resolver: VI
};
function YI(t, e) {
if (t == null) return {};
var n = {},
r = Object.keys(t),
i, s;
for (s = 0; s < r.length; s++) i = r[s], !(e.indexOf(i) >= 0) && (n[i] = t[i]);
return n
}
function XI(t, e) {
if (t == null) return {};
var n = YI(t, e),
r, i;
if (Object.getOwnPropertySymbols) {
var s = Object.getOwnPropertySymbols(t);
for (i = 0; i < s.length; i++) r = s[i], !(e.indexOf(r) >= 0) && (!Object.prototype.propertyIsEnumerable.call(t, r) || (n[r] = t[r]))
}
return n
}
const GI = {
target(t) {
if (t) return () => "current" in t ? t.current : t
},
enabled(t = !0) {
return t
},
window(t = Jt.isBrowser ? window : void 0) {
return t
},
eventOptions({
passive: t = !0,
capture: e = !1
} = {}) {
return {
passive: t,
capture: e
}
},
transform(t) {
return t
}
},
KI = ["target", "eventOptions", "window", "enabled", "transform"];
function Zc(t = {}, e) {
const n = {};
for (const [r, i] of Object.entries(e)) switch (typeof i) {
case "function":
n[r] = i.call(n, t[r], r, t);
break;
case "object":
n[r] = Zc(t[r], i);
break;
case "boolean":
i && (n[r] = t[r]);
break
}
return n
}
function qI(t, e, n = {}) {
const r = t,
{
target: i,
eventOptions: s,
window: d,
enabled: a,
transform: o
} = r,
c = XI(r, KI);
if (n.shared = Zc({
target: i,
eventOptions: s,
window: d,
enabled: a,
transform: o
}, GI), e) {
const h = tg.get(e);
n[e] = Zc(Ue({
shared: n.shared
}, c), h)
} else
for (const h in c) {
const l = tg.get(h);
l && (n[h] = Zc(Ue({
shared: n.shared
}, c[h]), l))
}
return n
}
class Jx {
constructor(e, n) {
wt(this, "_listeners", new Set), this._ctrl = e, this._gestureKey = n
}
add(e, n, r, i, s) {
const d = this._listeners,
a = pI(n, r),
o = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {},
c = Ue(Ue({}, o), s);
e.addEventListener(a, i, c);
const h = () => {
e.removeEventListener(a, i, c), d.delete(h)
};
return d.add(h), h
}
clean() {
this._listeners.forEach(e => e()), this._listeners.clear()
}
}
class ZI {
constructor() {
wt(this, "_timeouts", new Map)
}
add(e, n, r = 140, ...i) {
this.remove(e), this._timeouts.set(e, window.setTimeout(n, r, ...i))
}
remove(e) {
const n = this._timeouts.get(e);
n && window.clearTimeout(n)
}
clean() {
this._timeouts.forEach(e => void window.clearTimeout(e)), this._timeouts.clear()
}
}
class QI {
constructor(e) {
wt(this, "gestures", new Set), wt(this, "_targetEventStore", new Jx(this)), wt(this, "gestureEventStores", {}), wt(this, "gestureTimeoutStores", {}), wt(this, "handlers", {}), wt(this, "config", {}), wt(this, "pointerIds", new Set), wt(this, "touchIds", new Set), wt(this, "state", {
shared: {
shiftKey: !1,
metaKey: !1,
ctrlKey: !1,
altKey: !1
}
}), JI(this, e)
}
setEventIds(e) {
if (Gc(e)) return this.touchIds = new Set(vI(e)), this.touchIds;
if ("pointerId" in e) return e.type === "pointerup" || e.type === "pointercancel" ? this.pointerIds.delete(e.pointerId) : e.type === "pointerdown" && this.pointerIds.add(e.pointerId), this.pointerIds
}
applyHandlers(e, n) {
this.handlers = e, this.nativeHandlers = n
}
applyConfig(e, n) {
this.config = qI(e, n, this.config)
}
clean() {
this._targetEventStore.clean();
for (const e of this.gestures) this.gestureEventStores[e].clean(), this.gestureTimeoutStores[e].clean()
}
effect() {
return this.config.shared.target && this.bind(), () => this._targetEventStore.clean()
}
bind(...e) {
const n = this.config.shared,
r = {};
let i;
if (!(n.target && (i = n.target(), !i))) {
if (n.enabled) {
for (const d of this.gestures) {
const a = this.config[d],
o = e2(r, a.eventOptions, !!i);
if (a.enabled) {
const c = eg.get(d);
new c(this, e, d).bind(o)
}
}
const s = e2(r, n.eventOptions, !!i);
for (const d in this.nativeHandlers) s(d, "", a => this.nativeHandlers[d](Ue(Ue({}, this.state.shared), {}, {
event: a,
args: e
})), void 0, !0)
}
for (const s in r) r[s] = xI(...r[s]);
if (!i) return r;
for (const s in r) {
const {
device: d,
capture: a,
passive: o
} = dI(s);
this._targetEventStore.add(i, d, "", r[s], {
capture: a,
passive: o
})
}
}
}
}
function Ao(t, e) {
t.gestures.add(e), t.gestureEventStores[e] = new Jx(t, e), t.gestureTimeoutStores[e] = new ZI
}
function JI(t, e) {
e.drag && Ao(t, "drag"), e.wheel && Ao(t, "wheel"), e.scroll && Ao(t, "scroll"), e.move && Ao(t, "move"), e.pinch && Ao(t, "pinch"), e.hover && Ao(t, "hover")
}
const e2 = (t, e, n) => (r, i, s, d = {}, a = !1) => {
var o, c;
const h = (o = d.capture) !== null && o !== void 0 ? o : e.capture,
l = (c = d.passive) !== null && c !== void 0 ? c : e.passive;
let u = a ? r : fI(r, i, h);
n && l && (u += "Passive"), t[u] = t[u] || [], t[u].push(s)
},
e6 = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;
function t6(t) {
const e = {},
n = {},
r = new Set;
for (let i in t) e6.test(i) ? (r.add(RegExp.lastMatch), n[i] = t[i]) : e[i] = t[i];
return [n, e, r]
}
function Do(t, e, n, r, i, s) {
if (!t.has(n) || !eg.has(r)) return;
const d = n + "Start",
a = n + "End",
o = c => {
let h;
return c.first && d in e && e[d](c), n in e && (h = e[n](c)), c.last && a in e && e[a](c), h
};
i[r] = o, s[r] = s[r] || {}
}
function n6(t, e) {
const [n, r, i] = t6(t), s = {};
return Do(i, n, "onDrag", "drag", s, e), Do(i, n, "onWheel", "wheel", s, e), Do(i, n, "onScroll", "scroll", s, e), Do(i, n, "onPinch", "pinch", s, e), Do(i, n, "onMove", "move", s, e), Do(i, n, "onHover", "hover", s, e), {
handlers: s,
config: e,
nativeHandlers: r
}
}
function r6(t, e = {}, n, r) {
const i = ue.useMemo(() => new QI(t), []);
if (i.applyHandlers(t, r), i.applyConfig(e, n), ue.useEffect(i.effect.bind(i)), ue.useEffect(() => i.clean.bind(i), []), e.target === void 0) return i.bind.bind(i)
}
function i6(t) {
return t.forEach(HI),
function(n, r) {
const {
handlers: i,
nativeHandlers: s,
config: d
} = n6(n, r || {});
return r6(i, d, void 0, s)
}
}
function Gn({
e: t,
rect: e,
deltaX: n,
deltaY: r
}) {
return {
rect: e,
x: t.clientX,
y: t.clientY,
deltaX: n != null ? n : 0,
deltaY: r != null ? r : 0,
nativeEvent: t
}
}
function Qc({
onMoveStart: t,
onMove: e,
onMoveEnd: n,
minimumMovement: r = 0,
preventDefault: i,
stopPropagation: s = !0,
onPress: d,
onLongPress: a,
...o
}) {
const h = E.exports.useRef({
lastPosition: {
x: 0,
y: 0
},
started: !1,
longPressTriggered: !1
}).current,
{
addGlobalListener: l,
removeGlobalListener: u
} = wp(),
f = v => {
!h.el || (t == null ? void 0 : t(v, h.el)) === !1 || (h.originalTouchAction = h.el.style.touchAction, h.el.style.touchAction = "none", h.originalUserSelect = document.documentElement.style.userSelect, document.documentElement.style.userSelect = "none", h.started = !0)
},
p = v => {
var y;
if (v.button === 0 && h.id == null) {
if (h.started = !1, ((y = o.onPointerDown) == null ? void 0 : y.call(o, v)) === !1) return;
s && v.stopPropagation(), i && v.preventDefault(), h.id = v.pointerId, h.el = v.currentTarget, h.lastPosition = {
x: v.clientX,
y: v.clientY
}, a && (h.longPressTimer = setTimeout(() => {
a(v, h.el), h.longPressTriggered = !0
}, 400)), (t || e) && l(window, "pointermove", m, !1), l(window, "pointerup", g, !1), l(window, "pointercancel", g, !1)
}
},
m = v => {
if (v.pointerId === h.id) {
const y = v.clientX - h.lastPosition.x,
b = v.clientY - h.lastPosition.y;
(Math.abs(y) >= r || Math.abs(b) >= r) && !h.started && f(v), h.started && (e == null || e(v, y, b), h.lastPosition = {
x: v.clientX,
y: v.clientY
})
}
},
g = v => {
var y;
if (v.pointerId === h.id) {
h.longPressTimer && clearTimeout(h.longPressTimer);
const b = h.longPressTriggered;
h.longPressTriggered = !1, h.started && (n == null || n(v)), h.el && (v.type !== "pointercancel" && ((y = o.onPointerUp) == null || y.call(o, v, h.el), v.target && h.el.contains(v.target) && (b ? a == null || a(v, h.el) : d == null || d(v, h.el))), document.documentElement.style.userSelect = h.originalUserSelect || "", h.el.style.touchAction = h.originalTouchAction || ""), h.id = void 0, h.started = !1, u(window, "pointermove", m, !1), u(window, "pointerup", g, !1), u(window, "pointercancel", g, !1)
}
};
return {
domProps: {
onPointerDown: $n(p)
}
}
}
function o6(t, e) {
const n = {
...t
};
n.left = Math.max(0, n.left);
const r = n.left - t.left;
r > 0 && (n.width -= r), n.top = Math.max(0, n.top);
const i = n.top - t.top;
return i > 0 && (n.height -= i), n.width = Math.min(n.width, e.width - n.left), n.height = Math.min(n.height, e.height - n.top), n
}
function ua(t) {
return {
left: t.left,
top: t.top,
width: t.width,
height: t.height
}
}
var Yt = (t => (t.topLeft = "topLeft", t.topRight = "topRight", t.bottomLeft = "bottomLeft", t.bottomRight = "bottomRight", t))(Yt || {});
let Pe = {};
const t2 = (t = {}) => {
ko(null), Pe = t
};
function n2({
aspectRatio: t,
boundaryRef: e,
boundaryRect: n,
restrictWithinBoundary: r = !0,
minWidth: i = 50,
minHeight: s = 50,
...d
}) {
const a = {
onMoveStart: (c, h) => {
var u;
const l = c.target;
if (!l.dataset.resizeHandle || (t2({
currentRect: ua(h.getBoundingClientRect()),
resizeDir: l.dataset.resizeHandle
}), !Pe.currentRect)) return !1;
ko("resize"), n ? Pe.boundaryRect = n : e != null && e.current && (Pe.boundaryRect = ua(e.current.getBoundingClientRect())), Pe.currentRect && Pe.boundaryRect && (Pe.currentRect.left -= Pe.boundaryRect.left, Pe.currentRect.top -= Pe.boundaryRect.top), Pe.initialAspectRatio = Pe.currentRect.width / Pe.currentRect.height, (u = d.onResizeStart) == null || u.call(d, Gn({
rect: Pe.currentRect,
e: c
}))
},
onMove: (c, h, l) => {
var m;
if (!Pe.resizeDir || !Pe.currentRect) return;
const u = t === "initial" ? Pe.initialAspectRatio : t,
f = s6(Pe.currentRect, h, l, u),
p = a6(f, i, s, u);
(m = d.onResize) == null || m.call(d, Gn({
rect: p,
e: c,
deltaX: h,
deltaY: l
})), Pe.currentRect = f
},
onMoveEnd: c => {
var h;
Pe.currentRect && ((h = d.onResizeEnd) == null || h.call(d, Gn({
rect: Pe.currentRect,
e: c
}))), t2()
}
},
{
domProps: o
} = Qc(a);
return {
resizeProps: o
}
}
function s6(t, e, n, r) {
const i = {
...t
},
s = {
...t
};
return Pe.resizeDir === "topRight" ? (s.width = Math.floor(s.width + e), r ? s.height = Math.floor(s.width / r) : s.height = Math.floor(s.height - n), s.top = Math.floor(s.top + (i.height - s.height))) : Pe.resizeDir === "bottomRight" ? (s.width = Math.floor(s.width + e), r ? s.height = Math.floor(s.width / r) : s.height = Math.floor(s.height + n)) : Pe.resizeDir === "topLeft" ? (s.width = Math.floor(s.width - e), r ? s.height = Math.floor(s.width / r) : s.height = Math.floor(s.height - n), s.left = Math.floor(s.left + (i.width - s.width)), s.top = Math.floor(s.top + (i.height - s.height))) : Pe.resizeDir === "bottomLeft" && (s.width = Math.floor(s.width - e), r ? s.height = Math.floor(s.width / r) : s.height = Math.floor(s.height + n), s.left = Math.floor(s.left + e)), s
}
function a6(t, e, n, r) {
const i = Pe.resizeDir === "bottomLeft" || Pe.resizeDir === "topLeft",
s = Pe.resizeDir === "topRight" || Pe.resizeDir === "topLeft";
let d = {
...t
};
d.width = Math.max(e, t.width), d.height = Math.max(n, t.height);
const a = d.width - t.width;
i && a > 0 && (d.left -= a);
const o = d.height - t.height;
if (s && o > 0 && (d.top -= o), Pe.boundaryRect && (d = o6(d, Pe.boundaryRect)), r) {
const c = d.width,
h = d.height,
l = Ep(r, d.width, d.height);
d.width = l.width, d.height = l.height, s && (d.top += h - d.height), i && (d.left += c - d.width)
}
return d
}
function Ir({
position: t,
inset: e = !1
}) {
const n = l6(t, e);
return _("div", {
"data-resize-handle": t,
className: `border-white absolute w-20 h-20 ${n}`
})
}
function l6(t, e) {
const n = e ? "left-0" : "-left-5",
r = e ? "top-0" : "-top-5",
i = e ? "bottom-0" : "-bottom-5",
s = e ? "right-0" : "-right-5";
switch (t) {
case Yt.topLeft:
return `${n} ${r} border-l-4 border-t-4 cursor-nwse-resize`;
case Yt.topRight:
return `${s} ${r} border-r-4 border-t-4 cursor-nesw-resize`;
case Yt.bottomRight:
return `${s} ${i} border-r-4 border-b-4 cursor-se-resize`;
case Yt.bottomLeft:
return `${n} ${i} border-l-4 border-b-4 cursor-sw-resize`;
default:
return ""
}
}
var fa = (t => (t.top = "maskTop", t.right = "maskRight", t.bottom = "maskBottom", t.left = "maskLeft", t))(fa || {});
function Jc({
position: t,
refs: e
}) {
const n = c6(t);
return _("div", {
className: `cropzone-transition bg-black/50 bottom absolute ${n}`,
ref: r => e.current[t] = r
})
}
function c6(t) {
switch (t) {
case "maskTop":
return "left-0 top-0";
case "maskBottom":
return "bottom-0 left-0";
default:
return ""
}
}
function eu({
name: t,
refs: e
}) {
const n = he("cropzone-transition pointer-events-none absolute left-0 top-0 bg-white/50", t.startsWith("lineHor") ? "h-px" : "w-px");
return _("div", {
className: n,
ref: r => {
e.current[t] = r
}
})
}
function tu(t, e, n) {
return Math.min(Math.max(t, e), n)
}
let qe = {};
function r2({
boundaryRef: t,
boundaryRect: e,
minimumMovement: n,
restrictWithinBoundary: r = !0,
...i
}) {
const s = {
minimumMovement: n,
onMoveStart: (a, o) => {
var c;
if (Sp) return !1;
qe = {
currentRect: ua(o.getBoundingClientRect())
}, ko("move"), e ? qe.boundaryRect = e : t != null && t.current && (qe.boundaryRect = ua(t.current.getBoundingClientRect())), qe.currentRect && qe.boundaryRect && (qe.currentRect.left -= qe.boundaryRect.left, qe.currentRect.top -= qe.boundaryRect.top), (c = i.onMoveStart) == null || c.call(i, Gn({
rect: qe.currentRect,
e: a
}))
},
onMove: (a, o, c) => {
var u;
if (!qe.currentRect) return;
const h = {
...qe.currentRect,
left: qe.currentRect.left + o,
top: qe.currentRect.top + c
},
l = {
...h
};
qe.boundaryRect && r && (l.left = tu(h.left, 0, qe.boundaryRect.width - h.width), l.top = tu(h.top, 0, qe.boundaryRect.height - h.height)), (u = i.onMove) == null || u.call(i, Gn({
rect: l,
e: a,
deltaX: o,
deltaY: c
})), qe.currentRect = h
},
onMoveEnd: a => {
var o;
!qe.currentRect || ((o = i.onMoveEnd) == null || o.call(i, Gn({
rect: qe.currentRect,
e: a
})), ko(null), qe = {})
}
},
{
domProps: d
} = Qc(s);
return {
moveProps: d
}
}
function u6() {
const t = E.exports.useRef({}),
[e, n] = E.exports.useState(!0),
r = ae(h => h.canvasSize),
i = ae(h => {
var l, u;
return (u = (l = h.config.tools) == null ? void 0 : l.crop) == null ? void 0 : u.cropzone
}),
s = ae(h => {
var l, u;
return (u = (l = h.config.tools) == null ? void 0 : l.crop) == null ? void 0 : u.defaultRatio
}) || null,
d = ae(h => h.crop.selectedAspectRatio) || null,
{
moveProps: a
} = r2({
boundaryRect: r,
onMoveStart: () => n(!0),
onMove: h => L().crop.drawZone(h.rect),
onMoveEnd: () => n(!1)
}),
{
resizeProps: o
} = n2({
boundaryRect: r,
minHeight: 50,
minWidth: 50,
aspectRatio: Op(d),
onResizeStart: () => n(!0),
onResize: h => L().crop.drawZone(h.rect),
onResizeEnd: () => n(!1)
});
E.exports.useLayoutEffect(() => {
L().crop.registerRefs(t), L().crop.resetCropzone(s)
}, [s, r]);
const c = he("cropzone absolute z-cropzone isolate left-0 top-0 w-full h-full overflow-hidden", e && "moving");
return se("div", {
className: c,
onPointerDown: h => {
h.stopPropagation(), h.preventDefault()
},
children: [se("div", {
className: "cropzone-transition border-white/50 absolute z-10 left-0 top-0 border",
...Co(o, a),
ref: h => t.current.innerZone = h,
children: [!(i != null && i.hideTopLeft) && _(Ir, {
position: Yt.topLeft,
inset: !0
}), !(i != null && i.hideTopRight) && _(Ir, {
position: Yt.topRight,
inset: !0
}), !(i != null && i.hideBottomLeft) && _(Ir, {
position: Yt.bottomLeft,
inset: !0
}), !(i != null && i.hideBottomRight) && _(Ir, {
position: Yt.bottomRight,
inset: !0
}), _(eu, {
name: "lineVer1",
refs: t
}), _(eu, {
name: "lineVer2",
refs: t
}), _(eu, {
name: "lineHor1",
refs: t
}), _(eu, {
name: "lineHor2",
refs: t
})]
}), _(Jc, {
refs: t,
position: fa.top
}), _(Jc, {
refs: t,
position: fa.left
}), _(Jc, {
refs: t,
position: fa.right
}), _(Jc, {
refs: t,
position: fa.bottom
})]
})
}
const f6 = ye(_("path", {
d: "M 7 2 C 6.448 2 6 2.448 6 3 C 6 3.552 6.448 4 7 4 L 20 4 L 20 17 C 20 17.552 20.448 18 21 18 C 21.552 18 22 17.552 22 17 L 22 4 C 22 2.895 21.105 2 20 2 L 7 2 z M 4 6 C 2.895 6 2 6.895 2 8 L 2 20 C 2 21.105 2.895 22 4 22 L 16 22 C 17.105 22 18 21.105 18 20 L 18 8 C 18 6.895 17.105 6 16 6 L 4 6 z M 10 10 C 10.552 10 11 10.448 11 11 L 11 13 L 13 13 C 13.552 13 14 13.448 14 14 C 14 14.552 13.552 15 13 15 L 11 15 L 11 17 C 11 17.552 10.552 18 10 18 C 9.448 18 9 17.552 9 17 L 9 15 L 7 15 C 6.448 15 6 14.552 6 14 C 6 13.448 6.448 13 7 13 L 9 13 L 9 11 C 9 10.448 9.448 10 10 10 z"
})),
h6 = ye(_("path", {
d: "M 11 3 L 2 21 L 11 21 L 11 3 z M 13 3 L 13 21 L 22 21 L 13 3 z M 9 11.472656 L 9 19 L 5.2363281 19 L 9 11.472656 z"
})),
d6 = ye(_("path", {
d: "M 16.476562 2.4511719 C 16.392047 2.4657656 16.308531 2.5061719 16.238281 2.5761719 L 14.130859 4.6835938 C 13.956859 4.8575938 13.956859 5.1394531 14.130859 5.3144531 L 16.238281 7.4238281 C 16.519281 7.7048281 17 7.5054219 17 7.1074219 L 17 6 L 20 6 L 20 9 A 1.0001 1.0001 0 1 0 22 9 L 22 6 C 22 4.9069372 21.093063 4 20 4 L 17 4 L 17 2.8925781 C 17 2.5940781 16.730109 2.4073906 16.476562 2.4511719 z M 4 5 C 2.9069372 5 2 5.9069372 2 7 L 2 14 C 2 15.093063 2.9069372 16 4 16 L 7 16 L 7 19 C 7 20.105 7.895 21 9 21 L 16 21 C 17.105 21 18 20.105 18 19 L 18 12 C 18 10.895 17.105 10 16 10 L 13 10 L 13 7 C 13 5.9069372 12.093063 5 11 5 L 4 5 z M 4 7 L 11 7 L 11 14 L 4 14 L 4 7 z"
})),
p6 = ye(_("path", {
d: "M 10 2 L 9 3 L 3 3 L 3 5 L 21 5 L 21 3 L 15 3 L 14 2 L 10 2 z M 4.3652344 7 L 5.8925781 20.263672 C 6.0245781 21.253672 6.877 22 7.875 22 L 16.123047 22 C 17.121047 22 17.974422 21.254859 18.107422 20.255859 L 19.634766 7 L 4.3652344 7 z"
})),
g6 = {
width: 120,
height: 30
},
m6 = [{
name: "Duplicate",
icon: f6,
onClick: () => {
L().objects.duplicate()
}
}, {
name: "Flip",
icon: h6,
onClick: () => {
L().objects.flipHorizontally()
}
}, {
name: "Bring to front",
icon: d6,
onClick: () => {
L().objects.bringToFront()
}
}, {
name: "Delete",
icon: p6,
onClick: () => {
L().objects.delete()
}
}],
v6 = ue.forwardRef((t, e) => {
const r = ae(i => i.objects.active.isMoving) ? "opacity-0" : "opacity-100";
return _("div", {
ref: e,
className: `${r} absolute z-obj-box left-0 top-0 flex items-center text-white bg-controls rounded shadow transition-opacity overflow-hidden`,
children: m6.map(i => {
const s = i.icon;
return _(Re, {
size: "sm",
className: "w-30 h-30 hover:bg-white/hover",
radius: "rounded-none",
onClick: i.onClick,
children: _(s, {})
}, i.name)
})
})
});
function y6(t, e) {
if (!e) return;
const n = t.angle || 0,
r = n > 168 && n < 188 ? -30 : -15,
i = A().canvasSize,
s = A().stageSize,
d = g6,
a = i.top - s.top,
o = i.left - s.left,
c = s.width - (o + i.width),
h = s.height - (a + i.height),
l = -a,
u = -(i.left - s.left),
f = i.width - d.width + c,
p = i.height - d.height + h,
m = t.getBoundingRect();
let g = m.top - d.height + r,
v = m.left + m.width / 2 - d.width / 2;
g = Math.min(p, Math.max(l, g)), v = Math.min(f, Math.max(u, v)), e.style.transform = `translate(${v}px, ${g}px) rotate(0deg)`
}
function b6(t) {
const e = L().objects.getActive();
if (!e || !t.rect.angle) return;
const n = be.fabric.util.radiansToDegrees(t.rect.angle);
n !== e.angle && L().objects.setValues({
angle: n
})
}
function w6(t) {
const e = t.rect.width / 2,
n = t.rect.height / 2;
L().objects.setValues({
left: (t.rect.left + e) / A().zoom,
top: (t.rect.top + n) / A().zoom
})
}
function x6(t) {
const e = L().objects.getActive();
if (!e) return;
const n = {};
ir(e) ? (t.deltaX > 0 || e.getScaledHeight() >= 20 && e.getScaledWidth() >= 20) && (n.fontSize = (e.fontSize || 1) + t.deltaX) : (e.width && (n.scaleX = t.rect.width / A().zoom / e.width), e.height && (n.scaleY = t.rect.height / A().zoom / e.height)), L().objects.setValues(n)
}
function i2(t, e) {
var l, u, f;
const n = L().objects.getActive();
if (!n || !t.current) return;
const r = t.current,
i = be.fabric.util.degreesToRadians((l = n.angle) != null ? l : 0);
let s = Math.round(n.getScaledWidth() * A().zoom),
d = Math.round(n.getScaledHeight() * A().zoom),
a = Math.round(((u = n.left) != null ? u : 0) * A().zoom),
o = Math.round(((f = n.top) != null ? f : 0) * A().zoom);
const c = n.originX === "center" ? s / 2 : 0,
h = n.originY === "center" ? d / 2 : 0;
n.padding && (s += n.padding * 2, d += n.padding * 2, a -= n.padding, o -= n.padding), r.style.width = `${s}px`, r.style.height = `${d}px`, r.style.transform = `translate(${a-c}px, ${o-h}px) rotate(${i}rad)`, L().canvas.render(), y6(n, e.current)
}
function _6() {
var e;
const t = L().objects.getActive();
ir(t) && (t.enterEditing(), (e = t.hiddenTextarea) == null || e.focus())
}
function S6() {
return _("div", {
className: "absolute -bottom-20 left-1/2 w-2 h-20 bg-white cursor-default -translate-x-1/2",
children: _("div", {
"data-rotate-handle": !0,
className: "w-18 h-18 absolute -bottom-10 -left-8 bg-white rounded-full cursor-move bgrotate"
})
})
}
let Cn = {};
function C6(t) {
const e = {
onMoveStart: (r, i) => {
var c, h;
if (!r.target.dataset.rotateHandle) return !1;
const d = ua(i.getBoundingClientRect());
if (!d) return !1;
const a = (c = i.style.transform.match(/rotate\((.+?)\)/)) == null ? void 0 : c[1],
[o = "0"] = a ? a.split(",") : [];
s2({
currentRect: d,
centerX: d.left + d.width / 2,
centerY: d.top + d.height / 2,
startAngle: parseFloat(o)
}), ko("rotate"), Cn.startAngle = o2(r), (h = t.onRotateStart) == null || h.call(t, Gn({
rect: d,
e: r
}))
},
onMove: (r, i, s) => {
var a;
if (!Cn.currentRect) return;
const d = {
...Cn.currentRect
};
d.angle = o2(r), d.left += i, d.top += s, (a = t.onRotate) == null || a.call(t, Gn({
rect: d,
e: r,
deltaX: i,
deltaY: s
})), Cn.currentRect = d
},
onMoveEnd: r => {
var i;
Cn.currentRect && ((i = t.onRotateEnd) == null || i.call(t, Gn({
rect: Cn.currentRect,
e: r
}))), s2()
}
},
{
domProps: n
} = Qc(e);
return {
rotateProps: n
}
}
function o2(t) {
const e = {
x: Cn.centerX || 0,
y: Cn.centerY || 0
};
return Math.atan2(e.y - t.pageY, e.x - t.pageX) - (Cn.startAngle || 0)
}
const s2 = (t = {}) => {
ko(null), Cn = t
};
function T6() {
const t = E.exports.useRef(null),
e = E.exports.useRef(null),
n = ae(u => u.objects.active.id),
r = ae(u => u.objects.isEditingText),
i = ae(u => u.zoom),
s = k6(),
d = E.exports.useRef(null),
a = E.exports.useCallback(() => {
d.current ? (clearTimeout(d.current), d.current = null, _6()) : d.current = setTimeout(() => {
d.current = null
}, 300)
}, []);
let {
moveProps: o
} = r2({
boundaryRef: A().canvasRef,
restrictWithinBoundary: !1,
onMoveEnd: () => {
A().objects.setActiveIsMoving(!1)
},
onMove: u => {
A().objects.setActiveIsMoving(!0), w6(u)
}
});
s.lockMovement && (o = {});
const {
resizeProps: c
} = n2({
minWidth: 50,
minHeight: 50,
aspectRatio: s.unlockAspectRatio ? null : "initial",
boundaryRef: A().canvasRef,
restrictWithinBoundary: !1,
onResizeEnd: () => {
A().objects.setActiveIsMoving(!1)
},
onResize: u => {
A().objects.setActiveIsMoving(!0), x6(u)
}
}), {
rotateProps: h
} = C6({
boundaryRef: A().canvasRef,
onRotateEnd: () => {
A().objects.setActiveIsMoving(!1)
},
onRotate: u => {
A().objects.setActiveIsMoving(!0), b6(u)
}
});
return E.exports.useEffect(() => {
!de() || A().editor.on("object:modified", u => {
u.sizeOrPositionChanged && i2(t, e)
})
}, []), E.exports.useEffect(() => {
i2(t, e)
}, [n, i, r]), se("div", {
className: n && !r ? "block" : "hidden",
children: [se("div", {
ref: t,
...Co(h, c, o),
onClick: a,
className: "absolute z-obj-box border-2 border-white shadow-md cursor-move",
children: [!s.hideTopLeft && _(Ir, {
position: Yt.topLeft
}), !s.hideTopRight && _(Ir, {
position: Yt.topRight
}), !s.hideBottomLeft && _(Ir, {
position: Yt.bottomLeft
}), !s.hideBottomRight && _(Ir, {
position: Yt.bottomRight
}), !s.hideRotatingPoint && _(S6, {})]
}), _(v6, {
ref: e
})]
})
}
function k6() {
const t = L().objects.getActive();
if (!t || !t.name) return {};
const e = A().config.objectControls || {},
n = t.name;
return {
...e.global,
...e[n]
}
}
function E6() {
const t = ae(n => n.activeTool === Me.CROP),
e = ae(n => n.objects.active.id);
return se("div", {
children: [t && _(u6, {}), e && _(T6, {})]
})
}
const O6 = i6([UI, WI]),
P6 = ue.forwardRef((t, e) => {
const [n, r] = E.exports.useState(!1);
E.exports.useEffect(() => ae.subscribe(s => s.loading, s => {
r(!s)
}), []);
const i = {
visible: {
opacity: 1,
transition: {
duration: .35,
delay: .5
}
},
hidden: {
opacity: 0,
transition: {
duration: 0
}
}
};
return _(M6, {
children: se(Et.div, {
initial: {
opacity: 0
},
variants: i,
animate: n ? "visible" : "hidden",
className: "relative m-auto",
style: {
backgroundImage: `url(${Wt("images/empty-canvas-bg.png")})`
},
children: [_(E6, {}), _("canvas", {
ref: e
})]
})
})
});
function M6({
children: t
}) {
const e = E.exports.useRef(null),
n = O6({
onPinch: r => {
if (!L().zoom.allowUserZoom || !a2(r)) return r.cancel();
r.direction[0] === 1 ? L().zoom.zoomIn(.01) : L().zoom.zoomOut(.01), r.event.stopPropagation(), r.event.preventDefault()
},
onDrag: r => {
if (r.pinching || !a2(r)) return r.cancel();
e.current.scrollLeft -= r.delta[0], e.current.scrollTop -= r.delta[1]
}
});
return _("div", {
ref: e,
className: "flex items-center justify-center w-full h-full overflow-hidden touch-none",
...n(),
children: t
})
}
function a2(t) {
return !(de().findTarget(t.event, !1) || de().isDrawingMode)
}
function ng({
actionBtn: t,
children: e,
className: n
}) {
return se("div", {
className: he(n, "flex gap-16 items-center h-full"),
children: [t && _("div", {
className: "flex-shrink-0",
children: t
}), _("div", {
className: "w-full flex-auto",
children: e
}), t && _("div", {
className: "w-96"
})]
})
}
function Ro() {
return (Ro = Object.assign || function(t) {
for (var e = 1; e < arguments.length; e++) {
var n = arguments[e];
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r])
}
return t
}).apply(this, arguments)
}
function nu(t, e) {
if (t == null) return {};
var n, r, i = {},
s = Object.keys(t);
for (r = 0; r < s.length; r++) e.indexOf(n = s[r]) >= 0 || (i[n] = t[n]);
return i
}
function ha(t) {
var e = E.exports.useRef(t),
n = E.exports.useRef(function(r) {
e.current && e.current(r)
});
return e.current = t, n.current
}
var da = function(t, e, n) {
return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t < e ? e : t
},
pa = function(t) {
return "touches" in t
},
rg = function(t) {
return t && t.ownerDocument.defaultView || self
},
l2 = function(t, e, n) {
var r = t.getBoundingClientRect(),
i = pa(e) ? function(s, d) {
for (var a = 0; a < s.length; a++)
if (s[a].identifier === d) return s[a];
return s[0]
}(e.touches, n) : e;
return {
left: da((i.pageX - (r.left + rg(t).pageXOffset)) / r.width),
top: da((i.pageY - (r.top + rg(t).pageYOffset)) / r.height)
}
},
c2 = function(t) {
!pa(t) && t.preventDefault()
},
u2 = ue.memo(function(t) {
var e = t.onMove,
n = t.onKey,
r = nu(t, ["onMove", "onKey"]),
i = E.exports.useRef(null),
s = ha(e),
d = ha(n),
a = E.exports.useRef(null),
o = E.exports.useRef(!1),
c = E.exports.useMemo(function() {
var f = function(g) {
c2(g), (pa(g) ? g.touches.length > 0 : g.buttons > 0) && i.current ? s(l2(i.current, g, a.current)) : m(!1)
},
p = function() {
return m(!1)
};
function m(g) {
var v = o.current,
y = rg(i.current),
b = g ? y.addEventListener : y.removeEventListener;
b(v ? "touchmove" : "mousemove", f), b(v ? "touchend" : "mouseup", p)
}
return [function(g) {
var v = g.nativeEvent,
y = i.current;
if (y && (c2(v), ! function(w, x) {
return x && !pa(w)
}(v, o.current) && y)) {
if (pa(v)) {
o.current = !0;
var b = v.changedTouches || [];
b.length && (a.current = b[0].identifier)
}
y.focus(), s(l2(y, v, a.current)), m(!0)
}
}, function(g) {
var v = g.which || g.keyCode;
v < 37 || v > 40 || (g.preventDefault(), d({
left: v === 39 ? .05 : v === 37 ? -.05 : 0,
top: v === 40 ? .05 : v === 38 ? -.05 : 0
}))
}, m]
}, [d, s]),
h = c[0],
l = c[1],
u = c[2];
return E.exports.useEffect(function() {
return u
}, [u]), _("div", {
...Ro({}, r, {
onTouchStart: h,
onMouseDown: h,
className: "react-colorful__interactive",
ref: i,
onKeyDown: l,
tabIndex: 0,
role: "slider"
})
})
}),
ig = function(t) {
return t.filter(Boolean).join(" ")
},
f2 = function(t) {
var e = t.color,
n = t.left,
r = t.top,
i = r === void 0 ? .5 : r,
s = ig(["react-colorful__pointer", t.className]);
return _("div", {
className: s,
style: {
top: 100 * i + "%",
left: 100 * n + "%"
},
children: _("div", {
className: "react-colorful__pointer-fill",
style: {
backgroundColor: e
}
})
})
},
ht = function(t, e, n) {
return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n
},
A6 = function(t) {
return F6(og(t))
},
og = function(t) {
return t[0] === "#" && (t = t.substring(1)), t.length < 6 ? {
r: parseInt(t[0] + t[0], 16),
g: parseInt(t[1] + t[1], 16),
b: parseInt(t[2] + t[2], 16),
a: t.length === 4 ? ht(parseInt(t[3] + t[3], 16) / 255, 2) : 1
} : {
r: parseInt(t.substring(0, 2), 16),
g: parseInt(t.substring(2, 4), 16),
b: parseInt(t.substring(4, 6), 16),
a: t.length === 8 ? ht(parseInt(t.substring(6, 8), 16) / 255, 2) : 1
}
},
D6 = function(t) {
return L6(I6(t))
},
R6 = function(t) {
var e = t.s,
n = t.v,
r = t.a,
i = (200 - e) * n / 100;
return {
h: ht(t.h),
s: ht(i > 0 && i < 200 ? e * n / 100 / (i <= 100 ? i : 200 - i) * 100 : 0),
l: ht(i / 2),
a: ht(r, 2)
}
},
sg = function(t) {
var e = R6(t);
return "hsl(" + e.h + ", " + e.s + "%, " + e.l + "%)"
},
I6 = function(t) {
var e = t.h,
n = t.s,
r = t.v,
i = t.a;
e = e / 360 * 6, n /= 100, r /= 100;
var s = Math.floor(e),
d = r * (1 - n),
a = r * (1 - (e - s) * n),
o = r * (1 - (1 - e + s) * n),
c = s % 6;
return {
r: ht(255 * [r, a, d, d, o, r][c]),
g: ht(255 * [o, r, r, a, d, d][c]),
b: ht(255 * [d, d, o, r, r, a][c]),
a: ht(i, 2)
}
},
ru = function(t) {
var e = t.toString(16);
return e.length < 2 ? "0" + e : e
},
L6 = function(t) {
var e = t.r,
n = t.g,
r = t.b,
i = t.a,
s = i < 1 ? ru(ht(255 * i)) : "";
return "#" + ru(e) + ru(n) + ru(r) + s
},
F6 = function(t) {
var e = t.r,
n = t.g,
r = t.b,
i = t.a,
s = Math.max(e, n, r),
d = s - Math.min(e, n, r),
a = d ? s === e ? (n - r) / d : s === n ? 2 + (r - e) / d : 4 + (e - n) / d : 0;
return {
h: ht(60 * (a < 0 ? a + 6 : a)),
s: ht(s ? d / s * 100 : 0),
v: ht(s / 255 * 100),
a: i
}
},
z6 = ue.memo(function(t) {
var e = t.hue,
n = t.onChange,
r = ig(["react-colorful__hue", t.className]);
return ue.createElement("div", {
className: r
}, ue.createElement(u2, {
onMove: function(i) {
n({
h: 360 * i.left
})
},
onKey: function(i) {
n({
h: da(e + 360 * i.left, 0, 360)
})
},
"aria-label": "Hue",
"aria-valuenow": ht(e),
"aria-valuemax": "360",
"aria-valuemin": "0"
}, ue.createElement(f2, {
className: "react-colorful__hue-pointer",
left: e / 360,
color: sg({
h: e,
s: 100,
v: 100,
a: 1
})
})))
}),
N6 = ue.memo(function(t) {
var e = t.hsva,
n = t.onChange,
r = {
backgroundColor: sg({
h: e.h,
s: 100,
v: 100,
a: 1
})
};
return ue.createElement("div", {
className: "react-colorful__saturation",
style: r
}, ue.createElement(u2, {
onMove: function(i) {
n({
s: 100 * i.left,
v: 100 - 100 * i.top
})
},
onKey: function(i) {
n({
s: da(e.s + 100 * i.left, 0, 100),
v: da(e.v - 100 * i.top, 0, 100)
})
},
"aria-label": "Color",
"aria-valuetext": "Saturation " + ht(e.s) + "%, Brightness " + ht(e.v) + "%"
}, ue.createElement(f2, {
className: "react-colorful__saturation-pointer",
top: 1 - e.v / 100,
left: e.s / 100,
color: sg(e)
})))
}),
h2 = function(t, e) {
if (t === e) return !0;
for (var n in t)
if (t[n] !== e[n]) return !1;
return !0
},
j6 = function(t, e) {
return t.toLowerCase() === e.toLowerCase() || h2(og(t), og(e))
};
function B6(t, e, n) {
var r = ha(n),
i = E.exports.useState(function() {
return t.toHsva(e)
}),
s = i[0],
d = i[1],
a = E.exports.useRef({
color: e,
hsva: s
});
E.exports.useEffect(function() {
if (!t.equal(e, a.current.color)) {
var c = t.toHsva(e);
a.current = {
hsva: c,
color: e
}, d(c)
}
}, [e, t]), E.exports.useEffect(function() {
var c;
h2(s, a.current.hsva) || t.equal(c = t.fromHsva(s), a.current.color) || (a.current = {
hsva: s,
color: c
}, r(c))
}, [s, t, r]);
var o = E.exports.useCallback(function(c) {
d(function(h) {
return Object.assign({}, h, c)
})
}, []);
return [s, o]
}
var $6 = typeof window < "u" ? E.exports.useLayoutEffect : E.exports.useEffect,
V6 = function() {
return typeof __webpack_nonce__ < "u" ? __webpack_nonce__ : void 0
},
d2 = new Map,
H6 = function(t) {
$6(function() {
var e = t.current ? t.current.ownerDocument : document;
if (e !== void 0 && !d2.has(e)) {
var n = e.createElement("style");
n.innerHTML = `.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`, d2.set(e, n);
var r = V6();
r && n.setAttribute("nonce", r), e.head.appendChild(n)
}
}, [])
},
U6 = function(t) {
var e = t.className,
n = t.colorModel,
r = t.color,
i = r === void 0 ? n.defaultColor : r,
s = t.onChange,
d = nu(t, ["className", "colorModel", "color", "onChange"]),
a = E.exports.useRef(null);
H6(a);
var o = B6(n, i, s),
c = o[0],
h = o[1],
l = ig(["react-colorful", e]);
return se("div", {
...Ro({}, d, {
ref: a,
className: l
}),
children: [_(N6, {
hsva: c,
onChange: h
}), _(z6, {
hue: c.h,
onChange: h,
className: "react-colorful__last-control"
})]
})
},
W6 = {
defaultColor: "000",
toHsva: A6,
fromHsva: function(t) {
return D6({
h: t.h,
s: t.s,
v: t.v,
a: 1
})
},
equal: j6
},
Y6 = function(t) {
return _(U6, {
...Ro({}, t, {
colorModel: W6
})
})
},
X6 = /^#?([0-9A-F]{3,8})$/i,
G6 = function(t) {
var e = t.color,
n = e === void 0 ? "" : e,
r = t.onChange,
i = t.onBlur,
s = t.escape,
d = t.validate,
a = t.format,
o = t.process,
c = nu(t, ["color", "onChange", "onBlur", "escape", "validate", "format", "process"]),
h = E.exports.useState(function() {
return s(n)
}),
l = h[0],
u = h[1],
f = ha(r),
p = ha(i),
m = E.exports.useCallback(function(v) {
var y = s(v.target.value);
u(y), d(y) && f(o ? o(y) : y)
}, [s, o, d, f]),
g = E.exports.useCallback(function(v) {
d(v.target.value) || u(s(n)), p(v)
}, [n, s, d, p]);
return E.exports.useEffect(function() {
u(s(n))
}, [n, s]), _("input", {
...Ro({}, c, {
value: a ? a(l) : l,
spellCheck: "false",
onChange: m,
onBlur: g
})
})
},
p2 = function(t) {
return "#" + t
},
K6 = function(t) {
var e = t.prefixed,
n = t.alpha,
r = nu(t, ["prefixed", "alpha"]),
i = E.exports.useCallback(function(d) {
return d.replace(/([^0-9A-F]+)/gi, "").substring(0, n ? 8 : 6)
}, [n]),
s = E.exports.useCallback(function(d) {
return function(a, o) {
var c = X6.exec(a),
h = c ? c[1].length : 0;
return h === 3 || h === 6 || !!o && h === 4 || !!o && h === 8
}(d, n)
}, [n]);
return ue.createElement(G6, Ro({}, r, {
escape: i,
format: e ? p2 : void 0,
process: p2,
validate: s
}))
};
function q6(t) {
return t && t.__esModule ? t.default : t
}
var g2 = {},
m2 = {};
m2 = {
alpha: "\u0623\u0644\u0641\u0627",
blue: "\u0623\u0632\u0631\u0642",
brightness: "\u0627\u0644\u0633\u0637\u0648\u0639",
green: "\u0623\u062E\u0636\u0631",
hue: "\u062F\u0631\u062C\u0629 \u0627\u0644\u0644\u0648\u0646",
lightness: "\u0627\u0644\u0625\u0636\u0627\u0621\u0629",
red: "\u0623\u062D\u0645\u0631",
saturation: "\u0627\u0644\u062A\u0634\u0628\u0639"
};
var v2 = {};
v2 = {
alpha: "\u0410\u043B\u0444\u0430",
blue: "\u0421\u0438\u043D\u044C\u043E",
brightness: "\u042F\u0440\u043A\u043E\u0441\u0442",
green: "\u0417\u0435\u043B\u0435\u043D\u043E",
hue: "\u041E\u0442\u0442\u0435\u043D\u044A\u043A",
lightness: "\u041B\u0435\u043A\u043E\u0442\u0430",
red: "\u0427\u0435\u0440\u0432\u0435\u043D\u043E",
saturation: "\u041D\u0430\u0441\u0438\u0442\u0435\u043D\u043E\u0441\u0442"
};
var y2 = {};
y2 = {
alpha: "Alfa",
blue: "Modr\xE1",
brightness: "Jas",
green: "Zelen\xE1",
hue: "Odst\xEDn",
lightness: "Sv\u011Btlost",
red: "\u010Cerven\xE1",
saturation: "Sytost"
};
var b2 = {};
b2 = {
alpha: "Alfa",
blue: "Bl\xE5",
brightness: "Lysstyrke",
green: "Gr\xF8n",
hue: "Tone",
lightness: "Lyshed",
red: "R\xF8d",
saturation: "Farvem\xE6tning"
};
var w2 = {};
w2 = {
alpha: "Alpha",
blue: "Blau",
brightness: "Helligkeit",
green: "Gr\xFCn",
hue: "Farbton",
lightness: "Leuchtkraft",
red: "Rot",
saturation: "S\xE4ttigung"
};
var x2 = {};
x2 = {
alpha: "\u0386\u03BB\u03C6\u03B1",
blue: "\u039C\u03C0\u03BB\u03B5",
brightness: "\u03A6\u03C9\u03C4\u03B5\u03B9\u03BD\u03CC\u03C4\u03B7\u03C4\u03B1",
green: "\u03A0\u03C1\u03AC\u03C3\u03B9\u03BD\u03BF",
hue: "\u03A4\u03CC\u03BD\u03BF\u03C2",
lightness: "\u03A6\u03C9\u03C4\u03B5\u03B9\u03BD\u03CC\u03C4\u03B7\u03C4\u03B1",
red: "\u039A\u03CC\u03BA\u03BA\u03B9\u03BD\u03BF",
saturation: "\u039A\u03BF\u03C1\u03B5\u03C3\u03BC\u03CC\u03C2"
};
var _2 = {};
_2 = {
hue: "Hue",
saturation: "Saturation",
lightness: "Lightness",
brightness: "Brightness",
red: "Red",
green: "Green",
blue: "Blue",
alpha: "Alpha"
};
var S2 = {};
S2 = {
alpha: "Alpha",
blue: "Azul",
brightness: "Brillo",
green: "Verde",
hue: "Tono",
lightness: "Luminosidad",
red: "Rojo",
saturation: "Saturaci\xF3n"
};
var C2 = {};
C2 = {
alpha: "Alfa",
blue: "Sinine",
brightness: "Heledus",
green: "Roheline",
hue: "V\xE4rv",
lightness: "Valgus",
red: "Punane",
saturation: "K\xFCllastus"
};
var T2 = {};
T2 = {
alpha: "Alpha",
blue: "Sininen",
brightness: "Kirkkaus",
green: "Vihre\xE4",
hue: "S\xE4vy",
lightness: "Valom\xE4\xE4r\xE4",
red: "Punainen",
saturation: "V\xE4rikyll\xE4isyys"
};
var k2 = {};
k2 = {
alpha: "Alpha",
blue: "Bleu",
brightness: "Luminosit\xE9",
green: "Vert",
hue: "Teinte",
lightness: "Luminosit\xE9",
red: "Rouge",
saturation: "Saturation"
};
var E2 = {};
E2 = {
alpha: "\u05D0\u05DC\u05E4\u05D0",
blue: "\u05DB\u05D7\u05D5\u05DC",
brightness: "\u05D1\u05D4\u05D9\u05E8\u05D5\u05EA",
green: "\u05D9\u05E8\u05D5\u05E7",
hue: "\u05D2\u05D5\u05D5\u05DF",
lightness: "\u05DB\u05DE\u05D5\u05EA \u05D0\u05D5\u05E8",
red: "\u05D0\u05D3\u05D5\u05DD",
saturation: "\u05E8\u05D5\u05D5\u05D9\u05D4"
};
var O2 = {};
O2 = {
alpha: "Alfa",
blue: "Plava",
brightness: "Svjetlina",
green: "Zelena",
hue: "Nijansa",
lightness: "Osvijetljenost",
red: "Crvena",
saturation: "Zasi\u0107enost"
};
var P2 = {};
P2 = {
alpha: "Alfa",
blue: "K\xE9k",
brightness: "F\xE9nyess\xE9g",
green: "Z\xF6ld",
hue: "Sz\xEDn\xE1rnyalat",
lightness: "Vil\xE1goss\xE1g",
red: "Piros",
saturation: "Tel\xEDtetts\xE9g"
};
var M2 = {};
M2 = {
alpha: "Alfa",
blue: "Blu",
brightness: "Luminosit\xE0",
green: "Verde",
hue: "Tonalit\xE0",
lightness: "Luminosit\xE0",
red: "Rosso",
saturation: "Saturazione"
};
var A2 = {};
A2 = {
alpha: "\u30A2\u30EB\u30D5\u30A1",
blue: "\u9752",
brightness: "\u660E\u308B\u3055",
green: "\u7DD1",
hue: "\u8272\u76F8",
lightness: "\u660E\u5EA6",
red: "\u8D64",
saturation: "\u5F69\u5EA6"
};
var D2 = {};
D2 = {
alpha: "\uC54C\uD30C",
blue: "\uD30C\uB791",
brightness: "\uBA85\uB3C4",
green: "\uCD08\uB85D",
hue: "\uC0C9\uC870",
lightness: "\uBC1D\uAE30",
red: "\uBE68\uAC15",
saturation: "\uCC44\uB3C4"
};
var R2 = {};
R2 = {
alpha: "Alfa",
blue: "M\u0117lyna",
brightness: "Ry\u0161kumas",
green: "\u017Dalia",
hue: "Atspalvis",
lightness: "\u0160viesumas",
red: "Raudona",
saturation: "\u012Esotinimas"
};
var I2 = {};
I2 = {
alpha: "Alfa",
blue: "Zila",
brightness: "Spilgtums",
green: "Za\u013Ca",
hue: "Nokr\u0101sa",
lightness: "Gai\u0161ums",
red: "Sarkana",
saturation: "Pies\u0101tin\u0101jums"
};
var L2 = {};
L2 = {
alpha: "Alfa",
blue: "Bl\xE5",
brightness: "Lysstyrke",
green: "Gr\xF8nn",
hue: "Fargetone",
lightness: "Lyshet",
red: "R\xF8d",
saturation: "Metning"
};
var F2 = {};
F2 = {
alpha: "Alfa",
blue: "Blauw",
brightness: "Helderheid",
green: "Groen",
hue: "Kleurtoon",
lightness: "Lichtsterkte",
red: "Rood",
saturation: "Verzadiging"
};
var z2 = {};
z2 = {
alpha: "Alfa",
blue: "Niebieski",
brightness: "Jasno\u015B\u0107",
green: "Zielony",
hue: "Odcie\u0144",
lightness: "Jaskrawo\u015B\u0107",
red: "Czerwony",
saturation: "Nasycenie"
};
var N2 = {};
N2 = {
alpha: "Alfa",
blue: "Azul",
brightness: "Brilho",
green: "Verde",
hue: "Matiz",
lightness: "Luminosidade",
red: "Vermelho",
saturation: "Satura\xE7\xE3o"
};
var j2 = {};
j2 = {
alpha: "Alfa",
blue: "Azul",
brightness: "Luminosidade",
green: "Verde",
hue: "Tonalidade",
lightness: "Claridade",
red: "Vermelho",
saturation: "Satura\xE7\xE3o"
};
var B2 = {};
B2 = {
alpha: "Alfa",
blue: "Albastru",
brightness: "Luminozitate",
green: "Verde",
hue: "Nuan\u021B\u0103",
lightness: "Luminozitate",
red: "Ro\u0219u",
saturation: "Satura\u021Bie"
};
var $2 = {};
$2 = {
alpha: "\u0410\u043B\u044C\u0444\u0430",
blue: "\u0421\u0438\u043D\u0438\u0439",
brightness: "\u042F\u0440\u043A\u043E\u0441\u0442\u044C",
green: "\u0417\u0435\u043B\u0435\u043D\u044B\u0439",
hue: "\u041E\u0442\u0442\u0435\u043D\u043E\u043A",
lightness: "\u041E\u0441\u0432\u0435\u0449\u0435\u043D\u043D\u043E\u0441\u0442\u044C",
red: "\u041A\u0440\u0430\u0441\u043D\u044B\u0439",
saturation: "\u041D\u0430\u0441\u044B\u0449\u0435\u043D\u043D\u043E\u0441\u0442\u044C"
};
var V2 = {};
V2 = {
alpha: "Alfa",
blue: "Modr\xE1",
brightness: "Jas",
green: "Zelen\xE1",
hue: "Odtie\u0148",
lightness: "Svetlos\u0165",
red: "\u010Cerven\xE1",
saturation: "S\xFDtos\u0165"
};
var H2 = {};
H2 = {
alpha: "Alfa",
blue: "Modra",
brightness: "Svetlost",
green: "Zelena",
hue: "Barva",
lightness: "Lahkost",
red: "Rde\u010Da",
saturation: "Nasi\u010Denost"
};
var U2 = {};
U2 = {
alpha: "Alfa",
blue: "Plava",
brightness: "Osvetljenost",
green: "Zelena",
hue: "Nijansa",
lightness: "Osvetljenje",
red: "Crvena",
saturation: "Zasi\u0107enje"
};
var W2 = {};
W2 = {
alpha: "Alfa",
blue: "Bl\xE5tt",
brightness: "Ljusstyrka",
green: "Gr\xF6nt",
hue: "Nyans",
lightness: "Ljushet",
red: "R\xF6tt",
saturation: "M\xE4ttnad"
};
var Y2 = {};
Y2 = {
alpha: "Alfa",
blue: "Mavi",
brightness: "Parlakl\u0131k",
green: "Ye\u015Fil",
hue: "Ton",
lightness: "Canl\u0131l\u0131k",
red: "K\u0131rm\u0131z\u0131",
saturation: "Doygunluk"
};
var X2 = {};
X2 = {
alpha: "\u0410\u043B\u044C\u0444\u0430",
blue: "\u0421\u0438\u043D\u0456\u0439",
brightness: "\u042F\u0441\u043A\u0440\u0430\u0432\u0456\u0441\u0442\u044C",
green: "\u0417\u0435\u043B\u0435\u043D\u0438\u0439",
hue: "\u0422\u043E\u043D",
lightness: "\u041E\u0441\u0432\u0456\u0442\u043B\u0435\u043D\u0456\u0441\u0442\u044C",
red: "\u0427\u0435\u0440\u0432\u043E\u043D\u0438\u0439",
saturation: "\u041D\u0430\u0441\u0438\u0447\u0435\u043D\u0456\u0441\u0442\u044C"
};
var G2 = {};
G2 = {
alpha: "Alpha",
blue: "\u84DD\u8272",
brightness: "\u4EAE\u5EA6",
green: "\u7EFF\u8272",
hue: "\u8272\u76F8",
lightness: "\u660E\u4EAE\u5EA6",
red: "\u7EA2\u8272",
saturation: "\u9971\u548C\u5EA6"
};
var K2 = {};
K2 = {
alpha: "Alpha",
blue: "\u85CD\u8272",
brightness: "\u4EAE\u5EA6",
green: "\u7DA0\u8272",
hue: "\u8272\u76F8",
lightness: "\u660E\u4EAE",
red: "\u7D05\u8272",
saturation: "\u98FD\u548C\u5EA6"
}, g2 = {
"ar-AE": m2,
"bg-BG": v2,
"cs-CZ": y2,
"da-DK": b2,
"de-DE": w2,
"el-GR": x2,
"en-US": _2,
"es-ES": S2,
"et-EE": C2,
"fi-FI": T2,
"fr-FR": k2,
"he-IL": E2,
"hr-HR": O2,
"hu-HU": P2,
"it-IT": M2,
"ja-JP": A2,
"ko-KR": D2,
"lt-LT": R2,
"lv-LV": I2,
"nb-NO": L2,
"nl-NL": F2,
"pl-PL": z2,
"pt-BR": N2,
"pt-PT": j2,
"ro-RO": B2,
"ru-RU": $2,
"sk-SK": V2,
"sl-SI": H2,
"sr-SP": U2,
"sv-SE": W2,
"tr-TR": Y2,
"uk-UA": X2,
"zh-CN": G2,
"zh-TW": K2
};
const Z6 = new SR(q6(g2));
function ga(t) {
let e = Lr.parse(t) || Fr.parse(t) || zr.parse(t);
if (e) return e;
throw new Error("Invalid color value: " + t)
}
class ag {
toHexInt() {
return this.toFormat("rgb").toHexInt()
}
getChannelValue(e) {
if (e in this) return this[e];
throw new Error("Unsupported color channel: " + e)
}
withChannelValue(e, n) {
if (e in this) {
let r = this.clone();
return r[e] = n, r
}
throw new Error("Unsupported color channel: " + e)
}
getChannelName(e, n) {
return Z6.getStringForLocale(e, n)
}
getColorSpaceAxes(e) {
let {
xChannel: n,
yChannel: r
} = e, i = n || this.getColorChannels().find(a => a !== r), s = r || this.getColorChannels().find(a => a !== i), d = this.getColorChannels().find(a => a !== i && a !== s);
return {
xChannel: i,
yChannel: s,
zChannel: d
}
}
}
class Lr extends ag {
static parse(e) {
let n = [];
if (/^#[\da-f]+$/i.test(e) && [4, 5, 7, 9].includes(e.length)) {
const s = (e.length < 6 ? e.replace(/[^#]/gi, "$&$&") : e).slice(1).split("");
for (; s.length > 0;) n.push(parseInt(s.splice(0, 2).join(""), 16));
n[3] = n[3] !== void 0 ? n[3] / 255 : void 0
}
const r = e.match(/^rgba?\((.*)\)$/);
r != null && r[1] && (n = r[1].split(",").map(s => Number(s.trim())), n = n.map((s, d) => hi(s, 0, d < 3 ? 255 : 1)));
var i;
return n.length < 3 ? void 0 : new Lr(n[0], n[1], n[2], (i = n[3]) !== null && i !== void 0 ? i : 1)
}
toString(e) {
switch (e) {
case "hex":
return "#" + (this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0")).toUpperCase();
case "hexa":
return "#" + (this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0") + Math.round(this.alpha * 255).toString(16).padStart(2, "0")).toUpperCase();
case "rgb":
return `rgb(${this.red}, ${this.green}, ${this.blue})`;
case "css":
case "rgba":
return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
default:
return this.toFormat(e).toString(e)
}
}
toFormat(e) {
switch (e) {
case "hex":
case "hexa":
case "rgb":
case "rgba":
return this;
case "hsb":
case "hsba":
return this.toHSB();
case "hsl":
case "hsla":
return this.toHSL();
default:
throw new Error("Unsupported color conversion: rgb -> " + e)
}
}
toHexInt() {
return this.red << 16 | this.green << 8 | this.blue
}
toHSB() {
const e = this.red / 255,
n = this.green / 255,
r = this.blue / 255,
i = Math.min(e, n, r),
s = Math.max(e, n, r),
d = s - i,
a = s === 0 ? 0 : d / s;
let o = 0;
if (d !== 0) {
switch (s) {
case e:
o = (n - r) / d + (n < r ? 6 : 0);
break;
case n:
o = (r - e) / d + 2;
break;
case r:
o = (e - n) / d + 4;
break
}
o /= 6
}
return new Fr(Qe(o * 360, 2), Qe(a * 100, 2), Qe(s * 100, 2), this.alpha)
}
toHSL() {
const e = this.red / 255,
n = this.green / 255,
r = this.blue / 255,
i = Math.min(e, n, r),
s = Math.max(e, n, r),
d = (s + i) / 2,
a = s - i;
let o, c;
if (a === 0) o = c = 0;
else {
switch (c = a / (d < .5 ? s + i : 2 - s - i), s) {
case e:
o = (n - r) / a + (n < r ? 6 : 0);
break;
case n:
o = (r - e) / a + 2;
break;
case r:
o = (e - n) / a + 4;
break
}
o /= 6
}
return new zr(Qe(o * 360, 2), Qe(c * 100, 2), Qe(d * 100, 2), this.alpha)
}
clone() {
return new Lr(this.red, this.green, this.blue, this.alpha)
}
getChannelRange(e) {
switch (e) {
case "red":
case "green":
case "blue":
return {
minValue: 0, maxValue: 255, step: 1, pageSize: 17
};
case "alpha":
return {
minValue: 0, maxValue: 1, step: .01, pageSize: .1
};
default:
throw new Error("Unknown color channel: " + e)
}
}
formatChannelValue(e, n) {
let r, i = this.getChannelValue(e);
switch (e) {
case "red":
case "green":
case "blue":
r = {
style: "decimal"
};
break;
case "alpha":
r = {
style: "percent"
};
break;
default:
throw new Error("Unknown color channel: " + e)
}
return new Vc(n, r).format(i)
}
getColorSpace() {
return "rgb"
}
getColorChannels() {
return Lr.colorChannels
}
constructor(e, n, r, i) {
super(), this.red = e, this.green = n, this.blue = r, this.alpha = i
}
}
Lr.colorChannels = ["red", "green", "blue"];
const Q6 = /hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
class Fr extends ag {
static parse(e) {
let n;
if (n = e.match(Q6)) {
var r;
const [i, s, d, a] = ((r = n[1]) !== null && r !== void 0 ? r : n[2]).split(",").map(o => Number(o.trim().replace("%", "")));
return new Fr(q2(i, 360), hi(s, 0, 100), hi(d, 0, 100), hi(a != null ? a : 1, 0, 1))
}
}
toString(e) {
switch (e) {
case "css":
return this.toHSL().toString("css");
case "hex":
return this.toRGB().toString("hex");
case "hexa":
return this.toRGB().toString("hexa");
case "hsb":
return `hsb(${this.hue}, ${Qe(this.saturation,2)}%, ${Qe(this.brightness,2)}%)`;
case "hsba":
return `hsba(${this.hue}, ${Qe(this.saturation,2)}%, ${Qe(this.brightness,2)}%, ${this.alpha})`;
default:
return this.toFormat(e).toString(e)
}
}
toFormat(e) {
switch (e) {
case "hsb":
case "hsba":
return this;
case "hsl":
case "hsla":
return this.toHSL();
case "rgb":
case "rgba":
return this.toRGB();
default:
throw new Error("Unsupported color conversion: hsb -> " + e)
}
}
toHSL() {
let e = this.saturation / 100,
n = this.brightness / 100,
r = n * (1 - e / 2);
return e = r === 0 || r === 1 ? 0 : (n - r) / Math.min(r, 1 - r), new zr(Qe(this.hue, 2), Qe(e * 100, 2), Qe(r * 100, 2), this.alpha)
}
toRGB() {
let e = this.hue,
n = this.saturation / 100,
r = this.brightness / 100,
i = (s, d = (s + e / 60) % 6) => r - n * r * Math.max(Math.min(d, 4 - d, 1), 0);
return new Lr(Math.round(i(5) * 255), Math.round(i(3) * 255), Math.round(i(1) * 255), this.alpha)
}
clone() {
return new Fr(this.hue, this.saturation, this.brightness, this.alpha)
}
getChannelRange(e) {
switch (e) {
case "hue":
return {
minValue: 0, maxValue: 360, step: 1, pageSize: 15
};
case "saturation":
case "brightness":
return {
minValue: 0, maxValue: 100, step: 1, pageSize: 10
};
case "alpha":
return {
minValue: 0, maxValue: 1, step: .01, pageSize: .1
};
default:
throw new Error("Unknown color channel: " + e)
}
}
formatChannelValue(e, n) {
let r, i = this.getChannelValue(e);
switch (e) {
case "hue":
r = {
style: "unit",
unit: "degree",
unitDisplay: "narrow"
};
break;
case "saturation":
case "brightness":
r = {
style: "percent"
}, i /= 100;
break;
case "alpha":
r = {
style: "percent"
};
break;
default:
throw new Error("Unknown color channel: " + e)
}
return new Vc(n, r).format(i)
}
getColorSpace() {
return "hsb"
}
getColorChannels() {
return Fr.colorChannels
}
constructor(e, n, r, i) {
super(), this.hue = e, this.saturation = n, this.brightness = r, this.alpha = i
}
}
Fr.colorChannels = ["hue", "saturation", "brightness"];
const J6 = /hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
function q2(t, e) {
return (t % e + e) % e
}
class zr extends ag {
static parse(e) {
let n;
if (n = e.match(J6)) {
var r;
const [i, s, d, a] = ((r = n[1]) !== null && r !== void 0 ? r : n[2]).split(",").map(o => Number(o.trim().replace("%", "")));
return new zr(q2(i, 360), hi(s, 0, 100), hi(d, 0, 100), hi(a != null ? a : 1, 0, 1))
}
}
toString(e) {
switch (e) {
case "hex":
return this.toRGB().toString("hex");
case "hexa":
return this.toRGB().toString("hexa");
case "hsl":
return `hsl(${this.hue}, ${Qe(this.saturation,2)}%, ${Qe(this.lightness,2)}%)`;
case "css":
case "hsla":
return `hsla(${this.hue}, ${Qe(this.saturation,2)}%, ${Qe(this.lightness,2)}%, ${this.alpha})`;
default:
return this.toFormat(e).toString(e)
}
}
toFormat(e) {
switch (e) {
case "hsl":
case "hsla":
return this;
case "hsb":
case "hsba":
return this.toHSB();
case "rgb":
case "rgba":
return this.toRGB();
default:
throw new Error("Unsupported color conversion: hsl -> " + e)
}
}
toHSB() {
let e = this.saturation / 100,
n = this.lightness / 100,
r = n + e * Math.min(n, 1 - n);
return e = r === 0 ? 0 : 2 * (1 - n / r), new Fr(Qe(this.hue, 2), Qe(e * 100, 2), Qe(r * 100, 2), this.alpha)
}
toRGB() {
let e = this.hue,
n = this.saturation / 100,
r = this.lightness / 100,
i = n * Math.min(r, 1 - r),
s = (d, a = (d + e / 30) % 12) => r - i * Math.max(Math.min(a - 3, 9 - a, 1), -1);
return new Lr(Math.round(s(0) * 255), Math.round(s(8) * 255), Math.round(s(4) * 255), this.alpha)
}
clone() {
return new zr(this.hue, this.saturation, this.lightness, this.alpha)
}
getChannelRange(e) {
switch (e) {
case "hue":
return {
minValue: 0, maxValue: 360, step: 1, pageSize: 15
};
case "saturation":
case "lightness":
return {
minValue: 0, maxValue: 100, step: 1, pageSize: 10
};
case "alpha":
return {
minValue: 0, maxValue: 1, step: .01, pageSize: .1
};
default:
throw new Error("Unknown color channel: " + e)
}
}
formatChannelValue(e, n) {
let r, i = this.getChannelValue(e);
switch (e) {
case "hue":
r = {
style: "unit",
unit: "degree",
unitDisplay: "narrow"
};
break;
case "saturation":
case "lightness":
r = {
style: "percent"
}, i /= 100;
break;
case "alpha":
r = {
style: "percent"
};
break;
default:
throw new Error("Unknown color channel: " + e)
}
return new Vc(n, r).format(i)
}
getColorSpace() {
return "hsl"
}
getColorChannels() {
return zr.colorChannels
}
constructor(e, n, r, i) {
super(), this.hue = e, this.saturation = n, this.lightness = r, this.alpha = i
}
}
zr.colorChannels = ["hue", "saturation", "lightness"], ga("#ffffff"), ga("hsl(0, 100%, 50%)");
const eL = ga("#000000"),
tL = ga("#FFFFFF");
eL.toHexInt(), tL.toHexInt();
function nL({
onChange: t,
value: e,
colors: n
}) {
const r = n.map(i => {
const s = e === i;
return _(Vn, {
onClick: () => {
t == null || t(i)
},
className: he("relative block flex-shrink-0 w-26 h-26 border rounded", s && "shadow-md"),
style: {
backgroundColor: i
},
children: s && _("span", {
className: "absolute inset-0 m-auto rounded-full w-8 h-8 bg-white"
})
}, i)
});
return _("div", {
className: "flex gap-6",
children: r
})
}
function mi(t = {}) {
const {
size: e = "md",
startAdornment: n,
endAdornment: r,
startAppend: i,
endAppend: s,
className: d,
labelPosition: a,
labelDisplay: o = "block",
inputClassName: c,
inputWrapperClassName: h,
unstyled: l,
invalid: u,
disabled: f,
background: p = "transparent",
flexibleHeight: m
} = {
...t
};
if (l) return {
label: "",
input: c || "",
wrapper: d || "",
inputWrapper: h || "",
adornment: "",
append: {
size: "",
radius: ""
},
size: {
font: "",
height: ""
},
description: "",
error: ""
};
const g = rL({
size: t.size,
flexibleHeight: m
}),
v = i || s,
y = u ? "border-danger" : "border-divider",
b = u ? "focus:ring-danger/focus focus:border-danger/60" : "focus:ring-primary/focus focus:border-primary/60";
return {
label: he(o, "first-letter:capitalize text-left", f && "text-disabled", g.font, a === "side" ? "mr-16" : "mb-4"),
input: he("block text-left relative w-full appearance-none transition-shadow text", p === "transparent" && "bg-transparent", p === "bg-alt" && "bg-alt", p === "bg-paper" && "bg-paper", !v && "rounded", i && "rounded-r rounded-l-none", s && "rounded-l rounded-r-none", !v && `${y} border`, i && `${y} border-y border-r`, s && `${y} border-y border-l`, !f && `focus:ring ${b} focus:outline-none shadow-sm`, f && "text-disabled cursor-not-allowed", c, g.font, g.height, n ? "pl-46" : "pl-12", r ? "pr-46" : "pr-12"),
adornment: oD(e),
append: {
size: Ap(e),
radius: i ? "rounded-l" : "rounded-r"
},
wrapper: he(d, g.font, {
"flex items-center": a === "side"
}),
inputWrapper: he("relative", h, v && "flex items-stretch"),
size: g,
description: "text-muted pt-10 text-xs",
error: "text-danger pt-10 text-xs"
}
}
function rL({
size: t,
flexibleHeight: e
}) {
switch (t) {
case "xs":
return {
font: "text-xs", height: e ? "min-h-30" : "h-30"
};
case "sm":
return {
font: "text-sm", height: e ? "min-h-36" : "h-36"
};
case "lg":
return {
font: "text-lg", height: e ? "min-h-50" : "h-50"
};
case "xl":
return {
font: "text-xl", height: e ? "min-h-60" : "h-60"
};
default:
return {
font: "text-sm", height: e ? "min-h-42" : "h-42"
}
}
}
const iL = ["rgb(0,0,0)", "rgb(255, 255, 255)", "rgb(242, 38, 19)", "rgb(249, 105, 14)", "rgb(253, 227, 167)", "rgb(4, 147, 114)", "rgb(30, 139, 195)", "rgb(142, 68, 173)"];
function oL({
defaultValue: t,
onChange: e,
colorPresets: n,
showInput: r
}) {
const [i, s] = E.exports.useState(t), d = n || iL, a = mi({
size: "sm"
});
return se("div", {
children: [_(Y6, {
className: "!w-auto",
color: i,
onChange: o => {
e == null || e(o), s(o)
}
}), se("div", {
className: "py-20 px-12",
children: [d && _(nL, {
colors: d,
onChange: o => {
if (o) {
const c = ga(o).toString("hex");
e == null || e(c), s(c)
}
},
value: i
}), r && _("div", {
className: "pt-20",
children: _(K6, {
autoComplete: "off",
role: "textbox",
autoCorrect: "off",
spellCheck: "false",
required: !0,
"aria-label": "Hex color",
prefixed: !0,
className: a.input,
color: i,
onChange: o => {
e == null || e(o), s(o)
}
})
})]
})]
})
}
const iu = ue.createContext(null);
function Z2() {
return E.exports.useContext(iu)
}
function vi() {
const {
lines: t,
localeCode: e
} = Uc();
return {
trans: E.exports.useCallback(r => sL({
...r,
lines: t,
localeCode: e
}), [t, e])
}
}
const sL = ra(t => {
let {
lines: e,
message: n,
values: r,
localeCode: i
} = t;
return n = (e == null ? void 0 : e[n]) || n, r && (n = Mx(i, t), Object.entries(r).forEach(([s, d]) => {
n = n.replace(`:${s}`, `${d}`)
})), n
}, {
equals: Xp,
callTimeout: 0
});
function aL({
onDismiss: t
}) {
const {
trans: e
} = vi(), n = () => {
t && t()
};
return _("button", {
className: "sr-only",
"aria-label": e(fe("Dismiss")),
tabIndex: -1,
onClick: n
})
}
function ou(t) {
const {
type: e = "modal",
dialogProps: n,
...r
} = E.exports.useContext(iu), {
children: i,
className: s,
size: d = "md",
background: a,
radius: o = "rounded",
maxWidth: c = "max-w-dialog",
...h
} = t;
let l = null;
(e === "popover" || e === "tray") && (l = _(aL, {
onDismiss: r.close
}));
const u = d === "fullscreenTakeover" || e === "tray",
f = he("mx-auto pointer-events-auto outline-none flex flex-col overflow-hidden", a || "bg-paper", e !== "tray" && lL(d), e === "tray" && "rounded-t", d !== "fullscreenTakeover" && "shadow-2xl border max-h-dialog", !u && `${o} ${c}`, s);
return se("div", {
...Co({
role: "dialog",
tabIndex: -1
}, n, h),
style: {
"--be-dialog-padding": "24px"
},
"aria-modal": !0,
className: f,
children: [E.exports.Children.toArray(i).map(p => {
var m;
return E.exports.isValidElement(p) ? E.exports.cloneElement(p, {
size: (m = p.props.size) != null ? m : d
}) : p
}), l]
})
}
function lL(t) {
switch (t) {
case "xs":
return "w-320";
case "sm":
return "w-384";
case "md":
return "w-440";
case "lg":
return "w-620";
case "xl":
return "w-780";
case "2xl":
return "w-850";
case "fullscreenTakeover":
return "w-full h-full";
default:
return t
}
}
const lg = ye(_("path", {
d: "M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"
}), "KeyboardArrowDownOutlined"),
cL = E.exports.forwardRef(({
children: t,
autoFocus: e = !1,
restoreFocus: n = !0,
isDismissable: r = !0,
isOpen: i = !1,
onClose: s
}, d) => {
const a = jp(),
o = di(d);
return se("div", {
className: "isolate z-modal fixed inset-0",
style: a,
children: [_(Yp, {
onClick: () => {
r && s()
}
}, "modal-underlay"), _(Et.div, {
ref: o,
className: "absolute inset-0 w-full h-full z-20 flex items-center justify-center pointer-events-none",
role: "presentation",
initial: {
opacity: 0,
scale: .7
},
animate: {
opacity: 1,
scale: 1
},
exit: {
opacity: 0,
scale: 1
},
children: _(jc, {
restoreFocus: n,
autoFocus: e,
contain: !0,
children: t
})
})]
})
});
function su(t) {
let {
children: e,
type: n,
disableInitialTransition: r,
onClose: i,
isDismissable: s = !0,
triggerRef: d,
moveFocusToDialog: a = !0,
returnFocusToTrigger: o = !0
} = t;
const [c, h] = fi(t.isOpen, t.defaultIsOpen, t.onOpenChange), {
dialogTrigger: l,
dialog: u
} = uL(e);
Wc() && n === "popover" && (n = "modal");
const {
x: p,
y: m,
reference: g,
floating: v,
strategy: y,
refs: b
} = vx({
...t,
disablePositioning: n === "modal"
}), w = n === "popover" ? {
position: y,
top: m != null ? m : "",
left: p != null ? p : ""
} : {}, x = E.exports.useId(), S = `${x}-label`, T = `${x}-description`, P = `${x}-form`, I = E.exports.useCallback(te => {
i == null || i(te), h(!1)
}, [i, h]);
Bn(() => {
(d == null ? void 0 : d.current) && b.reference.current !== d.current && g(d.current)
}, [g, d, b]);
const z = E.exports.useMemo(() => ({
"aria-labelledby": S,
"aria-describedby": T
}), [S, T]);
let H;
n === "modal" ? H = cL : n === "tray" ? H = Ox : H = Hc;
const ee = E.exports.useMemo(() => ({
dialogProps: z,
type: n,
labelId: S,
descriptionId: T,
isDismissable: s,
close: I,
formId: P
}), [I, T, z, P, S, n, s]);
return se(E.exports.Fragment, {
children: [l && E.exports.cloneElement(l, {
onClick: $n(te => {
te.stopPropagation(), h(!c)
}),
ref: d ? null : g,
...l.props
}), mn && Jo.exports.createPortal(_(Or, {
initial: !r,
children: c && _(iu.Provider, {
value: ee,
children: _(H, {
ref: v,
triggerRef: b.reference,
style: w,
restoreFocus: o,
autoFocus: a,
isOpen: c,
onClose: I,
isDismissable: s,
children: u
})
})
}), mn)]
})
}
function uL(t) {
const e = ue.Children.toArray(t);
return e && e.length === 2 ? {
dialogTrigger: e[0],
dialog: e[1]
} : {
dialog: e[0]
}
}
function yi(t) {
const {
label: e,
className: n,
value: r,
onChange: i,
size: s
} = t, d = ae(f => {
var p, m;
return (m = (p = f.config.ui) == null ? void 0 : p.colorPresets) == null ? void 0 : m.items
}) || [], a = mi({
size: s
}), [o, c] = E.exports.useState(r), [h, l] = E.exports.useState(!1), u = f => {
c(f), i == null || i(f)
};
return se("div", {
className: he(n, "w-max"),
children: [e && _("span", {
className: a.label,
children: e
}), se(su, {
type: "popover",
isOpen: h,
onOpenChange: l,
children: [se(Vn, {
className: he(a.input, "inline-flex items-center"),
"aria-label": t["aria-label"],
children: [_("span", {
className: "block flex-shrink-0 mr-5 border rounded h-2/4 aspect-square",
style: {
backgroundColor: o
}
}), _(fL, {
isActive: h,
className: a.adornment
})]
}), _(ou, {
size: "auto",
children: _(oL, {
onChange: u,
defaultValue: o,
colorPresets: d
})
})]
})]
})
}
function fL({
isActive: t,
className: e
}) {
return _(lg, {
size: "sm",
className: `transition-transform ml-auto flex-shrink-0 ${t?"rotate-180":"rotate-0"} ${e}`
})
}
function hL(t) {
const {
size: e = "md",
inline: n,
label: r,
showValueLabel: i = !!r,
className: s,
slider: d,
children: a
} = t, {
domProps: o,
trackRef: c,
getThumbPercent: h,
getThumbValueLabel: l,
labelId: u,
groupId: f,
thumbIds: p,
isDisabled: m,
numberFormatter: g,
minValue: v,
maxValue: y,
step: b,
values: w,
getValueLabel: x
} = d;
let S = "",
T = Math.max([...g.format(v)].length, [...g.format(y)].length, [...g.format(b)].length);
x ? S = x(w[0]) : w.length === 1 ? S = l(0) : w.length === 2 && (S = `${l(0)} \u2013 ${l(1)}`, T = 3 + 2 * Math.max(T, [...g.format(v)].length, [...g.format(y)].length));
const P = mi({
size: e,
disabled: m,
labelDisplay: "flex"
}),
I = he("w-full flex-shrink-0 touch-none", s, {
"flex items-center": n
});
return se("div", {
className: I,
role: "group",
id: f,
children: [se("div", {
className: he(P.label, "select-none"),
children: [r && _("label", {
onClick: () => {
var z;
(z = document.getElementById(p[0])) == null || z.focus()
},
id: u,
htmlFor: f,
children: r
}), i && _("output", {
htmlFor: p[0],
className: "ml-auto text-right",
"aria-live": "off",
style: T ? {
width: `${T}ch`,
minWidth: `${T}ch`
} : void 0,
children: S
})]
}), se("div", {
ref: c,
className: "h-30 relative",
...o,
role: "presentation",
children: [_("div", {
className: `absolute inset-0 m-auto h-4 rounded ${m?"bg-disabled":"bg-primary-light"}`
}), _("div", {
className: `absolute inset-0 my-auto h-4 rounded ${m?"bg-disabled-fg":"bg-primary"}`,
style: {
width: `${h(0)*100}%`
}
}), a]
})]
})
}
function dL(t = {}) {
const {
localeCode: e
} = Uc();
return E.exports.useMemo(() => new Vc(e, t), [e, t])
}
function Q2({
minValue: t = 0,
maxValue: e = 100,
isDisabled: n = !1,
step: r = 1,
formatOptions: i,
onChangeEnd: s,
label: d,
getValueLabel: a,
...o
}) {
var X;
const c = dL(i),
{
addGlobalListener: h,
removeGlobalListener: l
} = wp(),
u = E.exports.useRef(null),
[f, p] = fi(o.value ? o.value : void 0, (X = o.defaultValue) != null ? X : [t], o.onChange),
m = E.exports.useRef(null);
m.current = f;
const [g, v] = E.exports.useState(new Array(f.length).fill(!1)), y = E.exports.useRef(null);
y.current = g;
function b(B) {
return c.format(B)
}
const w = B => {
var re;
return ((re = y.current) == null ? void 0 : re[B]) || !1
},
x = B => b(f[B]),
S = B => B === 0 ? t : f[B - 1],
T = B => B === f.length - 1 ? e : f[B + 1],
P = (B, re) => {
if (n || !V(B) || !m.current) return;
const U = S(B),
j = T(B);
re = $M(re, U, j, r), m.current = J2(m.current, B, re), p(m.current)
},
I = (B, re) => {
var j;
if (n || !V(B)) return;
const U = (j = y.current) == null ? void 0 : j[B];
y.current = J2(y.current || [], B, re), v(y.current), s && U && !y.current.some(Boolean) && s(m.current || [])
},
[z, H] = E.exports.useState(void 0),
ee = B => (B - t) / (e - t),
te = B => ee(m.current[B]),
ne = (B, re) => {
P(B, ie(re))
},
Z = B => Math.round((B - t) / r) * r + t,
ie = B => {
const re = B * (e - t) + t;
return tu(Z(re), t, e)
},
ce = E.exports.useRef(new Array(f.length).fill(!0)),
V = B => ce.current[B],
C = (B, re) => {
ce.current[B] = re
},
k = E.exports.useRef(null),
M = E.exports.useRef(void 0),
D = B => {
if (!(B.pointerType === "mouse" && (B.button !== 0 || B.altKey || B.ctrlKey || B.metaKey)) && u.current && !n && f.every((re, U) => !g[U])) {
const re = u.current.offsetWidth,
U = u.current.getBoundingClientRect().left,
K = (B.clientX - U) / re,
q = ie(K);
let Y;
const J = f.findIndex(le => q - le < 0);
if (J === 0) Y = J;
else if (J === -1) Y = f.length - 1;
else {
const le = f[J - 1],
xe = f[J];
Math.abs(le - q) < Math.abs(xe - q) ? Y = J - 1 : Y = J
}
Y >= 0 && V(Y) ? (B.preventDefault(), k.current = Y, H(Y), M.current = B.pointerId, I(k.current, !0), P(Y, q), h(window, "pointerup", O, !1)) : k.current = null
}
},
$ = E.exports.useRef(null),
{
domProps: R
} = Qc({
onPointerDown: D,
onMoveStart() {
$.current = null
},
onMove(B, re) {
var j;
const U = ((j = u.current) == null ? void 0 : j.offsetWidth) || 0;
if ($.current == null && ($.current = te(k.current || 0) * U), $.current += re, k.current != null && u.current) {
const K = tu($.current / U, 0, 1);
ne(k.current, K)
}
},
onMoveEnd() {
k.current != null && (I(k.current, !1), k.current = null)
}
}),
O = B => {
B.pointerId === M.current && (k.current != null && (I(k.current, !1), k.current = null), l(window, "pointerup", O, !1))
},
F = E.exports.useId(),
N = d ? `${F}-label` : void 0,
G = `${F}-group`,
W = [...Array(f.length)].map((B, re) => `${F}-thumb-${re}`);
return {
domProps: R,
trackRef: u,
isDisabled: n,
step: r,
values: f,
minValue: t,
maxValue: e,
focusedThumb: z,
labelId: N,
groupId: G,
thumbIds: W,
numberFormatter: c,
getThumbPercent: te,
getThumbMinValue: S,
getThumbMaxValue: T,
getThumbValueLabel: x,
isThumbDragging: w,
setThumbValue: P,
updateDraggedThumbs: I,
setThumbEditable: C,
setFocusedThumb: H,
getValueLabel: a
}
}
function J2(t, e, n) {
return t[e] === n ? t : [...t.slice(0, e), n, ...t.slice(e + 1)]
}
function pL({
index: t,
slider: e,
isDisabled: n,
ariaLabel: r,
inputRef: i,
onBlur: s
}) {
const d = di(i),
{
addGlobalListener: a,
removeGlobalListener: o
} = wp(),
{
step: c,
values: h,
focusedThumb: l,
labelId: u,
thumbIds: f,
isDisabled: p,
getThumbPercent: m,
getThumbMinValue: g,
getThumbMaxValue: v,
getThumbValueLabel: y,
setThumbValue: b,
updateDraggedThumbs: w,
isThumbDragging: x,
setThumbEditable: S,
setFocusedThumb: T
} = e,
P = h[t];
S(t, !n);
const I = n || p,
z = E.exports.useCallback(() => {
d.current && d.current.focus({
preventScroll: !0
})
}, [d]),
H = l === t;
E.exports.useEffect(() => {
H && z()
}, [H, z]);
const ee = E.exports.useRef(void 0),
te = Z => {
Z.pointerId === ee.current && (z(), w(t, !1), o(window, "pointerup", te, !1))
},
ne = he("outline-none rounded-full w-18 h-18 top-1/2 -translate-y-1/2 -translate-x-1/2 absolute inset-0 transition-button duration-200", !I && "focus-within:ring focus-within:ring-primary-light shadow-md", gL({
isDisabled: I,
isDragging: x(t)
}));
return _("div", {
role: "presentation",
className: ne,
style: {
left: `${Math.max(m(t)*100,0)}%`
},
onPointerDown: Z => {
Z.button !== 0 || Z.altKey || Z.ctrlKey || Z.metaKey || (z(), ee.current = Z.pointerId, w(t, !0), a(window, "pointerup", te, !1))
},
children: _("input", {
id: f[t],
onKeyDown: $n(() => {
w(t, !0)
}),
onKeyUp: $n(() => {
w(t, !1)
}),
ref: d,
tabIndex: I ? void 0 : 0,
min: g(t),
max: v(t),
step: c,
value: P,
disabled: I,
"aria-label": r,
"aria-labelledby": u,
"aria-orientation": "horizontal",
"aria-valuetext": y(t),
onFocus: () => {
T(t)
},
onBlur: Z => {
T(void 0), w(t, !1), s == null || s(Z)
},
onChange: Z => {
b(t, parseFloat(Z.target.value))
},
type: "range",
className: "sr-only"
})
})
}
function gL({
isDisabled: t,
isDragging: e
}) {
return t ? "bg-slider-disabled cursor-default" : he("hover:bg-primary-dark", e ? "bg-primary-dark" : "bg-primary")
}
var mL = t => t.type === "checkbox",
vL = t => t instanceof Date,
e_ = t => t == null;
const yL = t => typeof t == "object";
var au = t => !e_(t) && !Array.isArray(t) && yL(t) && !vL(t),
bL = t => au(t) && t.target ? mL(t.target) ? t.target.checked : t.target.value : t,
wL = t => t.substring(0, t.search(/\.\d+(\.|$)/)) || t,
xL = (t, e) => t.has(wL(e)),
_L = t => Array.isArray(t) ? t.filter(Boolean) : [],
ma = t => t === void 0,
dn = (t, e, n) => {
if (!e || !au(t)) return n;
const r = _L(e.split(/[,[\].]+?/)).reduce((i, s) => e_(i) ? i : i[s], t);
return ma(r) || r === t ? ma(t[e]) ? n : t[e] : r
};
const t_ = {
BLUR: "blur",
FOCUS_OUT: "focusout",
CHANGE: "change"
},
cg = {
onBlur: "onBlur",
onChange: "onChange",
onSubmit: "onSubmit",
onTouched: "onTouched",
all: "all"
},
SL = ue.createContext(null),
ug = () => ue.useContext(SL);
var CL = (t, e, n, r = !0) => {
const i = {};
for (const s in t) Object.defineProperty(i, s, {
get: () => {
const d = s;
return e[d] !== cg.all && (e[d] = !r || cg.all), n && (n[d] = !0), t[d]
}
});
return i
},
TL = t => au(t) && !Object.keys(t).length,
kL = (t, e, n) => {
const {
name: r,
...i
} = t;
return TL(i) || Object.keys(i).length >= Object.keys(e).length || Object.keys(i).find(s => e[s] === (!n || cg.all))
},
EL = t => Array.isArray(t) ? t : [t],
n_ = (t, e, n) => n && e ? t === e : !t || !e || t === e || EL(t).some(r => r && (r.startsWith(e) || e.startsWith(r)));
function r_(t) {
const e = ue.useRef(t);
e.current = t, ue.useEffect(() => {
const n = i => {
i && i.unsubscribe()
},
r = !t.disabled && e.current.subject.subscribe({
next: e.current.callback
});
return () => n(r)
}, [t.disabled])
}
function OL(t) {
const e = ug(),
{
control: n = e.control,
disabled: r,
name: i,
exact: s
} = t || {},
[d, a] = ue.useState(n._formState),
o = ue.useRef({
isDirty: !1,
dirtyFields: !1,
touchedFields: !1,
isValidating: !1,
isValid: !1,
errors: !1
}),
c = ue.useRef(i),
h = ue.useRef(!0);
c.current = i;
const l = ue.useCallback(u => h.current && n_(c.current, u.name, s) && kL(u, o.current) && a({
...n._formState,
...u
}), [n, s]);
return r_({
disabled: r,
callback: l,
subject: n._subjects.state
}), ue.useEffect(() => (h.current = !0, () => {
h.current = !1
}), []), CL(d, n._proxyFormState, o.current, !1)
}
var PL = t => typeof t == "string",
ML = (t, e, n, r) => {
const i = Array.isArray(t);
return PL(t) ? (r && e.watch.add(t), dn(n, t)) : i ? t.map(s => (r && e.watch.add(s), dn(n, s))) : (r && (e.watchAll = !0), n)
},
AL = t => typeof t == "function",
DL = t => {
for (const e in t)
if (AL(t[e])) return !0;
return !1
};
function RL(t) {
const e = ug(),
{
control: n = e.control,
name: r,
defaultValue: i,
disabled: s,
exact: d
} = t || {},
a = ue.useRef(r);
a.current = r;
const o = ue.useCallback(l => {
if (n_(a.current, l.name, d)) {
const u = ML(a.current, n._names, l.values || n._formValues);
h(ma(a.current) || au(u) && !DL(u) ? {
...u
} : Array.isArray(u) ? [...u] : ma(u) ? i : u)
}
}, [n, d, i]);
r_({
disabled: s,
subject: n._subjects.watch,
callback: o
});
const [c, h] = ue.useState(ma(i) ? n._getWatch(r) : i);
return ue.useEffect(() => {
n._removeUnmounted()
}), c
}
function IL(t) {
const e = ug(),
{
name: n,
control: r = e.control,
shouldUnregister: i
} = t,
s = xL(r._names.array, n),
d = RL({
control: r,
name: n,
defaultValue: dn(r._formValues, n, dn(r._defaultValues, n, t.defaultValue)),
exact: !0
}),
a = OL({
control: r,
name: n
}),
o = ue.useRef(r.register(n, {
...t.rules,
value: d
}));
return ue.useEffect(() => {
const c = (h, l) => {
const u = dn(r._fields, h);
u && (u._f.mount = l)
};
return c(n, !0), () => {
const h = r._options.shouldUnregister || i;
(s ? h && !r._stateFlags.action : h) ? r.unregister(n): c(n, !1)
}
}, [n, r, s, i]), {
field: {
name: n,
value: d,
onChange: ue.useCallback(c => {
o.current.onChange({
target: {
value: bL(c),
name: n
},
type: t_.CHANGE
})
}, [n]),
onBlur: ue.useCallback(() => {
o.current.onBlur({
target: {
value: dn(r._formValues, n),
name: n
},
type: t_.BLUR
})
}, [n, r]),
ref: ue.useCallback(c => {
const h = dn(r._fields, n);
c && h && c.focus && (h._f.ref = {
focus: () => c.focus(),
select: () => c.select(),
setCustomValidity: l => c.setCustomValidity(l),
reportValidity: () => c.reportValidity()
})
}, [n, r._fields])
},
formState: a,
fieldState: Object.defineProperties({}, {
invalid: {
enumerable: !0,
get: () => !!dn(a.errors, n)
},
isDirty: {
enumerable: !0,
get: () => !!dn(a.dirtyFields, n)
},
isTouched: {
enumerable: !0,
get: () => !!dn(a.touchedFields, n)
},
error: {
enumerable: !0,
get: () => dn(a.errors, n)
}
})
}
}
function bi({
inputRef: t,
onBlur: e,
...n
}) {
const {
onChange: r,
onChangeEnd: i,
value: s,
defaultValue: d,
...a
} = n, o = {
...a,
value: s != null ? [s] : void 0,
defaultValue: d != null ? [d] : void 0,
onChange: h => {
r == null || r(h[0])
},
onChangeEnd: h => {
i == null || i(h[0])
}
}, c = Q2(o);
return _(hL, {
...o,
slider: c,
children: _(pL, {
index: 0,
slider: c,
inputRef: t,
onBlur: e
})
})
}
function fg({
children: t,
direction: e,
className: n
}) {
const r = e === "start" ? "left-0" : "right-0";
return t ? _("div", {
className: he("absolute h-full min-w-42 flex items-center justify-center top-0 text-muted z-10", r, n),
children: t
}) : null
}
const i_ = ue.forwardRef((t, e) => {
const {
children: n,
description: r,
errorMessage: i,
descriptionProps: s = {},
errorMessageProps: d = {},
startAdornment: a,
endAdornment: o,
startAppend: c,
endAppend: h,
fieldClassNames: l,
disabled: u,
wrapperProps: f
} = t;
return se("div", {
className: l.wrapper,
ref: e,
...f,
children: [_(LL, {
...t
}), se("div", {
className: l.inputWrapper,
children: [_(fg, {
direction: "start",
className: l.adornment,
children: a
}), c && _(o_, {
style: l.append,
disabled: u,
children: c
}), n, h && _(o_, {
style: l.append,
disabled: u,
children: h
}), _(fg, {
direction: "end",
className: l.adornment,
children: o
})]
}), r && !i && _("div", {
className: l.description,
...s,
children: r
}), i && _("div", {
className: l.error,
...d,
children: i
})]
})
});
function LL({
labelElementType: t,
fieldClassNames: e,
labelProps: n,
label: r,
labelSuffix: i,
required: s
}) {
if (!r) return null;
const a = se(t || "label", {
className: e.label,
...n,
children: [r, s && _("span", {
className: "text-danger",
children: " *"
})]
});
return i ? se("div", {
className: "flex items-center gap-14 w-full",
children: [a, _("div", {
className: "ml-auto mb-4 text-muted text-xs",
children: i
})]
}) : a
}
function o_({
children: t,
style: e,
disabled: n
}) {
return ue.cloneElement(t, {
...t.props,
disabled: t.props.disabled || n,
...e
})
}
function hg({
autoFocus: t,
autoSelectText: e
}, n) {
const r = E.exports.useRef(t);
E.exports.useEffect(() => {
var i;
r.current && n.current && ((i = n.current) == null || i.focus(), e && n.current.nodeName.toLowerCase() === "input" && requestAnimationFrame(() => {
n.current.select()
})), r.current = !1
}, [n, e])
}
function s_(t) {
const {
focusRef: e,
labelElementType: n = "label",
label: r,
labelSuffix: i,
autoFocus: s,
autoSelectText: d,
labelPosition: a,
size: o,
errorMessage: c,
description: h,
flexibleHeight: l,
startAdornment: u,
endAdornment: f,
startAppend: p,
endAppend: m,
className: g,
inputClassName: v,
inputWrapperClassName: y,
unstyled: b,
background: w,
invalid: x,
disabled: S,
id: T,
...P
} = t;
hg(t, e);
const I = E.exports.useId(),
z = T || I,
H = `${z}-label`,
ee = `${z}-description`,
te = `${z}-error`,
ne = {
id: H,
htmlFor: n === "label" ? z : void 0
},
Z = {
id: ee
},
ie = {
id: te
},
V = {
"aria-label": !t.label && !t["aria-label"] && t.placeholder ? t.placeholder : t["aria-label"],
"aria-invalid": x || void 0,
id: z,
disabled: S,
...P
},
C = [];
r && C.push(ne.id), V["aria-labelledby"] && C.push(V["aria-labelledby"]), V["aria-labelledby"] = C.length ? C.join(" ") : void 0;
const k = [];
return h && k.push(Z.id), c && k.push(ie.id), V["aria-describedby"] && k.push(V["aria-describedby"]), V["aria-describedby"] = k.length ? k.join(" ") : void 0, {
fieldProps: {
errorMessageProps: ie,
descriptionProps: Z,
labelProps: ne,
disabled: S,
label: r,
labelSuffix: i,
autoFocus: s,
autoSelectText: d,
labelPosition: a,
size: o,
errorMessage: c,
description: h,
flexibleHeight: l,
startAdornment: u,
endAdornment: f,
startAppend: p,
endAppend: m,
className: g,
inputClassName: v,
inputWrapperClassName: y,
unstyled: b,
background: w,
invalid: x
},
inputProps: V
}
}
const dg = ue.forwardRef((t, e) => {
const {
hideCaret: n,
placeholder: r = _(_e, {
message: "Select an option..."
}),
selectedValue: i,
onItemSelected: s,
onOpenChange: d,
onInputValueChange: a,
onSelectionChange: o,
selectionMode: c,
minWidth: h = "min-w-128",
children: l,
...u
} = t, f = Wc(), p = yx({
...t,
floatingWidth: f ? "auto" : "matchTrigger",
selectionMode: "single",
role: "listbox"
}, e), {
state: {
selectedValues: m,
isOpen: g,
setIsOpen: v,
activeIndex: y,
setSelectedIndex: b
},
focusItem: w,
listboxId: x,
reference: S,
refs: T,
listContent: P
} = p, {
fieldProps: I,
inputProps: z
} = s_({
...u,
focusRef: T.reference
}), H = p.collection.get(m[0]), ee = H ? se("span", {
className: "flex items-center gap-10",
children: [H.element.props.startIcon, H.element.props.children]
}) : _("span", {
className: "italic",
children: r
}), te = mi({
...t,
endAdornment: !0
}), {
handleTriggerKeyDown: ne,
handleListboxKeyboardNavigation: Z
} = Dx(p), {
findMatchingItem: ie
} = Rx();
return _(Ax, {
listbox: p,
onKeyDownCapture: C => {
if (!g) return;
const k = ie(C, P, y);
k != null && w("increment", k)
},
onKeyDown: Z,
children: _(i_, {
fieldClassNames: te,
...I,
children: se("button", {
...z,
type: "button",
"aria-expanded": g ? "true" : "false",
"aria-haspopup": "listbox",
"aria-controls": g ? x : void 0,
ref: S,
onKeyDown: ne,
onKeyDownCapture: C => {
if (g) return;
const k = ie(C, P, y);
k != null && b(k)
},
disabled: u.disabled,
onClick: () => {
v(!g)
},
className: he(te.input, !I.unstyled && h),
children: [ee, !n && _(fg, {
direction: "end",
children: _(lg, {
className: te.adornment
})
})]
})
})
})
});
function FL() {
const t = ae(d => d.filter.selected);
if (!t) return null;
const e = L().filter.getByName(t).options,
n = (d, a) => {
var o;
(o = L().filter) == null || o.applyValue(t, d, a), A().setDirty(!0)
},
r = L().canvas.getMainImage().filters,
i = L().filter.findFilterIndex(t, r),
s = r == null ? void 0 : r[i];
if (e) {
const d = Object.entries(e).map(([a, o]) => {
let c;
const h = s ? s[a] : o.current;
return o.type === "slider" ? c = _(bi, {
label: _(_e, {
...Tp[a]
}),
minValue: o.min,
maxValue: o.max,
step: o.step,
defaultValue: h,
formatOptions: {
style: "percent"
},
size: "sm",
onChange: l => {
n(a, l)
}
}) : o.type === "colorPicker" ? c = _(yi, {
label: _(_e, {
...Tp[a]
}),
size: "sm",
className: "w-full",
value: h,
onChange: l => {
n(a, l)
}
}) : o.type === "select" && (c = _(dg, {
selectionMode: "single",
size: "sm",
label: _(_e, {
...Tp[a]
}),
defaultValue: h,
onSelectionChange: l => {
n(a, l)
},
children: o.available.map(l => _(zc, {
value: l.key,
children: _("span", {
className: "capitalize",
children: l.key
})
}, l.key))
})), _("div", {
className: "pb-10",
children: c
}, a)
});
return _(ng, {
children: _("div", {
className: "max-w-240 pt-10 mx-auto",
children: d
})
})
}
return null
}
function zL() {
const t = ae(r => r.frame.active),
e = (t == null ? void 0 : t.mode) === "basic",
n = E.exports.useCallback(r => `${r}%`, []);
return _(ng, {
className: "pb-18 pt-6",
children: se("div", {
className: "max-w-288 m-auto",
children: [e && _(yi, {
className: "w-full mb-20",
size: "sm",
label: _(_e, {
message: "Color"
}),
value: L().frame.builder.defaultColor,
onChange: r => {
L().frame.active.changeColor(r)
}
}), _(bi, {
size: "sm",
label: _(_e, {
message: "Size"
}),
step: 1,
minValue: L().frame.active.getMinSize(),
maxValue: L().frame.active.getMaxSize(),
defaultValue: L().frame.active.currentSizeInPercent,
getValueLabel: n,
onChange: r => {
L().frame.resize(r)
}
})]
})
})
}
const va = ue.createContext(null);
function NL() {
const {
tabsRef: t,
selectedTab: e
} = E.exports.useContext(va), [n, r] = E.exports.useState({
width: void 0,
transform: void 0,
className: void 0
});
return Bn(() => {
if (e != null && t.current) {
const i = t.current[e];
r(s => ({
width: `${i.offsetWidth}px`,
transform: `translateX(${i.offsetLeft}px)`,
className: s.width === void 0 ? "" : "transition-all"
}))
}
}, [r, e, t]), _("div", {
className: he("absolute bottom-0 left-0 h-2 bg-primary", n.className),
role: "presentation",
style: {
width: n.width,
transform: n.transform
}
})
}
function jL({
children: t,
center: e
}) {
const n = E.exports.Children.toArray(t);
return _(jc, {
children: se("div", {
className: "flex relative max-w-full overflow-auto border-b",
role: "tablist",
"aria-orientation": "horizontal",
children: [n.map((r, i) => E.exports.isValidElement(r) ? E.exports.cloneElement(r, {
index: i,
className: he(r.props.className, e && i === 0 && "ml-auto", e && i === n.length - 1 && "mr-auto")
}) : null), _(NL, {})]
})
})
}
function BL(t) {
const {
size: e = "md",
children: n,
className: r,
isLazy: i
} = t, s = E.exports.useRef([]), d = E.exports.useId(), [a, o] = fi(t.selectedTab, t.defaultSelectedTab || 0, t.onTabChange), c = E.exports.useMemo(() => ({
selectedTab: a,
setSelectedTab: o,
tabsRef: s,
size: e,
isLazy: i,
id: d
}), [a, d, i, o, e]);
return _(va.Provider, {
value: c,
children: _("div", {
className: he(r, "max-w-full overflow-hidden"),
children: n
})
})
}
const $L = ye(_("path", {
d: "M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"
}), "FormatUnderlinedOutlined"),
VL = ye(_("path", {
d: "M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"
}), "FormatStrikethroughOutlined"),
HL = ye(_("path", {
d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z"
}), "FormatItalicOutlined"),
UL = ye(_("path", {
d: "M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"
}), "FormatAlignRightOutlined"),
WL = ye(_("path", {
d: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"
}), "FormatAlignLeftOutlined"),
YL = ye(_("path", {
d: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"
}), "FormatAlignCenterOutlined"),
wi = E.exports.forwardRef(({
inputElementType: t = "input",
flexibleHeight: e,
inputRef: n,
...r
}, i) => {
const s = di(n),
{
fieldProps: d,
inputProps: a
} = s_({
...r,
focusRef: s
}),
o = t === "textarea",
c = o ? "textarea" : "input",
h = mi({
...r,
flexibleHeight: e || t === "textarea"
});
return t === "textarea" && !r.unstyled && (h.input = `${h.input} py-12`), _(i_, {
ref: i,
fieldClassNames: h,
...d,
children: _(c, {
ref: s,
...a,
rows: o ? a.rows || 4 : void 0,
className: h.input
})
})
});
ue.forwardRef(({
name: t,
...e
}, n) => {
const {
field: {
onChange: r,
onBlur: i,
value: s = "",
ref: d
},
fieldState: {
invalid: a,
error: o
}
} = IL({
name: t
}), c = {
onChange: r,
onBlur: i,
value: s == null ? "" : s,
invalid: a,
errorMessage: o == null ? void 0 : o.message,
inputRef: d
};
return _(wi, {
ref: n,
...Co(c, e)
})
});
function XL() {
return se("div", {
className: "flex gap-20 justify-center",
children: [_(GL, {}), _(KL, {}), _(qL, {})]
})
}
function GL() {
var n;
const t = (n = ae(r => r.objects.active.editableProps.fontSize)) != null ? n : 40,
{
trans: e
} = vi();
return _(wi, {
type: "number",
size: "xs",
"aria-label": e({
message: "Font Size"
}),
min: 1,
max: 300,
className: "w-64 flex-shrink-0",
value: t,
onChange: r => {
L().objects.setValues({
fontSize: r.target.valueAsNumber
}), A().setDirty(!0)
}
})
}
function KL() {
const t = ae(s => s.objects.active.editableProps.fontStyle),
e = ae(s => s.objects.active.editableProps.underline),
n = ae(s => s.objects.active.editableProps.linethrough),
[r, i] = E.exports.useState([t, e && "underline", n && "linethrough"]);
return se(Yc, {
size: "xs",
variant: "outline",
radius: "rounded",
value: r,
multiple: !0,
onChange: s => {
i(s), L().objects.setValues({
underline: s.includes("underline"),
linethrough: s.includes("linethrough"),
fontStyle: s.includes("italic") ? "italic" : ""
}), A().setDirty(!0)
},
children: [_(Re, {
value: "underline",
children: _($L, {})
}), _(Re, {
value: "linethrough",
children: _(VL, {})
}), _(Re, {
value: "italic",
children: _(HL, {})
})]
})
}
function qL() {
const t = ae(e => e.objects.active.editableProps.textAlign);
return se(Yc, {
size: "xs",
variant: "outline",
radius: "rounded",
value: t,
onChange: e => {
L().objects.setValues({
textAlign: e
}), A().setDirty(!0)
},
children: [_(Re, {
value: "left",
children: _(WL, {})
}), _(Re, {
value: "center",
children: _(YL, {})
}), _(Re, {
value: "right",
children: _(UL, {})
})]
})
}
function ZL({
children: t,
className: e
}) {
const {
selectedTab: n,
isLazy: r
} = E.exports.useContext(va), i = E.exports.Children.toArray(t);
let s;
return r ? s = E.exports.cloneElement(i[n], {
index: n
}) : s = i.map((d, a) => {
if (E.exports.isValidElement(d)) {
const o = a === n;
return E.exports.cloneElement(d, {
index: a,
"aria-hidden": !o,
className: o ? d.props.className : he(d.props.className, "hidden")
})
}
return null
}), _("div", {
className: e,
children: s
})
}
function xi({
className: t,
children: e,
index: n,
...r
}) {
const {
id: i
} = E.exports.useContext(va), [s, d] = E.exports.useState(0), a = E.exports.useRef(null);
return Bn(() => {
if (a != null && a.current) {
const o = () => {
const h = Dr(a.current, {
tabbable: !0
});
d(h.nextNode() ? void 0 : 0)
};
o();
const c = new MutationObserver(o);
return c.observe(a.current, {
subtree: !0,
childList: !0,
attributes: !0,
attributeFilter: ["tabIndex", "disabled"]
}), () => {
c.disconnect()
}
}
}, [a]), _("div", {
tabIndex: s,
ref: a,
id: `${i}-${n}-tabpanel`,
"aria-labelledby": `${i}-${n}-tab`,
className: he(t, "focus-visible:outline-primary-light"),
role: "tabpanel",
...r,
children: e
})
}
const a_ = [{
type: "linear",
coords: {
x1: -80,
y1: 0,
x2: 80,
y2: 0
},
colorStops: [{
color: "#ffe47b",
offset: 0
}, {
color: "rgb(111,154,211)",
offset: 1
}]
}, {
type: "linear",
coords: {
x1: 0,
y1: -120,
x2: 0,
y2: 120
},
colorStops: [{
color: "#ff4040",
offset: 0
}, {
color: "#e6399b",
offset: 1
}]
}, {
type: "linear",
coords: {
x1: -90,
y1: -90,
x2: 90,
y2: 90
},
colorStops: [{
offset: 0,
color: "rgb(166,111,213)"
}, {
offset: .5,
color: "rgba(106, 72, 215, 0.5)"
}, {
offset: 1,
color: "#200772"
}]
}, {
type: "radial",
coords: {
r1: 100,
r2: 10,
x1: 0,
y1: 0,
x2: 0,
y2: 0
},
colorStops: [{
offset: 0,
color: "#FF4F4F"
}, {
offset: 1,
color: "rgb(255, 239, 64)"
}]
}, {
type: "radial",
coords: {
r1: 100,
r2: 10,
x1: 0,
y1: 0,
x2: 20,
y2: 20
},
colorStops: [{
offset: 0,
color: "#ffe47b"
}, {
offset: .5,
color: "rgb(111,154,211)"
}, {
offset: 1,
color: "rgb(166,111,213)"
}]
}, {
type: "radial",
coords: {
r1: 50,
r2: 80,
x1: 45,
y1: 45,
x2: 52,
y2: 50
},
colorStops: [{
offset: 0,
color: "rgb(155, 237, 0)"
}, {
offset: 1,
color: "rgba(0, 164, 128,0.4)"
}]
}, {
type: "linear",
coords: {
x1: -90,
y1: -90,
x2: 90,
y2: 90
},
colorStops: [{
offset: 0,
color: "#9ecb2d"
}, {
offset: .5,
color: "#72aa00"
}, {
offset: 1,
color: "#bfd255"
}]
}, {
type: "radial",
coords: {
r1: 100,
r2: 50,
x1: 30,
y1: 0,
x2: 0,
y2: 0
},
colorStops: [{
offset: 0,
color: "#aebcbf"
}, {
offset: 1,
color: "#0a0809"
}]
}, {
type: "linear",
coords: {
x1: -80,
y1: 0,
x2: 80,
y2: 0
},
colorStops: [{
offset: 0,
color: "#ffffff"
}, {
offset: 1,
color: "#f6f6f6"
}]
}, {
type: "linear",
coords: {
x1: 0,
y1: -120,
x2: 0,
y2: 120
},
colorStops: [{
offset: 0,
color: "#fefcea"
}, {
offset: 1,
color: "#f1da36"
}]
}, {
type: "linear",
coords: {
x1: -90,
y1: -90,
x2: 90,
y2: 90
},
colorStops: [{
offset: 0,
color: "rgb(166,111,213)"
}, {
offset: .5,
color: "rgba(106, 72, 215, 0.5)"
}, {
offset: 1,
color: "#ff1a00"
}]
}, {
type: "linear",
coords: {
x1: 0,
y1: -120,
x2: 0,
y2: 120
},
colorStops: [{
offset: 0,
color: "#b7deed"
}, {
offset: 1,
color: "#21b4e2"
}]
}, {
type: "linear",
coords: {
x1: -80,
y1: 100,
x2: 80,
y2: -100
},
colorStops: [{
offset: 0,
color: "#ffe47b"
}, {
offset: 1,
color: "rgb(111,154,211)"
}]
}],
QL = ye(_("path", {
d: "M19.51 3.08 3.08 19.51c.09.34.27.65.51.9.25.24.56.42.9.51L20.93 4.49c-.19-.69-.73-1.23-1.42-1.41zM11.88 3 3 11.88v2.83L14.71 3h-2.83zM5 3c-1.1 0-2 .9-2 2v2l4-4H5zm14 18c.55 0 1.05-.22 1.41-.59.37-.36.59-.86.59-1.41v-2l-4 4h2zm-9.71 0h2.83L21 12.12V9.29L9.29 21z"
}), "TextureOutlined"),
JL = ye(_("path", {
d: "M11 9h2v2h-2V9zm-2 2h2v2H9v-2zm4 0h2v2h-2v-2zm2-2h2v2h-2V9zM7 9h2v2H7V9zm12-6H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 18H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm2-7h-2v2h2v2h-2v-2h-2v2h-2v-2h-2v2H9v-2H7v2H5v-2h2v-2H5V5h14v6z"
}), "GradientOutlined"),
e8 = ye(_("path", {
d: "M18 20H4V6h9V4H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-9h-2v9zm-7.79-3.17-1.96-2.36L5.5 18h11l-3.54-4.71zM20 4V1h-2v3h-3c.01.01 0 2 0 2h3v2.99c.01.01 2 0 2 0V6h3V4h-3z"
}), "AddPhotoAlternateOutlined");
function l_({
property: t
}) {
const {
trans: e
} = vi(), n = ae(r => r.objects.active.editableProps[t]);
return se("div", {
className: "flex items-center justify-center gap-14",
children: [_(yi, {
className: "flex-shrink-0",
size: "xs",
"aria-label": e({
message: "Color"
}),
value: typeof n == "string" ? n : Qu.fill,
onChange: r => {
L().objects.setValues({
[t]: r
}), A().setDirty(!0)
}
}), _(c_, {
type: "gradient",
property: t
}), _(c_, {
type: "texture",
property: t
})]
})
}
function c_({
type: t,
property: e
}) {
const n = t === "texture" ? _(QL, {}) : _(JL, {});
return _(E.exports.Fragment, {
children: se(su, {
type: "popover",
children: [_(bt, {
className: "flex-shrink-0",
id: `${t}-panel-trigger`,
variant: "outline",
size: "xs",
startIcon: n,
endIcon: _(lg, {}),
children: _("span", {
className: "capitalize",
children: t === "gradient" ? _(_e, {
message: "Gradient"
}) : _(_e, {
message: "Texture"
})
})
}), _(ou, {
size: "auto",
children: _("div", {
className: "grid gap-8 grid-cols-5-min-content p-10 bg-paper rounded shadow-md",
children: _(t8, {
property: e,
type: t
})
})
})]
})
})
}
function t8({
type: t,
property: e
}) {
const {
close: n
} = Z2(), r = Array.from(Array(t === "gradient" ? a_.length : 28).keys()), i = "w-56 h-56 bg border shadow-sm hover:scale-110", s = r.map(d => {
const a = Wt(`images/${t}s/${d}.png`);
return _(Vn, {
radius: "rounded",
className: i,
style: {
backgroundImage: `url(${a})`
},
"aria-label": `Select ${t} #${d}`,
onClick: async () => {
n();
const o = t === "gradient" ? new be.fabric.Gradient(a_[d]) : await u_(a);
L().objects.setValues({
[e]: o
}), A().setDirty(!0)
}
}, d)
});
return t === "texture" && s.unshift(_(n8, {
property: e,
className: i
}, "upload-btn")), _(E.exports.Fragment, {
children: s
})
}
function n8({
className: t,
property: e
}) {
const {
close: n
} = Z2();
return _(Vn, {
radius: "rounded",
className: t,
"aria-label": "Upload an image",
onClick: async () => {
const r = await L().import.openUploadWindow();
if (n(), r) {
const i = await u_(await r.data);
L().objects.setValues({
[e]: i
})
}
},
children: _(e8, {
className: "icon-md"
})
})
}
function u_(t) {
return new Promise(e => {
be.fabric.util.loadImage(t, n => {
const r = new be.fabric.Pattern({
source: n,
repeat: "repeat"
});
e(r)
})
})
}
function r8() {
const t = ae(e => e.objects.active.editableProps.opacity);
return _(bi, {
className: "max-w-240 w-full mx-auto",
"aria-label": "Opacity",
value: t,
minValue: .1,
step: .1,
maxValue: 1,
onChange: e => {
L().objects.setValues({
opacity: e
}), A().setDirty(!0)
}
})
}
function i8() {
const {
trans: t
} = vi(), e = ae(r => r.objects.active.editableProps.stroke), n = ae(r => r.objects.active.editableProps.strokeWidth);
return se("div", {
className: "flex items-center gap-40",
children: [_(yi, {
className: "ml-auto flex-shrink-0",
size: "xs",
value: e,
"aria-label": t({
message: "Outline Color"
}),
onChange: r => {
L().objects.setValues({
stroke: r
}), A().setDirty(!0)
}
}), _(bi, {
"aria-label": "Outline Width",
className: "max-w-240 mr-auto flex-shrink-0",
value: n,
onChange: r => {
L().objects.setValues({
strokeWidth: r
}), A().setDirty(!0)
}
})]
})
}
const o8 = ye(_("path", {
d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86-3 3.87L9 13.14 6 17h12l-3.86-5.14z"
}), "ImageOutlined");
function s8() {
return _("div", {
children: _(bt, {
type: "button",
variant: "outline",
size: "xs",
startIcon: _(o8, {}),
radius: "rounded-full",
onClick: async () => {
const t = await L().import.openUploadWindow();
if (t) {
const e = L().objects.getActive();
if (e && "setSrc" in e) {
const n = await t.data;
e.setSrc(n, () => {
Fw({
src: n
}), L().canvas.render()
})
}
}
},
children: _(_e, {
message: "Replace Image"
})
})
})
}
const f_ = {
color: "rgba(0, 0, 0, 0.6)",
blur: 3,
offsetX: -1,
offsetY: 0
};
function a8() {
const {
trans: t
} = vi(), e = ae(n => n.objects.active.editableProps.shadow) || f_;
return se("div", {
className: "flex items-center gap-40",
children: [_(yi, {
className: "ml-auto flex-shrink-0",
value: e.color,
size: "xs",
"aria-label": t({
message: "Shadow Color"
}),
onChange: n => {
L().objects.setValues({
shadow: h_({
color: n
})
}), A().setDirty(!0)
}
}), _(bi, {
"aria-label": "Shadow Blur",
className: "max-w-240 mr-auto flex-shrink-0",
defaultValue: e.blur,
onChange: n => {
L().objects.setValues({
shadow: h_({
blur: n
})
}), A().setDirty(!0)
}
})]
})
}
function h_(t) {
var n;
const e = (n = L().objects.getActive()) == null ? void 0 : n.shadow;
return e ? (Object.entries(t).forEach(([r, i]) => {
e[r] = i
}), e) : new be.fabric.Shadow({
...f_,
...t
})
}
function _i({
index: t,
className: e,
isDisabled: n,
children: r
}) {
const {
selectedTab: i,
setSelectedTab: s,
tabsRef: d,
size: a,
id: o
} = E.exports.useContext(va), c = t === i, h = gR(), l = he("tracking-wide overflow-hidden capitalize text-sm flex-shrink-0 flex items-center justify-center outline-none transition-colors", "focus-visible:ring focus-visible:ring-2 ring-inset rounded", l8({
isDisabled: n,
isSelected: c
}), e, {
"px-18 h-48": !a || a === "md",
"px-12 h-32": a === "sm",
"cursor-pointer": !n
}), u = p => {
switch (p.key) {
case "ArrowLeft":
h.focusPrevious();
break;
case "ArrowRight":
h.focusNext();
break;
case "Home":
h.focusFirst();
break;
case "End":
h.focusLast();
break
}
}, f = c ? 0 : -1;
return _("button", {
disabled: n,
id: `${o}-${t}-tab`,
"aria-controls": `${o}-${t}-tabpanel`,
type: "button",
role: "tab",
"aria-selected": c,
tabIndex: n ? void 0 : f,
onKeyDown: u,
onClick: () => {
s(t)
},
className: l,
ref: p => {
d.current && p && (d.current[t] = p)
},
children: r
})
}
function l8({
isDisabled: t,
isSelected: e
}) {
return t ? "text-disabled cursor-default" : e ? "text-primary" : "text-muted hover:text-main"
}
function d_() {
const t = ae(e => e.objects.active);
return se(BL, {
size: "sm",
className: "pb-18 pt-6",
children: [se(jL, {
center: !0,
children: [t.isText && _(_i, {
children: _(_e, {
message: "Font"
})
}), !t.isImage && _(_i, {
children: _(_e, {
message: "Color"
})
}), !t.isImage && _(_i, {
children: _(_e, {
message: "Background"
})
}), t.isImage && _(_i, {
children: _(_e, {
message: "Image"
})
}), _(_i, {
children: _(_e, {
message: "Opacity"
})
}), _(_i, {
children: _(_e, {
message: "Outline"
})
}), _(_i, {
children: _(_e, {
message: "Shadow"
})
})]
}), se(ZL, {
className: "pt-16 h-50",
children: [t.isText && _(xi, {
children: _(XL, {})
}, "font"), !t.isImage && _(xi, {
children: _(l_, {
property: "fill"
})
}), !t.isImage && _(xi, {
children: _(l_, {
property: "backgroundColor"
})
}), t.isImage && _(xi, {
children: _(s8, {})
}), _(xi, {
children: _(r8, {})
}), _(xi, {
children: _(i8, {})
}), _(xi, {
children: _(a8, {})
})]
})]
})
}
function c8() {
const e = !Wc() && _(bt, {
size: "sm",
color: "primary",
variant: "outline",
onClick: () => {
L().text.add(), A().setDirty(!0)
},
children: _(_e, {
message: "New Text"
})
});
return _(ng, {
actionBtn: e,
children: _(d_, {})
})
}
function u8() {
const t = ae(r => r.activeToolOverlay),
e = ae(r => r.objects.active.id),
n = f8(t, e);
return _("div", {
className: "relative z-tool-overlay text-sm",
children: _(Or, {
children: n && _(Et.div, {
initial: {
y: 0,
opacity: 0
},
animate: {
y: "-100%",
opacity: 1
},
exit: {
y: 0,
opacity: 0
},
transition: {
type: "tween",
duration: .15
},
className: "absolute inset-x-0 gap-16 px-5vw bg bg-opacity-95 border-t",
children: n
}, "tool-controls-overlay")
})
})
}
function f8(t, e) {
switch (t) {
case rn.Filter:
return _(FL, {});
case rn.Frame:
return _(zL, {});
case rn.Text:
return e && _(c8, {});
case rn.ActiveObject:
return e && _(d_, {});
default:
return null
}
}
const pg = ye(_("path", {
d: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"
}), "CancelOutlined");
function h8({
filter: t
}) {
const e = ae(d => d.filter.applied.includes(t)),
n = L().filter.hasOptions(t),
r = he("block flex-shrink-0 rounded", {
"text-primary border-primary": e
}),
i = dA[t],
s = se(Uo, {
children: [se("div", {
className: "relative",
children: [_(d8, {
filter: t
}), e && _(p8, {
filter: t,
hasOptions: n
})]
}), _("div", {
className: "mt-4 text-center text-xs capitalize",
children: i ? _(_e, {
...i
}) : t
})]
});
return e && n ? _("div", {
className: r,
children: s
}) : _(Vn, {
className: r,
onClick: () => {
e ? L().filter.remove(t) : L().filter.apply(t)
},
children: s
})
}
function d8({
filter: t
}) {
const e = ae(r => r.filter.selected === t),
n = he("m-auto w-96 h-56 border rounded object-cover", {
shadow: e
});
return _("img", {
src: Wt(`images/filter/${t}.jpg`),
className: n,
alt: ""
})
}
function p8({
filter: t,
hasOptions: e
}) {
return se("div", {
className: "flex items-center justify-center bg-background/70 absolute inset-0 border-2 border-primary rounded",
children: [e ? _(Re, {
color: "primary",
size: "md",
onClick: () => {
L().filter.remove(t)
},
children: _(pg, {})
}) : _(pg, {
className: "svg-icon icon-md"
}), e && _(g8, {
filter: t,
hasOptions: e
})]
})
}
function g8({
filter: t,
hasOptions: e
}) {
return _(Re, {
color: "primary",
size: "md",
onClick: () => {
A().activeToolOverlay === rn.Filter && A().filter.selected === t ? A().setActiveTool(A().activeTool, null) : A().filter.select(t, e)
},
children: _(Vm, {})
})
}
const Si = E.exports.forwardRef(({
children: t,
className: e,
gap: n
}, r) => {
const i = ue.Children.map(t, (s, d) => ue.isValidElement(s) ? ue.cloneElement(s, {
isFirst: d === 0,
isLast: ue.Children.count(t) === d + 1
}) : s);
return _("div", {
ref: r,
className: `tiny-scrollbar pb-4 overflow-x-auto relative flex items-center ${n||"gap-10"} ${e}`,
children: i
})
});
function Kn({
isFirst: t,
isLast: e,
children: n,
className: r
}) {
const i = he(r, "flex-shrink-0", {
"ml-auto": t,
"mr-auto": e
});
return _("div", {
className: i,
children: n
})
}
function m8() {
const t = ae(n => {
var r, i;
return (i = (r = n.config.tools) == null ? void 0 : r.filter) == null ? void 0 : i.items
}) || [];
E.exports.useEffect(() => {
L().filter.syncState()
}, []);
const e = t.map(n => _(Kn, {
children: _(h8, {
filter: n
})
}, n));
return _(Si, {
children: e
})
}
const v8 = ye(_("path", {
d: "M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"
}), "LockOutlined"),
y8 = ye(_("path", {
d: "M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h2c0-1.66 1.34-3 3-3s3 1.34 3 3v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm0 12H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"
}), "LockOpenOutlined"),
b8 = ye(_("path", {
d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
}), "CheckBoxOutlineBlankOutlined"),
w8 = ye(_("path", {
d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
}), "CheckBox"),
p_ = ye(_("path", {
d: "M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M17,13H7v-2h10V13z"
}), "CheckBox"),
x8 = E.exports.forwardRef((t, e) => {
const {
size: n = "md",
children: r,
className: i,
icon: s,
checkedIcon: d,
disabled: a,
isIndeterminate: o,
errorMessage: c,
invalid: h,
orientation: l = "horizontal",
onChange: u,
autoFocus: f,
required: p,
value: m
} = t, g = mi({
...t,
label: r
}), v = s || b8, y = d || (o ? p_ : w8), b = di(e);
hg({
autoFocus: f
}, b), E.exports.useEffect(() => {
b.current && (b.current.indeterminate = o || !1)
});
const [w, x] = fi(t.checked, t.defaultChecked || !1), S = E.exports.useCallback(z => {
u == null || u(z), x(z.target.checked)
}, [u, x]), T = he("select-none", i, h && "text-danger", !h && a && "text-disabled");
let P, I = h ? "text-danger" : null;
return o ? (P = p_, I = I || "text-primary") : w ? (P = y, I = I || "text-primary") : (P = v, I = I || "text-muted"), se("div", {
children: [_("label", {
className: T,
children: se("div", {
className: he("relative flex items-center", l === "vertical" && "flex-col flex-col-reverse"),
children: [_("input", {
className: "focus-visible:ring ring-inset transition-shadow outline-none absolute left-0 top-0 w-24 h-24 rounded appearance-none",
type: "checkbox",
"aria-checked": o ? "mixed" : w,
"aria-invalid": h || void 0,
onChange: S,
ref: b,
required: p,
disabled: a,
value: m
}), _(P, {
size: n,
className: he("pointer-events-none", a ? "text-disabled" : I)
}), r && _("div", {
className: he("first-letter:capitalize", g.size.font, l === "vertical" ? "mb-6" : "ml-6"),
children: r
})]
})
}), c && _("div", {
className: g.error,
children: c
})]
})
});
function _8() {
const {
trans: t
} = vi(), {
minWidth: e = 50,
minHeight: n = 50,
maxHeight: r = 2400,
maxWidth: i = 2400
} = ae(l => {
var u;
return (u = l.config.tools) == null ? void 0 : u.resize
}) || {}, s = ae(l => l.original), d = ae(l => l.resize.formValue);
E.exports.useEffect(() => {
A().resize.setFormValue({
...s
})
}, [s]), E.exports.useEffect(() => {
A().setDirty(!0)
}, []);
const a = l => {
const u = {
...d,
width: l
};
d.maintainAspect && (u.height = Oc(l, d.usePercentages)), A().resize.setFormValue(u)
},
o = l => {
const u = {
...d,
height: l
};
l && d.maintainAspect && (u.width = kp(l, d.usePercentages)), A().resize.setFormValue(u)
},
c = l => {
const u = {
...d,
maintainAspect: l
};
l && (u.height = Oc(u.width, u.usePercentages)), A().resize.setFormValue(u)
};
return se("form", {
className: "flex items-center justify-center gap-16 w-full",
onSubmit: l => {
l.preventDefault(), A().applyChanges()
},
children: [_(wi, {
type: "number",
min: e,
max: i,
size: "sm",
className: "w-full max-w-112",
label: "Width",
value: d.width,
onChange: l => {
a(l.target.valueAsNumber)
}
}), _("div", {
className: "mt-24",
children: _(x8, {
size: "md",
checked: d.maintainAspect,
onChange: l => {
c(!d.maintainAspect)
},
"aria-label": t({
message: "Maintain aspect ratio"
}),
checkedIcon: v8,
icon: y8
})
}), _(wi, {
type: "number",
min: n,
max: r,
size: "sm",
className: "w-full max-w-112",
label: "Height",
value: d.height,
onChange: l => {
o(l.target.valueAsNumber)
}
}), _("button", {
type: "submit",
className: "hidden",
children: _(_e, {
message: "Resize"
})
})]
})
}
function S8() {
var i;
const t = ae(s => {
var d, a;
return (a = (d = s.config.tools) == null ? void 0 : d.crop) == null ? void 0 : a.presets
}) || [],
e = ae(s => s.crop.selectedAspectRatio),
n = (i = ae(s => {
var d, a;
return (a = (d = s.config.tools) == null ? void 0 : d.crop) == null ? void 0 : a.allowCustomRatio
})) != null ? i : !0,
r = t.filter(s => s.ratio || !s.ratio && n).map(s => _(Kn, {
children: se(Vn, {
onClick: () => L().crop.resetCropzone(s.ratio),
className: "flex flex-col items-center justify-between cursor-pointer h-56",
children: [_(C8, {
preset: s,
selectedRatio: e
}), _(T8, {
preset: s,
selectedRatio: e
})]
})
}, s.ratio || s.name));
return _(Si, {
gap: "gap-18",
children: r
})
}
function C8({
preset: t,
selectedRatio: e
}) {
let n = 40,
r = 30;
if (t.ratio) {
const s = Op(t.ratio);
({
width: n,
height: r
} = Ep(s, n, r))
}
const i = he("border-2", {
"border-dotted": t.ratio === null,
"border-primary": e === t.ratio
});
return _("div", {
style: {
width: `${n}px`,
height: `${r}px`
},
className: i
})
}
function T8({
preset: t,
selectedRatio: e
}) {
const n = he("mt-4 text-center text-xs", {
"text-primary": e === t.ratio
});
return _("div", {
className: n,
children: t.name || t.ratio
})
}
const g_ = ye(_("path", {
d: "M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"
}), "FlipOutlined");
function k8() {
return se("div", {
children: [_(Re, {
size: "sm",
onClick: () => {
L().transform.flip("vertical"), A().setDirty(!0)
},
children: _(g_, {})
}), _(Re, {
size: "sm",
onClick: () => {
L().transform.flip("horizontal"), A().setDirty(!0)
},
children: _(g_, {
className: "rotate-90"
})
})]
})
}
const E8 = ye(_("path", {
d: "M7.11 8.53 5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47zM6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47zm1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93z"
}), "RotateLeftOutlined"),
O8 = ye(_("path", {
d: "M15.55 5.55 11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42 1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z"
}), "RotateRightOutlined");
function P8() {
return se("div", {
children: [_(Re, {
size: "sm",
onClick: () => {
L().transform.rotateLeft(), A().setDirty(!0)
},
children: _(E8, {})
}), _(Re, {
size: "sm",
onClick: () => {
L().transform.rotateRight(), A().setDirty(!0)
},
children: _(O8, {})
})]
})
}
function M8() {
return se("div", {
className: "flex items-center justify-center gap-16",
children: [_(k8, {}), _(A8, {}), _(P8, {})]
})
}
function A8() {
const t = E.exports.useRef(null),
{
domProps: e,
groupId: n,
thumbIds: r,
trackRef: i,
getThumbValueLabel: s
} = Q2({
minValue: -45,
maxValue: 45,
step: 1,
defaultValue: [A().crop.straightenAngle],
onChange: d => {
const a = d[0];
L().transform.straighten(a), A().crop.setTransformAngle(a), A().setDirty(!0), t.current.style.transform = `translateX(${a}px)`
}
});
return _("div", {
id: n,
role: "group",
className: "flex-auto flex-shrink-0 max-w-320 touch-none isolate",
children: se("div", {
...e,
ref: i,
className: "h-36 relative",
children: [se("output", {
htmlFor: r[0],
"aria-live": "off",
className: "absolute left-1/2 top-1/2 w-40 text-center bg -translate-x-1/2 -translate-y-1/2 z-10",
children: [s(0), "\xB0"]
}), _(D8, {
ref: t
})]
})
})
}
const D8 = ue.forwardRef((t, e) => {
const n = [...Array(80).keys()],
r = n.map(i => _("circle", {
cx: 2 + i * 10,
cy: "20",
r: i % 5 ? .75 : 2
}, i));
return _("div", {
className: "relative h-full cursor-pointer overflow-hidden",
children: _("svg", {
ref: e,
style: {
width: n.length * 10
},
className: "absolute -left-80 h-full fill-current",
xmlns: "http://www.w3.org/2000/svg",
"aria-hidden": "true",
focusable: "false",
children: r
})
})
});
function R8() {
return E.exports.useEffect(() => (A().setDirty(!0), L().frame.active.hide(), () => {
L().frame.active.show()
}), []), se("div", {
className: "pb-16",
children: [_("div", {
className: "mb-10",
children: _(M8, {})
}), _(S8, {})]
})
}
const I8 = ye(_("path", {
d: "M 16 6 C 12.484375 6 9.273438 7.070313 6.90625 8.84375 C 4.539063 10.617188 3 13.15625 3 16 C 3 18.84375 4.539063 21.382813 6.90625 23.15625 C 9.273438 24.929688 12.484375 26 16 26 C 19.515625 26 22.726563 24.929688 25.09375 23.15625 C 27.460938 21.382813 29 18.84375 29 16 C 29 13.15625 27.460938 10.617188 25.09375 8.84375 C 22.726563 7.070313 19.515625 6 16 6 Z M 16 8 C 19.109375 8 21.898438 8.957031 23.875 10.4375 C 25.851563 11.917969 27 13.875 27 16 C 27 18.125 25.851563 20.082031 23.875 21.5625 C 21.898438 23.042969 19.109375 24 16 24 C 12.890625 24 10.101563 23.042969 8.125 21.5625 C 6.148438 20.082031 5 18.125 5 16 C 5 13.875 6.148438 11.917969 8.125 10.4375 C 10.101563 8.957031 12.890625 8 16 8 Z "
})),
L8 = ye(_("path", {
d: "M 16 4 C 9.382813 4 4 9.382813 4 16 C 4 22.617188 9.382813 28 16 28 C 22.617188 28 28 22.617188 28 16 C 28 9.382813 22.617188 4 16 4 Z M 16 6 C 21.535156 6 26 10.464844 26 16 C 26 21.535156 21.535156 26 16 26 C 10.464844 26 6 21.535156 6 16 C 6 10.464844 10.464844 6 16 6 Z "
})),
F8 = ye(_("path", {
d: "M 3 6 L 3 26 L 29 26 L 29 6 Z M 5 8 L 27 8 L 27 24 L 5 24 Z "
})),
z8 = ye(_("path", {
d: "M 16 4.90625 L 15.125 6.40625 L 4.71875 24.5 L 3.875 26 L 28.125 26 L 27.28125 24.5 L 16.875 6.40625 Z M 16 8.9375 L 24.65625 24 L 7.34375 24 Z "
}));
function N8() {
const e = (ae(n => {
var r, i;
return (i = (r = n.config.tools) == null ? void 0 : r.shapes) == null ? void 0 : i.items
}) || []).map(n => _(Kn, {
children: _(Re, {
variant: "outline",
radius: "rounded-2xl",
size: "xl",
onClick: () => {
L().shape.addBasicShape(n.name), A().setDirty(!0)
},
children: _(j8, {
shape: n
})
})
}, n.name));
return _(Si, {
children: e
})
}
function j8({
shape: t
}) {
var e;
return t.type === "Path" ? _("svg", {
className: "m-auto w-36 h-36",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 -100 512 700",
children: _("path", {
className: "fill-transparent stroke-current",
d: (e = t.options) == null ? void 0 : e.path,
strokeWidth: 25
})
}) : ue.cloneElement(B8[t.name], {
className: "w-30 h-30"
})
}
const B8 = {
circle: _(L8, {
viewBox: "0 0 32 32"
}),
square: _(F8, {
viewBox: "0 0 32 32"
}),
triangle: _(z8, {
viewBox: "0 0 32 32"
}),
ellipse: _(I8, {
viewBox: "0 0 32 32"
})
};
/**
* react-virtual
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
/**
* virtual-core
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
function lu(t, e, n) {
let r = [],
i;
return () => {
let s;
n.key && n.debug != null && n.debug() && (s = Date.now());
const d = t();
if (!(d.length !== r.length || d.some((c, h) => r[h] !== c))) return i;
r = d;
let o;
if (n.key && n.debug != null && n.debug() && (o = Date.now()), i = e(...d), n == null || n.onChange == null || n.onChange(i), n.key && n.debug != null && n.debug()) {
const c = Math.round((Date.now() - s) * 100) / 100,
h = Math.round((Date.now() - o) * 100) / 100,
l = h / 16,
u = (f, p) => {
for (f = String(f); f.length < p;) f = " " + f;
return f
};
console.info("%c\u23F1 " + u(h, 5) + " /" + u(c, 5) + " ms", `
font-size: .6rem;
font-weight: bold;
color: hsl(` + Math.max(0, Math.min(120 - 120 * l, 120)) + "deg 100% 31%);", n == null ? void 0 : n.key)
}
return i
}
}
const $8 = t => t,
V8 = t => {
const e = Math.max(t.startIndex - t.overscan, 0),
n = Math.min(t.endIndex + t.overscan, t.count - 1),
r = [];
for (let i = e; i <= n; i++) r.push(i);
return r
},
H8 = (t, e) => {
const n = new ResizeObserver(r => {
var i, s;
e({
width: (i = r[0]) == null ? void 0 : i.contentRect.width,
height: (s = r[0]) == null ? void 0 : s.contentRect.height
})
});
if (!!t.scrollElement) return e(t.scrollElement.getBoundingClientRect()), n.observe(t.scrollElement), () => {
n.unobserve(t.scrollElement)
}
},
m_ = {
element: ["scrollLeft", "scrollTop"],
window: ["scrollX", "scrollY"]
},
U8 = (t => (e, n) => {
if (!e.scrollElement) return;
const r = m_[t][0],
i = m_[t][1];
let s = e.scrollElement[r],
d = e.scrollElement[i];
const a = () => {
n(e.scrollElement[e.options.horizontal ? r : i])
};
a();
const o = c => {
const h = c.currentTarget,
l = h[r],
u = h[i];
(e.options.horizontal ? s - l : d - u) && a(), s = l, d = u
};
return e.scrollElement.addEventListener("scroll", o, {
capture: !1,
passive: !0
}), () => {
e.scrollElement.removeEventListener("scroll", o)
}
})("element"),
W8 = (t, e) => t.getBoundingClientRect()[e.options.horizontal ? "width" : "height"],
Y8 = (t, e, n) => {
var r;
(r = n.scrollElement) == null || r.scrollTo == null || r.scrollTo({
[n.options.horizontal ? "left" : "top"]: t,
behavior: e ? "smooth" : void 0
})
};
class X8 {
constructor(e) {
var n = this;
this.unsubs = [], this.scrollElement = null, this.measurementsCache = [], this.itemMeasurementsCache = {}, this.pendingMeasuredCacheIndexes = [], this.measureElementCache = {}, this.range = {
startIndex: 0,
endIndex: 0
}, this.setOptions = r => {
Object.entries(r).forEach(i => {
let [s, d] = i;
typeof d > "u" && delete r[s]
}), this.options = {
debug: !1,
initialOffset: 0,
overscan: 1,
paddingStart: 0,
paddingEnd: 0,
scrollPaddingStart: 0,
scrollPaddingEnd: 0,
horizontal: !1,
getItemKey: $8,
rangeExtractor: V8,
enableSmoothScroll: !0,
onChange: () => {},
measureElement: W8,
initialRect: {
width: 0,
height: 0
},
...r
}
}, this.notify = () => {
var r, i;
(r = (i = this.options).onChange) == null || r.call(i, this)
}, this.cleanup = () => {
this.unsubs.filter(Boolean).forEach(r => r()), this.unsubs = [], this.scrollElement = null
}, this._didMount = () => () => {
this.cleanup()
}, this._willUpdate = () => {
const r = this.options.getScrollElement();
this.scrollElement !== r && (this.cleanup(), this.scrollElement = r, this._scrollToOffset(this.scrollOffset, !1), this.unsubs.push(this.options.observeElementRect(this, i => {
this.scrollRect = i, this.calculateRange()
})), this.unsubs.push(this.options.observeElementOffset(this, i => {
this.scrollOffset = i, this.calculateRange()
})))
}, this.getSize = () => this.scrollRect[this.options.horizontal ? "width" : "height"], this.getMeasurements = lu(() => [this.options.count, this.options.paddingStart, this.options.getItemKey, this.itemMeasurementsCache], (r, i, s, d) => {
const a = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
this.pendingMeasuredCacheIndexes = [];
const o = this.measurementsCache.slice(0, a);
for (let c = a; c < r; c++) {
const h = s(c),
l = d[h],
u = o[c - 1] ? o[c - 1].end : i,
f = typeof l == "number" ? l : this.options.estimateSize(c),
p = u + f;
o[c] = {
index: c,
start: u,
size: f,
end: p,
key: h
}
}
return this.measurementsCache = o, o
}, {
key: !1,
debug: () => this.options.debug
}), this.calculateRange = lu(() => [this.getMeasurements(), this.getSize(), this.scrollOffset], (r, i, s) => {
const d = K8({
measurements: r,
outerSize: i,
scrollOffset: s
});
return (d.startIndex !== this.range.startIndex || d.endIndex !== this.range.endIndex) && (this.range = d, this.notify()), this.range
}, {
key: !1,
debug: () => this.options.debug
}), this.getIndexes = lu(() => [this.options.rangeExtractor, this.range, this.options.overscan, this.options.count], (r, i, s, d) => r({
...i,
overscan: s,
count: d
}), {
key: !1,
debug: () => this.options.debug
}), this.getVirtualItems = lu(() => [this.getIndexes(), this.getMeasurements(), this.options.measureElement], (r, i, s) => {
const d = h => l => {
var u;
const f = this.measurementsCache[h];
if (!l) return;
const p = s(l, this),
m = (u = this.itemMeasurementsCache[f.key]) != null ? u : f.size;
p !== m && (f.start < this.scrollOffset && (this.destinationOffset || this._scrollToOffset(this.scrollOffset + (p - m), !1)), this.pendingMeasuredCacheIndexes.push(h), this.itemMeasurementsCache = {
...this.itemMeasurementsCache,
[f.key]: p
}, this.notify())
},
a = [],
o = {};
for (let h = 0, l = r.length; h < l; h++) {
var c;
const u = r[h],
p = {
...i[u],
measureElement: o[u] = (c = this.measureElementCache[u]) != null ? c : d(u)
};
a.push(p)
}
return this.measureElementCache = o, a
}, {
key: !1,
debug: () => this.options.debug
}), this.scrollToOffset = function(r, i) {
let {
align: s = "start",
smoothScroll: d = n.options.enableSmoothScroll
} = i === void 0 ? {} : i;
const a = n.scrollOffset,
o = n.getSize();
s === "auto" && (r <= a ? s = "start" : r >= a + o ? s = "end" : s = "start"), s === "start" ? n._scrollToOffset(r, d) : s === "end" ? n._scrollToOffset(r - o, d) : s === "center" && n._scrollToOffset(r - o / 2, d)
}, this.scrollToIndex = function(r, i) {
let {
align: s = "auto",
smoothScroll: d = n.options.enableSmoothScroll,
...a
} = i === void 0 ? {} : i;
const o = n.getMeasurements(),
c = n.scrollOffset,
h = n.getSize(),
{
count: l
} = n.options,
u = o[Math.max(0, Math.min(r, l - 1))];
if (!u) return;
if (s === "auto")
if (u.end >= c + h - n.options.scrollPaddingEnd) s = "end";
else if (u.start <= c + n.options.scrollPaddingStart) s = "start";
else return;
const f = s === "end" ? u.end + n.options.scrollPaddingEnd : u.start - n.options.scrollPaddingStart;
n.scrollToOffset(f, {
align: s,
smoothScroll: d,
...a
})
}, this.getTotalSize = () => {
var r;
return (((r = this.getMeasurements()[this.options.count - 1]) == null ? void 0 : r.end) || this.options.paddingStart) + this.options.paddingEnd
}, this._scrollToOffset = (r, i) => {
clearTimeout(this.scrollCheckFrame), this.destinationOffset = r, this.options.scrollToFn(r, i, this);
let s;
const d = () => {
let a = this.scrollOffset;
this.scrollCheckFrame = s = setTimeout(() => {
if (this.scrollCheckFrame === s) {
if (this.scrollOffset === a) {
this.destinationOffset = void 0;
return
}
a = this.scrollOffset, d()
}
}, 100)
};
d()
}, this.measure = () => {
this.itemMeasurementsCache = {}, this.notify()
}, this.setOptions(e), this.scrollRect = this.options.initialRect, this.scrollOffset = this.options.initialOffset, this.calculateRange()
}
}
const G8 = (t, e, n, r) => {
for (; t <= e;) {
const i = (t + e) / 2 | 0,
s = n(i);
if (s < r) t = i + 1;
else if (s > r) e = i - 1;
else return i
}
return t > 0 ? t - 1 : 0
};
function K8(t) {
let {
measurements: e,
outerSize: n,
scrollOffset: r
} = t;
const i = e.length - 1,
d = G8(0, i, o => e[o].start, r);
let a = d;
for (; a < i && e[a].end < r + n;) a++;
return {
startIndex: d,
endIndex: a
}
}
const q8 = typeof window < "u" ? E.exports.useLayoutEffect : E.exports.useEffect;
function Z8(t) {
const e = E.exports.useReducer(() => ({}), {})[1],
n = {
...t,
onChange: i => {
e(), t.onChange == null || t.onChange(i)
}
},
[r] = E.exports.useState(() => new X8(n));
return r.setOptions(n), E.exports.useEffect(() => r._didMount(), []), q8(() => r._willUpdate()), r
}
function Q8(t) {
return Z8({
observeElementRect: H8,
observeElementOffset: U8,
scrollToFn: Y8,
...t
})
}
function v_() {
const t = ae(e => {
var n;
return (n = e.config.ui) == null ? void 0 : n.activeTheme
});
return ae(e => {
var n;
return (((n = e.config.ui) == null ? void 0 : n.themes) || []).find(r => r.name === t)
})
}
function J8({
category: t
}) {
const e = v_(),
n = t.name,
r = t.list ? t.list : Array.from(Array(t.items).keys()),
i = E.exports.useRef(null),
s = Q8({
horizontal: !0,
count: r.length,
getScrollElement: () => i.current,
estimateSize: E.exports.useCallback(() => 52, []),
overscan: 5
});
return E.exports.useEffect(() => {
s.scrollToIndex(0)
}, [n]), _(E.exports.Fragment, {
children: _("div", {
ref: i,
className: "tiny-scrollbar overflow-x-auto overflow-y-hidden",
style: {
height: "52px"
},
children: _("div", {
className: "h-full relative mx-auto",
style: {
width: `${s.getTotalSize()}px`
},
children: s.getVirtualItems().map(d => {
const a = `${r[d.index]}`;
return _("div", {
className: "absolute top-0 left-0 h-full",
style: {
width: `${d.size}px`,
transform: `translateX(${d.start}px)`
},
children: _(bt, {
variant: "outline",
radius: "rounded-xl",
size: "md",
equalWidth: !0,
onClick: async () => {
await L().shape.addSticker(t.name, a), A().setDirty(!0)
},
children: _("img", {
className: he("m-auto m-auto w-28 h-28", t.invertPreview && (e == null ? void 0 : e.isDark) && "invert"),
src: Pp(t, a),
alt: a
})
})
}, d.index)
})
})
})
})
}
function eF() {
const t = ae(i => {
var s, d;
return (d = (s = i.config.tools) == null ? void 0 : s.stickers) == null ? void 0 : d.items
}) || [],
[e, n] = E.exports.useState(t[0]),
r = t.map(i => {
const s = e === i,
d = n5[i.name];
return _(bt, {
size: "xs",
color: s ? "primary" : null,
value: i,
children: _("span", {
className: "capitalize",
children: d ? _(_e, {
...d
}) : i.name
})
}, i.name)
});
return se("div", {
className: "h-92",
children: [_(Yc, {
value: e,
onChange: i => n(i),
className: "mb-10 w-full justify-center",
variant: "outline",
radius: "rounded-full",
children: r
}), e && _(J8, {
category: e
})]
})
}
function tF() {
const t = ae(r => {
var i, s;
return (s = (i = r.config.tools) == null ? void 0 : i.frame) == null ? void 0 : s.items
}) || [],
e = ae(r => r.frame.active);
E.exports.useEffect(() => {
A().frame.active && A().frame.showOptionsPanel()
}, []);
const n = t.map(r => {
const i = Wt(`images/frames/${r.name}/thumbnail.png`),
s = (e == null ? void 0 : e.name) === r.name;
return _(Kn, {
children: se("button", {
type: "button",
className: `border-2 overflow-hidden relative rounded border cursor-pointer ${s?"border-primary":""}`,
onClick: () => {
A().setDirty(!0), s ? L().frame.remove() : L().frame.add(r.name)
},
children: [s && _(nF, {}), _("img", {
draggable: "false",
className: "w-64 h-64",
src: i,
alt: r.name
})]
})
}, r.name)
});
return _(Si, {
children: n
})
}
function nF() {
return _("span", {
className: "bg-background/70 absolute inset-0 text-primary",
children: _(pg, {
className: "svg-icon icon-md absolute inset-0 block m-auto"
})
})
}
function rF() {
const t = ae(n => {
var r, i;
return (i = (r = n.config.tools) == null ? void 0 : r.text) == null ? void 0 : i.items
});
E.exports.useEffect(() => {
t && Bw(t, Wt).catch(() => {})
}, [t]), E.exports.useEffect(() => {
L().text.selectOrAddText() && A().setDirty(!0)
}, []);
const e = (t || []).map(n => _(Kn, {
children: _(iF, {
fontConfig: n
})
}, n.family));
return _(Si, {
className: "pt-6",
children: e
})
}
function iF({
fontConfig: t
}) {
var r;
const e = ae(i => i.objects.active.editableProps.fontFamily),
n = he("block px-6 w-110 h-68 text-sm bg border rounded-2xl", {
"border-primary": e === t.family,
"text-primary": e === t.family
});
return _("button", {
type: "button",
className: n,
style: {
fontFamily: t.family,
fontWeight: ((r = t.descriptors) == null ? void 0 : r.weight) || "normal"
},
onClick: async () => {
L().text.selectOrAddText(), A().setDirty(!0), L().objects.setValues({
fontFamily: t.family
})
},
children: t.family
})
}
function oF() {
return E.exports.useEffect(() => (L().draw.enable(), () => {
L().draw.disable()
}), []), se(Si, {
gap: "gap-16",
className: "justify-center",
children: [_(Kn, {
children: _(yi, {
size: "sm",
label: _(_e, {
message: "Brush Color"
}),
value: L().draw.currentBrush.color,
onChange: t => {
L().draw.setBrushColor(t)
}
})
}), _(Kn, {
children: _(aF, {})
}), _(Kn, {
children: _(sF, {})
})]
})
}
function sF() {
const t = ae(r => {
var i, s;
return (s = (i = r.config.tools) == null ? void 0 : i.draw) == null ? void 0 : s.brushSizes
}) || [],
[e, n] = E.exports.useState(L().draw.currentBrush.width);
return _(dg, {
selectionMode: "single",
selectedValue: e,
onSelectionChange: r => {
n(r), L().draw.setBrushSize(r)
},
size: "sm",
label: "Brush Size",
children: t.map(r => _(zc, {
value: r,
children: se("div", {
className: "flex items-center",
children: [_("div", {
className: "flex-shrink-0 mr-8 border-[3px] rounded-full",
style: {
width: `${r}px`,
height: `${r}px`
}
}), r]
})
}, r))
})
}
function aF() {
const t = ae(i => {
var s, d;
return (d = (s = i.config.tools) == null ? void 0 : s.draw) == null ? void 0 : d.brushTypes
}) || [],
e = v_(),
[n, r] = E.exports.useState(L().draw.currentBrush.type);
return _(dg, {
selectionMode: "single",
selectedValue: n,
onSelectionChange: i => {
r(i), L().draw.setBrushType(i)
},
size: "sm",
label: "Brush Type",
children: t.map(i => _(zc, {
value: i,
children: se("div", {
className: "flex items-center",
children: [_("img", {
className: "flex-shrink-0 mr-8 w-24 h-24",
src: lF(i, e == null ? void 0 : e.isDark),
alt: ""
}), i]
})
}, i))
})
}
function lF(t, e = !1) {
const n = t.replace("Brush", "").toLowerCase();
return Wt(`images/brushes/${e?"white":"black"}/${n}.png`)
}
function cF() {
const {
trans: t
} = vi(), e = ae(n => n.corners.radius);
return E.exports.useEffect(() => (A().setDirty(!0), L().corners.showPreview(), () => L().corners.hidePreview()), []), _("div", {
className: "max-w-320 mx-auto",
children: _(bi, {
minValue: 1,
maxValue: 300,
label: t({
message: "Radius"
}),
getValueLabel: n => `${n}px`,
onChange: n => {
L().corners.updatePreview(n), A().corners.setRadius(n)
},
value: e
})
})
}
const y_ = {
initial: {
y: "130%",
opacity: 0
},
animate: {
y: 0,
opacity: 1
},
exit: {
y: "130%",
opacity: 0,
left: 0,
position: "absolute",
overflowY: "hidden"
},
transition: {
type: "tween",
duration: .15
}
};
function uF({
activeTool: t
}) {
const e = fF(t);
return _(Et.div, {
className: "relative h-full w-full text-sm bg select-none overflow-hidden",
...y_,
children: e
})
}
function fF(t) {
switch (t) {
case Me.FILTER:
return _(m8, {});
case Me.RESIZE:
return _(_8, {});
case Me.CROP:
return _(R8, {});
case Me.DRAW:
return _(oF, {});
case Me.TEXT:
return _(rF, {});
case Me.SHAPES:
return _(N8, {});
case Me.STICKERS:
return _(eF, {});
case Me.FRAME:
return _(tF, {});
case Me.CORNERS:
return _(cF, {});
default:
return null
}
}
function b_({
className: t
}) {
const e = ae(n => n.activeTool);
return _("nav", {
className: he("z-navbar min-h-86 flex-shrink-0 px-16 relative overflow-hidden", t),
children: _(Or, {
initial: !1,
children: e ? _(uF, {
activeTool: e
}, "tool-controls") : _(hF, {}, "nav-items")
})
})
}
function hF() {
const t = ae(e => {
var n, r;
return (r = (n = e.config.ui) == null ? void 0 : n.nav) == null ? void 0 : r.items
}) || [];
return _(Et.div, {
className: "w-full h-full",
...y_,
children: _(Si, {
children: t.map(e => _(Kn, {
children: _(dF, {
item: e
})
}, e.name))
})
})
}
function dF({
item: t
}) {
const e = () => {
typeof t.action == "string" ? Sf(t.action) : typeof t.action == "function" && t.action(A().editor)
},
n = w5[t.name];
return se(Vn, {
variant: "outline",
color: "paper",
className: "flex-col flex-shrink-0 w-68 h-68",
radius: "rounded-2xl",
onClick: e,
children: [_("div", {
className: "mb-1",
children: _(Kp, {
className: "icon-md",
icon: t.icon
})
}), _("div", {
className: "mt-6 text-xs capitalize max-w-[90%] overflow-hidden overflow-ellipsis",
children: n ? _(_e, {
...n
}) : t.name
})]
})
}
function pF() {
const t = ae(n => n.history.items),
e = ae(n => n.history.pointer);
return se(Et.div, {
...Np,
className: "absolute bottom-20 right-20 w-224 max-w-[calc(100%-40px)] max-h-[calc(100%-40px)] bg-paper shadow-xl border focus:outline-none rounded overflow-hidden",
children: [se("div", {
className: "px-10 py-2 mb-4 font-medium text-sm border-b flex items-center",
children: [_(_e, {
message: "History"
}), _(Re, {
size: "xs",
className: "ml-auto flex-shrink-0",
onClick: () => {
A().togglePanel("history", !1)
},
children: _(Rr, {})
})]
}), _("div", {
className: "p-10",
children: t.map(n => {
const r = n.id === t[e].id,
i = rr[n.name],
s = i.icon && ue.createElement(i.icon, {
className: "icon-sm"
});
return _(bt, {
onClick: () => {
r || L().history.load(n)
},
variant: "outline",
color: r ? "primary" : null,
size: "sm",
className: he("w-full mb-8", r && "pointer-events-none"),
justify: "justify-start",
startIcon: s,
children: _(_e, {
...i.name
})
}, n.id)
})
})]
})
}
function gF(t) {
const {
children: e,
className: n,
color: r,
onDismiss: i,
leftAdornment: s,
rightAdornment: d,
hideDismissButton: a = !1,
size: o,
showDivider: c
} = t, {
labelId: h,
isDismissable: l,
close: u
} = E.exports.useContext(iu);
return se("div", {
className: he(n, "flex items-center justify-between gap-10 flex-shrink-0", c && "border-b", mF(t), r || "text-main"),
children: [s, _("h3", {
id: h,
className: he(n, o === "xs" ? "text-xs" : "text-sm", "font-semibold leading-5 opacity-90"),
children: e
}), d, l && !a && _(Re, {
"aria-label": "Dismiss",
onClick: () => {
i ? i() : u()
},
size: o === "xs" ? "xs" : "sm",
className: he("text-muted ml-auto", d && "sr-only"),
children: _(Rr, {})
})]
})
}
function mF({
size: t,
padding: e
}) {
if (e) return e;
switch (t) {
case "xs":
return "px-14 py-4";
case "sm":
return "px-18 py-4";
default:
return "px-24 py-6"
}
}
const w_ = E.exports.forwardRef((t, e) => {
const {
children: n,
className: r
} = t;
return _("div", {
ref: e,
className: he(r, vF(t), "overflow-y-auto overflow-x-hidden text-sm"),
children: n
})
});
function vF({
size: t,
padding: e
}) {
if (e) return e;
switch (t) {
case "xs":
return "p-14";
case "sm":
return "p-18";
default:
return "px-24 py-20"
}
}
function yF() {
const t = ae(e => e.openPanels.newImage);
return _(su, {
isOpen: t,
disableInitialTransition: !0,
type: "modal",
isDismissable: !1,
children: _(bF, {})
})
}
function bF() {
const [t, e] = E.exports.useState("default");
return se(ou, {
className: "text-center max-w-max",
size: "auto",
children: [_(gF, {
padding: "px-24 pt-24 pb-12",
showDivider: !1,
children: _(_e, {
message: "Open a photo or design to get started"
})
}), _(w_, {
children: t === "default" ? _(wF, {
setActivePanel: e
}) : _(_F, {
setActivePanel: e
})
})]
})
}
function wF({
setActivePanel: t
}) {
return se(Uo, {
children: [_(bt, {
className: "mr-20",
size: "sm",
variant: "raised",
color: "primary",
onClick: () => {
L().import.uploadAndReplaceMainImage()
},
children: _(_e, {
message: "Open Photo"
})
}), _(bt, {
variant: "outline",
size: "sm",
color: "primary",
onClick: () => {
t("newCanvas")
},
children: _(_e, {
message: "Create New"
})
}), _(xF, {})]
})
}
function xF() {
const t = ae(e => {
var n, r;
return (r = (n = e.config.ui) == null ? void 0 : n.openImageDialog) == null ? void 0 : r.sampleImages
});
return t != null && t.length ? se(Uo, {
children: [se("div", {
className: "relative py-20",
children: [_("hr", {
className: "absolute h-1 border-none bg-divider w-full top inset-0 m-auto"
}), _("span", {
className: "text-sm bg-paper px-6 relative",
children: _(_e, {
message: "or use sample"
})
})]
}), _("ul", {
className: "flex items-center gap-16",
children: t.map(e => _("li", {
className: "shrink-0",
children: _("button", {
type: "button",
onClick: async () => {
typeof e.action == "function" ? e.action() : e.url.endsWith(".json") ? (await Ya(Wt(e.url)), A().togglePanel("newImage", !1)) : (await L().import.openBackgroundImage(Wt(e.url)), A().togglePanel("newImage", !1))
},
children: _("img", {
className: "w-80 h-80 rounded overflow-hidden transition-shadow hover:shadow-md",
src: Wt(e.thumbnail),
alt: ""
})
})
}, e.url || e.thumbnail))
})]
}) : null
}
function _F({
setActivePanel: t
}) {
const [e, n] = E.exports.useState({
width: 800,
height: 600,
bgColor: "transparent"
});
return se("form", {
onSubmit: r => {
r.preventDefault();
const {
width: i,
height: s,
bgColor: d
} = e;
i && s && (A().setConfig({
blankCanvasSize: {
width: i,
height: s
}
}), L().canvas.openNew(i, s, d), A().togglePanel("newImage", !1), L().history.addInitial())
},
children: [_(wi, {
type: "number",
label: _(_e, {
message: "Width"
}),
value: e.width,
min: 1,
required: !0,
className: "mb-16",
onChange: r => {
n({
...e,
width: r.target.valueAsNumber
})
}
}), _(wi, {
type: "number",
label: _(_e, {
message: "Height"
}),
value: e.height,
min: 1,
required: !0,
className: "mb-16",
onChange: r => {
n({
...e,
height: r.target.valueAsNumber
})
}
}), _(yi, {
onChange: r => {
n({
...e,
bgColor: r
})
},
className: "mb-16",
value: e.bgColor,
label: _(_e, {
message: "Background color"
})
}), se("div", {
className: "text-right",
children: [_(bt, {
size: "sm",
variant: "text",
className: "mr-10",
onClick: () => {
t("default")
},
children: _(_e, {
message: "Cancel"
})
}), _(bt, {
size: "sm",
type: "submit",
variant: "raised",
color: "primary",
children: _(_e, {
message: "Create"
})
})]
})]
})
}
const SF = E.exports.forwardRef((t, e) => {
const n = mi(t),
{
label: r,
children: i,
size: s,
className: d,
orientation: a = "horizontal",
disabled: o,
required: c,
invalid: h,
errorMessage: l,
description: u
} = t,
f = {},
p = E.exports.useId(),
m = t.name || p;
return se("fieldset", {
"aria-describedby": u ? `${p}-description` : void 0,
ref: e,
className: he("text-left", d),
children: [r && _("legend", {
className: n.label,
...f,
children: r
}), _("div", {
className: he("flex", a === "vertical" ? "flex-col gap-10" : "flex-row gap-16"),
children: E.exports.Children.map(i, g => {
if (E.exports.isValidElement(g)) return E.exports.cloneElement(g, {
name: m,
size: s,
invalid: g.props.invalid || h || void 0,
disabled: g.props.disabled || o,
required: g.props.required || c
})
})
}), u && !l && _("div", {
className: n.description,
id: `${p}-description`,
children: u
}), l && _("div", {
className: n.error,
children: l
})]
})
}),
gg = E.exports.forwardRef((t, e) => {
const {
children: n,
autoFocus: r,
size: i,
invalid: s,
isFirst: d,
...a
} = t, o = di(e);
hg({
autoFocus: r
}, o);
const c = CF(i);
return se("label", {
className: he("inline-flex gap-8 select-none items-center whitespace-nowrap align-middle", c.label, t.disabled && "text-disabled pointer-events-none", t.invalid && "text-danger"),
children: [_("input", {
type: "radio",
className: he("focus-visible:ring outline-none", "rounded-full transition-button border-2 appearance-none", "border-text-muted disabled:border-disabled-fg checked:border-primary checked:hover:border-primary-dark", "before:bg-primary disabled:before:bg-disabled-fg before:hover:bg-primary-dark", "before:h-full before:w-full before:block before:rounded-full before:scale-10 before:opacity-0 before:transition before:duration-200", "checked:before:scale-[.65] checked:before:opacity-100", c.circle),
ref: o,
...a
}), n && _("span", {
children: n
})]
})
});
function CF(t) {
switch (t) {
case "xs":
return {
circle: "h-12 w-12", label: "text-xs"
};
case "sm":
return {
circle: "h-16 w-16", label: "text-sm"
};
case "lg":
return {
circle: "h-24 w-24", label: "text-lg"
};
default:
return {
circle: "h-20 w-20", label: "text-base"
}
}
}
function TF() {
const t = ae(e => e.openPanels.export);
return _(su, {
isOpen: t,
onOpenChange: e => {
e || A().togglePanel("export", !1)
},
type: "modal",
children: _(kF, {})
})
}
function kF() {
const [t, e] = E.exports.useState(() => {
var n, r, i, s, d, a;
return {
filename: ((r = (n = A().config.tools) == null ? void 0 : n.export) == null ? void 0 : r.defaultName) || "image",
format: ((s = (i = A().config.tools) == null ? void 0 : i.export) == null ? void 0 : s.defaultFormat) || "jpeg",
quality: ((a = (d = A().config.tools) == null ? void 0 : d.export) == null ? void 0 : a.defaultQuality) || .8
}
});
return _(ou, {
className: "text-center max-w-max",
size: "auto",
children: _(w_, {
children: se("form", {
onSubmit: n => {
n.preventDefault(), L().export.save(t.filename, t.format, t.quality), A().togglePanel("export", !1)
},
children: [_(wi, {
required: !0,
size: "sm",
label: _(_e, {
message: "Save As"
}),
value: t.filename,
onChange: n => {
e({
...t,
filename: n.target.value
})
}
}), se(SF, {
size: "sm",
className: "my-20",
"aria-label": "Image format",
children: [_(gg, {
value: "jpeg",
checked: t.format === "jpeg",
onChange: n => {
e({
...t,
format: n.target.value
})
},
children: "JPEG"
}), _(gg, {
value: "png",
checked: t.format === "png",
onChange: n => {
e({
...t,
format: n.target.value
})
},
children: "PNG"
}), _(gg, {
value: "json",
checked: t.format === "json",
onChange: n => {
e({
...t,
format: n.target.value
})
},
children: "JSON"
})]
}), _(bi, {
size: "sm",
minValue: .1,
step: .1,
maxValue: 1,
value: t.quality,
onChange: n => {
e({
...t,
quality: n
})
},
formatOptions: {
style: "percent"
},
label: _(_e, {
message: "Quality"
})
}), _(bt, {
variant: "raised",
color: "primary",
type: "submit",
className: "mt-20 w-full",
size: "sm",
children: _(_e, {
message: "Save"
})
})]
})
})
})
}
function EF() {
const t = ae(n => n.objects.all),
e = ae(n => n.objects.active.id);
return se(Et.div, {
...Np,
className: "absolute bottom-20 right-20 w-224 max-w-[calc(100%-40px)] max-h-[calc(100%-40px)] bg-paper shadow-xl border focus:outline-none rounded overflow-hidden",
children: [se("div", {
className: "px-10 py-2 mb-4 font-medium text-sm border-b flex items-center",
children: [_(_e, {
message: "Objects"
}), _(Re, {
size: "xs",
className: "ml-auto flex-shrink-0",
onClick: () => {
A().togglePanel("objects", !1)
},
children: _(Rr, {})
})]
}), _("div", {
className: "p-8",
children: t.map(n => {
const r = n.id === e,
i = n.name,
s = lk[i],
d = s.icon && ue.createElement(s.icon, {
className: "icon-sm"
});
return _(bt, {
onClick: () => {
r || !n.selectable || L().objects.select(n.id)
},
variant: "outline",
color: r ? "primary" : null,
size: "sm",
className: he("w-full mb-8", (r || !n.selectable) && "pointer-events-none"),
justify: "justify-start",
startIcon: d,
children: _(_e, {
...s.name
})
}, n.id)
})
})]
})
}
function OF() {
const t = ae(n => n.openPanels.history),
e = ae(n => n.openPanels.objects);
return se("div", {
className: "z-modal",
children: [se(Or, {
children: [t && _(pF, {}, "historyPanel"), e && _(EF, {}, "objListPanel")]
}), _(yF, {}), _(TF, {})]
})
}
/**
* @remix-run/router v1.0.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
function mg() {
return mg = Object.assign ? Object.assign.bind() : function(t) {
for (var e = 1; e < arguments.length; e++) {
var n = arguments[e];
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r])
}
return t
}, mg.apply(this, arguments)
}
var x_;
(function(t) {
t.Pop = "POP", t.Push = "PUSH", t.Replace = "REPLACE"
})(x_ || (x_ = {}));
function __(t) {
let {
pathname: e = "/",
search: n = "",
hash: r = ""
} = t;
return n && n !== "?" && (e += n.charAt(0) === "?" ? n : "?" + n), r && r !== "#" && (e += r.charAt(0) === "#" ? r : "#" + r), e
}
function S_(t) {
let e = {};
if (t) {
let n = t.indexOf("#");
n >= 0 && (e.hash = t.substr(n), t = t.substr(0, n));
let r = t.indexOf("?");
r >= 0 && (e.search = t.substr(r), t = t.substr(0, r)), t && (e.pathname = t)
}
return e
}
var C_;
(function(t) {
t.data = "data", t.deferred = "deferred", t.redirect = "redirect", t.error = "error"
})(C_ || (C_ = {}));
function vg(t, e) {
if (t === !1 || t === null || typeof t > "u") throw new Error(e)
}
function PF(t, e) {
e === void 0 && (e = "/");
let {
pathname: n,
search: r = "",
hash: i = ""
} = typeof t == "string" ? S_(t) : t;
return {
pathname: n ? n.startsWith("/") ? n : MF(n, e) : e,
search: AF(r),
hash: DF(i)
}
}
function MF(t, e) {
let n = e.replace(/\/+$/, "").split("/");
return t.split("/").forEach(i => {
i === ".." ? n.length > 1 && n.pop() : i !== "." && n.push(i)
}), n.length > 1 ? n.join("/") : "/"
}
function T_(t, e, n, r) {
r === void 0 && (r = !1);
let i = typeof t == "string" ? S_(t) : mg({}, t),
s = t === "" || i.pathname === "",
d = s ? "/" : i.pathname,
a;
if (r || d == null) a = n;
else {
let l = e.length - 1;
if (d.startsWith("..")) {
let u = d.split("/");
for (; u[0] === "..";) u.shift(), l -= 1;
i.pathname = u.join("/")
}
a = l >= 0 ? e[l] : "/"
}
let o = PF(i, a),
c = d && d !== "/" && d.endsWith("/"),
h = (s || d === ".") && n.endsWith("/");
return !o.pathname.endsWith("/") && (c || h) && (o.pathname += "/"), o
}
const k_ = t => t.join("/").replace(/\/\/+/g, "/"),
AF = t => !t || t === "?" ? "" : t.startsWith("?") ? t : "?" + t,
DF = t => !t || t === "#" ? "" : t.startsWith("#") ? t : "#" + t;
/**
* React Router v6.4.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
function RF(t, e) {
return t === e && (t !== 0 || 1 / t === 1 / e) || t !== t && e !== e
}
const IF = typeof Object.is == "function" ? Object.is : RF,
{
useState: LF,
useEffect: FF,
useLayoutEffect: zF,
useDebugValue: NF
} = gu;
function jF(t, e, n) {
const r = e(),
[{
inst: i
}, s] = LF({
inst: {
value: r,
getSnapshot: e
}
});
return zF(() => {
i.value = r, i.getSnapshot = e, yg(i) && s({
inst: i
})
}, [t, r, e]), FF(() => (yg(i) && s({
inst: i
}), t(() => {
yg(i) && s({
inst: i
})
})), [t]), NF(r), r
}
function yg(t) {
const e = t.getSnapshot,
n = t.value;
try {
const r = e();
return !IF(n, r)
} catch {
return !0
}
}
function BF(t, e, n) {
return e()
}
const $F = !(typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u") ? BF : jF;
"useSyncExternalStore" in gu && (t => t.useSyncExternalStore)(gu);
const E_ = E.exports.createContext(null),
O_ = E.exports.createContext(null),
P_ = E.exports.createContext({
outlet: null,
matches: []
});
function VF(t, e) {
let {
relative: n
} = e === void 0 ? {} : e;
bg() || vg(!1);
let {
basename: r,
navigator: i
} = E.exports.useContext(E_), {
hash: s,
pathname: d,
search: a
} = A_(t, {
relative: n
}), o = d;
return r !== "/" && (o = d === "/" ? r : k_([r, d])), i.createHref({
pathname: o,
search: a,
hash: s
})
}
function bg() {
return E.exports.useContext(O_) != null
}
function wg() {
return bg() || vg(!1), E.exports.useContext(O_).location
}
function M_(t) {
return t.filter((e, n) => n === 0 || !e.route.index && e.pathnameBase !== t[n - 1].pathnameBase)
}
function HF() {
bg() || vg(!1);
let {
basename: t,
navigator: e
} = E.exports.useContext(E_), {
matches: n
} = E.exports.useContext(P_), {
pathname: r
} = wg(), i = JSON.stringify(M_(n).map(a => a.pathnameBase)), s = E.exports.useRef(!1);
return E.exports.useEffect(() => {
s.current = !0
}), E.exports.useCallback(function(a, o) {
if (o === void 0 && (o = {}), !s.current) return;
if (typeof a == "number") {
e.go(a);
return
}
let c = T_(a, JSON.parse(i), r, o.relative === "path");
t !== "/" && (c.pathname = c.pathname === "/" ? t : k_([t, c.pathname])), (o.replace ? e.replace : e.push)(c, o.state, o)
}, [t, e, i, r])
}
function A_(t, e) {
let {
relative: n
} = e === void 0 ? {} : e, {
matches: r
} = E.exports.useContext(P_), {
pathname: i
} = wg(), s = JSON.stringify(M_(r).map(d => d.pathnameBase));
return E.exports.useMemo(() => T_(t, JSON.parse(s), i, n === "path"), [t, s, i, n])
}
var D_;
(function(t) {
t.UseLoaderData = "useLoaderData", t.UseActionData = "useActionData", t.UseRouteError = "useRouteError", t.UseNavigation = "useNavigation", t.UseRouteLoaderData = "useRouteLoaderData", t.UseMatches = "useMatches", t.UseRevalidator = "useRevalidator"
})(D_ || (D_ = {}));
var R_;
(function(t) {
t[t.pending = 0] = "pending", t[t.success = 1] = "success", t[t.error = 2] = "error"
})(R_ || (R_ = {})), new Promise(() => {});
/**
* React Router DOM v6.4.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
function UF(t, e) {
if (t == null) return {};
var n = {},
r = Object.keys(t),
i, s;
for (s = 0; s < r.length; s++) i = r[s], !(e.indexOf(i) >= 0) && (n[i] = t[i]);
return n
}
function WF(t) {
return !!(t.metaKey || t.altKey || t.ctrlKey || t.shiftKey)
}
function YF(t, e) {
return t.button === 0 && (!e || e === "_self") && !WF(t)
}
const XF = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset"],
GF = E.exports.forwardRef(function(e, n) {
let {
onClick: r,
relative: i,
reloadDocument: s,
replace: d,
state: a,
target: o,
to: c,
preventScrollReset: h
} = e, l = UF(e, XF), u = VF(c, {
relative: i
}), f = KF(c, {
replace: d,
state: a,
target: o,
preventScrollReset: h,
relative: i
});
function p(m) {
r && r(m), m.defaultPrevented || f(m)
}
return _("a", {
...l,
href: u,
onClick: s ? r : p,
ref: n,
target: o
})
});
function KF(t, e) {
let {
target: n,
replace: r,
state: i,
preventScrollReset: s,
relative: d
} = e === void 0 ? {} : e, a = HF(), o = wg(), c = A_(t, {
relative: d
});
return E.exports.useCallback(h => {
if (YF(h, n)) {
h.preventDefault();
let l = r !== void 0 ? r : __(o) === __(c);
a(t, {
replace: l,
state: i,
preventScrollReset: s,
relative: d
})
}
}, [o, a, c, r, i, n, t, s, d])
}
const qF = ye(_("path", {
d: "M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
}), "ErrorOutlineOutlined"),
ZF = ye(_("path", {
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"
}), "CheckCircleOutlined");
function QF() {
const t = Mv(e => e.toasts);
return _("div", {
className: "relative pointer-events-none",
children: _(Or, {
initial: !1,
children: t.map(e => _("div", {
"data-toast": !0,
className: he("fixed mx-auto p-20 z-toast", e.position === "bottom-center" ? "left-0 right-0 bottom-0" : "right-0 bottom-0"),
children: se(Et.div, {
initial: {
opacity: 0,
y: 50,
scale: .3
},
animate: {
opacity: 1,
y: 0,
scale: 1
},
exit: {
opacity: 0,
scale: .5,
transition: {
duration: .2
}
},
className: he("flex items-center gap-10 min-w-288 max-w-500 shadow-lg w-min rounded-lg pl-16 pr-6 py-6 text-sm pointer-events-auto max-h-100 bg-paper text-main bg-paper border mx-auto"),
onPointerEnter: () => {
var n;
return (n = e.timer) == null ? void 0 : n.pause()
},
onPointerLeave: () => {
var n;
return (n = e.timer) == null ? void 0 : n.resume()
},
role: "alert",
"aria-live": e.type === "danger" ? "assertive" : "polite",
children: [e.type === "danger" && _(qF, {
className: "text-danger flex-shrink-0",
size: "md"
}), e.type === "positive" && _(ZF, {
className: "text-positive flex-shrink-0",
size: "md"
}), _("div", {
className: "overflow-hidden overflow-ellipsis w-max mr-auto",
children: _(qp, {
value: e.message
})
}), e.action && _(bt, {
variant: "text",
color: "primary",
size: "sm",
className: "flex-shrink-0",
onFocus: () => {
var n;
return (n = e.timer) == null ? void 0 : n.pause()
},
onBlur: () => {
var n;
return (n = e.timer) == null ? void 0 : n.resume()
},
onClick: () => Zo().remove(e.id),
elementType: GF,
to: e.action.action,
children: _(qp, {
value: e.action.label
})
}), _(Re, {
onFocus: () => {
var n;
return (n = e.timer) == null ? void 0 : n.pause()
},
onBlur: () => {
var n;
return (n = e.timer) == null ? void 0 : n.resume()
},
type: "button",
className: "flex-shrink-0",
onClick: () => {
Zo().remove(e.id)
},
size: "sm",
children: _(Rr, {})
})]
})
}, e.id))
})
})
}
function JF(t) {
return Rw() ? t.metaKey : t.ctrlKey
}
function ez(t) {
switch (t.key) {
case "z":
JF(t) && (t.preventDefault(), t.stopPropagation(), t.shiftKey ? L().history.redo() : L().history.undo());
break;
case "ArrowUp":
t.preventDefault(), t.stopPropagation(), L().objects.move("up");
break;
case "ArrowRight":
t.preventDefault(), t.stopPropagation(), L().objects.move("right");
break;
case "ArrowDown":
t.preventDefault(), t.stopPropagation(), L().objects.move("down");
break;
case "ArrowLeft":
t.preventDefault(), t.stopPropagation(), L().objects.move("left");
break;
case "Delete":
t.preventDefault(), t.stopPropagation(), L().objects.delete();
break
}
}
const tz = new Map,
xg = new Map,
I_ = {
status: "inactive"
};
async function* nz(t) {
for (const e of t.items)
if (e.kind === "file")
if (typeof e.webkitGetAsEntry == "function") {
const n = e.webkitGetAsEntry();
if (!n) continue;
if (n.isFile) {
if (n.name === ".DS_Store") continue;
yield new na(e.getAsFile(), n.fullPath)
} else n.isDirectory && (yield* L_(n))
} else {
const n = e.getAsFile();
if (!n || n.name === ".DS_Store") continue;
yield new na(n, e.fullPath)
}
}
async function* L_(t) {
const e = t.createReader();
let n;
do {
n = await new Promise((r, i) => {
e.readEntries(r, i)
});
for (const r of n)
if (r.isFile) {
if (r.name === ".DS_Store") continue;
const i = await rz(r);
yield new na(i, r.fullPath)
} else r.isDirectory && (yield* L_(r))
} while (n.length > 0)
}
function rz(t) {
return new Promise((e, n) => t.file(e, n))
}
async function iz(t) {
const e = [];
for await (const n of t) e.push(n);
return e
}
const oz = 400;
function sz({
id: t,
disabled: e,
ref: n,
...r
}) {
const i = E.exports.useRef({
dragOverElements: new Set,
dropActivateTimer: void 0
}).current,
s = E.exports.useRef(r);
s.current = r, E.exports.useLayoutEffect(() => (xg.set(t, {
...xg.get(t),
disabled: e,
id: t,
ref: n
}), () => {
xg.delete(t)
}), [t, s, e, n]);
const d = u => {
var p;
const f = s.current;
return !!((u == null ? void 0 : u.type) && n.current !== ((p = u.ref) == null ? void 0 : p.current) && f.types.includes(u.type) && (!f.acceptsDrop || f.acceptsDrop(u)))
},
a = u => {
var p, m;
const f = cu(u);
f && ((m = (p = s.current).onDragLeave) == null || m.call(p, f))
};
return {
droppableProps: e ? {} : {
onDragOver: u => {
u.preventDefault(), u.stopPropagation()
},
onDragEnter: u => {
var p, m;
if (u.stopPropagation(), i.dragOverElements.add(u.target), i.dragOverElements.size > 1) return;
const f = cu(u);
f && d(f) && ((m = (p = s.current).onDragEnter) == null || m.call(p, f), clearTimeout(i.dropActivateTimer), typeof s.current.onDropActivate == "function" && (i.dropActivateTimer = setTimeout(() => {
var g, v;
f && ((v = (g = s.current).onDropActivate) == null || v.call(g, f))
}, oz)))
},
onDragLeave: u => {
u.stopPropagation(), i.dragOverElements.delete(u.target);
for (const p of i.dragOverElements) u.currentTarget.contains(p) || i.dragOverElements.delete(p);
if (i.dragOverElements.size > 0) return;
const f = cu(u);
f && d(f) && (a(u), clearTimeout(i.dropActivateTimer))
},
onDrop: async u => {
var p, m, g, v;
u.preventDefault(), u.stopPropagation(), i.dragOverElements.clear(), a(u), clearTimeout(i.dropActivateTimer);
const f = cu(u);
f && ((m = (p = s.current).onDragLeave) == null || m.call(p, f), d(f) && ((v = (g = s.current).onDrop) == null || v.call(g, f)))
}
}
}
}
function cu(t) {
if (I_.dragTargetId != null) return tz.get(I_.dragTargetId);
if (t.dataTransfer.types.includes("Files")) return {
type: "nativeFile",
el: null,
ref: null,
getData: () => iz(nz(t.dataTransfer))
}
}
function az({
children: t
}) {
const e = ae(r => r.bootstrapData),
n = E.exports.useMemo(() => ({
data: e,
setBootstrapData: () => {},
mergeBootstrapData: () => {},
invalidateBootstrapData: () => {}
}), [e]);
return _(Px.Provider, {
value: n,
children: t
})
}
function lz() {
var p, m, g, v;
const t = (p = ae(y => {
var b;
return (b = y.config.ui) == null ? void 0 : b.visible
})) != null ? p : !0,
e = (m = ae(y => {
var b, w;
return (w = (b = y.config.ui) == null ? void 0 : b.nav) == null ? void 0 : w.position
})) != null ? m : "bottom",
n = (g = ae(y => {
var b, w;
return (w = (b = y.config.ui) == null ? void 0 : b.menubar) == null ? void 0 : w.position
})) != null ? g : "top",
r = (v = ae(y => {
var b;
return (b = y.config.ui) == null ? void 0 : b.allowEditorClose
})) != null ? v : !0,
i = E.exports.useRef(null),
s = E.exports.useRef(null),
{
isModal: d,
isMobile: a
} = Xc(),
o = E.exports.useCallback(async y => {
var w, x, S;
if (A().activeTool || A().dirty || y.type !== "nativeFile") return;
const b = await y.getData();
!L().import.fileIsValid(b[0]) || ((S = (x = (w = A().config.tools) == null ? void 0 : w.import) == null ? void 0 : x.openDroppedImageAsBackground) != null && S ? await L().import.openBackgroundImage(b[0]) : await L().import.openUploadedFile(b[0]))
}, []),
{
droppableProps: c
} = sz({
id: "pixie-root",
ref: s,
types: ["nativeFile"],
onDrop: o
});
E.exports.useEffect(() => {
var w, x;
A().fabric || (ae.setState({
canvasRef: i
}), iD(i.current), (w = A().config.ui) != null && w.defaultTool && A().setActiveTool((x = A().config.ui) == null ? void 0 : x.defaultTool, null), L().canvas.loadInitialContent().then(() => {
var S, T;
(T = (S = A().config).onLoad) == null || T.call(S, A().editor)
}));
const y = qw(s, () => {
A().setStageSize(Zw(s.current))
}),
b = qw(i, () => {
A().setCanvasSize(Zw(i.current))
});
return () => {
y(), b()
}
}, [s]);
const h = {
visible: {
opacity: 1,
scale: 1,
display: "flex"
},
hidden: {
opacity: 0,
transitionEnd: {
display: "none"
}
}
},
l = he("pixie-root flex flex-col overflow-hidden bg-background text-main no-tap-highlight w-full h-full", {
relative: !d,
"fixed inset-0 w-full h-full z-20": d,
"shadow-lg border rounded-md m-auto max-h-[calc(100vh-90px)] max-w-[calc(100vw-90px)]": d && !a
});
return _(jM, {
features: BM,
strict: !0,
children: se(az, {
children: [d && t && !a && r && _(Re, {
className: "z-20 fixed right-2 top-2 text-white",
size: "lg",
onClick: () => {
A().editor.close()
},
children: _(Rr, {})
}), d && t && _(Yp, {
position: "fixed",
disableInitialTransition: !0
}), se(Et.div, {
initial: !1,
variants: h,
animate: t ? "visible" : "hidden",
className: l,
children: [n === "top" && _(Ix, {}), e === "top" && _(b_, {
className: "pt-14"
}), se("main", {
className: "relative flex-auto my-20 overflow-hidden outline-none",
tabIndex: -1,
...Co(c, {
onKeyDownCapture: ez
}),
ref: s,
children: [_(sI, {}), _(P6, {
ref: i
})]
}), _(u8, {}), e === "bottom" && _(b_, {}), n === "bottom" && _(Ix, {}), _(OF, {}), _(QF, {})]
})]
})
})
}
bu.enableBoundaryChecking(!1);
const _g = class {
constructor(e) {
Ce(this, "tools", {});
Ce(this, "fabric", null);
if (e.sentryDsn && YT({
dsn: e.sentryDsn
}), gS(Vk), !e.selector) throw new Error('Pixie required "selector" option.');
const n = document.querySelector(e.selector);
if (!n) return;
n.classList.add("pi"), jk(n), this.setConfig(e), ae.setState({
editor: this
}), zy(n).render(_(ue.StrictMode, {
children: _(lz, {})
}))
}
get state() {
return A()
}
get defaultConfig() {
return _g.defaultConfig
}
open(e = {}) {
var n;
(n = A().config.ui) != null && n.visible || (this.setConfig(Lg(e, {
ui: {
visible: !0
}
})), requestAnimationFrame(() => {
var r, i, s, d;
L().zoom.fitToScreen(), L().history.addInitial(), Cf() && ((i = (r = A().config.ui) == null ? void 0 : r.openImageDialog) == null ? void 0 : i.show) && this.togglePanel("newImage", !0), (d = (s = A().config).onOpen) == null || d.call(s)
}))
}
close() {
var e, n, r;
!((e = A().config.ui) != null && e.visible) || (this.setConfig({
ui: {
visible: !1
}
}), (r = (n = A().config).onClose) == null || r.call(n))
}
setConfig(e) {
A().setConfig(e)
}
uploadAndAddImage() {
return L().import.uploadAndAddImage()
}
uploadAndReplaceMainImage() {
return L().import.uploadAndReplaceMainImage()
}
uploadAndOpenStateFile() {
return L().import.uploadAndOpenStateFile()
}
newCanvas(e, n, r) {
return L().canvas.openNew(e, n, r)
}
getState(e) {
return JSON.stringify(Xa(e))
}
setState(e) {
return L().import.loadState(e)
}
async setStateFromUrl(e) {
const n = await Ya(e);
return L().import.loadState(n)
}
openTool(e) {
Sf(e)
}
applyChanges() {
A().applyChanges()
}
cancelChanges() {
A().cancelChanges()
}
async resetEditor(e) {
await _f(e), await L().canvas.loadInitialContent()
}
togglePanel(e, n) {
e === "objects" && A().togglePanel("history", !1), e === "history" && A().togglePanel("objects", !1), A().togglePanel(e, n)
}
on(e, n) {
var r;
(r = this.fabric) == null || r.on(e, n)
}
isDirty() {
return A().dirty
}
get(e) {
return this.tools[e]
}
notify(e) {
return Qo(e)
}
static init(e) {
return new Promise(n => {
const r = e.onLoad;
e.onLoad = i => {
r == null || r(i), n(i)
}, new this(e)
})
}
};
let ya = _g;
return Ce(ya, "defaultConfig", Wm), Ce(ya, "version", _5), ya
});
//# sourceMappingURL=pixie.umd.js.map