import { shallowRef as In, watchEffect as s0, readonly as o0, unref as H, getCurrentScope as a0, onScopeDispose as l0, getCurrentInstance as cn, onMounted as on, nextTick as Mt, watch as Ke, ref as Ae, defineComponent as De, openBlock as pe, createElementBlock as Re, createElementVNode as Be, warn as Kw, isVNode as ed, computed as ce, inject as ht, isRef as Ls, onBeforeUnmount as li, onBeforeMount as Qw, provide as gn, mergeProps as Oi, renderSlot as Xe, toRef as Bn, onUnmounted as c0, useAttrs as e1, useSlots as ou, createCommentVNode as Ge, Fragment as Wt, normalizeClass as Le, createBlock as He, withCtx as fe, resolveDynamicComponent as zn, withModifiers as fn, createVNode as ae, toDisplayString as wt, normalizeStyle as Ot, Transition as hl, withDirectives as Ft, vShow as xn, reactive as qn, onActivated as t1, onUpdated as sf, cloneVNode as n1, Text as u0, Comment as i1, Teleport as r1, onDeactivated as s1, toHandlers as o1, withKeys as vi, createTextVNode as yt, createSlots as a1, toRaw as of, toRefs as cr, resolveComponent as Xn, resolveDirective as l1, toHandlerKey as c1, renderList as ri, vModelText as u1, h as bo, createApp as h1, markRaw as Cn, hasInjectionContext as d1, effectScope as f1, isReactive as af, pushScopeId as p1, popScopeId as m1 } from "vue"; import { TreeControls as g1, CreateTooltipContent as v1, Tooltip as y1, DrawToolbar as b1 } from "@abi-software/map-utilities"; import { MapSvgIcon as x1, MapSvgSpriteColor as w1 } from "@abi-software/svg-sprite"; const Qi = (n, e, { checkForDefaultPrevented: t = !0 } = {}) => (r) => { const s = n == null ? void 0 : n(r); if (t === !1 || !s) return e == null ? void 0 : e(r); }; var M1 = Object.defineProperty, S1 = Object.defineProperties, _1 = Object.getOwnPropertyDescriptors, Gp = Object.getOwnPropertySymbols, T1 = Object.prototype.hasOwnProperty, E1 = Object.prototype.propertyIsEnumerable, Hp = (n, e, t) => e in n ? M1(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, A1 = (n, e) => { for (var t in e || (e = {})) T1.call(e, t) && Hp(n, t, e[t]); if (Gp) for (var t of Gp(e)) E1.call(e, t) && Hp(n, t, e[t]); return n; }, C1 = (n, e) => S1(n, _1(e)); function Wp(n, e) { var t; const i = In(); return s0(() => { i.value = n(); }, C1(A1({}, e), { flush: (t = void 0) != null ? t : "sync" })), o0(i); } var jp; const rn = typeof window < "u", L1 = (n) => typeof n == "string", h0 = () => { }, td = rn && ((jp = window == null ? void 0 : window.navigator) == null ? void 0 : jp.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent); function d0(n) { return typeof n == "function" ? n() : H(n); } function R1(n) { return n; } function au(n) { return a0() ? (l0(n), !0) : !1; } function P1(n, e = !0) { cn() ? on(n) : e ? n() : Mt(n); } function ir(n) { var e; const t = d0(n); return (e = t == null ? void 0 : t.$el) != null ? e : t; } const dl = rn ? window : void 0, I1 = rn ? window.document : void 0; function pn(...n) { let e, t, i, r; if (L1(n[0]) || Array.isArray(n[0]) ? ([t, i, r] = n, e = dl) : [e, t, i, r] = n, !e) return h0; Array.isArray(t) || (t = [t]), Array.isArray(i) || (i = [i]); const s = [], o = () => { s.forEach((d) => d()), s.length = 0; }, a = (d, h, p, g) => (d.addEventListener(h, p, g), () => d.removeEventListener(h, p, g)), c = Ke(() => [ir(e), d0(r)], ([d, h]) => { o(), d && s.push(...t.flatMap((p) => i.map((g) => a(d, p, g, h)))); }, { immediate: !0, flush: "post" }), l = () => { c(), o(); }; return au(l), l; } let $p = !1; function O1(n, e, t = {}) { const { window: i = dl, ignore: r = [], capture: s = !0, detectIframe: o = !1 } = t; if (!i) return; td && !$p && ($p = !0, Array.from(i.document.body.children).forEach((p) => p.addEventListener("click", h0))); let a = !0; const c = (p) => r.some((g) => { if (typeof g == "string") return Array.from(i.document.querySelectorAll(g)).some((f) => f === p.target || p.composedPath().includes(f)); { const f = ir(g); return f && (p.target === f || p.composedPath().includes(f)); } }), d = [ pn(i, "click", (p) => { const g = ir(n); if (!(!g || g === p.target || p.composedPath().includes(g))) { if (p.detail === 0 && (a = !c(p)), !a) { a = !0; return; } e(p); } }, { passive: !0, capture: s }), pn(i, "pointerdown", (p) => { const g = ir(n); g && (a = !p.composedPath().includes(g) && !c(p)); }, { passive: !0 }), o && pn(i, "blur", (p) => { var g; const f = ir(n); ((g = i.document.activeElement) == null ? void 0 : g.tagName) === "IFRAME" && !(f != null && f.contains(i.document.activeElement)) && e(p); }) ].filter(Boolean); return () => d.forEach((p) => p()); } function f0(n, e = !1) { const t = Ae(), i = () => t.value = !!n(); return i(), P1(i, e), t; } const Zp = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Xp = "__vueuse_ssr_handlers__"; Zp[Xp] = Zp[Xp] || {}; function D1({ document: n = I1 } = {}) { if (!n) return Ae("visible"); const e = Ae(n.visibilityState); return pn(n, "visibilitychange", () => { e.value = n.visibilityState; }), e; } var Yp = Object.getOwnPropertySymbols, N1 = Object.prototype.hasOwnProperty, F1 = Object.prototype.propertyIsEnumerable, B1 = (n, e) => { var t = {}; for (var i in n) N1.call(n, i) && e.indexOf(i) < 0 && (t[i] = n[i]); if (n != null && Yp) for (var i of Yp(n)) e.indexOf(i) < 0 && F1.call(n, i) && (t[i] = n[i]); return t; }; function ii(n, e, t = {}) { const i = t, { window: r = dl } = i, s = B1(i, ["window"]); let o; const a = f0(() => r && "ResizeObserver" in r), c = () => { o && (o.disconnect(), o = void 0); }, l = Ke(() => ir(n), (h) => { c(), a.value && r && h && (o = new ResizeObserver(e), o.observe(h, s)); }, { immediate: !0, flush: "post" }), d = () => { c(), l(); }; return au(d), { isSupported: a, stop: d }; } var Jp = Object.getOwnPropertySymbols, z1 = Object.prototype.hasOwnProperty, U1 = Object.prototype.propertyIsEnumerable, V1 = (n, e) => { var t = {}; for (var i in n) z1.call(n, i) && e.indexOf(i) < 0 && (t[i] = n[i]); if (n != null && Jp) for (var i of Jp(n)) e.indexOf(i) < 0 && U1.call(n, i) && (t[i] = n[i]); return t; }; function k1(n, e, t = {}) { const i = t, { window: r = dl } = i, s = V1(i, ["window"]); let o; const a = f0(() => r && "MutationObserver" in r), c = () => { o && (o.disconnect(), o = void 0); }, l = Ke(() => ir(n), (h) => { c(), a.value && r && h && (o = new MutationObserver(e), o.observe(h, s)); }, { immediate: !0 }), d = () => { c(), l(); }; return au(d), { isSupported: a, stop: d }; } var qp; (function(n) { n.UP = "UP", n.RIGHT = "RIGHT", n.DOWN = "DOWN", n.LEFT = "LEFT", n.NONE = "NONE"; })(qp || (qp = {})); var G1 = Object.defineProperty, Kp = Object.getOwnPropertySymbols, H1 = Object.prototype.hasOwnProperty, W1 = Object.prototype.propertyIsEnumerable, Qp = (n, e, t) => e in n ? G1(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, j1 = (n, e) => { for (var t in e || (e = {})) H1.call(e, t) && Qp(n, t, e[t]); if (Kp) for (var t of Kp(e)) W1.call(e, t) && Qp(n, t, e[t]); return n; }; const $1 = { easeInSine: [0.12, 0, 0.39, 0], easeOutSine: [0.61, 1, 0.88, 1], easeInOutSine: [0.37, 0, 0.63, 1], easeInQuad: [0.11, 0, 0.5, 0], easeOutQuad: [0.5, 1, 0.89, 1], easeInOutQuad: [0.45, 0, 0.55, 1], easeInCubic: [0.32, 0, 0.67, 0], easeOutCubic: [0.33, 1, 0.68, 1], easeInOutCubic: [0.65, 0, 0.35, 1], easeInQuart: [0.5, 0, 0.75, 0], easeOutQuart: [0.25, 1, 0.5, 1], easeInOutQuart: [0.76, 0, 0.24, 1], easeInQuint: [0.64, 0, 0.78, 0], easeOutQuint: [0.22, 1, 0.36, 1], easeInOutQuint: [0.83, 0, 0.17, 1], easeInExpo: [0.7, 0, 0.84, 0], easeOutExpo: [0.16, 1, 0.3, 1], easeInOutExpo: [0.87, 0, 0.13, 1], easeInCirc: [0.55, 0, 1, 0.45], easeOutCirc: [0, 0.55, 0.45, 1], easeInOutCirc: [0.85, 0, 0.15, 1], easeInBack: [0.36, 0, 0.66, -0.56], easeOutBack: [0.34, 1.56, 0.64, 1], easeInOutBack: [0.68, -0.6, 0.32, 1.6] }; j1({ linear: R1 }, $1); function Z1({ window: n = dl } = {}) { if (!n) return Ae(!1); const e = Ae(n.document.hasFocus()); return pn(n, "blur", () => { e.value = !1; }), pn(n, "focus", () => { e.value = !0; }), e; } const X1 = () => rn && /firefox/i.test(window.navigator.userAgent); /** * @vue/shared v3.5.11 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/ process.env.NODE_ENV !== "production" && Object.freeze({}); process.env.NODE_ENV !== "production" && Object.freeze([]); const $a = () => { }, Y1 = Object.prototype.hasOwnProperty, em = (n, e) => Y1.call(n, e), Un = Array.isArray, Ln = (n) => typeof n == "function", On = (n) => typeof n == "string", Pn = (n) => n !== null && typeof n == "object", J1 = Object.prototype.toString, q1 = (n) => J1.call(n), ju = (n) => q1(n).slice(8, -1), lf = (n) => { const e = /* @__PURE__ */ Object.create(null); return (t) => e[t] || (e[t] = n(t)); }, K1 = /-(\w)/g, Q1 = lf( (n) => n.replace(K1, (e, t) => t ? t.toUpperCase() : "") ), eM = /\B([A-Z])/g, tM = lf( (n) => n.replace(eM, "-$1").toLowerCase() ), nM = lf((n) => n.charAt(0).toUpperCase() + n.slice(1)); var p0 = typeof global == "object" && global && global.Object === Object && global, iM = typeof self == "object" && self && self.Object === Object && self, Gi = p0 || iM || Function("return this")(), Bi = Gi.Symbol, m0 = Object.prototype, rM = m0.hasOwnProperty, sM = m0.toString, ga = Bi ? Bi.toStringTag : void 0; function oM(n) { var e = rM.call(n, ga), t = n[ga]; try { n[ga] = void 0; var i = !0; } catch { } var r = sM.call(n); return i && (e ? n[ga] = t : delete n[ga]), r; } var aM = Object.prototype, lM = aM.toString; function cM(n) { return lM.call(n); } var uM = "[object Null]", hM = "[object Undefined]", tm = Bi ? Bi.toStringTag : void 0; function ta(n) { return n == null ? n === void 0 ? hM : uM : tm && tm in Object(n) ? oM(n) : cM(n); } function Co(n) { return n != null && typeof n == "object"; } var dM = "[object Symbol]"; function lu(n) { return typeof n == "symbol" || Co(n) && ta(n) == dM; } function fM(n, e) { for (var t = -1, i = n == null ? 0 : n.length, r = Array(i); ++t < i; ) r[t] = e(n[t], t, n); return r; } var xi = Array.isArray, pM = 1 / 0, nm = Bi ? Bi.prototype : void 0, im = nm ? nm.toString : void 0; function g0(n) { if (typeof n == "string") return n; if (xi(n)) return fM(n, g0) + ""; if (lu(n)) return im ? im.call(n) : ""; var e = n + ""; return e == "0" && 1 / n == -pM ? "-0" : e; } var mM = /\s/; function gM(n) { for (var e = n.length; e-- && mM.test(n.charAt(e)); ) ; return e; } var vM = /^\s+/; function yM(n) { return n && n.slice(0, gM(n) + 1).replace(vM, ""); } function Wr(n) { var e = typeof n; return n != null && (e == "object" || e == "function"); } var rm = NaN, bM = /^[-+]0x[0-9a-f]+$/i, xM = /^0b[01]+$/i, wM = /^0o[0-7]+$/i, MM = parseInt; function sm(n) { if (typeof n == "number") return n; if (lu(n)) return rm; if (Wr(n)) { var e = typeof n.valueOf == "function" ? n.valueOf() : n; n = Wr(e) ? e + "" : e; } if (typeof n != "string") return n === 0 ? n : +n; n = yM(n); var t = xM.test(n); return t || wM.test(n) ? MM(n.slice(2), t ? 2 : 8) : bM.test(n) ? rm : +n; } function v0(n) { return n; } var SM = "[object AsyncFunction]", _M = "[object Function]", TM = "[object GeneratorFunction]", EM = "[object Proxy]"; function y0(n) { if (!Wr(n)) return !1; var e = ta(n); return e == _M || e == TM || e == SM || e == EM; } var $u = Gi["__core-js_shared__"], om = function() { var n = /[^.]+$/.exec($u && $u.keys && $u.keys.IE_PROTO || ""); return n ? "Symbol(src)_1." + n : ""; }(); function AM(n) { return !!om && om in n; } var CM = Function.prototype, LM = CM.toString; function Vs(n) { if (n != null) { try { return LM.call(n); } catch { } try { return n + ""; } catch { } } return ""; } var RM = /[\\^$.*+?()[\]{}|]/g, PM = /^\[object .+?Constructor\]$/, IM = Function.prototype, OM = Object.prototype, DM = IM.toString, NM = OM.hasOwnProperty, FM = RegExp( "^" + DM.call(NM).replace(RM, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); function BM(n) { if (!Wr(n) || AM(n)) return !1; var e = y0(n) ? FM : PM; return e.test(Vs(n)); } function zM(n, e) { return n == null ? void 0 : n[e]; } function ks(n, e) { var t = zM(n, e); return BM(t) ? t : void 0; } var nd = ks(Gi, "WeakMap"); function UM(n, e, t) { switch (t.length) { case 0: return n.call(e); case 1: return n.call(e, t[0]); case 2: return n.call(e, t[0], t[1]); case 3: return n.call(e, t[0], t[1], t[2]); } return n.apply(e, t); } var VM = 800, kM = 16, GM = Date.now; function HM(n) { var e = 0, t = 0; return function() { var i = GM(), r = kM - (i - t); if (t = i, r > 0) { if (++e >= VM) return arguments[0]; } else e = 0; return n.apply(void 0, arguments); }; } function WM(n) { return function() { return n; }; } var Hc = function() { try { var n = ks(Object, "defineProperty"); return n({}, "", {}), n; } catch { } }(), jM = Hc ? function(n, e) { return Hc(n, "toString", { configurable: !0, enumerable: !1, value: WM(e), writable: !0 }); } : v0, $M = HM(jM); function ZM(n, e, t, i) { n.length; for (var r = t + 1; r--; ) if (e(n[r], r, n)) return r; return -1; } var XM = 9007199254740991, YM = /^(?:0|[1-9]\d*)$/; function cf(n, e) { var t = typeof n; return e = e ?? XM, !!e && (t == "number" || t != "symbol" && YM.test(n)) && n > -1 && n % 1 == 0 && n < e; } function JM(n, e, t) { e == "__proto__" && Hc ? Hc(n, e, { configurable: !0, enumerable: !0, value: t, writable: !0 }) : n[e] = t; } function uf(n, e) { return n === e || n !== n && e !== e; } var qM = Object.prototype, KM = qM.hasOwnProperty; function QM(n, e, t) { var i = n[e]; (!(KM.call(n, e) && uf(i, t)) || t === void 0 && !(e in n)) && JM(n, e, t); } var am = Math.max; function eS(n, e, t) { return e = am(e === void 0 ? n.length - 1 : e, 0), function() { for (var i = arguments, r = -1, s = am(i.length - e, 0), o = Array(s); ++r < s; ) o[r] = i[e + r]; r = -1; for (var a = Array(e + 1); ++r < e; ) a[r] = i[r]; return a[e] = t(o), UM(n, this, a); }; } var tS = 9007199254740991; function hf(n) { return typeof n == "number" && n > -1 && n % 1 == 0 && n <= tS; } function nS(n) { return n != null && hf(n.length) && !y0(n); } var iS = Object.prototype; function rS(n) { var e = n && n.constructor, t = typeof e == "function" && e.prototype || iS; return n === t; } function sS(n, e) { for (var t = -1, i = Array(n); ++t < n; ) i[t] = e(t); return i; } var oS = "[object Arguments]"; function lm(n) { return Co(n) && ta(n) == oS; } var b0 = Object.prototype, aS = b0.hasOwnProperty, lS = b0.propertyIsEnumerable, df = lm(/* @__PURE__ */ function() { return arguments; }()) ? lm : function(n) { return Co(n) && aS.call(n, "callee") && !lS.call(n, "callee"); }; function cS() { return !1; } var x0 = typeof exports == "object" && exports && !exports.nodeType && exports, cm = x0 && typeof module == "object" && module && !module.nodeType && module, uS = cm && cm.exports === x0, um = uS ? Gi.Buffer : void 0, hS = um ? um.isBuffer : void 0, id = hS || cS, dS = "[object Arguments]", fS = "[object Array]", pS = "[object Boolean]", mS = "[object Date]", gS = "[object Error]", vS = "[object Function]", yS = "[object Map]", bS = "[object Number]", xS = "[object Object]", wS = "[object RegExp]", MS = "[object Set]", SS = "[object String]", _S = "[object WeakMap]", TS = "[object ArrayBuffer]", ES = "[object DataView]", AS = "[object Float32Array]", CS = "[object Float64Array]", LS = "[object Int8Array]", RS = "[object Int16Array]", PS = "[object Int32Array]", IS = "[object Uint8Array]", OS = "[object Uint8ClampedArray]", DS = "[object Uint16Array]", NS = "[object Uint32Array]", Pt = {}; Pt[AS] = Pt[CS] = Pt[LS] = Pt[RS] = Pt[PS] = Pt[IS] = Pt[OS] = Pt[DS] = Pt[NS] = !0; Pt[dS] = Pt[fS] = Pt[TS] = Pt[pS] = Pt[ES] = Pt[mS] = Pt[gS] = Pt[vS] = Pt[yS] = Pt[bS] = Pt[xS] = Pt[wS] = Pt[MS] = Pt[SS] = Pt[_S] = !1; function FS(n) { return Co(n) && hf(n.length) && !!Pt[ta(n)]; } function BS(n) { return function(e) { return n(e); }; } var w0 = typeof exports == "object" && exports && !exports.nodeType && exports, Ba = w0 && typeof module == "object" && module && !module.nodeType && module, zS = Ba && Ba.exports === w0, Zu = zS && p0.process, hm = function() { try { var n = Ba && Ba.require && Ba.require("util").types; return n || Zu && Zu.binding && Zu.binding("util"); } catch { } }(), dm = hm && hm.isTypedArray, M0 = dm ? BS(dm) : FS, US = Object.prototype, VS = US.hasOwnProperty; function kS(n, e) { var t = xi(n), i = !t && df(n), r = !t && !i && id(n), s = !t && !i && !r && M0(n), o = t || i || r || s, a = o ? sS(n.length, String) : [], c = a.length; for (var l in n) VS.call(n, l) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode. (l == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. r && (l == "offset" || l == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. s && (l == "buffer" || l == "byteLength" || l == "byteOffset") || // Skip index properties. cf(l, c))) && a.push(l); return a; } function GS(n, e) { return function(t) { return n(e(t)); }; } var HS = GS(Object.keys, Object), WS = Object.prototype, jS = WS.hasOwnProperty; function $S(n) { if (!rS(n)) return HS(n); var e = []; for (var t in Object(n)) jS.call(n, t) && t != "constructor" && e.push(t); return e; } function S0(n) { return nS(n) ? kS(n) : $S(n); } var ZS = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, XS = /^\w*$/; function ff(n, e) { if (xi(n)) return !1; var t = typeof n; return t == "number" || t == "symbol" || t == "boolean" || n == null || lu(n) ? !0 : XS.test(n) || !ZS.test(n) || e != null && n in Object(e); } var Za = ks(Object, "create"); function YS() { this.__data__ = Za ? Za(null) : {}, this.size = 0; } function JS(n) { var e = this.has(n) && delete this.__data__[n]; return this.size -= e ? 1 : 0, e; } var qS = "__lodash_hash_undefined__", KS = Object.prototype, QS = KS.hasOwnProperty; function e_(n) { var e = this.__data__; if (Za) { var t = e[n]; return t === qS ? void 0 : t; } return QS.call(e, n) ? e[n] : void 0; } var t_ = Object.prototype, n_ = t_.hasOwnProperty; function i_(n) { var e = this.__data__; return Za ? e[n] !== void 0 : n_.call(e, n); } var r_ = "__lodash_hash_undefined__"; function s_(n, e) { var t = this.__data__; return this.size += this.has(n) ? 0 : 1, t[n] = Za && e === void 0 ? r_ : e, this; } function Rs(n) { var e = -1, t = n == null ? 0 : n.length; for (this.clear(); ++e < t; ) { var i = n[e]; this.set(i[0], i[1]); } } Rs.prototype.clear = YS; Rs.prototype.delete = JS; Rs.prototype.get = e_; Rs.prototype.has = i_; Rs.prototype.set = s_; function o_() { this.__data__ = [], this.size = 0; } function cu(n, e) { for (var t = n.length; t--; ) if (uf(n[t][0], e)) return t; return -1; } var a_ = Array.prototype, l_ = a_.splice; function c_(n) { var e = this.__data__, t = cu(e, n); if (t < 0) return !1; var i = e.length - 1; return t == i ? e.pop() : l_.call(e, t, 1), --this.size, !0; } function u_(n) { var e = this.__data__, t = cu(e, n); return t < 0 ? void 0 : e[t][1]; } function h_(n) { return cu(this.__data__, n) > -1; } function d_(n, e) { var t = this.__data__, i = cu(t, n); return i < 0 ? (++this.size, t.push([n, e])) : t[i][1] = e, this; } function pr(n) { var e = -1, t = n == null ? 0 : n.length; for (this.clear(); ++e < t; ) { var i = n[e]; this.set(i[0], i[1]); } } pr.prototype.clear = o_; pr.prototype.delete = c_; pr.prototype.get = u_; pr.prototype.has = h_; pr.prototype.set = d_; var Xa = ks(Gi, "Map"); function f_() { this.size = 0, this.__data__ = { hash: new Rs(), map: new (Xa || pr)(), string: new Rs() }; } function p_(n) { var e = typeof n; return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? n !== "__proto__" : n === null; } function uu(n, e) { var t = n.__data__; return p_(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map; } function m_(n) { var e = uu(this, n).delete(n); return this.size -= e ? 1 : 0, e; } function g_(n) { return uu(this, n).get(n); } function v_(n) { return uu(this, n).has(n); } function y_(n, e) { var t = uu(this, n), i = t.size; return t.set(n, e), this.size += t.size == i ? 0 : 1, this; } function mr(n) { var e = -1, t = n == null ? 0 : n.length; for (this.clear(); ++e < t; ) { var i = n[e]; this.set(i[0], i[1]); } } mr.prototype.clear = f_; mr.prototype.delete = m_; mr.prototype.get = g_; mr.prototype.has = v_; mr.prototype.set = y_; var b_ = "Expected a function"; function pf(n, e) { if (typeof n != "function" || e != null && typeof e != "function") throw new TypeError(b_); var t = function() { var i = arguments, r = e ? e.apply(this, i) : i[0], s = t.cache; if (s.has(r)) return s.get(r); var o = n.apply(this, i); return t.cache = s.set(r, o) || s, o; }; return t.cache = new (pf.Cache || mr)(), t; } pf.Cache = mr; var x_ = 500; function w_(n) { var e = pf(n, function(i) { return t.size === x_ && t.clear(), i; }), t = e.cache; return e; } var M_ = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, S_ = /\\(\\)?/g, __ = w_(function(n) { var e = []; return n.charCodeAt(0) === 46 && e.push(""), n.replace(M_, function(t, i, r, s) { e.push(r ? s.replace(S_, "$1") : i || t); }), e; }); function T_(n) { return n == null ? "" : g0(n); } function hu(n, e) { return xi(n) ? n : ff(n, e) ? [n] : __(T_(n)); } var E_ = 1 / 0; function fl(n) { if (typeof n == "string" || lu(n)) return n; var e = n + ""; return e == "0" && 1 / n == -E_ ? "-0" : e; } function mf(n, e) { e = hu(e, n); for (var t = 0, i = e.length; n != null && t < i; ) n = n[fl(e[t++])]; return t && t == i ? n : void 0; } function er(n, e, t) { var i = n == null ? void 0 : mf(n, e); return i === void 0 ? t : i; } function _0(n, e) { for (var t = -1, i = e.length, r = n.length; ++t < i; ) n[r + t] = e[t]; return n; } var fm = Bi ? Bi.isConcatSpreadable : void 0; function A_(n) { return xi(n) || df(n) || !!(fm && n && n[fm]); } function C_(n, e, t, i, r) { var s = -1, o = n.length; for (t || (t = A_), r || (r = []); ++s < o; ) { var a = n[s]; t(a) ? _0(r, a) : r[r.length] = a; } return r; } function L_(n) { var e = n == null ? 0 : n.length; return e ? C_(n) : []; } function R_(n) { return $M(eS(n, void 0, L_), n + ""); } function Ri() { if (!arguments.length) return []; var n = arguments[0]; return xi(n) ? n : [n]; } function P_() { this.__data__ = new pr(), this.size = 0; } function I_(n) { var e = this.__data__, t = e.delete(n); return this.size = e.size, t; } function O_(n) { return this.__data__.get(n); } function D_(n) { return this.__data__.has(n); } var N_ = 200; function F_(n, e) { var t = this.__data__; if (t instanceof pr) { var i = t.__data__; if (!Xa || i.length < N_ - 1) return i.push([n, e]), this.size = ++t.size, this; t = this.__data__ = new mr(i); } return t.set(n, e), this.size = t.size, this; } function rr(n) { var e = this.__data__ = new pr(n); this.size = e.size; } rr.prototype.clear = P_; rr.prototype.delete = I_; rr.prototype.get = O_; rr.prototype.has = D_; rr.prototype.set = F_; function B_(n, e) { for (var t = -1, i = n == null ? 0 : n.length, r = 0, s = []; ++t < i; ) { var o = n[t]; e(o, t, n) && (s[r++] = o); } return s; } function z_() { return []; } var U_ = Object.prototype, V_ = U_.propertyIsEnumerable, pm = Object.getOwnPropertySymbols, k_ = pm ? function(n) { return n == null ? [] : (n = Object(n), B_(pm(n), function(e) { return V_.call(n, e); })); } : z_; function G_(n, e, t) { var i = e(n); return xi(n) ? i : _0(i, t(n)); } function mm(n) { return G_(n, S0, k_); } var rd = ks(Gi, "DataView"), sd = ks(Gi, "Promise"), od = ks(Gi, "Set"), gm = "[object Map]", H_ = "[object Object]", vm = "[object Promise]", ym = "[object Set]", bm = "[object WeakMap]", xm = "[object DataView]", W_ = Vs(rd), j_ = Vs(Xa), $_ = Vs(sd), Z_ = Vs(od), X_ = Vs(nd), Nr = ta; (rd && Nr(new rd(new ArrayBuffer(1))) != xm || Xa && Nr(new Xa()) != gm || sd && Nr(sd.resolve()) != vm || od && Nr(new od()) != ym || nd && Nr(new nd()) != bm) && (Nr = function(n) { var e = ta(n), t = e == H_ ? n.constructor : void 0, i = t ? Vs(t) : ""; if (i) switch (i) { case W_: return xm; case j_: return gm; case $_: return vm; case Z_: return ym; case X_: return bm; } return e; }); var wm = Gi.Uint8Array, Y_ = "__lodash_hash_undefined__"; function J_(n) { return this.__data__.set(n, Y_), this; } function q_(n) { return this.__data__.has(n); } function Wc(n) { var e = -1, t = n == null ? 0 : n.length; for (this.__data__ = new mr(); ++e < t; ) this.add(n[e]); } Wc.prototype.add = Wc.prototype.push = J_; Wc.prototype.has = q_; function K_(n, e) { for (var t = -1, i = n == null ? 0 : n.length; ++t < i; ) if (e(n[t], t, n)) return !0; return !1; } function Q_(n, e) { return n.has(e); } var eT = 1, tT = 2; function T0(n, e, t, i, r, s) { var o = t & eT, a = n.length, c = e.length; if (a != c && !(o && c > a)) return !1; var l = s.get(n), d = s.get(e); if (l && d) return l == e && d == n; var h = -1, p = !0, g = t & tT ? new Wc() : void 0; for (s.set(n, e), s.set(e, n); ++h < a; ) { var f = n[h], u = e[h]; if (i) var y = o ? i(u, f, h, e, n, s) : i(f, u, h, n, e, s); if (y !== void 0) { if (y) continue; p = !1; break; } if (g) { if (!K_(e, function(v, m) { if (!Q_(g, m) && (f === v || r(f, v, t, i, s))) return g.push(m); })) { p = !1; break; } } else if (!(f === u || r(f, u, t, i, s))) { p = !1; break; } } return s.delete(n), s.delete(e), p; } function nT(n) { var e = -1, t = Array(n.size); return n.forEach(function(i, r) { t[++e] = [r, i]; }), t; } function iT(n) { var e = -1, t = Array(n.size); return n.forEach(function(i) { t[++e] = i; }), t; } var rT = 1, sT = 2, oT = "[object Boolean]", aT = "[object Date]", lT = "[object Error]", cT = "[object Map]", uT = "[object Number]", hT = "[object RegExp]", dT = "[object Set]", fT = "[object String]", pT = "[object Symbol]", mT = "[object ArrayBuffer]", gT = "[object DataView]", Mm = Bi ? Bi.prototype : void 0, Xu = Mm ? Mm.valueOf : void 0; function vT(n, e, t, i, r, s, o) { switch (t) { case gT: if (n.byteLength != e.byteLength || n.byteOffset != e.byteOffset) return !1; n = n.buffer, e = e.buffer; case mT: return !(n.byteLength != e.byteLength || !s(new wm(n), new wm(e))); case oT: case aT: case uT: return uf(+n, +e); case lT: return n.name == e.name && n.message == e.message; case hT: case fT: return n == e + ""; case cT: var a = nT; case dT: var c = i & rT; if (a || (a = iT), n.size != e.size && !c) return !1; var l = o.get(n); if (l) return l == e; i |= sT, o.set(n, e); var d = T0(a(n), a(e), i, r, s, o); return o.delete(n), d; case pT: if (Xu) return Xu.call(n) == Xu.call(e); } return !1; } var yT = 1, bT = Object.prototype, xT = bT.hasOwnProperty; function wT(n, e, t, i, r, s) { var o = t & yT, a = mm(n), c = a.length, l = mm(e), d = l.length; if (c != d && !o) return !1; for (var h = c; h--; ) { var p = a[h]; if (!(o ? p in e : xT.call(e, p))) return !1; } var g = s.get(n), f = s.get(e); if (g && f) return g == e && f == n; var u = !0; s.set(n, e), s.set(e, n); for (var y = o; ++h < c; ) { p = a[h]; var v = n[p], m = e[p]; if (i) var w = o ? i(m, v, p, e, n, s) : i(v, m, p, n, e, s); if (!(w === void 0 ? v === m || r(v, m, t, i, s) : w)) { u = !1; break; } y || (y = p == "constructor"); } if (u && !y) { var S = n.constructor, T = e.constructor; S != T && "constructor" in n && "constructor" in e && !(typeof S == "function" && S instanceof S && typeof T == "function" && T instanceof T) && (u = !1); } return s.delete(n), s.delete(e), u; } var MT = 1, Sm = "[object Arguments]", _m = "[object Array]", Nl = "[object Object]", ST = Object.prototype, Tm = ST.hasOwnProperty; function _T(n, e, t, i, r, s) { var o = xi(n), a = xi(e), c = o ? _m : Nr(n), l = a ? _m : Nr(e); c = c == Sm ? Nl : c, l = l == Sm ? Nl : l; var d = c == Nl, h = l == Nl, p = c == l; if (p && id(n)) { if (!id(e)) return !1; o = !0, d = !1; } if (p && !d) return s || (s = new rr()), o || M0(n) ? T0(n, e, t, i, r, s) : vT(n, e, c, t, i, r, s); if (!(t & MT)) { var g = d && Tm.call(n, "__wrapped__"), f = h && Tm.call(e, "__wrapped__"); if (g || f) { var u = g ? n.value() : n, y = f ? e.value() : e; return s || (s = new rr()), r(u, y, t, i, s); } } return p ? (s || (s = new rr()), wT(n, e, t, i, r, s)) : !1; } function du(n, e, t, i, r) { return n === e ? !0 : n == null || e == null || !Co(n) && !Co(e) ? n !== n && e !== e : _T(n, e, t, i, du, r); } var TT = 1, ET = 2; function AT(n, e, t, i) { var r = t.length, s = r; if (n == null) return !s; for (n = Object(n); r--; ) { var o = t[r]; if (o[2] ? o[1] !== n[o[0]] : !(o[0] in n)) return !1; } for (; ++r < s; ) { o = t[r]; var a = o[0], c = n[a], l = o[1]; if (o[2]) { if (c === void 0 && !(a in n)) return !1; } else { var d = new rr(), h; if (!(h === void 0 ? du(l, c, TT | ET, i, d) : h)) return !1; } } return !0; } function E0(n) { return n === n && !Wr(n); } function CT(n) { for (var e = S0(n), t = e.length; t--; ) { var i = e[t], r = n[i]; e[t] = [i, r, E0(r)]; } return e; } function A0(n, e) { return function(t) { return t == null ? !1 : t[n] === e && (e !== void 0 || n in Object(t)); }; } function LT(n) { var e = CT(n); return e.length == 1 && e[0][2] ? A0(e[0][0], e[0][1]) : function(t) { return t === n || AT(t, n, e); }; } function RT(n, e) { return n != null && e in Object(n); } function PT(n, e, t) { e = hu(e, n); for (var i = -1, r = e.length, s = !1; ++i < r; ) { var o = fl(e[i]); if (!(s = n != null && t(n, o))) break; n = n[o]; } return s || ++i != r ? s : (r = n == null ? 0 : n.length, !!r && hf(r) && cf(o, r) && (xi(n) || df(n))); } function C0(n, e) { return n != null && PT(n, e, RT); } var IT = 1, OT = 2; function DT(n, e) { return ff(n) && E0(e) ? A0(fl(n), e) : function(t) { var i = er(t, n); return i === void 0 && i === e ? C0(t, n) : du(e, i, IT | OT); }; } function NT(n) { return function(e) { return e == null ? void 0 : e[n]; }; } function FT(n) { return function(e) { return mf(e, n); }; } function BT(n) { return ff(n) ? NT(fl(n)) : FT(n); } function zT(n) { return typeof n == "function" ? n : n == null ? v0 : typeof n == "object" ? xi(n) ? DT(n[0], n[1]) : LT(n) : BT(n); } var Yu = function() { return Gi.Date.now(); }, UT = "Expected a function", VT = Math.max, kT = Math.min; function ad(n, e, t) { var i, r, s, o, a, c, l = 0, d = !1, h = !1, p = !0; if (typeof n != "function") throw new TypeError(UT); e = sm(e) || 0, Wr(t) && (d = !!t.leading, h = "maxWait" in t, s = h ? VT(sm(t.maxWait) || 0, e) : s, p = "trailing" in t ? !!t.trailing : p); function g(M) { var x = i, _ = r; return i = r = void 0, l = M, o = n.apply(_, x), o; } function f(M) { return l = M, a = setTimeout(v, e), d ? g(M) : o; } function u(M) { var x = M - c, _ = M - l, E = e - x; return h ? kT(E, s - _) : E; } function y(M) { var x = M - c, _ = M - l; return c === void 0 || x >= e || x < 0 || h && _ >= s; } function v() { var M = Yu(); if (y(M)) return m(M); a = setTimeout(v, u(M)); } function m(M) { return a = void 0, p && i ? g(M) : (i = r = void 0, o); } function w() { a !== void 0 && clearTimeout(a), l = 0, i = c = r = a = void 0; } function S() { return a === void 0 ? o : m(Yu()); } function T() { var M = Yu(), x = y(M); if (i = arguments, r = this, c = M, x) { if (a === void 0) return f(c); if (h) return clearTimeout(a), a = setTimeout(v, e), g(c); } return a === void 0 && (a = setTimeout(v, e)), o; } return T.cancel = w, T.flush = S, T; } function GT(n, e, t) { var i = n == null ? 0 : n.length; if (!i) return -1; var r = i - 1; return ZM(n, zT(e), r); } function jc(n) { for (var e = -1, t = n == null ? 0 : n.length, i = {}; ++e < t; ) { var r = n[e]; i[r[0]] = r[1]; } return i; } function ld(n, e) { return du(n, e); } function sr(n) { return n == null; } function HT(n) { return n === void 0; } function WT(n, e, t, i) { if (!Wr(n)) return n; e = hu(e, n); for (var r = -1, s = e.length, o = s - 1, a = n; a != null && ++r < s; ) { var c = fl(e[r]), l = t; if (c === "__proto__" || c === "constructor" || c === "prototype") return n; if (r != o) { var d = a[c]; l = void 0, l === void 0 && (l = Wr(d) ? d : cf(e[r + 1]) ? [] : {}); } QM(a, c, l), a = a[c]; } return n; } function jT(n, e, t) { for (var i = -1, r = e.length, s = {}; ++i < r; ) { var o = e[i], a = mf(n, o); t(a, o) && WT(s, hu(o, n), a); } return s; } function $T(n, e) { return jT(n, e, function(t, i) { return C0(n, i); }); } var ZT = R_(function(n, e) { return n == null ? {} : $T(n, e); }); const yi = (n) => n === void 0, gf = (n) => typeof n == "boolean", St = (n) => typeof n == "number", Ms = (n) => typeof Element > "u" ? !1 : n instanceof Element, XT = (n) => On(n) ? !Number.isNaN(Number(n)) : !1, YT = (n = "") => n.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"), Br = (n) => nM(n), Em = (n) => Object.keys(n); class L0 extends Error { constructor(e) { super(e), this.name = "ElementPlusError"; } } function na(n, e) { throw new L0(`[${n}] ${e}`); } function en(n, e) { if (process.env.NODE_ENV !== "production") { const t = On(n) ? new L0(`[${n}] ${e}`) : n; console.warn(t); } } const JT = "utils/dom/style", R0 = (n = "") => n.split(" ").filter((e) => !!e.trim()), Am = (n, e) => { !n || !e.trim() || n.classList.add(...R0(e)); }, $c = (n, e) => { !n || !e.trim() || n.classList.remove(...R0(e)); }, va = (n, e) => { var t; if (!rn || !n || !e) return ""; let i = Q1(e); i === "float" && (i = "cssFloat"); try { const r = n.style[i]; if (r) return r; const s = (t = document.defaultView) == null ? void 0 : t.getComputedStyle(n, ""); return s ? s[i] : ""; } catch { return n.style[i]; } }; function Zc(n, e = "px") { if (!n) return ""; if (St(n) || XT(n)) return `${n}${e}`; if (On(n)) return n; en(JT, "binding value must be a string or number"); } function qT(n, e) { if (!rn) return; if (!e) { n.scrollTop = 0; return; } const t = []; let i = e.offsetParent; for (; i !== null && n !== i && n.contains(i); ) t.push(i), i = i.offsetParent; const r = e.offsetTop + t.reduce((c, l) => c + l.offsetTop, 0), s = r + e.offsetHeight, o = n.scrollTop, a = o + n.clientHeight; r < o ? n.scrollTop = r : s > a && (n.scrollTop = s - n.clientHeight); } /*! Element Plus Icons Vue v2.3.1 */ var KT = /* @__PURE__ */ De({ name: "ArrowDown", __name: "arrow-down", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z" }) ])); } }), vf = KT, QT = /* @__PURE__ */ De({ name: "ArrowLeft", __name: "arrow-left", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z" }) ])); } }), jr = QT, eE = /* @__PURE__ */ De({ name: "ArrowRight", __name: "arrow-right", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z" }) ])); } }), $r = eE, tE = /* @__PURE__ */ De({ name: "ArrowUp", __name: "arrow-up", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0" }) ])); } }), nE = tE, iE = /* @__PURE__ */ De({ name: "CircleCheck", __name: "circle-check", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896" }), Be("path", { fill: "currentColor", d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z" }) ])); } }), rE = iE, sE = /* @__PURE__ */ De({ name: "CircleClose", __name: "circle-close", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z" }), Be("path", { fill: "currentColor", d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896" }) ])); } }), yf = sE, oE = /* @__PURE__ */ De({ name: "Close", __name: "close", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z" }) ])); } }), cd = oE, aE = /* @__PURE__ */ De({ name: "Delete", __name: "delete", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32" }) ])); } }), Xc = aE, lE = /* @__PURE__ */ De({ name: "Hide", __name: "hide", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z" }), Be("path", { fill: "currentColor", d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z" }) ])); } }), cE = lE, uE = /* @__PURE__ */ De({ name: "Loading", __name: "loading", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z" }) ])); } }), P0 = uE, hE = /* @__PURE__ */ De({ name: "Minus", __name: "minus", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64" }) ])); } }), dE = hE, fE = /* @__PURE__ */ De({ name: "Plus", __name: "plus", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z" }) ])); } }), fu = fE, pE = /* @__PURE__ */ De({ name: "View", __name: "view", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160" }) ])); } }), mE = pE, gE = /* @__PURE__ */ De({ name: "WarningFilled", __name: "warning-filled", setup(n) { return (e, t) => (pe(), Re("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Be("path", { fill: "currentColor", d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4" }) ])); } }), I0 = gE; const O0 = "__epPropKey", Ye = (n) => n, vE = (n) => Pn(n) && !!n[O0], pu = (n, e) => { if (!Pn(n) || vE(n)) return n; const { values: t, required: i, default: r, type: s, validator: o } = n, c = { type: s, required: !!i, validator: t || o ? (l) => { let d = !1, h = []; if (t && (h = Array.from(t), em(n, "default") && h.push(r), d || (d = h.includes(l))), o && (d || (d = o(l))), !d && h.length > 0) { const p = [...new Set(h)].map((g) => JSON.stringify(g)).join(", "); Kw(`Invalid prop: validation failed${e ? ` for prop "${e}"` : ""}. Expected one of [${p}], got value ${JSON.stringify(l)}.`); } return d; } : void 0, [O0]: !0 }; return em(n, "default") && (c.default = r), c; }, dt = (n) => jc(Object.entries(n).map(([e, t]) => [ e, pu(t, e) ])), Zr = Ye([ String, Object, Function ]), D0 = { validating: P0, success: rE, error: yf }, vn = (n, e) => { if (n.install = (t) => { for (const i of [n, ...Object.values(e ?? {})]) t.component(i.name, i); }, e) for (const [t, i] of Object.entries(e)) n[t] = i; return n; }, yE = (n, e) => (n.install = (t) => { t.directive(e, n); }, n), gr = (n) => (n.install = $a, n), Di = { tab: "Tab", enter: "Enter", space: "Space", left: "ArrowLeft", up: "ArrowUp", right: "ArrowRight", down: "ArrowDown", esc: "Escape", delete: "Delete", backspace: "Backspace", numpadEnter: "NumpadEnter", pageUp: "PageUp", pageDown: "PageDown", home: "Home", end: "End" }, Dt = "update:modelValue", Qr = "change", Ss = "input", N0 = ["", "default", "small", "large"], Fc = (n) => { const e = Un(n) ? n : [n], t = []; return e.forEach((i) => { var r; Un(i) ? t.push(...Fc(i)) : ed(i) && Un(i.children) ? t.push(...Fc(i.children)) : (t.push(i), ed(i) && ((r = i.component) != null && r.subTree) && t.push(...Fc(i.component.subTree))); }), t; }, bE = (n) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(n), tr = (n) => n, xE = ["class", "style"], wE = /^on[A-Z]/, ME = (n = {}) => { const { excludeListeners: e = !1, excludeKeys: t } = n, i = ce(() => ((t == null ? void 0 : t.value) || []).concat(xE)), r = cn(); return r ? ce(() => { var s; return jc(Object.entries((s = r.proxy) == null ? void 0 : s.$attrs).filter(([o]) => !i.value.includes(o) && !(e && wE.test(o)))); }) : (en("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"), ce(() => ({}))); }, SE = ({ from: n, replacement: e, scope: t, version: i, ref: r, type: s = "API" }, o) => { Ke(() => H(o), (a) => { a && en(t, `[${s}] ${n} is about to be deprecated in version ${i}, please use ${e} instead. For more detail, please visit: ${r} `); }, { immediate: !0 }); }; var _E = { name: "en", el: { breadcrumb: { label: "Breadcrumb" }, colorpicker: { confirm: "OK", clear: "Clear", defaultLabel: "color picker", description: "current color is {color}. press enter to select a new color.", alphaLabel: "pick alpha value" }, datepicker: { now: "Now", today: "Today", cancel: "Cancel", clear: "Clear", confirm: "OK", dateTablePrompt: "Use the arrow keys and enter to select the day of the month", monthTablePrompt: "Use the arrow keys and enter to select the month", yearTablePrompt: "Use the arrow keys and enter to select the year", selectedDate: "Selected date", selectDate: "Select date", selectTime: "Select time", startDate: "Start Date", startTime: "Start Time", endDate: "End Date", endTime: "End Time", prevYear: "Previous Year", nextYear: "Next Year", prevMonth: "Previous Month", nextMonth: "Next Month", year: "", month1: "January", month2: "February", month3: "March", month4: "April", month5: "May", month6: "June", month7: "July", month8: "August", month9: "September", month10: "October", month11: "November", month12: "December", week: "week", weeks: { sun: "Sun", mon: "Mon", tue: "Tue", wed: "Wed", thu: "Thu", fri: "Fri", sat: "Sat" }, weeksFull: { sun: "Sunday", mon: "Monday", tue: "Tuesday", wed: "Wednesday", thu: "Thursday", fri: "Friday", sat: "Saturday" }, months: { jan: "Jan", feb: "Feb", mar: "Mar", apr: "Apr", may: "May", jun: "Jun", jul: "Jul", aug: "Aug", sep: "Sep", oct: "Oct", nov: "Nov", dec: "Dec" } }, inputNumber: { decrease: "decrease number", increase: "increase number" }, select: { loading: "Loading", noMatch: "No matching data", noData: "No data", placeholder: "Select" }, mention: { loading: "Loading" }, dropdown: { toggleDropdown: "Toggle Dropdown" }, cascader: { noMatch: "No matching data", loading: "Loading", placeholder: "Select", noData: "No data" }, pagination: { goto: "Go to", pagesize: "/page", total: "Total {total}", pageClassifier: "", page: "Page", prev: "Go to previous page", next: "Go to next page", currentPage: "page {pager}", prevPages: "Previous {pager} pages", nextPages: "Next {pager} pages", deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details" }, dialog: { close: "Close this dialog" }, drawer: { close: "Close this dialog" }, messagebox: { title: "Message", confirm: "OK", cancel: "Cancel", error: "Illegal input", close: "Close this dialog" }, upload: { deleteTip: "press delete to remove", delete: "Delete", preview: "Preview", continue: "Continue" }, slider: { defaultLabel: "slider between {min} and {max}", defaultRangeStartLabel: "pick start value", defaultRangeEndLabel: "pick end value" }, table: { emptyText: "No Data", confirmFilter: "Confirm", resetFilter: "Reset", clearFilter: "All", sumText: "Sum" }, tour: { next: "Next", previous: "Previous", finish: "Finish" }, tree: { emptyText: "No Data" }, transfer: { noMatch: "No matching data", noData: "No data", titles: ["List 1", "List 2"], filterPlaceholder: "Enter keyword", noCheckedFormat: "{total} items", hasCheckedFormat: "{checked}/{total} checked" }, image: { error: "FAILED" }, pageHeader: { title: "Back" }, popconfirm: { confirmButtonText: "Yes", cancelButtonText: "No" }, carousel: { leftArrow: "Carousel arrow left", rightArrow: "Carousel arrow right", indicator: "Carousel switch to index {index}" } } }; const TE = (n) => (e, t) => EE(e, t, H(n)), EE = (n, e, t) => er(t, n, n).replace(/\{(\w+)\}/g, (i, r) => { var s; return `${(s = e == null ? void 0 : e[r]) != null ? s : `{${r}}`}`; }), AE = (n) => { const e = ce(() => H(n).name), t = Ls(n) ? n : Ae(n); return { lang: e, locale: t, t: TE(n) }; }, F0 = Symbol("localeContextKey"), mu = (n) => { const e = n || ht(F0, Ae()); return AE(ce(() => e.value || _E)); }, Bc = "el", CE = "is-", ls = (n, e, t, i, r) => { let s = `${n}-${e}`; return t && (s += `-${t}`), i && (s += `__${i}`), r && (s += `--${r}`), s; }, B0 = Symbol("namespaceContextKey"), bf = (n) => { const e = n || (cn() ? ht(B0, Ae(Bc)) : Ae(Bc)); return ce(() => H(e) || Bc); }, it = (n, e) => { const t = bf(e); return { namespace: t, b: (u = "") => ls(t.value, n, u, "", ""), e: (u) => u ? ls(t.value, n, "", u, "") : "", m: (u) => u ? ls(t.value, n, "", "", u) : "", be: (u, y) => u && y ? ls(t.value, n, u, y, "") : "", em: (u, y) => u && y ? ls(t.value, n, "", u, y) : "", bm: (u, y) => u && y ? ls(t.value, n, u, "", y) : "", bem: (u, y, v) => u && y && v ? ls(t.value, n, u, y, v) : "", is: (u, ...y) => { const v = y.length >= 1 ? y[0] : !0; return u && v ? `${CE}${u}` : ""; }, cssVar: (u) => { const y = {}; for (const v in u) u[v] && (y[`--${t.value}-${v}`] = u[v]); return y; }, cssVarName: (u) => `--${t.value}-${u}`, cssVarBlock: (u) => { const y = {}; for (const v in u) u[v] && (y[`--${t.value}-${n}-${v}`] = u[v]); return y; }, cssVarBlockName: (u) => `--${t.value}-${n}-${u}` }; }, LE = pu({ type: Ye(Boolean), default: null }), RE = pu({ type: Ye(Function) }), PE = (n) => { const e = `update:${n}`, t = `onUpdate:${n}`, i = [e], r = { [n]: LE, [t]: RE }; return { useModelToggle: ({ indicator: o, toggleReason: a, shouldHideWhenRouteChanges: c, shouldProceed: l, onShow: d, onHide: h }) => { const p = cn(), { emit: g } = p, f = p.props, u = ce(() => Ln(f[t])), y = ce(() => f[n] === null), v = (x) => { o.value !== !0 && (o.value = !0, a && (a.value = x), Ln(d) && d(x)); }, m = (x) => { o.value !== !1 && (o.value = !1, a && (a.value = x), Ln(h) && h(x)); }, w = (x) => { if (f.disabled === !0 || Ln(l) && !l()) return; const _ = u.value && rn; _ && g(e, !0), (y.value || !_) && v(x); }, S = (x) => { if (f.disabled === !0 || !rn) return; const _ = u.value && rn; _ && g(e, !1), (y.value || !_) && m(x); }, T = (x) => { gf(x) && (f.disabled && x ? u.value && g(e, !1) : o.value !== x && (x ? v() : m())); }, M = () => { o.value ? S() : w(); }; return Ke(() => f[n], T), c && p.appContext.config.globalProperties.$route !== void 0 && Ke(() => ({ ...p.proxy.$route }), () => { c.value && o.value && S(); }), on(() => { T(f[n]); }), { hide: S, show: w, toggle: M, hasUpdateHandler: u }; }, useModelToggleProps: r, useModelToggleEmits: i }; }, z0 = (n) => { const e = cn(); return ce(() => { var t, i; return (i = (t = e == null ? void 0 : e.proxy) == null ? void 0 : t.$props) == null ? void 0 : i[n]; }); }; var kn = "top", oi = "bottom", ai = "right", Gn = "left", xf = "auto", pl = [kn, oi, ai, Gn], Lo = "start", Ya = "end", IE = "clippingParents", U0 = "viewport", ya = "popper", OE = "reference", Cm = pl.reduce(function(n, e) { return n.concat([e + "-" + Lo, e + "-" + Ya]); }, []), ia = [].concat(pl, [xf]).reduce(function(n, e) { return n.concat([e, e + "-" + Lo, e + "-" + Ya]); }, []), DE = "beforeRead", NE = "read", FE = "afterRead", BE = "beforeMain", zE = "main", UE = "afterMain", VE = "beforeWrite", kE = "write", GE = "afterWrite", HE = [DE, NE, FE, BE, zE, UE, VE, kE, GE]; function zi(n) { return n ? (n.nodeName || "").toLowerCase() : null; } function Si(n) { if (n == null) return window; if (n.toString() !== "[object Window]") { var e = n.ownerDocument; return e && e.defaultView || window; } return n; } function Ro(n) { var e = Si(n).Element; return n instanceof e || n instanceof Element; } function si(n) { var e = Si(n).HTMLElement; return n instanceof e || n instanceof HTMLElement; } function wf(n) { if (typeof ShadowRoot > "u") return !1; var e = Si(n).ShadowRoot; return n instanceof e || n instanceof ShadowRoot; } function WE(n) { var e = n.state; Object.keys(e.elements).forEach(function(t) { var i = e.styles[t] || {}, r = e.attributes[t] || {}, s = e.elements[t]; !si(s) || !zi(s) || (Object.assign(s.style, i), Object.keys(r).forEach(function(o) { var a = r[o]; a === !1 ? s.removeAttribute(o) : s.setAttribute(o, a === !0 ? "" : a); })); }); } function jE(n) { var e = n.state, t = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} }; return Object.assign(e.elements.popper.style, t.popper), e.styles = t, e.elements.arrow && Object.assign(e.elements.arrow.style, t.arrow), function() { Object.keys(e.elements).forEach(function(i) { var r = e.elements[i], s = e.attributes[i] || {}, o = Object.keys(e.styles.hasOwnProperty(i) ? e.styles[i] : t[i]), a = o.reduce(function(c, l) { return c[l] = "", c; }, {}); !si(r) || !zi(r) || (Object.assign(r.style, a), Object.keys(s).forEach(function(c) { r.removeAttribute(c); })); }); }; } var V0 = { name: "applyStyles", enabled: !0, phase: "write", fn: WE, effect: jE, requires: ["computeStyles"] }; function Ni(n) { return n.split("-")[0]; } var _s = Math.max, Yc = Math.min, Po = Math.round; function Io(n, e) { e === void 0 && (e = !1); var t = n.getBoundingClientRect(), i = 1, r = 1; if (si(n) && e) { var s = n.offsetHeight, o = n.offsetWidth; o > 0 && (i = Po(t.width) / o || 1), s > 0 && (r = Po(t.height) / s || 1); } return { width: t.width / i, height: t.height / r, top: t.top / r, right: t.right / i, bottom: t.bottom / r, left: t.left / i, x: t.left / i, y: t.top / r }; } function Mf(n) { var e = Io(n), t = n.offsetWidth, i = n.offsetHeight; return Math.abs(e.width - t) <= 1 && (t = e.width), Math.abs(e.height - i) <= 1 && (i = e.height), { x: n.offsetLeft, y: n.offsetTop, width: t, height: i }; } function k0(n, e) { var t = e.getRootNode && e.getRootNode(); if (n.contains(e)) return !0; if (t && wf(t)) { var i = e; do { if (i && n.isSameNode(i)) return !0; i = i.parentNode || i.host; } while (i); } return !1; } function ur(n) { return Si(n).getComputedStyle(n); } function $E(n) { return ["table", "td", "th"].indexOf(zi(n)) >= 0; } function es(n) { return ((Ro(n) ? n.ownerDocument : n.document) || window.document).documentElement; } function gu(n) { return zi(n) === "html" ? n : n.assignedSlot || n.parentNode || (wf(n) ? n.host : null) || es(n); } function Lm(n) { return !si(n) || ur(n).position === "fixed" ? null : n.offsetParent; } function ZE(n) { var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, t = navigator.userAgent.indexOf("Trident") !== -1; if (t && si(n)) { var i = ur(n); if (i.position === "fixed") return null; } var r = gu(n); for (wf(r) && (r = r.host); si(r) && ["html", "body"].indexOf(zi(r)) < 0; ) { var s = ur(r); if (s.transform !== "none" || s.perspective !== "none" || s.contain === "paint" || ["transform", "perspective"].indexOf(s.willChange) !== -1 || e && s.willChange === "filter" || e && s.filter && s.filter !== "none") return r; r = r.parentNode; } return null; } function ml(n) { for (var e = Si(n), t = Lm(n); t && $E(t) && ur(t).position === "static"; ) t = Lm(t); return t && (zi(t) === "html" || zi(t) === "body" && ur(t).position === "static") ? e : t || ZE(n) || e; } function Sf(n) { return ["top", "bottom"].indexOf(n) >= 0 ? "x" : "y"; } function za(n, e, t) { return _s(n, Yc(e, t)); } function XE(n, e, t) { var i = za(n, e, t); return i > t ? t : i; } function G0() { return { top: 0, right: 0, bottom: 0, left: 0 }; } function H0(n) { return Object.assign({}, G0(), n); } function W0(n, e) { return e.reduce(function(t, i) { return t[i] = n, t; }, {}); } var YE = function(n, e) { return n = typeof n == "function" ? n(Object.assign({}, e.rects, { placement: e.placement })) : n, H0(typeof n != "number" ? n : W0(n, pl)); }; function JE(n) { var e, t = n.state, i = n.name, r = n.options, s = t.elements.arrow, o = t.modifiersData.popperOffsets, a = Ni(t.placement), c = Sf(a), l = [Gn, ai].indexOf(a) >= 0, d = l ? "height" : "width"; if (!(!s || !o)) { var h = YE(r.padding, t), p = Mf(s), g = c === "y" ? kn : Gn, f = c === "y" ? oi : ai, u = t.rects.reference[d] + t.rects.reference[c] - o[c] - t.rects.popper[d], y = o[c] - t.rects.reference[c], v = ml(s), m = v ? c === "y" ? v.clientHeight || 0 : v.clientWidth || 0 : 0, w = u / 2 - y / 2, S = h[g], T = m - p[d] - h[f], M = m / 2 - p[d] / 2 + w, x = za(S, M, T), _ = c; t.modifiersData[i] = (e = {}, e[_] = x, e.centerOffset = x - M, e); } } function qE(n) { var e = n.state, t = n.options, i = t.element, r = i === void 0 ? "[data-popper-arrow]" : i; r != null && (typeof r == "string" && (r = e.elements.popper.querySelector(r), !r) || !k0(e.elements.popper, r) || (e.elements.arrow = r)); } var KE = { name: "arrow", enabled: !0, phase: "main", fn: JE, effect: qE, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] }; function Oo(n) { return n.split("-")[1]; } var QE = { top: "auto", right: "auto", bottom: "auto", left: "auto" }; function eA(n) { var e = n.x, t = n.y, i = window, r = i.devicePixelRatio || 1; return { x: Po(e * r) / r || 0, y: Po(t * r) / r || 0 }; } function Rm(n) { var e, t = n.popper, i = n.popperRect, r = n.placement, s = n.variation, o = n.offsets, a = n.position, c = n.gpuAcceleration, l = n.adaptive, d = n.roundOffsets, h = n.isFixed, p = o.x, g = p === void 0 ? 0 : p, f = o.y, u = f === void 0 ? 0 : f, y = typeof d == "function" ? d({ x: g, y: u }) : { x: g, y: u }; g = y.x, u = y.y; var v = o.hasOwnProperty("x"), m = o.hasOwnProperty("y"), w = Gn, S = kn, T = window; if (l) { var M = ml(t), x = "clientHeight", _ = "clientWidth"; if (M === Si(t) && (M = es(t), ur(M).position !== "static" && a === "absolute" && (x = "scrollHeight", _ = "scrollWidth")), M = M, r === kn || (r === Gn || r === ai) && s === Ya) { S = oi; var E = h && M === T && T.visualViewport ? T.visualViewport.height : M[x]; u -= E - i.height, u *= c ? 1 : -1; } if (r === Gn || (r === kn || r === oi) && s === Ya) { w = ai; var L = h && M === T && T.visualViewport ? T.visualViewport.width : M[_]; g -= L - i.width, g *= c ? 1 : -1; } } var R = Object.assign({ position: a }, l && QE), C = d === !0 ? eA({ x: g, y: u }) : { x: g, y: u }; if (g = C.x, u = C.y, c) { var A; return Object.assign({}, R, (A = {}, A[S] = m ? "0" : "", A[w] = v ? "0" : "", A.transform = (T.devicePixelRatio || 1) <= 1 ? "translate(" + g + "px, " + u + "px)" : "translate3d(" + g + "px, " + u + "px, 0)", A)); } return Object.assign({}, R, (e = {}, e[S] = m ? u + "px" : "", e[w] = v ? g + "px" : "", e.transform = "", e)); } function tA(n) { var e = n.state, t = n.options, i = t.gpuAcceleration, r = i === void 0 ? !0 : i, s = t.adaptive, o = s === void 0 ? !0 : s, a = t.roundOffsets, c = a === void 0 ? !0 : a, l = { placement: Ni(e.placement), variation: Oo(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: r, isFixed: e.options.strategy === "fixed" }; e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, Rm(Object.assign({}, l, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: o, roundOffsets: c })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, Rm(Object.assign({}, l, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: !1, roundOffsets: c })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement }); } var j0 = { name: "computeStyles", enabled: !0, phase: "beforeWrite", fn: tA, data: {} }, Fl = { passive: !0 }; function nA(n) { var e = n.state, t = n.instance, i = n.options, r = i.scroll, s = r === void 0 ? !0 : r, o = i.resize, a = o === void 0 ? !0 : o, c = Si(e.elements.popper), l = [].concat(e.scrollParents.reference, e.scrollParents.popper); return s && l.forEach(function(d) { d.addEventListener("scroll", t.update, Fl); }), a && c.addEventListener("resize", t.update, Fl), function() { s && l.forEach(function(d) { d.removeEventListener("scroll", t.update, Fl); }), a && c.removeEventListener("resize", t.update, Fl); }; } var $0 = { name: "eventListeners", enabled: !0, phase: "write", fn: function() { }, effect: nA, data: {} }, iA = { left: "right", right: "left", bottom: "top", top: "bottom" }; function zc(n) { return n.replace(/left|right|bottom|top/g, function(e) { return iA[e]; }); } var rA = { start: "end", end: "start" }; function Pm(n) { return n.replace(/start|end/g, function(e) { return rA[e]; }); } function _f(n) { var e = Si(n), t = e.pageXOffset, i = e.pageYOffset; return { scrollLeft: t, scrollTop: i }; } function Tf(n) { return Io(es(n)).left + _f(n).scrollLeft; } function sA(n) { var e = Si(n), t = es(n), i = e.visualViewport, r = t.clientWidth, s = t.clientHeight, o = 0, a = 0; return i && (r = i.width, s = i.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (o = i.offsetLeft, a = i.offsetTop)), { width: r, height: s, x: o + Tf(n), y: a }; } function oA(n) { var e, t = es(n), i = _f(n), r = (e = n.ownerDocument) == null ? void 0 : e.body, s = _s(t.scrollWidth, t.clientWidth, r ? r.scrollWidth : 0, r ? r.clientWidth : 0), o = _s(t.scrollHeight, t.clientHeight, r ? r.scrollHeight : 0, r ? r.clientHeight : 0), a = -i.scrollLeft + Tf(n), c = -i.scrollTop; return ur(r || t).direction === "rtl" && (a += _s(t.clientWidth, r ? r.clientWidth : 0) - s), { width: s, height: o, x: a, y: c }; } function Ef(n) { var e = ur(n), t = e.overflow, i = e.overflowX, r = e.overflowY; return /auto|scroll|overlay|hidden/.test(t + r + i); } function Z0(n) { return ["html", "body", "#document"].indexOf(zi(n)) >= 0 ? n.ownerDocument.body : si(n) && Ef(n) ? n : Z0(gu(n)); } function Ua(n, e) { var t; e === void 0 && (e = []); var i = Z0(n), r = i === ((t = n.ownerDocument) == null ? void 0 : t.body), s = Si(i), o = r ? [s].concat(s.visualViewport || [], Ef(i) ? i : []) : i, a = e.concat(o); return r ? a : a.concat(Ua(gu(o))); } function ud(n) { return Object.assign({}, n, { left: n.x, top: n.y, right: n.x + n.width, bottom: n.y + n.height }); } function aA(n) { var e = Io(n); return e.top = e.top + n.clientTop, e.left = e.left + n.clientLeft, e.bottom = e.top + n.clientHeight, e.right = e.left + n.clientWidth, e.width = n.clientWidth, e.height = n.clientHeight, e.x = e.left, e.y = e.top, e; } function Im(n, e) { return e === U0 ? ud(sA(n)) : Ro(e) ? aA(e) : ud(oA(es(n))); } function lA(n) { var e = Ua(gu(n)), t = ["absolute", "fixed"].indexOf(ur(n).position) >= 0, i = t && si(n) ? ml(n) : n; return Ro(i) ? e.filter(function(r) { return Ro(r) && k0(r, i) && zi(r) !== "body"; }) : []; } function cA(n, e, t) { var i = e === "clippingParents" ? lA(n) : [].concat(e), r = [].concat(i, [t]), s = r[0], o = r.reduce(function(a, c) { var l = Im(n, c); return a.top = _s(l.top, a.top), a.right = Yc(l.right, a.right), a.bottom = Yc(l.bottom, a.bottom), a.left = _s(l.left, a.left), a; }, Im(n, s)); return o.width = o.right - o.left, o.height = o.bottom - o.top, o.x = o.left, o.y = o.top, o; } function X0(n) { var e = n.reference, t = n.element, i = n.placement, r = i ? Ni(i) : null, s = i ? Oo(i) : null, o = e.x + e.width / 2 - t.width / 2, a = e.y + e.height / 2 - t.height / 2, c; switch (r) { case kn: c = { x: o, y: e.y - t.height }; break; case oi: c = { x: o, y: e.y + e.height }; break; case ai: c = { x: e.x + e.width, y: a }; break; case Gn: c = { x: e.x - t.width, y: a }; break; default: c = { x: e.x, y: e.y }; } var l = r ? Sf(r) : null; if (l != null) { var d = l === "y" ? "height" : "width"; switch (s) { case Lo: c[l] = c[l] - (e[d] / 2 - t[d] / 2); break; case Ya: c[l] = c[l] + (e[d] / 2 - t[d] / 2); break; } } return c; } function Ja(n, e) { e === void 0 && (e = {}); var t = e, i = t.placement, r = i === void 0 ? n.placement : i, s = t.boundary, o = s === void 0 ? IE : s, a = t.rootBoundary, c = a === void 0 ? U0 : a, l = t.elementContext, d = l === void 0 ? ya : l, h = t.altBoundary, p = h === void 0 ? !1 : h, g = t.padding, f = g === void 0 ? 0 : g, u = H0(typeof f != "number" ? f : W0(f, pl)), y = d === ya ? OE : ya, v = n.rects.popper, m = n.elements[p ? y : d], w = cA(Ro(m) ? m : m.contextElement || es(n.elements.popper), o, c), S = Io(n.elements.reference), T = X0({ reference: S, element: v, strategy: "absolute", placement: r }), M = ud(Object.assign({}, v, T)), x = d === ya ? M : S, _ = { top: w.top - x.top + u.top, bottom: x.bottom - w.bottom + u.bottom, left: w.left - x.left + u.left, right: x.right - w.right + u.right }, E = n.modifiersData.offset; if (d === ya && E) { var L = E[r]; Object.keys(_).forEach(function(R) { var C = [ai, oi].indexOf(R) >= 0 ? 1 : -1, A = [kn, oi].indexOf(R) >= 0 ? "y" : "x"; _[R] += L[A] * C; }); } return _; } function uA(n, e) { e === void 0 && (e = {}); var t = e, i = t.placement, r = t.boundary, s = t.rootBoundary, o = t.padding, a = t.flipVariations, c = t.allowedAutoPlacements, l = c === void 0 ? ia : c, d = Oo(i), h = d ? a ? Cm : Cm.filter(function(f) { return Oo(f) === d; }) : pl, p = h.filter(function(f) { return l.indexOf(f) >= 0; }); p.length === 0 && (p = h); var g = p.reduce(function(f, u) { return f[u] = Ja(n, { placement: u, boundary: r, rootBoundary: s, padding: o })[Ni(u)], f; }, {}); return Object.keys(g).sort(function(f, u) { return g[f] - g[u]; }); } function hA(n) { if (Ni(n) === xf) return []; var e = zc(n); return [Pm(n), e, Pm(e)]; } function dA(n) { var e = n.state, t = n.options, i = n.name; if (!e.modifiersData[i]._skip) { for (var r = t.mainAxis, s = r === void 0 ? !0 : r, o = t.altAxis, a = o === void 0 ? !0 : o, c = t.fallbackPlacements, l = t.padding, d = t.boundary, h = t.rootBoundary, p = t.altBoundary, g = t.flipVariations, f = g === void 0 ? !0 : g, u = t.allowedAutoPlacements, y = e.options.placement, v = Ni(y), m = v === y, w = c || (m || !f ? [zc(y)] : hA(y)), S = [y].concat(w).reduce(function(ie, j) { return ie.concat(Ni(j) === xf ? uA(e, { placement: j, boundary: d, rootBoundary: h, padding: l, flipVariations: f, allowedAutoPlacements: u }) : j); }, []), T = e.rects.reference, M = e.rects.popper, x = /* @__PURE__ */ new Map(), _ = !0, E = S[0], L = 0; L < S.length; L++) { var R = S[L], C = Ni(R), A = Oo(R) === Lo, P = [kn, oi].indexOf(C) >= 0, I = P ? "width" : "height", b = Ja(e, { placement: R, boundary: d, rootBoundary: h, altBoundary: p, padding: l }), O = P ? A ? ai : Gn : A ? oi : kn; T[I] > M[I] && (O = zc(O)); var N = zc(O), D = []; if (s && D.push(b[C] <= 0), a && D.push(b[O] <= 0, b[N] <= 0), D.every(function(ie) { return ie; })) { E = R, _ = !1; break; } x.set(R, D); } if (_) for (var B = f ? 3 : 1, U = function(ie) { var j = S.find(function(G) { var W = x.get(G); if (W) return W.slice(0, ie).every(function(q) { return q; }); }); if (j) return E = j, "break"; }, k = B; k > 0; k--) { var K = U(k); if (K === "break") break; } e.placement !== E && (e.modifiersData[i]._skip = !0, e.placement = E, e.reset = !0); } } var fA = { name: "flip", enabled: !0, phase: "main", fn: dA, requiresIfExists: ["offset"], data: { _skip: !1 } }; function Om(n, e, t) { return t === void 0 && (t = { x: 0, y: 0 }), { top: n.top - e.height - t.y, right: n.right - e.width + t.x, bottom: n.bottom - e.height + t.y, left: n.left - e.width - t.x }; } function Dm(n) { return [kn, ai, oi, Gn].some(function(e) { return n[e] >= 0; }); } function pA(n) { var e = n.state, t = n.name, i = e.rects.reference, r = e.rects.popper, s = e.modifiersData.preventOverflow, o = Ja(e, { elementContext: "reference" }), a = Ja(e, { altBoundary: !0 }), c = Om(o, i), l = Om(a, r, s), d = Dm(c), h = Dm(l); e.modifiersData[t] = { referenceClippingOffsets: c, popperEscapeOffsets: l, isReferenceHidden: d, hasPopperEscaped: h }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": d, "data-popper-escaped": h }); } var mA = { name: "hide", enabled: !0, phase: "main", requiresIfExists: ["preventOverflow"], fn: pA }; function gA(n, e, t) { var i = Ni(n), r = [Gn, kn].indexOf(i) >= 0 ? -1 : 1, s = typeof t == "function" ? t(Object.assign({}, e, { placement: n })) : t, o = s[0], a = s[1]; return o = o || 0, a = (a || 0) * r, [Gn, ai].indexOf(i) >= 0 ? { x: a, y: o } : { x: o, y: a }; } function vA(n) { var e = n.state, t = n.options, i = n.name, r = t.offset, s = r === void 0 ? [0, 0] : r, o = ia.reduce(function(d, h) { return d[h] = gA(h, e.rects, s), d; }, {}), a = o[e.placement], c = a.x, l = a.y; e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += c, e.modifiersData.popperOffsets.y += l), e.modifiersData[i] = o; } var yA = { name: "offset", enabled: !0, phase: "main", requires: ["popperOffsets"], fn: vA }; function bA(n) { var e = n.state, t = n.name; e.modifiersData[t] = X0({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement }); } var Y0 = { name: "popperOffsets", enabled: !0, phase: "read", fn: bA, data: {} }; function xA(n) { return n === "x" ? "y" : "x"; } function wA(n) { var e = n.state, t = n.options, i = n.name, r = t.mainAxis, s = r === void 0 ? !0 : r, o = t.altAxis, a = o === void 0 ? !1 : o, c = t.boundary, l = t.rootBoundary, d = t.altBoundary, h = t.padding, p = t.tether, g = p === void 0 ? !0 : p, f = t.tetherOffset, u = f === void 0 ? 0 : f, y = Ja(e, { boundary: c, rootBoundary: l, padding: h, altBoundary: d }), v = Ni(e.placement), m = Oo(e.placement), w = !m, S = Sf(v), T = xA(S), M = e.modifiersData.popperOffsets, x = e.rects.reference, _ = e.rects.popper, E = typeof u == "function" ? u(Object.assign({}, e.rects, { placement: e.placement })) : u, L = typeof E == "number" ? { mainAxis: E, altAxis: E } : Object.assign({ mainAxis: 0, altAxis: 0 }, E), R = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, C = { x: 0, y: 0 }; if (M) { if (s) { var A, P = S === "y" ? kn : Gn, I = S === "y" ? oi : ai, b = S === "y" ? "height" : "width", O = M[S], N = O + y[P], D = O - y[I], B = g ? -_[b] / 2 : 0, U = m === Lo ? x[b] : _[b], k = m === Lo ? -_[b] : -x[b], K = e.elements.arrow, ie = g && K ? Mf(K) : { width: 0, height: 0 }, j = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : G0(), G = j[P], W = j[I], q = za(0, x[b], ie[b]), Q = w ? x[b] / 2 - B - q - G - L.mainAxis : U - q - G - L.mainAxis, ee = w ? -x[b] / 2 + B + q + W + L.mainAxis : k + q + W + L.mainAxis, ne = e.elements.arrow && ml(e.elements.arrow), Y = ne ? S === "y" ? ne.clientTop || 0 : ne.clientLeft || 0 : 0, te = (A = R == null ? void 0 : R[S]) != null ? A : 0, F = O + Q - te - Y, $ = O + ee - te, J = za(g ? Yc(N, F) : N, O, g ? _s(D, $) : D); M[S] = J, C[S] = J - O; } if (a) { var z, V = S === "x" ? kn : Gn, oe = S === "x" ? oi : ai, ue = M[T], le = T === "y" ? "height" : "width", ve = ue + y[V], xe = ue - y[oe], Te = [kn, Gn].indexOf(v) !== -1, de = (z = R == null ? void 0 : R[T]) != null ? z : 0, we = Te ? ve : ue - x[le] - _[le] - de + L.altAxis, se = Te ? ue + x[le] + _[le] - de - L.altAxis : xe, Se = g && Te ? XE(we, ue, se) : za(g ? we : ve, ue, g ? se : xe); M[T] = Se, C[T] = Se - ue; } e.modifiersData[i] = C; } } var MA = { name: "preventOverflow", enabled: !0, phase: "main", fn: wA, requiresIfExists: ["offset"] }; function SA(n) { return { scrollLeft: n.scrollLeft, scrollTop: n.scrollTop }; } function _A(n) { return n === Si(n) || !si(n) ? _f(n) : SA(n); } function TA(n) { var e = n.getBoundingClientRect(), t = Po(e.width) / n.offsetWidth || 1, i = Po(e.height) / n.offsetHeight || 1; return t !== 1 || i !== 1; } function EA(n, e, t) { t === void 0 && (t = !1); var i = si(e), r = si(e) && TA(e), s = es(e), o = Io(n, r), a = { scrollLeft: 0, scrollTop: 0 }, c = { x: 0, y: 0 }; return (i || !i && !t) && ((zi(e) !== "body" || Ef(s)) && (a = _A(e)), si(e) ? (c = Io(e, !0), c.x += e.clientLeft, c.y += e.clientTop) : s && (c.x = Tf(s))), { x: o.left + a.scrollLeft - c.x, y: o.top + a.scrollTop - c.y, width: o.width, height: o.height }; } function AA(n) { var e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), i = []; n.forEach(function(s) { e.set(s.name, s); }); function r(s) { t.add(s.name); var o = [].concat(s.requires || [], s.requiresIfExists || []); o.forEach(function(a) { if (!t.has(a)) { var c = e.get(a); c && r(c); } }), i.push(s); } return n.forEach(function(s) { t.has(s.name) || r(s); }), i; } function CA(n) { var e = AA(n); return HE.reduce(function(t, i) { return t.concat(e.filter(function(r) { return r.phase === i; })); }, []); } function LA(n) { var e; return function() { return e || (e = new Promise(function(t) { Promise.resolve().then(function() { e = void 0, t(n()); }); })), e; }; } function RA(n) { var e = n.reduce(function(t, i) { var r = t[i.name]; return t[i.name] = r ? Object.assign({}, r, i, { options: Object.assign({}, r.options, i.options), data: Object.assign({}, r.data, i.data) }) : i, t; }, {}); return Object.keys(e).map(function(t) { return e[t]; }); } var Nm = { placement: "bottom", modifiers: [], strategy: "absolute" }; function Fm() { for (var n = arguments.length, e = new Array(n), t = 0; t < n; t++) e[t] = arguments[t]; return !e.some(function(i) { return !(i && typeof i.getBoundingClientRect == "function"); }); } function Af(n) { n === void 0 && (n = {}); var e = n, t = e.defaultModifiers, i = t === void 0 ? [] : t, r = e.defaultOptions, s = r === void 0 ? Nm : r; return function(o, a, c) { c === void 0 && (c = s); var l = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, Nm, s), modifiersData: {}, elements: { reference: o, popper: a }, attributes: {}, styles: {} }, d = [], h = !1, p = { state: l, setOptions: function(u) { var y = typeof u == "function" ? u(l.options) : u; f(), l.options = Object.assign({}, s, l.options, y), l.scrollParents = { reference: Ro(o) ? Ua(o) : o.contextElement ? Ua(o.contextElement) : [], popper: Ua(a) }; var v = CA(RA([].concat(i, l.options.modifiers))); return l.orderedModifiers = v.filter(function(m) { return m.enabled; }), g(), p.update(); }, forceUpdate: function() { if (!h) { var u = l.elements, y = u.reference, v = u.popper; if (Fm(y, v)) { l.rects = { reference: EA(y, ml(v), l.options.strategy === "fixed"), popper: Mf(v) }, l.reset = !1, l.placement = l.options.placement, l.orderedModifiers.forEach(function(_) { return l.modifiersData[_.name] = Object.assign({}, _.data); }); for (var m = 0; m < l.orderedModifiers.length; m++) { if (l.reset === !0) { l.reset = !1, m = -1; continue; } var w = l.orderedModifiers[m], S = w.fn, T = w.options, M = T === void 0 ? {} : T, x = w.name; typeof S == "function" && (l = S({ state: l, options: M, name: x, instance: p }) || l); } } } }, update: LA(function() { return new Promise(function(u) { p.forceUpdate(), u(l); }); }), destroy: function() { f(), h = !0; } }; if (!Fm(o, a)) return p; p.setOptions(c).then(function(u) { !h && c.onFirstUpdate && c.onFirstUpdate(u); }); function g() { l.orderedModifiers.forEach(function(u) { var y = u.name, v = u.options, m = v === void 0 ? {} : v, w = u.effect; if (typeof w == "function") { var S = w({ state: l, name: y, instance: p, options: m }), T = function() { }; d.push(S || T); } }); } function f() { d.forEach(function(u) { return u(); }), d = []; } return p; }; } Af(); var PA = [$0, Y0, j0, V0]; Af({ defaultModifiers: PA }); var IA = [$0, Y0, j0, V0, yA, fA, MA, KE, mA], OA = Af({ defaultModifiers: IA }); const DA = (n, e, t = {}) => { const i = { name: "updateState", enabled: !0, phase: "write", fn: ({ state: c }) => { const l = NA(c); Object.assign(o.value, l); }, requires: ["computeStyles"] }, r = ce(() => { const { onFirstUpdate: c, placement: l, strategy: d, modifiers: h } = H(t); return { onFirstUpdate: c, placement: l || "bottom", strategy: d || "absolute", modifiers: [ ...h || [], i, { name: "applyStyles", enabled: !1 } ] }; }), s = In(), o = Ae({ styles: { popper: { position: H(r).strategy, left: "0", top: "0" }, arrow: { position: "absolute" } }, attributes: {} }), a = () => { s.value && (s.value.destroy(), s.value = void 0); }; return Ke(r, (c) => { const l = H(s); l && l.setOptions(c); }, { deep: !0 }), Ke([n, e], ([c, l]) => { a(), !(!c || !l) && (s.value = OA(c, l, H(r))); }), li(() => { a(); }), { state: ce(() => { var c; return { ...((c = H(s)) == null ? void 0 : c.state) || {} }; }), styles: ce(() => H(o).styles), attributes: ce(() => H(o).attributes), update: () => { var c; return (c = H(s)) == null ? void 0 : c.update(); }, forceUpdate: () => { var c; return (c = H(s)) == null ? void 0 : c.forceUpdate(); }, instanceRef: ce(() => H(s)) }; }; function NA(n) { const e = Object.keys(n.elements), t = jc(e.map((r) => [r, n.styles[r] || {}])), i = jc(e.map((r) => [r, n.attributes[r]])); return { styles: t, attributes: i }; } function Bm() { let n; const e = (i, r) => { t(), n = window.setTimeout(i, r); }, t = () => window.clearTimeout(n); return au(() => t()), { registerTimeout: e, cancelTimeout: t }; } const hd = { prefix: Math.floor(Math.random() * 1e4), current: 0 }, FA = Symbol("elIdInjection"), Cf = () => cn() ? ht(FA, hd) : hd, vu = (n) => { const e = Cf(); !rn && e === hd && en("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed usage: app.provide(ID_INJECTION_KEY, { prefix: number, current: number, })`); const t = bf(); return ce(() => H(n) || `${t.value}-id-${e.prefix}-${e.current++}`); }; let xo = []; const zm = (n) => { const e = n; e.key === Di.esc && xo.forEach((t) => t(e)); }, BA = (n) => { on(() => { xo.length === 0 && document.addEventListener("keydown", zm), rn && xo.push(n); }), li(() => { xo = xo.filter((e) => e !== n), xo.length === 0 && rn && document.removeEventListener("keydown", zm); }); }; let Um; const J0 = () => { const n = bf(), e = Cf(), t = ce(() => `${n.value}-popper-container-${e.prefix}`), i = ce(() => `#${t.value}`); return { id: t, selector: i }; }, zA = (n) => { const e = document.createElement("div"); return e.id = n, document.body.appendChild(e), e; }, UA = () => { const { id: n, selector: e } = J0(); return Qw(() => { rn && (process.env.NODE_ENV === "test" || !Um || !document.body.querySelector(e.value)) && (Um = zA(n.value)); }), { id: n, selector: e }; }, VA = dt({ showAfter: { type: Number, default: 0 }, hideAfter: { type: Number, default: 200 }, autoClose: { type: Number, default: 0 } }), kA = ({ showAfter: n, hideAfter: e, autoClose: t, open: i, close: r }) => { const { registerTimeout: s } = Bm(), { registerTimeout: o, cancelTimeout: a } = Bm(); return { onOpen: (d) => { s(() => { i(d); const h = H(t); St(h) && h > 0 && o(() => { r(d); }, h); }, H(n)); }, onClose: (d) => { a(), s(() => { r(d); }, H(e)); } }; }, q0 = Symbol("elForwardRef"), GA = (n) => { gn(q0, { setForwardRef: (t) => { n.value = t; } }); }, HA = (n) => ({ mounted(e) { n(e); }, updated(e) { n(e); }, unmounted() { n(null); } }), Vm = { current: 0 }, km = Ae(0), K0 = 2e3, Gm = Symbol("elZIndexContextKey"), Q0 = Symbol("zIndexContextKey"), ey = (n) => { const e = cn() ? ht(Gm, Vm) : Vm, t = n || (cn() ? ht(Q0, void 0) : void 0), i = ce(() => { const o = H(t); return St(o) ? o : K0; }), r = ce(() => i.value + km.value), s = () => (e.current++, km.value = e.current, r.value); return !rn && !ht(Gm) && en("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`), { initialZIndex: i, currentZIndex: r, nextZIndex: s }; }; function WA(n) { let e; function t() { if (n.value == null) return; const { selectionStart: r, selectionEnd: s, value: o } = n.value; if (r == null || s == null) return; const a = o.slice(0, Math.max(0, r)), c = o.slice(Math.max(0, s)); e = { selectionStart: r, selectionEnd: s, value: o, beforeTxt: a, afterTxt: c }; } function i() { if (n.value == null || e == null) return; const { value: r } = n.value, { beforeTxt: s, afterTxt: o, selectionStart: a } = e; if (s == null || o == null || a == null) return; let c = r.length; if (r.endsWith(o)) c = r.length - o.length; else if (r.startsWith(s)) c = s.length; else { const l = s[a - 1], d = r.indexOf(l, a - 1); d !== -1 && (c = d + 1); } n.value.setSelectionRange(c, c); } return [t, i]; } const jA = (n, e, t) => Fc(n.subTree).filter((s) => { var o; return ed(s) && ((o = s.type) == null ? void 0 : o.name) === e && !!s.component; }).map((s) => s.component.uid).map((s) => t[s]).filter((s) => !!s), $A = (n, e) => { const t = {}, i = In([]); return { children: i, addChild: (o) => { t[o.uid] = o, i.value = jA(n, e, t); }, removeChild: (o) => { delete t[o], i.value = i.value.filter((a) => a.uid !== o); } }; }, Do = pu({ type: String, values: N0, required: !1 }), ty = Symbol("size"), ZA = () => { const n = ht(ty, {}); return ce(() => H(n.size) || ""); }; function ny(n, { beforeFocus: e, afterFocus: t, beforeBlur: i, afterBlur: r } = {}) { const s = cn(), { emit: o } = s, a = In(), c = Ae(!1), l = (p) => { Ln(e) && e(p) || c.value || (c.value = !0, o("focus", p), t == null || t()); }, d = (p) => { var g; Ln(i) && i(p) || p.relatedTarget && ((g = a.value) != null && g.contains(p.relatedTarget)) || (c.value = !1, o("blur", p), r == null || r()); }, h = () => { var p, g; (p = a.value) != null && p.contains(document.activeElement) && a.value !== document.activeElement || (g = n.value) == null || g.focus(); }; return Ke(a, (p) => { p && p.setAttribute("tabindex", "-1"); }), pn(a, "focus", l, !0), pn(a, "blur", d, !0), pn(a, "click", h, !0), process.env.NODE_ENV === "test" && on(() => { const p = Ms(n.value) ? n.value : document.querySelector("input,textarea"); p && (pn(p, "focus", l, !0), pn(p, "blur", d, !0)); }), { isFocused: c, wrapperRef: a, handleFocus: l, handleBlur: d }; } function iy({ afterComposition: n, emit: e }) { const t = Ae(!1), i = (a) => { e == null || e("compositionstart", a), t.value = !0; }, r = (a) => { var c; e == null || e("compositionupdate", a); const l = (c = a.target) == null ? void 0 : c.value, d = l[l.length - 1] || ""; t.value = !bE(d); }, s = (a) => { e == null || e("compositionend", a), t.value && (t.value = !1, Mt(() => n(a))); }; return { isComposing: t, handleComposition: (a) => { a.type === "compositionend" ? s(a) : r(a); }, handleCompositionStart: i, handleCompositionUpdate: r, handleCompositionEnd: s }; } const ry = Symbol("emptyValuesContextKey"), XA = "use-empty-values", YA = ["", void 0, null], JA = void 0, qA = dt({ emptyValues: Array, valueOnClear: { type: [String, Number, Boolean, Function], default: void 0, validator: (n) => Ln(n) ? !n() : !n } }), KA = (n, e) => { const t = cn() ? ht(ry, Ae({})) : Ae({}), i = ce(() => n.emptyValues || t.value.emptyValues || YA), r = ce(() => Ln(n.valueOnClear) ? n.valueOnClear() : n.valueOnClear !== void 0 ? n.valueOnClear : Ln(t.value.valueOnClear) ? t.value.valueOnClear() : t.value.valueOnClear !== void 0 ? t.value.valueOnClear : JA), s = (o) => i.value.includes(o); return i.value.includes(r.value) || en(XA, "value-on-clear should be a value of empty-values"), { emptyValues: i, valueOnClear: r, isEmptyValue: s }; }, QA = dt({ ariaLabel: String, ariaOrientation: { type: String, values: ["horizontal", "vertical", "undefined"] }, ariaControls: String }), Gs = (n) => ZT(QA, n), sy = Symbol(), Jc = Ae(); function Lf(n, e = void 0) { const t = cn() ? ht(sy, Jc) : Jc; return n ? ce(() => { var i, r; return (r = (i = t.value) == null ? void 0 : i[n]) != null ? r : e; }) : t; } function eC(n, e) { const t = Lf(), i = it(n, ce(() => { var a; return ((a = t.value) == null ? void 0 : a.namespace) || Bc; })), r = mu(ce(() => { var a; return (a = t.value) == null ? void 0 : a.locale; })), s = ey(ce(() => { var a; return ((a = t.value) == null ? void 0 : a.zIndex) || K0; })), o = ce(() => { var a; return H(e) || ((a = t.value) == null ? void 0 : a.size) || ""; }); return tC(ce(() => H(t) || {})), { ns: i, locale: r, zIndex: s, size: o }; } const tC = (n, e, t = !1) => { var i; const r = !!cn(), s = r ? Lf() : void 0, o = (i = void 0) != null ? i : r ? gn : void 0; if (!o) { en("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup()."); return; } const a = ce(() => { const c = H(n); return s != null && s.value ? nC(s.value, c) : c; }); return o(sy, a), o(F0, ce(() => a.value.locale)), o(B0, ce(() => a.value.namespace)), o(Q0, ce(() => a.value.zIndex)), o(ty, { size: ce(() => a.value.size || "") }), o(ry, ce(() => ({ emptyValues: a.value.emptyValues, valueOnClear: a.value.valueOnClear }))), (t || !Jc.value) && (Jc.value = a.value), a; }, nC = (n, e) => { const t = [.../* @__PURE__ */ new Set([...Em(n), ...Em(e)])], i = {}; for (const r of t) i[r] = e[r] !== void 0 ? e[r] : n[r]; return i; }; var at = (n, e) => { const t = n.__vccOpts || n; for (const [i, r] of e) t[i] = r; return t; }; const iC = dt({ size: { type: Ye([Number, String]) }, color: { type: String } }), rC = De({ name: "ElIcon", inheritAttrs: !1 }), sC = /* @__PURE__ */ De({ ...rC, props: iC, setup(n) { const e = n, t = it("icon"), i = ce(() => { const { size: r, color: s } = e; return !r && !s ? {} : { fontSize: yi(r) ? void 0 : Zc(r), "--color": s }; }); return (r, s) => (pe(), Re("i", Oi({ class: H(t).b(), style: H(i) }, r.$attrs), [ Xe(r.$slots, "default") ], 16)); } }); var oC = /* @__PURE__ */ at(sC, [["__file", "icon.vue"]]); const Bt = vn(oC), Rf = Symbol("formContextKey"), qc = Symbol("formItemContextKey"), ra = (n, e = {}) => { const t = Ae(void 0), i = e.prop ? t : z0("size"), r = e.global ? t : ZA(), s = e.form ? { size: void 0 } : ht(Rf, void 0), o = e.formItem ? { size: void 0 } : ht(qc, void 0); return ce(() => i.value || H(n) || (o == null ? void 0 : o.size) || (s == null ? void 0 : s.size) || r.value || ""); }, yu = (n) => { const e = z0("disabled"), t = ht(Rf, void 0); return ce(() => e.value || H(n) || (t == null ? void 0 : t.disabled) || !1); }, gl = () => { const n = ht(Rf, void 0), e = ht(qc, void 0); return { form: n, formItem: e }; }, Pf = (n, { formItemContext: e, disableIdGeneration: t, disableIdManagement: i }) => { t || (t = Ae(!1)), i || (i = Ae(!1)); const r = Ae(); let s; const o = ce(() => { var a; return !!(!(n.label || n.ariaLabel) && e && e.inputIds && ((a = e.inputIds) == null ? void 0 : a.length) <= 1); }); return on(() => { s = Ke([Bn(n, "id"), t], ([a, c]) => { const l = a ?? (c ? void 0 : vu().value); l !== r.value && (e != null && e.removeInputId && (r.value && e.removeInputId(r.value), !(i != null && i.value) && !c && l && e.addInputId(l)), r.value = l); }, { immediate: !0 }); }), c0(() => { s && s(), e != null && e.removeInputId && r.value && e.removeInputId(r.value); }), { isLabeledByFormItem: o, inputId: r }; }; let ui; const aC = ` height:0 !important; visibility:hidden !important; ${X1() ? "" : "overflow:hidden !important;"} position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important; `, lC = [ "letter-spacing", "line-height", "padding-top", "padding-bottom", "font-family", "font-weight", "font-size", "text-rendering", "text-transform", "width", "text-indent", "padding-left", "padding-right", "border-width", "box-sizing" ]; function cC(n) { const e = window.getComputedStyle(n), t = e.getPropertyValue("box-sizing"), i = Number.parseFloat(e.getPropertyValue("padding-bottom")) + Number.parseFloat(e.getPropertyValue("padding-top")), r = Number.parseFloat(e.getPropertyValue("border-bottom-width")) + Number.parseFloat(e.getPropertyValue("border-top-width")); return { contextStyle: lC.map((o) => `${o}:${e.getPropertyValue(o)}`).join(";"), paddingSize: i, borderSize: r, boxSizing: t }; } function Hm(n, e = 1, t) { var i; ui || (ui = document.createElement("textarea"), document.body.appendChild(ui)); const { paddingSize: r, borderSize: s, boxSizing: o, contextStyle: a } = cC(n); ui.setAttribute("style", `${a};${aC}`), ui.value = n.value || n.placeholder || ""; let c = ui.scrollHeight; const l = {}; o === "border-box" ? c = c + s : o === "content-box" && (c = c - r), ui.value = ""; const d = ui.scrollHeight - r; if (St(e)) { let h = d * e; o === "border-box" && (h = h + r + s), c = Math.max(h, c), l.minHeight = `${h}px`; } if (St(t)) { let h = d * t; o === "border-box" && (h = h + r + s), c = Math.min(h, c); } return l.height = `${c}px`, (i = ui.parentNode) == null || i.removeChild(ui), ui = void 0, l; } const uC = dt({ id: { type: String, default: void 0 }, size: Do, disabled: Boolean, modelValue: { type: Ye([ String, Number, Object ]), default: "" }, maxlength: { type: [String, Number] }, minlength: { type: [String, Number] }, type: { type: String, default: "text" }, resize: { type: String, values: ["none", "both", "horizontal", "vertical"] }, autosize: { type: Ye([Boolean, Object]), default: !1 }, autocomplete: { type: String, default: "off" }, formatter: { type: Function }, parser: { type: Function }, placeholder: { type: String }, form: { type: String }, readonly: Boolean, clearable: Boolean, showPassword: Boolean, showWordLimit: Boolean, suffixIcon: { type: Zr }, prefixIcon: { type: Zr }, containerRole: { type: String, default: void 0 }, tabindex: { type: [String, Number], default: 0 }, validateEvent: { type: Boolean, default: !0 }, inputStyle: { type: Ye([Object, Array, String]), default: () => tr({}) }, autofocus: Boolean, rows: { type: Number, default: 2 }, ...Gs(["ariaLabel"]) }), hC = { [Dt]: (n) => On(n), input: (n) => On(n), change: (n) => On(n), focus: (n) => n instanceof FocusEvent, blur: (n) => n instanceof FocusEvent, clear: () => !0, mouseleave: (n) => n instanceof MouseEvent, mouseenter: (n) => n instanceof MouseEvent, keydown: (n) => n instanceof Event, compositionstart: (n) => n instanceof CompositionEvent, compositionupdate: (n) => n instanceof CompositionEvent, compositionend: (n) => n instanceof CompositionEvent }, dC = De({ name: "ElInput", inheritAttrs: !1 }), fC = /* @__PURE__ */ De({ ...dC, props: uC, emits: hC, setup(n, { expose: e, emit: t }) { const i = n, r = e1(), s = ou(), o = ce(() => { const de = {}; return i.containerRole === "combobox" && (de["aria-haspopup"] = r["aria-haspopup"], de["aria-owns"] = r["aria-owns"], de["aria-expanded"] = r["aria-expanded"]), de; }), a = ce(() => [ i.type === "textarea" ? y.b() : u.b(), u.m(g.value), u.is("disabled", f.value), u.is("exceed", K.value), { [u.b("group")]: s.prepend || s.append, [u.m("prefix")]: s.prefix || i.prefixIcon, [u.m("suffix")]: s.suffix || i.suffixIcon || i.clearable || i.showPassword, [u.bm("suffix", "password-clear")]: D.value && B.value, [u.b("hidden")]: i.type === "hidden" }, r.class ]), c = ce(() => [ u.e("wrapper"), u.is("focus", E.value) ]), l = ME({ excludeKeys: ce(() => Object.keys(o.value)) }), { form: d, formItem: h } = gl(), { inputId: p } = Pf(i, { formItemContext: h }), g = ra(), f = yu(), u = it("input"), y = it("textarea"), v = In(), m = In(), w = Ae(!1), S = Ae(!1), T = Ae(), M = In(i.inputStyle), x = ce(() => v.value || m.value), { wrapperRef: _, isFocused: E, handleFocus: L, handleBlur: R } = ny(x, { beforeFocus() { return f.value; }, afterBlur() { var de; i.validateEvent && ((de = h == null ? void 0 : h.validate) == null || de.call(h, "blur").catch((we) => en(we))); } }), C = ce(() => { var de; return (de = d == null ? void 0 : d.statusIcon) != null ? de : !1; }), A = ce(() => (h == null ? void 0 : h.validateState) || ""), P = ce(() => A.value && D0[A.value]), I = ce(() => S.value ? mE : cE), b = ce(() => [ r.style ]), O = ce(() => [ i.inputStyle, M.value, { resize: i.resize } ]), N = ce(() => sr(i.modelValue) ? "" : String(i.modelValue)), D = ce(() => i.clearable && !f.value && !i.readonly && !!N.value && (E.value || w.value)), B = ce(() => i.showPassword && !f.value && !i.readonly && !!N.value && (!!N.value || E.value)), U = ce(() => i.showWordLimit && !!i.maxlength && (i.type === "text" || i.type === "textarea") && !f.value && !i.readonly && !i.showPassword), k = ce(() => N.value.length), K = ce(() => !!U.value && k.value > Number(i.maxlength)), ie = ce(() => !!s.suffix || !!i.suffixIcon || D.value || i.showPassword || U.value || !!A.value && C.value), [j, G] = WA(v); ii(m, (de) => { if (Q(), !U.value || i.resize !== "both") return; const we = de[0], { width: se } = we.contentRect; T.value = { right: `calc(100% - ${se + 15 + 6}px)` }; }); const W = () => { const { type: de, autosize: we } = i; if (!(!rn || de !== "textarea" || !m.value)) if (we) { const se = Pn(we) ? we.minRows : void 0, Se = Pn(we) ? we.maxRows : void 0, ge = Hm(m.value, se, Se); M.value = { overflowY: "hidden", ...ge }, Mt(() => { m.value.offsetHeight, M.value = ge; }); } else M.value = { minHeight: Hm(m.value).minHeight }; }, Q = ((de) => { let we = !1; return () => { var se; if (we || !i.autosize) return; ((se = m.value) == null ? void 0 : se.offsetParent) === null || (de(), we = !0); }; })(W), ee = () => { const de = x.value, we = i.formatter ? i.formatter(N.value) : N.value; !de || de.value === we || (de.value = we); }, ne = async (de) => { j(); let { value: we } = de.target; if (i.formatter && (we = i.parser ? i.parser(we) : we), !te.value) { if (we === N.value) { ee(); return; } t(Dt, we), t("input", we), await Mt(), ee(), G(); } }, Y = (de) => { t("change", de.target.value); }, { isComposing: te, handleCompositionStart: F, handleCompositionUpdate: $, handleCompositionEnd: J } = iy({ emit: t, afterComposition: ne }), z = () => { S.value = !S.value, V(); }, V = async () => { var de; await Mt(), (de = x.value) == null || de.focus(); }, oe = () => { var de; return (de = x.value) == null ? void 0 : de.blur(); }, ue = (de) => { w.value = !1, t("mouseleave", de); }, le = (de) => { w.value = !0, t("mouseenter", de); }, ve = (de) => { t("keydown", de); }, xe = () => { var de; (de = x.value) == null || de.select(); }, Te = () => { t(Dt, ""), t("change", ""), t("clear"), t("input", ""); }; return Ke(() => i.modelValue, () => { var de; Mt(() => W()), i.validateEvent && ((de = h == null ? void 0 : h.validate) == null || de.call(h, "change").catch((we) => en(we))); }), Ke(N, () => ee()), Ke(() => i.type, async () => { await Mt(), ee(), W(); }), on(() => { !i.formatter && i.parser && en("ElInput", "If you set the parser, you also need to set the formatter."), ee(), Mt(W); }), e({ input: v, textarea: m, ref: x, textareaStyle: O, autosize: Bn(i, "autosize"), isComposing: te, focus: V, blur: oe, select: xe, clear: Te, resizeTextarea: W }), (de, we) => (pe(), Re("div", Oi(H(o), { class: [ H(a), { [H(u).bm("group", "append")]: de.$slots.append, [H(u).bm("group", "prepend")]: de.$slots.prepend } ], style: H(b), role: de.containerRole, onMouseenter: le, onMouseleave: ue }), [ Ge(" input "), de.type !== "textarea" ? (pe(), Re(Wt, { key: 0 }, [ Ge(" prepend slot "), de.$slots.prepend ? (pe(), Re("div", { key: 0, class: Le(H(u).be("group", "prepend")) }, [ Xe(de.$slots, "prepend") ], 2)) : Ge("v-if", !0), Be("div", { ref_key: "wrapperRef", ref: _, class: Le(H(c)) }, [ Ge(" prefix slot "), de.$slots.prefix || de.prefixIcon ? (pe(), Re("span", { key: 0, class: Le(H(u).e("prefix")) }, [ Be("span", { class: Le(H(u).e("prefix-inner")) }, [ Xe(de.$slots, "prefix"), de.prefixIcon ? (pe(), He(H(Bt), { key: 0, class: Le(H(u).e("icon")) }, { default: fe(() => [ (pe(), He(zn(de.prefixIcon))) ]), _: 1 }, 8, ["class"])) : Ge("v-if", !0) ], 2) ], 2)) : Ge("v-if", !0), Be("input", Oi({ id: H(p), ref_key: "input", ref: v, class: H(u).e("inner") }, H(l), { minlength: de.minlength, maxlength: de.maxlength, type: de.showPassword ? S.value ? "text" : "password" : de.type, disabled: H(f), readonly: de.readonly, autocomplete: de.autocomplete, tabindex: de.tabindex, "aria-label": de.ariaLabel, placeholder: de.placeholder, style: de.inputStyle, form: de.form, autofocus: de.autofocus, onCompositionstart: H(F), onCompositionupdate: H($), onCompositionend: H(J), onInput: ne, onChange: Y, onKeydown: ve }), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "onCompositionstart", "onCompositionupdate", "onCompositionend"]), Ge(" suffix slot "), H(ie) ? (pe(), Re("span", { key: 1, class: Le(H(u).e("suffix")) }, [ Be("span", { class: Le(H(u).e("suffix-inner")) }, [ !H(D) || !H(B) || !H(U) ? (pe(), Re(Wt, { key: 0 }, [ Xe(de.$slots, "suffix"), de.suffixIcon ? (pe(), He(H(Bt), { key: 0, class: Le(H(u).e("icon")) }, { default: fe(() => [ (pe(), He(zn(de.suffixIcon))) ]), _: 1 }, 8, ["class"])) : Ge("v-if", !0) ], 64)) : Ge("v-if", !0), H(D) ? (pe(), He(H(Bt), { key: 1, class: Le([H(u).e("icon"), H(u).e("clear")]), onMousedown: fn(H($a), ["prevent"]), onClick: Te }, { default: fe(() => [ ae(H(yf)) ]), _: 1 }, 8, ["class", "onMousedown"])) : Ge("v-if", !0), H(B) ? (pe(), He(H(Bt), { key: 2, class: Le([H(u).e("icon"), H(u).e("password")]), onClick: z }, { default: fe(() => [ (pe(), He(zn(H(I)))) ]), _: 1 }, 8, ["class"])) : Ge("v-if", !0), H(U) ? (pe(), Re("span", { key: 3, class: Le(H(u).e("count")) }, [ Be("span", { class: Le(H(u).e("count-inner")) }, wt(H(k)) + " / " + wt(de.maxlength), 3) ], 2)) : Ge("v-if", !0), H(A) && H(P) && H(C) ? (pe(), He(H(Bt), { key: 4, class: Le([ H(u).e("icon"), H(u).e("validateIcon"), H(u).is("loading", H(A) === "validating") ]) }, { default: fe(() => [ (pe(), He(zn(H(P)))) ]), _: 1 }, 8, ["class"])) : Ge("v-if", !0) ], 2) ], 2)) : Ge("v-if", !0) ], 2), Ge(" append slot "), de.$slots.append ? (pe(), Re("div", { key: 1, class: Le(H(u).be("group", "append")) }, [ Xe(de.$slots, "append") ], 2)) : Ge("v-if", !0) ], 64)) : (pe(), Re(Wt, { key: 1 }, [ Ge(" textarea "), Be("textarea", Oi({ id: H(p), ref_key: "textarea", ref: m, class: [H(y).e("inner"), H(u).is("focus", H(E))] }, H(l), { minlength: de.minlength, maxlength: de.maxlength, tabindex: de.tabindex, disabled: H(f), readonly: de.readonly, autocomplete: de.autocomplete, style: H(O), "aria-label": de.ariaLabel, placeholder: de.placeholder, form: de.form, autofocus: de.autofocus, rows: de.rows, onCompositionstart: H(F), onCompositionupdate: H($), onCompositionend: H(J), onInput: ne, onFocus: H(L), onBlur: H(R), onChange: Y, onKeydown: ve }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]), H(U) ? (pe(), Re("span", { key: 0, style: Ot(T.value), class: Le(H(u).e("count")) }, wt(H(k)) + " / " + wt(de.maxlength), 7)) : Ge("v-if", !0) ], 64)) ], 16, ["role"])); } }); var pC = /* @__PURE__ */ at(fC, [["__file", "input.vue"]]); const mC = vn(pC), Ys = 4, gC = { vertical: { offset: "offsetHeight", scroll: "scrollTop", scrollSize: "scrollHeight", size: "height", key: "vertical", axis: "Y", client: "clientY", direction: "top" }, horizontal: { offset: "offsetWidth", scroll: "scrollLeft", scrollSize: "scrollWidth", size: "width", key: "horizontal", axis: "X", client: "clientX", direction: "left" } }, vC = ({ move: n, size: e, bar: t }) => ({ [t.size]: e, transform: `translate${t.axis}(${n}%)` }), If = Symbol("scrollbarContextKey"), yC = dt({ vertical: Boolean, size: String, move: Number, ratio: { type: Number, required: !0 }, always: Boolean }), bC = "Thumb", xC = /* @__PURE__ */ De({ __name: "thumb", props: yC, setup(n) { const e = n, t = ht(If), i = it("scrollbar"); t || na(bC, "can not inject scrollbar context"); const r = Ae(), s = Ae(), o = Ae({}), a = Ae(!1); let c = !1, l = !1, d = rn ? document.onselectstart : null; const h = ce(() => gC[e.vertical ? "vertical" : "horizontal"]), p = ce(() => vC({ size: e.size, move: e.move, bar: h.value })), g = ce(() => r.value[h.value.offset] ** 2 / t.wrapElement[h.value.scrollSize] / e.ratio / s.value[h.value.offset]), f = (M) => { var x; if (M.stopPropagation(), M.ctrlKey || [1, 2].includes(M.button)) return; (x = window.getSelection()) == null || x.removeAllRanges(), y(M); const _ = M.currentTarget; _ && (o.value[h.value.axis] = _[h.value.offset] - (M[h.value.client] - _.getBoundingClientRect()[h.value.direction])); }, u = (M) => { if (!s.value || !r.value || !t.wrapElement) return; const x = Math.abs(M.target.getBoundingClientRect()[h.value.direction] - M[h.value.client]), _ = s.value[h.value.offset] / 2, E = (x - _) * 100 * g.value / r.value[h.value.offset]; t.wrapElement[h.value.scroll] = E * t.wrapElement[h.value.scrollSize] / 100; }, y = (M) => { M.stopImmediatePropagation(), c = !0, document.addEventListener("mousemove", v), document.addEventListener("mouseup", m), d = document.onselectstart, document.onselectstart = () => !1; }, v = (M) => { if (!r.value || !s.value || c === !1) return; const x = o.value[h.value.axis]; if (!x) return; const _ = (r.value.getBoundingClientRect()[h.value.direction] - M[h.value.client]) * -1, E = s.value[h.value.offset] - x, L = (_ - E) * 100 * g.value / r.value[h.value.offset]; t.wrapElement[h.value.scroll] = L * t.wrapElement[h.value.scrollSize] / 100; }, m = () => { c = !1, o.value[h.value.axis] = 0, document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", m), T(), l && (a.value = !1); }, w = () => { l = !1, a.value = !!e.size; }, S = () => { l = !0, a.value = c; }; li(() => { T(), document.removeEventListener("mouseup", m); }); const T = () => { document.onselectstart !== d && (document.onselectstart = d); }; return pn(Bn(t, "scrollbarElement"), "mousemove", w), pn(Bn(t, "scrollbarElement"), "mouseleave", S), (M, x) => (pe(), He(hl, { name: H(i).b("fade"), persisted: "" }, { default: fe(() => [ Ft(Be("div", { ref_key: "instance", ref: r, class: Le([H(i).e("bar"), H(i).is(H(h).key)]), onMousedown: u }, [ Be("div", { ref_key: "thumb", ref: s, class: Le(H(i).e("thumb")), style: Ot(H(p)), onMousedown: f }, null, 38) ], 34), [ [xn, M.always || a.value] ]) ]), _: 1 }, 8, ["name"])); } }); var Wm = /* @__PURE__ */ at(xC, [["__file", "thumb.vue"]]); const wC = dt({ always: { type: Boolean, default: !0 }, minSize: { type: Number, required: !0 } }), MC = /* @__PURE__ */ De({ __name: "bar", props: wC, setup(n, { expose: e }) { const t = n, i = ht(If), r = Ae(0), s = Ae(0), o = Ae(""), a = Ae(""), c = Ae(1), l = Ae(1); return e({ handleScroll: (p) => { if (p) { const g = p.offsetHeight - Ys, f = p.offsetWidth - Ys; s.value = p.scrollTop * 100 / g * c.value, r.value = p.scrollLeft * 100 / f * l.value; } }, update: () => { const p = i == null ? void 0 : i.wrapElement; if (!p) return; const g = p.offsetHeight - Ys, f = p.offsetWidth - Ys, u = g ** 2 / p.scrollHeight, y = f ** 2 / p.scrollWidth, v = Math.max(u, t.minSize), m = Math.max(y, t.minSize); c.value = u / (g - u) / (v / (g - v)), l.value = y / (f - y) / (m / (f - m)), a.value = v + Ys < g ? `${v}px` : "", o.value = m + Ys < f ? `${m}px` : ""; } }), (p, g) => (pe(), Re(Wt, null, [ ae(Wm, { move: r.value, ratio: l.value, size: o.value, always: p.always }, null, 8, ["move", "ratio", "size", "always"]), ae(Wm, { move: s.value, ratio: c.value, size: a.value, vertical: "", always: p.always }, null, 8, ["move", "ratio", "size", "always"]) ], 64)); } }); var SC = /* @__PURE__ */ at(MC, [["__file", "bar.vue"]]); const _C = dt({ height: { type: [String, Number], default: "" }, maxHeight: { type: [String, Number], default: "" }, native: { type: Boolean, default: !1 }, wrapStyle: { type: Ye([String, Object, Array]), default: "" }, wrapClass: { type: [String, Array], default: "" }, viewClass: { type: [String, Array], default: "" }, viewStyle: { type: [String, Array, Object], default: "" }, noresize: Boolean, tag: { type: String, default: "div" }, always: Boolean, minSize: { type: Number, default: 20 }, tabindex: { type: [String, Number], default: void 0 }, id: String, role: String, ...Gs(["ariaLabel", "ariaOrientation"]) }), TC = { scroll: ({ scrollTop: n, scrollLeft: e }) => [n, e].every(St) }, dd = "ElScrollbar", EC = De({ name: dd }), AC = /* @__PURE__ */ De({ ...EC, props: _C, emits: TC, setup(n, { expose: e, emit: t }) { const i = n, r = it("scrollbar"); let s, o, a = 0, c = 0; const l = Ae(), d = Ae(), h = Ae(), p = Ae(), g = ce(() => { const T = {}; return i.height && (T.height = Zc(i.height)), i.maxHeight && (T.maxHeight = Zc(i.maxHeight)), [i.wrapStyle, T]; }), f = ce(() => [ i.wrapClass, r.e("wrap"), { [r.em("wrap", "hidden-default")]: !i.native } ]), u = ce(() => [r.e("view"), i.viewClass]), y = () => { var T; d.value && ((T = p.value) == null || T.handleScroll(d.value), a = d.value.scrollTop, c = d.value.scrollLeft, t("scroll", { scrollTop: d.value.scrollTop, scrollLeft: d.value.scrollLeft })); }; function v(T, M) { Pn(T) ? d.value.scrollTo(T) : St(T) && St(M) && d.value.scrollTo(T, M); } const m = (T) => { if (!St(T)) { en(dd, "value must be a number"); return; } d.value.scrollTop = T; }, w = (T) => { if (!St(T)) { en(dd, "value must be a number"); return; } d.value.scrollLeft = T; }, S = () => { var T; (T = p.value) == null || T.update(); }; return Ke(() => i.noresize, (T) => { T ? (s == null || s(), o == null || o()) : ({ stop: s } = ii(h, S), o = pn("resize", S)); }, { immediate: !0 }), Ke(() => [i.maxHeight, i.height], () => { i.native || Mt(() => { var T; S(), d.value && ((T = p.value) == null || T.handleScroll(d.value)); }); }), gn(If, qn({ scrollbarElement: l, wrapElement: d })), t1(() => { d.value && (d.value.scrollTop = a, d.value.scrollLeft = c); }), on(() => { i.native || Mt(() => { S(); }); }), sf(() => S()), e({ wrapRef: d, update: S, scrollTo: v, setScrollTop: m, setScrollLeft: w, handleScroll: y }), (T, M) => (pe(), Re("div", { ref_key: "scrollbarRef", ref: l, class: Le(H(r).b()) }, [ Be("div", { ref_key: "wrapRef", ref: d, class: Le(H(f)), style: Ot(H(g)), tabindex: T.tabindex, onScroll: y }, [ (pe(), He(zn(T.tag), { id: T.id, ref_key: "resizeRef", ref: h, class: Le(H(u)), style: Ot(T.viewStyle), role: T.role, "aria-label": T.ariaLabel, "aria-orientation": T.ariaOrientation }, { default: fe(() => [ Xe(T.$slots, "default") ]), _: 3 }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"])) ], 46, ["tabindex"]), T.native ? Ge("v-if", !0) : (pe(), He(SC, { key: 0, ref_key: "barRef", ref: p, always: T.always, "min-size": T.minSize }, null, 8, ["always", "min-size"])) ], 2)); } }); var CC = /* @__PURE__ */ at(AC, [["__file", "scrollbar.vue"]]); const LC = vn(CC), Of = Symbol("popper"), oy = Symbol("popperContent"), RC = [ "dialog", "grid", "group", "listbox", "menu", "navigation", "tooltip", "tree" ], ay = dt({ role: { type: String, values: RC, default: "tooltip" } }), PC = De({ name: "ElPopper", inheritAttrs: !1 }), IC = /* @__PURE__ */ De({ ...PC, props: ay, setup(n, { expose: e }) { const t = n, i = Ae(), r = Ae(), s = Ae(), o = Ae(), a = ce(() => t.role), c = { triggerRef: i, popperInstanceRef: r, contentRef: s, referenceRef: o, role: a }; return e(c), gn(Of, c), (l, d) => Xe(l.$slots, "default"); } }); var OC = /* @__PURE__ */ at(IC, [["__file", "popper.vue"]]); const ly = dt({ arrowOffset: { type: Number, default: 5 } }), DC = De({ name: "ElPopperArrow", inheritAttrs: !1 }), NC = /* @__PURE__ */ De({ ...DC, props: ly, setup(n, { expose: e }) { const t = n, i = it("popper"), { arrowOffset: r, arrowRef: s, arrowStyle: o } = ht(oy, void 0); return Ke(() => t.arrowOffset, (a) => { r.value = a; }), li(() => { s.value = void 0; }), e({ arrowRef: s }), (a, c) => (pe(), Re("span", { ref_key: "arrowRef", ref: s, class: Le(H(i).e("arrow")), style: Ot(H(o)), "data-popper-arrow": "" }, null, 6)); } }); var FC = /* @__PURE__ */ at(NC, [["__file", "arrow.vue"]]); const Ju = "ElOnlyChild", BC = De({ name: Ju, setup(n, { slots: e, attrs: t }) { var i; const r = ht(q0), s = HA((i = r == null ? void 0 : r.setForwardRef) != null ? i : $a); return () => { var o; const a = (o = e.default) == null ? void 0 : o.call(e, t); if (!a) return null; if (a.length > 1) return en(Ju, "requires exact only one valid child."), null; const c = cy(a); return c ? Ft(n1(c, t), [[s]]) : (en(Ju, "no valid child node found"), null); }; } }); function cy(n) { if (!n) return null; const e = n; for (const t of e) { if (Pn(t)) switch (t.type) { case i1: continue; case u0: case "svg": return jm(t); case Wt: return cy(t.children); default: return t; } return jm(t); } return null; } function jm(n) { const e = it("only-child"); return ae("span", { class: e.e("content") }, [n]); } const uy = dt({ virtualRef: { type: Ye(Object) }, virtualTriggering: Boolean, onMouseenter: { type: Ye(Function) }, onMouseleave: { type: Ye(Function) }, onClick: { type: Ye(Function) }, onKeydown: { type: Ye(Function) }, onFocus: { type: Ye(Function) }, onBlur: { type: Ye(Function) }, onContextmenu: { type: Ye(Function) }, id: String, open: Boolean }), zC = De({ name: "ElPopperTrigger", inheritAttrs: !1 }), UC = /* @__PURE__ */ De({ ...zC, props: uy, setup(n, { expose: e }) { const t = n, { role: i, triggerRef: r } = ht(Of, void 0); GA(r); const s = ce(() => a.value ? t.id : void 0), o = ce(() => { if (i && i.value === "tooltip") return t.open && t.id ? t.id : void 0; }), a = ce(() => { if (i && i.value !== "tooltip") return i.value; }), c = ce(() => a.value ? `${t.open}` : void 0); let l; const d = [ "onMouseenter", "onMouseleave", "onClick", "onKeydown", "onFocus", "onBlur", "onContextmenu" ]; return on(() => { Ke(() => t.virtualRef, (h) => { h && (r.value = ir(h)); }, { immediate: !0 }), Ke(r, (h, p) => { l == null || l(), l = void 0, Ms(h) && (d.forEach((g) => { var f; const u = t[g]; u && (h.addEventListener(g.slice(2).toLowerCase(), u), (f = p == null ? void 0 : p.removeEventListener) == null || f.call(p, g.slice(2).toLowerCase(), u)); }), l = Ke([s, o, a, c], (g) => { [ "aria-controls", "aria-describedby", "aria-haspopup", "aria-expanded" ].forEach((f, u) => { sr(g[u]) ? h.removeAttribute(f) : h.setAttribute(f, g[u]); }); }, { immediate: !0 })), Ms(p) && [ "aria-controls", "aria-describedby", "aria-haspopup", "aria-expanded" ].forEach((g) => p.removeAttribute(g)); }, { immediate: !0 }); }), li(() => { if (l == null || l(), l = void 0, r.value && Ms(r.value)) { const h = r.value; d.forEach((p) => { const g = t[p]; g && h.removeEventListener(p.slice(2).toLowerCase(), g); }), r.value = void 0; } }), e({ triggerRef: r }), (h, p) => h.virtualTriggering ? Ge("v-if", !0) : (pe(), He(H(BC), Oi({ key: 0 }, h.$attrs, { "aria-controls": H(s), "aria-describedby": H(o), "aria-expanded": H(c), "aria-haspopup": H(a) }), { default: fe(() => [ Xe(h.$slots, "default") ]), _: 3 }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])); } }); var VC = /* @__PURE__ */ at(UC, [["__file", "trigger.vue"]]); const qu = "focus-trap.focus-after-trapped", Ku = "focus-trap.focus-after-released", kC = "focus-trap.focusout-prevented", $m = { cancelable: !0, bubbles: !1 }, GC = { cancelable: !0, bubbles: !1 }, Zm = "focusAfterTrapped", Xm = "focusAfterReleased", HC = Symbol("elFocusTrap"), Df = Ae(), bu = Ae(0), Nf = Ae(0); let Bl = 0; const hy = (n) => { const e = [], t = document.createTreeWalker(n, NodeFilter.SHOW_ELEMENT, { acceptNode: (i) => { const r = i.tagName === "INPUT" && i.type === "hidden"; return i.disabled || i.hidden || r ? NodeFilter.FILTER_SKIP : i.tabIndex >= 0 || i === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } }); for (; t.nextNode(); ) e.push(t.currentNode); return e; }, Ym = (n, e) => { for (const t of n) if (!WC(t, e)) return t; }, WC = (n, e) => { if (process.env.NODE_ENV === "test") return !1; if (getComputedStyle(n).visibility === "hidden") return !0; for (; n; ) { if (e && n === e) return !1; if (getComputedStyle(n).display === "none") return !0; n = n.parentElement; } return !1; }, jC = (n) => { const e = hy(n), t = Ym(e, n), i = Ym(e.reverse(), n); return [t, i]; }, $C = (n) => n instanceof HTMLInputElement && "select" in n, Ir = (n, e) => { if (n && n.focus) { const t = document.activeElement; n.focus({ preventScroll: !0 }), Nf.value = window.performance.now(), n !== t && $C(n) && e && n.select(); } }; function Jm(n, e) { const t = [...n], i = n.indexOf(e); return i !== -1 && t.splice(i, 1), t; } const ZC = () => { let n = []; return { push: (i) => { const r = n[0]; r && i !== r && r.pause(), n = Jm(n, i), n.unshift(i); }, remove: (i) => { var r, s; n = Jm(n, i), (s = (r = n[0]) == null ? void 0 : r.resume) == null || s.call(r); } }; }, XC = (n, e = !1) => { const t = document.activeElement; for (const i of n) if (Ir(i, e), document.activeElement !== t) return; }, qm = ZC(), YC = () => bu.value > Nf.value, zl = () => { Df.value = "pointer", bu.value = window.performance.now(); }, Km = () => { Df.value = "keyboard", bu.value = window.performance.now(); }, JC = () => (on(() => { Bl === 0 && (document.addEventListener("mousedown", zl), document.addEventListener("touchstart", zl), document.addEventListener("keydown", Km)), Bl++; }), li(() => { Bl--, Bl <= 0 && (document.removeEventListener("mousedown", zl), document.removeEventListener("touchstart", zl), document.removeEventListener("keydown", Km)); }), { focusReason: Df, lastUserFocusTimestamp: bu, lastAutomatedFocusTimestamp: Nf }), Ul = (n) => new CustomEvent(kC, { ...GC, detail: n }), qC = De({ name: "ElFocusTrap", inheritAttrs: !1, props: { loop: Boolean, trapped: Boolean, focusTrapEl: Object, focusStartEl: { type: [Object, String], default: "first" } }, emits: [ Zm, Xm, "focusin", "focusout", "focusout-prevented", "release-requested" ], setup(n, { emit: e }) { const t = Ae(); let i, r; const { focusReason: s } = JC(); BA((f) => { n.trapped && !o.paused && e("release-requested", f); }); const o = { paused: !1, pause() { this.paused = !0; }, resume() { this.paused = !1; } }, a = (f) => { if (!n.loop && !n.trapped || o.paused) return; const { key: u, altKey: y, ctrlKey: v, metaKey: m, currentTarget: w, shiftKey: S } = f, { loop: T } = n, M = u === Di.tab && !y && !v && !m, x = document.activeElement; if (M && x) { const _ = w, [E, L] = jC(_); if (E && L) { if (!S && x === L) { const C = Ul({ focusReason: s.value }); e("focusout-prevented", C), C.defaultPrevented || (f.preventDefault(), T && Ir(E, !0)); } else if (S && [E, _].includes(x)) { const C = Ul({ focusReason: s.value }); e("focusout-prevented", C), C.defaultPrevented || (f.preventDefault(), T && Ir(L, !0)); } } else if (x === _) { const C = Ul({ focusReason: s.value }); e("focusout-prevented", C), C.defaultPrevented || f.preventDefault(); } } }; gn(HC, { focusTrapRef: t, onKeydown: a }), Ke(() => n.focusTrapEl, (f) => { f && (t.value = f); }, { immediate: !0 }), Ke([t], ([f], [u]) => { f && (f.addEventListener("keydown", a), f.addEventListener("focusin", d), f.addEventListener("focusout", h)), u && (u.removeEventListener("keydown", a), u.removeEventListener("focusin", d), u.removeEventListener("focusout", h)); }); const c = (f) => { e(Zm, f); }, l = (f) => e(Xm, f), d = (f) => { const u = H(t); if (!u) return; const y = f.target, v = f.relatedTarget, m = y && u.contains(y); n.trapped || v && u.contains(v) || (i = v), m && e("focusin", f), !o.paused && n.trapped && (m ? r = y : Ir(r, !0)); }, h = (f) => { const u = H(t); if (!(o.paused || !u)) if (n.trapped) { const y = f.relatedTarget; !sr(y) && !u.contains(y) && setTimeout(() => { if (!o.paused && n.trapped) { const v = Ul({ focusReason: s.value }); e("focusout-prevented", v), v.defaultPrevented || Ir(r, !0); } }, 0); } else { const y = f.target; y && u.contains(y) || e("focusout", f); } }; async function p() { await Mt(); const f = H(t); if (f) { qm.push(o); const u = f.contains(document.activeElement) ? i : document.activeElement; if (i = u, !f.contains(u)) { const v = new Event(qu, $m); f.addEventListener(qu, c), f.dispatchEvent(v), v.defaultPrevented || Mt(() => { let m = n.focusStartEl; On(m) || (Ir(m), document.activeElement !== m && (m = "first")), m === "first" && XC(hy(f), !0), (document.activeElement === u || m === "container") && Ir(f); }); } } } function g() { const f = H(t); if (f) { f.removeEventListener(qu, c); const u = new CustomEvent(Ku, { ...$m, detail: { focusReason: s.value } }); f.addEventListener(Ku, l), f.dispatchEvent(u), !u.defaultPrevented && (s.value == "keyboard" || !YC() || f.contains(document.activeElement)) && Ir(i ?? document.body), f.removeEventListener(Ku, l), qm.remove(o); } } return on(() => { n.trapped && p(), Ke(() => n.trapped, (f) => { f ? p() : g(); }); }), li(() => { n.trapped && g(), t.value && (t.value.removeEventListener("keydown", a), t.value.removeEventListener("focusin", d), t.value.removeEventListener("focusout", h), t.value = void 0); }), { onKeydown: a }; } }); function KC(n, e, t, i, r, s) { return Xe(n.$slots, "default", { handleKeydown: n.onKeydown }); } var QC = /* @__PURE__ */ at(qC, [["render", KC], ["__file", "focus-trap.vue"]]); const e2 = ["fixed", "absolute"], t2 = dt({ boundariesPadding: { type: Number, default: 0 }, fallbackPlacements: { type: Ye(Array), default: void 0 }, gpuAcceleration: { type: Boolean, default: !0 }, offset: { type: Number, default: 12 }, placement: { type: String, values: ia, default: "bottom" }, popperOptions: { type: Ye(Object), default: () => ({}) }, strategy: { type: String, values: e2, default: "absolute" } }), dy = dt({ ...t2, id: String, style: { type: Ye([String, Array, Object]) }, className: { type: Ye([String, Array, Object]) }, effect: { type: Ye(String), default: "dark" }, visible: Boolean, enterable: { type: Boolean, default: !0 }, pure: Boolean, focusOnShow: { type: Boolean, default: !1 }, trapping: { type: Boolean, default: !1 }, popperClass: { type: Ye([String, Array, Object]) }, popperStyle: { type: Ye([String, Array, Object]) }, referenceEl: { type: Ye(Object) }, triggerTargetEl: { type: Ye(Object) }, stopPopperMouseEvent: { type: Boolean, default: !0 }, virtualTriggering: Boolean, zIndex: Number, ...Gs(["ariaLabel"]) }), n2 = { mouseenter: (n) => n instanceof MouseEvent, mouseleave: (n) => n instanceof MouseEvent, focus: () => !0, blur: () => !0, close: () => !0 }, i2 = (n, e = []) => { const { placement: t, strategy: i, popperOptions: r } = n, s = { placement: t, strategy: i, ...r, modifiers: [...s2(n), ...e] }; return o2(s, r == null ? void 0 : r.modifiers), s; }, r2 = (n) => { if (rn) return ir(n); }; function s2(n) { const { offset: e, gpuAcceleration: t, fallbackPlacements: i } = n; return [ { name: "offset", options: { offset: [0, e ?? 12] } }, { name: "preventOverflow", options: { padding: { top: 2, bottom: 2, left: 5, right: 5 } } }, { name: "flip", options: { padding: 5, fallbackPlacements: i } }, { name: "computeStyles", options: { gpuAcceleration: t } } ]; } function o2(n, e) { e && (n.modifiers = [...n.modifiers, ...e ?? []]); } const a2 = 0, l2 = (n) => { const { popperInstanceRef: e, contentRef: t, triggerRef: i, role: r } = ht(Of, void 0), s = Ae(), o = Ae(), a = ce(() => ({ name: "eventListeners", enabled: !!n.visible })), c = ce(() => { var v; const m = H(s), w = (v = H(o)) != null ? v : a2; return { name: "arrow", enabled: !HT(m), options: { element: m, padding: w } }; }), l = ce(() => ({ onFirstUpdate: () => { f(); }, ...i2(n, [ H(c), H(a) ]) })), d = ce(() => r2(n.referenceEl) || H(i)), { attributes: h, state: p, styles: g, update: f, forceUpdate: u, instanceRef: y } = DA(d, t, l); return Ke(y, (v) => e.value = v), on(() => { Ke(() => { var v; return (v = H(d)) == null ? void 0 : v.getBoundingClientRect(); }, () => { f(); }); }), { attributes: h, arrowRef: s, contentRef: t, instanceRef: y, state: p, styles: g, role: r, forceUpdate: u, update: f }; }, c2 = (n, { attributes: e, styles: t, role: i }) => { const { nextZIndex: r } = ey(), s = it("popper"), o = ce(() => H(e).popper), a = Ae(St(n.zIndex) ? n.zIndex : r()), c = ce(() => [ s.b(), s.is("pure", n.pure), s.is(n.effect), n.popperClass ]), l = ce(() => [ { zIndex: H(a) }, H(t).popper, n.popperStyle || {} ]), d = ce(() => i.value === "dialog" ? "false" : void 0), h = ce(() => H(t).arrow || {}); return { ariaModal: d, arrowStyle: h, contentAttrs: o, contentClass: c, contentStyle: l, contentZIndex: a, updateZIndex: () => { a.value = St(n.zIndex) ? n.zIndex : r(); } }; }, u2 = (n, e) => { const t = Ae(!1), i = Ae(); return { focusStartRef: i, trapped: t, onFocusAfterReleased: (l) => { var d; ((d = l.detail) == null ? void 0 : d.focusReason) !== "pointer" && (i.value = "first", e("blur")); }, onFocusAfterTrapped: () => { e("focus"); }, onFocusInTrap: (l) => { n.visible && !t.value && (l.target && (i.value = l.target), t.value = !0); }, onFocusoutPrevented: (l) => { n.trapping || (l.detail.focusReason === "pointer" && l.preventDefault(), t.value = !1); }, onReleaseRequested: () => { t.value = !1, e("close"); } }; }, h2 = De({ name: "ElPopperContent" }), d2 = /* @__PURE__ */ De({ ...h2, props: dy, emits: n2, setup(n, { expose: e, emit: t }) { const i = n, { focusStartRef: r, trapped: s, onFocusAfterReleased: o, onFocusAfterTrapped: a, onFocusInTrap: c, onFocusoutPrevented: l, onReleaseRequested: d } = u2(i, t), { attributes: h, arrowRef: p, contentRef: g, styles: f, instanceRef: u, role: y, update: v } = l2(i), { ariaModal: m, arrowStyle: w, contentAttrs: S, contentClass: T, contentStyle: M, updateZIndex: x } = c2(i, { styles: f, attributes: h, role: y }), _ = ht(qc, void 0), E = Ae(); gn(oy, { arrowStyle: w, arrowRef: p, arrowOffset: E }), _ && gn(qc, { ..._, addInputId: $a, removeInputId: $a }); let L; const R = (A = !0) => { v(), A && x(); }, C = () => { R(!1), i.visible && i.focusOnShow ? s.value = !0 : i.visible === !1 && (s.value = !1); }; return on(() => { Ke(() => i.triggerTargetEl, (A, P) => { L == null || L(), L = void 0; const I = H(A || g.value), b = H(P || g.value); Ms(I) && (L = Ke([y, () => i.ariaLabel, m, () => i.id], (O) => { ["role", "aria-label", "aria-modal", "id"].forEach((N, D) => { sr(O[D]) ? I.removeAttribute(N) : I.setAttribute(N, O[D]); }); }, { immediate: !0 })), b !== I && Ms(b) && ["role", "aria-label", "aria-modal", "id"].forEach((O) => { b.removeAttribute(O); }); }, { immediate: !0 }), Ke(() => i.visible, C, { immediate: !0 }); }), li(() => { L == null || L(), L = void 0; }), e({ popperContentRef: g, popperInstanceRef: u, updatePopper: R, contentStyle: M }), (A, P) => (pe(), Re("div", Oi({ ref_key: "contentRef", ref: g }, H(S), { style: H(M), class: H(T), tabindex: "-1", onMouseenter: (I) => A.$emit("mouseenter", I), onMouseleave: (I) => A.$emit("mouseleave", I) }), [ ae(H(QC), { trapped: H(s), "trap-on-focus-in": !0, "focus-trap-el": H(g), "focus-start-el": H(r), onFocusAfterTrapped: H(a), onFocusAfterReleased: H(o), onFocusin: H(c), onFocusoutPrevented: H(l), onReleaseRequested: H(d) }, { default: fe(() => [ Xe(A.$slots, "default") ]), _: 3 }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"]) ], 16, ["onMouseenter", "onMouseleave"])); } }); var f2 = /* @__PURE__ */ at(d2, [["__file", "content.vue"]]); const p2 = vn(OC), Ff = Symbol("elTooltip"), Zn = dt({ ...VA, ...dy, appendTo: { type: Ye([String, Object]) }, content: { type: String, default: "" }, rawContent: Boolean, persistent: Boolean, visible: { type: Ye(Boolean), default: null }, transition: String, teleported: { type: Boolean, default: !0 }, disabled: Boolean, ...Gs(["ariaLabel"]) }), qa = dt({ ...uy, disabled: Boolean, trigger: { type: Ye([String, Array]), default: "hover" }, triggerKeys: { type: Ye(Array), default: () => [Di.enter, Di.space] } }), { useModelToggleProps: m2, useModelToggleEmits: g2, useModelToggle: v2 } = PE("visible"), y2 = dt({ ...ay, ...m2, ...Zn, ...qa, ...ly, showArrow: { type: Boolean, default: !0 } }), b2 = [ ...g2, "before-show", "before-hide", "show", "hide", "open", "close" ], x2 = (n, e) => Un(n) ? n.includes(e) : n === e, Js = (n, e, t) => (i) => { x2(H(n), e) && t(i); }, w2 = De({ name: "ElTooltipTrigger" }), M2 = /* @__PURE__ */ De({ ...w2, props: qa, setup(n, { expose: e }) { const t = n, i = it("tooltip"), { controlled: r, id: s, open: o, onOpen: a, onClose: c, onToggle: l } = ht(Ff, void 0), d = Ae(null), h = () => { if (H(r) || t.disabled) return !0; }, p = Bn(t, "trigger"), g = Qi(h, Js(p, "hover", a)), f = Qi(h, Js(p, "hover", c)), u = Qi(h, Js(p, "click", (S) => { S.button === 0 && l(S); })), y = Qi(h, Js(p, "focus", a)), v = Qi(h, Js(p, "focus", c)), m = Qi(h, Js(p, "contextmenu", (S) => { S.preventDefault(), l(S); })), w = Qi(h, (S) => { const { code: T } = S; t.triggerKeys.includes(T) && (S.preventDefault(), l(S)); }); return e({ triggerRef: d }), (S, T) => (pe(), He(H(VC), { id: H(s), "virtual-ref": S.virtualRef, open: H(o), "virtual-triggering": S.virtualTriggering, class: Le(H(i).e("trigger")), onBlur: H(v), onClick: H(u), onContextmenu: H(m), onFocus: H(y), onMouseenter: H(g), onMouseleave: H(f), onKeydown: H(w) }, { default: fe(() => [ Xe(S.$slots, "default") ]), _: 3 }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"])); } }); var S2 = /* @__PURE__ */ at(M2, [["__file", "trigger.vue"]]); const _2 = dt({ to: { type: Ye([String, Object]), required: !0 }, disabled: Boolean }), T2 = /* @__PURE__ */ De({ __name: "teleport", props: _2, setup(n) { return (e, t) => e.disabled ? Xe(e.$slots, "default", { key: 0 }) : (pe(), He(r1, { key: 1, to: e.to }, [ Xe(e.$slots, "default") ], 8, ["to"])); } }); var E2 = /* @__PURE__ */ at(T2, [["__file", "teleport.vue"]]); const A2 = vn(E2), C2 = De({ name: "ElTooltipContent", inheritAttrs: !1 }), L2 = /* @__PURE__ */ De({ ...C2, props: Zn, setup(n, { expose: e }) { const t = n, { selector: i } = J0(), r = it("tooltip"), s = Ae(null); let o; const { controlled: a, id: c, open: l, trigger: d, onClose: h, onOpen: p, onShow: g, onHide: f, onBeforeShow: u, onBeforeHide: y } = ht(Ff, void 0), v = ce(() => t.transition || `${r.namespace.value}-fade-in-linear`), m = ce(() => process.env.NODE_ENV === "test" ? !0 : t.persistent); li(() => { o == null || o(); }); const w = ce(() => H(m) ? !0 : H(l)), S = ce(() => t.disabled ? !1 : H(l)), T = ce(() => t.appendTo || i.value), M = ce(() => { var b; return (b = t.style) != null ? b : {}; }), x = Ae(!0), _ = () => { f(), x.value = !0; }, E = () => { if (H(a)) return !0; }, L = Qi(E, () => { t.enterable && H(d) === "hover" && p(); }), R = Qi(E, () => { H(d) === "hover" && h(); }), C = () => { var b, O; (O = (b = s.value) == null ? void 0 : b.updatePopper) == null || O.call(b), u == null || u(); }, A = () => { y == null || y(); }, P = () => { g(), o = O1(ce(() => { var b; return (b = s.value) == null ? void 0 : b.popperContentRef; }), () => { if (H(a)) return; H(d) !== "hover" && h(); }); }, I = () => { t.virtualTriggering || h(); }; return Ke(() => H(l), (b) => { b ? x.value = !1 : o == null || o(); }, { flush: "post" }), Ke(() => t.content, () => { var b, O; (O = (b = s.value) == null ? void 0 : b.updatePopper) == null || O.call(b); }), e({ contentRef: s }), (b, O) => (pe(), He(H(A2), { disabled: !b.teleported, to: H(T) }, { default: fe(() => [ ae(hl, { name: H(v), onAfterLeave: _, onBeforeEnter: C, onAfterEnter: P, onBeforeLeave: A }, { default: fe(() => [ H(w) ? Ft((pe(), He(H(f2), Oi({ key: 0, id: H(c), ref_key: "contentRef", ref: s }, b.$attrs, { "aria-label": b.ariaLabel, "aria-hidden": x.value, "boundaries-padding": b.boundariesPadding, "fallback-placements": b.fallbackPlacements, "gpu-acceleration": b.gpuAcceleration, offset: b.offset, placement: b.placement, "popper-options": b.popperOptions, strategy: b.strategy, effect: b.effect, enterable: b.enterable, pure: b.pure, "popper-class": b.popperClass, "popper-style": [b.popperStyle, H(M)], "reference-el": b.referenceEl, "trigger-target-el": b.triggerTargetEl, visible: H(S), "z-index": b.zIndex, onMouseenter: H(L), onMouseleave: H(R), onBlur: I, onClose: H(h) }), { default: fe(() => [ Xe(b.$slots, "default") ]), _: 3 }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [ [xn, H(S)] ]) : Ge("v-if", !0) ]), _: 3 }, 8, ["name"]) ]), _: 3 }, 8, ["disabled", "to"])); } }); var R2 = /* @__PURE__ */ at(L2, [["__file", "content.vue"]]); const P2 = De({ name: "ElTooltip" }), I2 = /* @__PURE__ */ De({ ...P2, props: y2, emits: b2, setup(n, { expose: e, emit: t }) { const i = n; UA(); const r = vu(), s = Ae(), o = Ae(), a = () => { var v; const m = H(s); m && ((v = m.popperInstanceRef) == null || v.update()); }, c = Ae(!1), l = Ae(), { show: d, hide: h, hasUpdateHandler: p } = v2({ indicator: c, toggleReason: l }), { onOpen: g, onClose: f } = kA({ showAfter: Bn(i, "showAfter"), hideAfter: Bn(i, "hideAfter"), autoClose: Bn(i, "autoClose"), open: d, close: h }), u = ce(() => gf(i.visible) && !p.value); gn(Ff, { controlled: u, id: r, open: o0(c), trigger: Bn(i, "trigger"), onOpen: (v) => { g(v); }, onClose: (v) => { f(v); }, onToggle: (v) => { H(c) ? f(v) : g(v); }, onShow: () => { t("show", l.value); }, onHide: () => { t("hide", l.value); }, onBeforeShow: () => { t("before-show", l.value); }, onBeforeHide: () => { t("before-hide", l.value); }, updatePopper: a }), Ke(() => i.disabled, (v) => { v && c.value && (c.value = !1); }); const y = (v) => { var m, w; const S = (w = (m = o.value) == null ? void 0 : m.contentRef) == null ? void 0 : w.popperContentRef, T = (v == null ? void 0 : v.relatedTarget) || document.activeElement; return S && S.contains(T); }; return s1(() => c.value && h()), e({ popperRef: s, contentRef: o, isFocusInsideContent: y, updatePopper: a, onOpen: g, onClose: f, hide: h }), (v, m) => (pe(), He(H(p2), { ref_key: "popperRef", ref: s, role: v.role }, { default: fe(() => [ ae(S2, { disabled: v.disabled, trigger: v.trigger, "trigger-keys": v.triggerKeys, "virtual-ref": v.virtualRef, "virtual-triggering": v.virtualTriggering }, { default: fe(() => [ v.$slots.default ? Xe(v.$slots, "default", { key: 0 }) : Ge("v-if", !0) ]), _: 3 }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]), ae(R2, { ref_key: "contentRef", ref: o, "aria-label": v.ariaLabel, "boundaries-padding": v.boundariesPadding, content: v.content, disabled: v.disabled, effect: v.effect, enterable: v.enterable, "fallback-placements": v.fallbackPlacements, "hide-after": v.hideAfter, "gpu-acceleration": v.gpuAcceleration, offset: v.offset, persistent: v.persistent, "popper-class": v.popperClass, "popper-style": v.popperStyle, placement: v.placement, "popper-options": v.popperOptions, pure: v.pure, "raw-content": v.rawContent, "reference-el": v.referenceEl, "trigger-target-el": v.triggerTargetEl, "show-after": v.showAfter, strategy: v.strategy, teleported: v.teleported, transition: v.transition, "virtual-triggering": v.virtualTriggering, "z-index": v.zIndex, "append-to": v.appendTo }, { default: fe(() => [ Xe(v.$slots, "content", {}, () => [ v.rawContent ? (pe(), Re("span", { key: 0, innerHTML: v.content }, null, 8, ["innerHTML"])) : (pe(), Re("span", { key: 1 }, wt(v.content), 1)) ]), v.showArrow ? (pe(), He(H(FC), { key: 0, "arrow-offset": v.arrowOffset }, null, 8, ["arrow-offset"])) : Ge("v-if", !0) ]), _: 3 }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"]) ]), _: 3 }, 8, ["role"])); } }); var O2 = /* @__PURE__ */ at(I2, [["__file", "tooltip.vue"]]); const Bf = vn(O2), fy = Symbol("buttonGroupContextKey"), D2 = (n, e) => { SE({ from: "type.text", replacement: "link", version: "3.0.0", scope: "props", ref: "https://element-plus.org/en-US/component/button.html#button-attributes" }, ce(() => n.type === "text")); const t = ht(fy, void 0), i = Lf("button"), { form: r } = gl(), s = ra(ce(() => t == null ? void 0 : t.size)), o = yu(), a = Ae(), c = ou(), l = ce(() => n.type || (t == null ? void 0 : t.type) || ""), d = ce(() => { var f, u, y; return (y = (u = n.autoInsertSpace) != null ? u : (f = i.value) == null ? void 0 : f.autoInsertSpace) != null ? y : !1; }), h = ce(() => n.tag === "button" ? { ariaDisabled: o.value || n.loading, disabled: o.value || n.loading, autofocus: n.autofocus, type: n.nativeType } : {}), p = ce(() => { var f; const u = (f = c.default) == null ? void 0 : f.call(c); if (d.value && (u == null ? void 0 : u.length) === 1) { const y = u[0]; if ((y == null ? void 0 : y.type) === u0) { const v = y.children; return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(v.trim()); } } return !1; }); return { _disabled: o, _size: s, _type: l, _ref: a, _props: h, shouldAddSpace: p, handleClick: (f) => { if (o.value || n.loading) { f.stopPropagation(); return; } n.nativeType === "reset" && (r == null || r.resetFields()), e("click", f); } }; }, N2 = [ "default", "primary", "success", "warning", "info", "danger", "text", "" ], F2 = ["button", "submit", "reset"], fd = dt({ size: Do, disabled: Boolean, type: { type: String, values: N2, default: "" }, icon: { type: Zr }, nativeType: { type: String, values: F2, default: "button" }, loading: Boolean, loadingIcon: { type: Zr, default: () => P0 }, plain: Boolean, text: Boolean, link: Boolean, bg: Boolean, autofocus: Boolean, round: Boolean, circle: Boolean, color: String, dark: Boolean, autoInsertSpace: { type: Boolean, default: void 0 }, tag: { type: Ye([String, Object]), default: "button" } }), B2 = { click: (n) => n instanceof MouseEvent }; function Mn(n, e) { z2(n) && (n = "100%"); var t = U2(n); return n = e === 360 ? n : Math.min(e, Math.max(0, parseFloat(n))), t && (n = parseInt(String(n * e), 10) / 100), Math.abs(n - e) < 1e-6 ? 1 : (e === 360 ? n = (n < 0 ? n % e + e : n % e) / parseFloat(String(e)) : n = n % e / parseFloat(String(e)), n); } function Vl(n) { return Math.min(1, Math.max(0, n)); } function z2(n) { return typeof n == "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1; } function U2(n) { return typeof n == "string" && n.indexOf("%") !== -1; } function py(n) { return n = parseFloat(n), (isNaN(n) || n < 0 || n > 1) && (n = 1), n; } function kl(n) { return n <= 1 ? "".concat(Number(n) * 100, "%") : n; } function bs(n) { return n.length === 1 ? "0" + n : String(n); } function V2(n, e, t) { return { r: Mn(n, 255) * 255, g: Mn(e, 255) * 255, b: Mn(t, 255) * 255 }; } function Qm(n, e, t) { n = Mn(n, 255), e = Mn(e, 255), t = Mn(t, 255); var i = Math.max(n, e, t), r = Math.min(n, e, t), s = 0, o = 0, a = (i + r) / 2; if (i === r) o = 0, s = 0; else { var c = i - r; switch (o = a > 0.5 ? c / (2 - i - r) : c / (i + r), i) { case n: s = (e - t) / c + (e < t ? 6 : 0); break; case e: s = (t - n) / c + 2; break; case t: s = (n - e) / c + 4; break; } s /= 6; } return { h: s, s: o, l: a }; } function Qu(n, e, t) { return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? n + (e - n) * (6 * t) : t < 1 / 2 ? e : t < 2 / 3 ? n + (e - n) * (2 / 3 - t) * 6 : n; } function k2(n, e, t) { var i, r, s; if (n = Mn(n, 360), e = Mn(e, 100), t = Mn(t, 100), e === 0) r = t, s = t, i = t; else { var o = t < 0.5 ? t * (1 + e) : t + e - t * e, a = 2 * t - o; i = Qu(a, o, n + 1 / 3), r = Qu(a, o, n), s = Qu(a, o, n - 1 / 3); } return { r: i * 255, g: r * 255, b: s * 255 }; } function eg(n, e, t) { n = Mn(n, 255), e = Mn(e, 255), t = Mn(t, 255); var i = Math.max(n, e, t), r = Math.min(n, e, t), s = 0, o = i, a = i - r, c = i === 0 ? 0 : a / i; if (i === r) s = 0; else { switch (i) { case n: s = (e - t) / a + (e < t ? 6 : 0); break; case e: s = (t - n) / a + 2; break; case t: s = (n - e) / a + 4; break; } s /= 6; } return { h: s, s: c, v: o }; } function G2(n, e, t) { n = Mn(n, 360) * 6, e = Mn(e, 100), t = Mn(t, 100); var i = Math.floor(n), r = n - i, s = t * (1 - e), o = t * (1 - r * e), a = t * (1 - (1 - r) * e), c = i % 6, l = [t, o, s, s, a, t][c], d = [a, t, t, o, s, s][c], h = [s, s, a, t, t, o][c]; return { r: l * 255, g: d * 255, b: h * 255 }; } function tg(n, e, t, i) { var r = [ bs(Math.round(n).toString(16)), bs(Math.round(e).toString(16)), bs(Math.round(t).toString(16)) ]; return i && r[0].startsWith(r[0].charAt(1)) && r[1].startsWith(r[1].charAt(1)) && r[2].startsWith(r[2].charAt(1)) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) : r.join(""); } function H2(n, e, t, i, r) { var s = [ bs(Math.round(n).toString(16)), bs(Math.round(e).toString(16)), bs(Math.round(t).toString(16)), bs(W2(i)) ]; return r && s[0].startsWith(s[0].charAt(1)) && s[1].startsWith(s[1].charAt(1)) && s[2].startsWith(s[2].charAt(1)) && s[3].startsWith(s[3].charAt(1)) ? s[0].charAt(0) + s[1].charAt(0) + s[2].charAt(0) + s[3].charAt(0) : s.join(""); } function W2(n) { return Math.round(parseFloat(n) * 255).toString(16); } function ng(n) { return $n(n) / 255; } function $n(n) { return parseInt(n, 16); } function j2(n) { return { r: n >> 16, g: (n & 65280) >> 8, b: n & 255 }; } var pd = { 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", darkgreen: "#006400", darkgrey: "#a9a9a9", 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", goldenrod: "#daa520", gold: "#ffd700", gray: "#808080", green: "#008000", greenyellow: "#adff2f", grey: "#808080", honeydew: "#f0fff0", hotpink: "#ff69b4", indianred: "#cd5c5c", indigo: "#4b0082", ivory: "#fffff0", khaki: "#f0e68c", lavenderblush: "#fff0f5", lavender: "#e6e6fa", lawngreen: "#7cfc00", lemonchiffon: "#fffacd", lightblue: "#add8e6", lightcoral: "#f08080", lightcyan: "#e0ffff", lightgoldenrodyellow: "#fafad2", lightgray: "#d3d3d3", lightgreen: "#90ee90", lightgrey: "#d3d3d3", 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 $2(n) { var e = { r: 0, g: 0, b: 0 }, t = 1, i = null, r = null, s = null, o = !1, a = !1; return typeof n == "string" && (n = Y2(n)), typeof n == "object" && (ji(n.r) && ji(n.g) && ji(n.b) ? (e = V2(n.r, n.g, n.b), o = !0, a = String(n.r).substr(-1) === "%" ? "prgb" : "rgb") : ji(n.h) && ji(n.s) && ji(n.v) ? (i = kl(n.s), r = kl(n.v), e = G2(n.h, i, r), o = !0, a = "hsv") : ji(n.h) && ji(n.s) && ji(n.l) && (i = kl(n.s), s = kl(n.l), e = k2(n.h, i, s), o = !0, a = "hsl"), Object.prototype.hasOwnProperty.call(n, "a") && (t = n.a)), t = py(t), { ok: o, format: n.format || a, r: Math.min(255, Math.max(e.r, 0)), g: Math.min(255, Math.max(e.g, 0)), b: Math.min(255, Math.max(e.b, 0)), a: t }; } var Z2 = "[-\\+]?\\d+%?", X2 = "[-\\+]?\\d*\\.\\d+%?", zr = "(?:".concat(X2, ")|(?:").concat(Z2, ")"), eh = "[\\s|\\(]+(".concat(zr, ")[,|\\s]+(").concat(zr, ")[,|\\s]+(").concat(zr, ")\\s*\\)?"), th = "[\\s|\\(]+(".concat(zr, ")[,|\\s]+(").concat(zr, ")[,|\\s]+(").concat(zr, ")[,|\\s]+(").concat(zr, ")\\s*\\)?"), mi = { CSS_UNIT: new RegExp(zr), rgb: new RegExp("rgb" + eh), rgba: new RegExp("rgba" + th), hsl: new RegExp("hsl" + eh), hsla: new RegExp("hsla" + th), hsv: new RegExp("hsv" + eh), hsva: new RegExp("hsva" + th), hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ }; function Y2(n) { if (n = n.trim().toLowerCase(), n.length === 0) return !1; var e = !1; if (pd[n]) n = pd[n], e = !0; else if (n === "transparent") return { r: 0, g: 0, b: 0, a: 0, format: "name" }; var t = mi.rgb.exec(n); return t ? { r: t[1], g: t[2], b: t[3] } : (t = mi.rgba.exec(n), t ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = mi.hsl.exec(n), t ? { h: t[1], s: t[2], l: t[3] } : (t = mi.hsla.exec(n), t ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = mi.hsv.exec(n), t ? { h: t[1], s: t[2], v: t[3] } : (t = mi.hsva.exec(n), t ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = mi.hex8.exec(n), t ? { r: $n(t[1]), g: $n(t[2]), b: $n(t[3]), a: ng(t[4]), format: e ? "name" : "hex8" } : (t = mi.hex6.exec(n), t ? { r: $n(t[1]), g: $n(t[2]), b: $n(t[3]), format: e ? "name" : "hex" } : (t = mi.hex4.exec(n), t ? { r: $n(t[1] + t[1]), g: $n(t[2] + t[2]), b: $n(t[3] + t[3]), a: ng(t[4] + t[4]), format: e ? "name" : "hex8" } : (t = mi.hex3.exec(n), t ? { r: $n(t[1] + t[1]), g: $n(t[2] + t[2]), b: $n(t[3] + t[3]), format: e ? "name" : "hex" } : !1))))))))); } function ji(n) { return !!mi.CSS_UNIT.exec(String(n)); } var J2 = ( /** @class */ function() { function n(e, t) { e === void 0 && (e = ""), t === void 0 && (t = {}); var i; if (e instanceof n) return e; typeof e == "number" && (e = j2(e)), this.originalInput = e; var r = $2(e); this.originalInput = e, this.r = r.r, this.g = r.g, this.b = r.b, this.a = r.a, this.roundA = Math.round(100 * this.a) / 100, this.format = (i = t.format) !== null && i !== void 0 ? i : r.format, this.gradientType = t.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = r.ok; } return n.prototype.isDark = function() { return this.getBrightness() < 128; }, n.prototype.isLight = function() { return !this.isDark(); }, n.prototype.getBrightness = function() { var e = this.toRgb(); return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3; }, n.prototype.getLuminance = function() { var e = this.toRgb(), t, i, r, s = e.r / 255, o = e.g / 255, a = e.b / 255; return s <= 0.03928 ? t = s / 12.92 : t = Math.pow((s + 0.055) / 1.055, 2.4), o <= 0.03928 ? i = o / 12.92 : i = Math.pow((o + 0.055) / 1.055, 2.4), a <= 0.03928 ? r = a / 12.92 : r = Math.pow((a + 0.055) / 1.055, 2.4), 0.2126 * t + 0.7152 * i + 0.0722 * r; }, n.prototype.getAlpha = function() { return this.a; }, n.prototype.setAlpha = function(e) { return this.a = py(e), this.roundA = Math.round(100 * this.a) / 100, this; }, n.prototype.isMonochrome = function() { var e = this.toHsl().s; return e === 0; }, n.prototype.toHsv = function() { var e = eg(this.r, this.g, this.b); return { h: e.h * 360, s: e.s, v: e.v, a: this.a }; }, n.prototype.toHsvString = function() { var e = eg(this.r, this.g, this.b), t = Math.round(e.h * 360), i = Math.round(e.s * 100), r = Math.round(e.v * 100); return this.a === 1 ? "hsv(".concat(t, ", ").concat(i, "%, ").concat(r, "%)") : "hsva(".concat(t, ", ").concat(i, "%, ").concat(r, "%, ").concat(this.roundA, ")"); }, n.prototype.toHsl = function() { var e = Qm(this.r, this.g, this.b); return { h: e.h * 360, s: e.s, l: e.l, a: this.a }; }, n.prototype.toHslString = function() { var e = Qm(this.r, this.g, this.b), t = Math.round(e.h * 360), i = Math.round(e.s * 100), r = Math.round(e.l * 100); return this.a === 1 ? "hsl(".concat(t, ", ").concat(i, "%, ").concat(r, "%)") : "hsla(".concat(t, ", ").concat(i, "%, ").concat(r, "%, ").concat(this.roundA, ")"); }, n.prototype.toHex = function(e) { return e === void 0 && (e = !1), tg(this.r, this.g, this.b, e); }, n.prototype.toHexString = function(e) { return e === void 0 && (e = !1), "#" + this.toHex(e); }, n.prototype.toHex8 = function(e) { return e === void 0 && (e = !1), H2(this.r, this.g, this.b, this.a, e); }, n.prototype.toHex8String = function(e) { return e === void 0 && (e = !1), "#" + this.toHex8(e); }, n.prototype.toHexShortString = function(e) { return e === void 0 && (e = !1), this.a === 1 ? this.toHexString(e) : this.toHex8String(e); }, n.prototype.toRgb = function() { return { r: Math.round(this.r), g: Math.round(this.g), b: Math.round(this.b), a: this.a }; }, n.prototype.toRgbString = function() { var e = Math.round(this.r), t = Math.round(this.g), i = Math.round(this.b); return this.a === 1 ? "rgb(".concat(e, ", ").concat(t, ", ").concat(i, ")") : "rgba(".concat(e, ", ").concat(t, ", ").concat(i, ", ").concat(this.roundA, ")"); }, n.prototype.toPercentageRgb = function() { var e = function(t) { return "".concat(Math.round(Mn(t, 255) * 100), "%"); }; return { r: e(this.r), g: e(this.g), b: e(this.b), a: this.a }; }, n.prototype.toPercentageRgbString = function() { var e = function(t) { return Math.round(Mn(t, 255) * 100); }; return this.a === 1 ? "rgb(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%)") : "rgba(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%, ").concat(this.roundA, ")"); }, n.prototype.toName = function() { if (this.a === 0) return "transparent"; if (this.a < 1) return !1; for (var e = "#" + tg(this.r, this.g, this.b, !1), t = 0, i = Object.entries(pd); t < i.length; t++) { var r = i[t], s = r[0], o = r[1]; if (e === o) return s; } return !1; }, n.prototype.toString = function(e) { var t = !!e; e = e ?? this.format; var i = !1, r = this.a < 1 && this.a >= 0, s = !t && r && (e.startsWith("hex") || e === "name"); return s ? e === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (i = this.toRgbString()), e === "prgb" && (i = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (i = this.toHexString()), e === "hex3" && (i = this.toHexString(!0)), e === "hex4" && (i = this.toHex8String(!0)), e === "hex8" && (i = this.toHex8String()), e === "name" && (i = this.toName()), e === "hsl" && (i = this.toHslString()), e === "hsv" && (i = this.toHsvString()), i || this.toHexString()); }, n.prototype.toNumber = function() { return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b); }, n.prototype.clone = function() { return new n(this.toString()); }, n.prototype.lighten = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.l += e / 100, t.l = Vl(t.l), new n(t); }, n.prototype.brighten = function(e) { e === void 0 && (e = 10); var t = this.toRgb(); return t.r = Math.max(0, Math.min(255, t.r - Math.round(255 * -(e / 100)))), t.g = Math.max(0, Math.min(255, t.g - Math.round(255 * -(e / 100)))), t.b = Math.max(0, Math.min(255, t.b - Math.round(255 * -(e / 100)))), new n(t); }, n.prototype.darken = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.l -= e / 100, t.l = Vl(t.l), new n(t); }, n.prototype.tint = function(e) { return e === void 0 && (e = 10), this.mix("white", e); }, n.prototype.shade = function(e) { return e === void 0 && (e = 10), this.mix("black", e); }, n.prototype.desaturate = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.s -= e / 100, t.s = Vl(t.s), new n(t); }, n.prototype.saturate = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.s += e / 100, t.s = Vl(t.s), new n(t); }, n.prototype.greyscale = function() { return this.desaturate(100); }, n.prototype.spin = function(e) { var t = this.toHsl(), i = (t.h + e) % 360; return t.h = i < 0 ? 360 + i : i, new n(t); }, n.prototype.mix = function(e, t) { t === void 0 && (t = 50); var i = this.toRgb(), r = new n(e).toRgb(), s = t / 100, o = { r: (r.r - i.r) * s + i.r, g: (r.g - i.g) * s + i.g, b: (r.b - i.b) * s + i.b, a: (r.a - i.a) * s + i.a }; return new n(o); }, n.prototype.analogous = function(e, t) { e === void 0 && (e = 6), t === void 0 && (t = 30); var i = this.toHsl(), r = 360 / t, s = [this]; for (i.h = (i.h - (r * e >> 1) + 720) % 360; --e; ) i.h = (i.h + r) % 360, s.push(new n(i)); return s; }, n.prototype.complement = function() { var e = this.toHsl(); return e.h = (e.h + 180) % 360, new n(e); }, n.prototype.monochromatic = function(e) { e === void 0 && (e = 6); for (var t = this.toHsv(), i = t.h, r = t.s, s = t.v, o = [], a = 1 / e; e--; ) o.push(new n({ h: i, s: r, v: s })), s = (s + a) % 1; return o; }, n.prototype.splitcomplement = function() { var e = this.toHsl(), t = e.h; return [ this, new n({ h: (t + 72) % 360, s: e.s, l: e.l }), new n({ h: (t + 216) % 360, s: e.s, l: e.l }) ]; }, n.prototype.onBackground = function(e) { var t = this.toRgb(), i = new n(e).toRgb(), r = t.a + i.a * (1 - t.a); return new n({ r: (t.r * t.a + i.r * i.a * (1 - t.a)) / r, g: (t.g * t.a + i.g * i.a * (1 - t.a)) / r, b: (t.b * t.a + i.b * i.a * (1 - t.a)) / r, a: r }); }, n.prototype.triad = function() { return this.polyad(3); }, n.prototype.tetrad = function() { return this.polyad(4); }, n.prototype.polyad = function(e) { for (var t = this.toHsl(), i = t.h, r = [this], s = 360 / e, o = 1; o < e; o++) r.push(new n({ h: (i + o * s) % 360, s: t.s, l: t.l })); return r; }, n.prototype.equals = function(e) { return this.toRgbString() === new n(e).toRgbString(); }, n; }() ); function Mr(n, e = 20) { return n.mix("#141414", e).toString(); } function q2(n) { const e = yu(), t = it("button"); return ce(() => { let i = {}, r = n.color; if (r) { const s = r.match(/var\((.*?)\)/); s && (r = window.getComputedStyle(window.document.documentElement).getPropertyValue(s[1])); const o = new J2(r), a = n.dark ? o.tint(20).toString() : Mr(o, 20); if (n.plain) i = t.cssVarBlock({ "bg-color": n.dark ? Mr(o, 90) : o.tint(90).toString(), "text-color": r, "border-color": n.dark ? Mr(o, 50) : o.tint(50).toString(), "hover-text-color": `var(${t.cssVarName("color-white")})`, "hover-bg-color": r, "hover-border-color": r, "active-bg-color": a, "active-text-color": `var(${t.cssVarName("color-white")})`, "active-border-color": a }), e.value && (i[t.cssVarBlockName("disabled-bg-color")] = n.dark ? Mr(o, 90) : o.tint(90).toString(), i[t.cssVarBlockName("disabled-text-color")] = n.dark ? Mr(o, 50) : o.tint(50).toString(), i[t.cssVarBlockName("disabled-border-color")] = n.dark ? Mr(o, 80) : o.tint(80).toString()); else { const c = n.dark ? Mr(o, 30) : o.tint(30).toString(), l = o.isDark() ? `var(${t.cssVarName("color-white")})` : `var(${t.cssVarName("color-black")})`; if (i = t.cssVarBlock({ "bg-color": r, "text-color": l, "border-color": r, "hover-bg-color": c, "hover-text-color": l, "hover-border-color": c, "active-bg-color": a, "active-border-color": a }), e.value) { const d = n.dark ? Mr(o, 50) : o.tint(50).toString(); i[t.cssVarBlockName("disabled-bg-color")] = d, i[t.cssVarBlockName("disabled-text-color")] = n.dark ? "rgba(255, 255, 255, 0.5)" : `var(${t.cssVarName("color-white")})`, i[t.cssVarBlockName("disabled-border-color")] = d; } } } return i; }); } const K2 = De({ name: "ElButton" }), Q2 = /* @__PURE__ */ De({ ...K2, props: fd, emits: B2, setup(n, { expose: e, emit: t }) { const i = n, r = q2(i), s = it("button"), { _ref: o, _size: a, _type: c, _disabled: l, _props: d, shouldAddSpace: h, handleClick: p } = D2(i, t), g = ce(() => [ s.b(), s.m(c.value), s.m(a.value), s.is("disabled", l.value), s.is("loading", i.loading), s.is("plain", i.plain), s.is("round", i.round), s.is("circle", i.circle), s.is("text", i.text), s.is("link", i.link), s.is("has-bg", i.bg) ]); return e({ ref: o, size: a, type: c, disabled: l, shouldAddSpace: h }), (f, u) => (pe(), He(zn(f.tag), Oi({ ref_key: "_ref", ref: o }, H(d), { class: H(g), style: H(r), onClick: H(p) }), { default: fe(() => [ f.loading ? (pe(), Re(Wt, { key: 0 }, [ f.$slots.loading ? Xe(f.$slots, "loading", { key: 0 }) : (pe(), He(H(Bt), { key: 1, class: Le(H(s).is("loading")) }, { default: fe(() => [ (pe(), He(zn(f.loadingIcon))) ]), _: 1 }, 8, ["class"])) ], 64)) : f.icon || f.$slots.icon ? (pe(), He(H(Bt), { key: 1 }, { default: fe(() => [ f.icon ? (pe(), He(zn(f.icon), { key: 0 })) : Xe(f.$slots, "icon", { key: 1 }) ]), _: 3 })) : Ge("v-if", !0), f.$slots.default ? (pe(), Re("span", { key: 2, class: Le({ [H(s).em("text", "expand")]: H(h) }) }, [ Xe(f.$slots, "default") ], 2)) : Ge("v-if", !0) ]), _: 3 }, 16, ["class", "style", "onClick"])); } }); var eL = /* @__PURE__ */ at(Q2, [["__file", "button.vue"]]); const tL = { size: fd.size, type: fd.type }, nL = De({ name: "ElButtonGroup" }), iL = /* @__PURE__ */ De({ ...nL, props: tL, setup(n) { const e = n; gn(fy, qn({ size: Bn(e, "size"), type: Bn(e, "type") })); const t = it("button"); return (i, r) => (pe(), Re("div", { class: Le(H(t).b("group")) }, [ Xe(i.$slots, "default") ], 2)); } }); var my = /* @__PURE__ */ at(iL, [["__file", "button-group.vue"]]); const sa = vn(eL, { ButtonGroup: my }); gr(my); var Fr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function rL(n) { return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; } function xu(n) { if (n.__esModule) return n; var e = n.default; if (typeof e == "function") { var t = function i() { return this instanceof i ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments); }; t.prototype = e.prototype; } else t = {}; return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(n).forEach(function(i) { var r = Object.getOwnPropertyDescriptor(n, i); Object.defineProperty(t, i, r.get ? r : { enumerable: !0, get: function() { return n[i]; } }); }), t; } const Or = /* @__PURE__ */ new Map(); if (rn) { let n; document.addEventListener("mousedown", (e) => n = e), document.addEventListener("mouseup", (e) => { if (n) { for (const t of Or.values()) for (const { documentHandler: i } of t) i(e, n); n = void 0; } }); } function ig(n, e) { let t = []; return Array.isArray(e.arg) ? t = e.arg : Ms(e.arg) && t.push(e.arg), function(i, r) { const s = e.instance.popperRef, o = i.target, a = r == null ? void 0 : r.target, c = !e || !e.instance, l = !o || !a, d = n.contains(o) || n.contains(a), h = n === o, p = t.length && t.some((f) => f == null ? void 0 : f.contains(o)) || t.length && t.includes(a), g = s && (s.contains(o) || s.contains(a)); c || l || d || h || p || g || e.value(i, r); }; } const sL = { beforeMount(n, e) { Or.has(n) || Or.set(n, []), Or.get(n).push({ documentHandler: ig(n, e), bindingFn: e.value }); }, updated(n, e) { Or.has(n) || Or.set(n, []); const t = Or.get(n), i = t.findIndex((s) => s.bindingFn === e.oldValue), r = { documentHandler: ig(n, e), bindingFn: e.value }; i >= 0 ? t.splice(i, 1, r) : t.push(r); }, unmounted(n) { Or.delete(n); } }, oL = 100, aL = 600, rg = { beforeMount(n, e) { const t = e.value, { interval: i = oL, delay: r = aL } = Ln(t) ? {} : t; let s, o; const a = () => Ln(t) ? t() : t.handler(), c = () => { o && (clearTimeout(o), o = void 0), s && (clearInterval(s), s = void 0); }; n.addEventListener("mousedown", (l) => { l.button === 0 && (c(), a(), document.addEventListener("mouseup", () => c(), { once: !0 }), o = setTimeout(() => { s = setInterval(() => { a(); }, i); }, r)); }); } }, md = dt({ type: { type: String, values: ["primary", "success", "info", "warning", "danger"], default: "primary" }, closable: Boolean, disableTransitions: Boolean, hit: Boolean, color: String, size: { type: String, values: N0 }, effect: { type: String, values: ["dark", "light", "plain"], default: "light" }, round: Boolean }), lL = { close: (n) => n instanceof MouseEvent, click: (n) => n instanceof MouseEvent }, cL = De({ name: "ElTag" }), uL = /* @__PURE__ */ De({ ...cL, props: md, emits: lL, setup(n, { emit: e }) { const t = n, i = ra(), r = it("tag"), s = ce(() => { const { type: l, hit: d, effect: h, closable: p, round: g } = t; return [ r.b(), r.is("closable", p), r.m(l || "primary"), r.m(i.value), r.m(h), r.is("hit", d), r.is("round", g) ]; }), o = (l) => { e("close", l); }, a = (l) => { e("click", l); }, c = (l) => { l.component.subTree.component.bum = null; }; return (l, d) => l.disableTransitions ? (pe(), Re("span", { key: 0, class: Le(H(s)), style: Ot({ backgroundColor: l.color }), onClick: a }, [ Be("span", { class: Le(H(r).e("content")) }, [ Xe(l.$slots, "default") ], 2), l.closable ? (pe(), He(H(Bt), { key: 0, class: Le(H(r).e("close")), onClick: fn(o, ["stop"]) }, { default: fe(() => [ ae(H(cd)) ]), _: 1 }, 8, ["class", "onClick"])) : Ge("v-if", !0) ], 6)) : (pe(), He(hl, { key: 1, name: `${H(r).namespace.value}-zoom-in-center`, appear: "", onVnodeMounted: c }, { default: fe(() => [ Be("span", { class: Le(H(s)), style: Ot({ backgroundColor: l.color }), onClick: a }, [ Be("span", { class: Le(H(r).e("content")) }, [ Xe(l.$slots, "default") ], 2), l.closable ? (pe(), He(H(Bt), { key: 0, class: Le(H(r).e("close")), onClick: fn(o, ["stop"]) }, { default: fe(() => [ ae(H(cd)) ]), _: 1 }, 8, ["class", "onClick"])) : Ge("v-if", !0) ], 6) ]), _: 3 }, 8, ["name"])); } }); var hL = /* @__PURE__ */ at(uL, [["__file", "tag.vue"]]); const dL = vn(hL), gy = Symbol("rowContextKey"), fL = [ "start", "center", "end", "space-around", "space-between", "space-evenly" ], pL = ["top", "middle", "bottom"], mL = dt({ tag: { type: String, default: "div" }, gutter: { type: Number, default: 0 }, justify: { type: String, values: fL, default: "start" }, align: { type: String, values: pL } }), gL = De({ name: "ElRow" }), vL = /* @__PURE__ */ De({ ...gL, props: mL, setup(n) { const e = n, t = it("row"), i = ce(() => e.gutter); gn(gy, { gutter: i }); const r = ce(() => { const o = {}; return e.gutter && (o.marginRight = o.marginLeft = `-${e.gutter / 2}px`), o; }), s = ce(() => [ t.b(), t.is(`justify-${e.justify}`, e.justify !== "start"), t.is(`align-${e.align}`, !!e.align) ]); return (o, a) => (pe(), He(zn(o.tag), { class: Le(H(s)), style: Ot(H(r)) }, { default: fe(() => [ Xe(o.$slots, "default") ]), _: 3 }, 8, ["class", "style"])); } }); var yL = /* @__PURE__ */ at(vL, [["__file", "row.vue"]]); const Hi = vn(yL), bL = dt({ tag: { type: String, default: "div" }, span: { type: Number, default: 24 }, offset: { type: Number, default: 0 }, pull: { type: Number, default: 0 }, push: { type: Number, default: 0 }, xs: { type: Ye([Number, Object]), default: () => tr({}) }, sm: { type: Ye([Number, Object]), default: () => tr({}) }, md: { type: Ye([Number, Object]), default: () => tr({}) }, lg: { type: Ye([Number, Object]), default: () => tr({}) }, xl: { type: Ye([Number, Object]), default: () => tr({}) } }), xL = De({ name: "ElCol" }), wL = /* @__PURE__ */ De({ ...xL, props: bL, setup(n) { const e = n, { gutter: t } = ht(gy, { gutter: ce(() => 0) }), i = it("col"), r = ce(() => { const o = {}; return t.value && (o.paddingLeft = o.paddingRight = `${t.value / 2}px`), o; }), s = ce(() => { const o = []; return ["span", "offset", "pull", "push"].forEach((l) => { const d = e[l]; St(d) && (l === "span" ? o.push(i.b(`${e[l]}`)) : d > 0 && o.push(i.b(`${l}-${e[l]}`))); }), ["xs", "sm", "md", "lg", "xl"].forEach((l) => { St(e[l]) ? o.push(i.b(`${l}-${e[l]}`)) : Pn(e[l]) && Object.entries(e[l]).forEach(([d, h]) => { o.push(d !== "span" ? i.b(`${l}-${d}-${h}`) : i.b(`${l}-${h}`)); }); }), t.value && o.push(i.is("guttered")), [i.b(), o]; }); return (o, a) => (pe(), He(zn(o.tag), { class: Le(H(s)), style: Ot(H(r)) }, { default: fe(() => [ Xe(o.$slots, "default") ]), _: 3 }, 8, ["class", "style"])); } }); var ML = /* @__PURE__ */ at(wL, [["__file", "col.vue"]]); const _i = vn(ML), sg = (n) => St(n) || On(n) || Un(n), SL = dt({ accordion: Boolean, modelValue: { type: Ye([Array, String, Number]), default: () => tr([]) } }), _L = { [Dt]: sg, [Qr]: sg }, vy = Symbol("collapseContextKey"), TL = (n, e) => { const t = Ae(Ri(n.modelValue)), i = (s) => { t.value = s; const o = n.accordion ? t.value[0] : t.value; e(Dt, o), e(Qr, o); }, r = (s) => { if (n.accordion) i([t.value[0] === s ? "" : s]); else { const o = [...t.value], a = o.indexOf(s); a > -1 ? o.splice(a, 1) : o.push(s), i(o); } }; return Ke(() => n.modelValue, () => t.value = Ri(n.modelValue), { deep: !0 }), gn(vy, { activeNames: t, handleItemClick: r }), { activeNames: t, setActiveNames: i }; }, EL = () => { const n = it("collapse"); return { rootKls: ce(() => n.b()) }; }, AL = De({ name: "ElCollapse" }), CL = /* @__PURE__ */ De({ ...AL, props: SL, emits: _L, setup(n, { expose: e, emit: t }) { const i = n, { activeNames: r, setActiveNames: s } = TL(i, t), { rootKls: o } = EL(); return e({ activeNames: r, setActiveNames: s }), (a, c) => (pe(), Re("div", { class: Le(H(o)) }, [ Xe(a.$slots, "default") ], 2)); } }); var LL = /* @__PURE__ */ at(CL, [["__file", "collapse.vue"]]); const RL = De({ name: "ElCollapseTransition" }), PL = /* @__PURE__ */ De({ ...RL, setup(n) { const e = it("collapse-transition"), t = (r) => { r.style.maxHeight = "", r.style.overflow = r.dataset.oldOverflow, r.style.paddingTop = r.dataset.oldPaddingTop, r.style.paddingBottom = r.dataset.oldPaddingBottom; }, i = { beforeEnter(r) { r.dataset || (r.dataset = {}), r.dataset.oldPaddingTop = r.style.paddingTop, r.dataset.oldPaddingBottom = r.style.paddingBottom, r.style.height && (r.dataset.elExistsHeight = r.style.height), r.style.maxHeight = 0, r.style.paddingTop = 0, r.style.paddingBottom = 0; }, enter(r) { requestAnimationFrame(() => { r.dataset.oldOverflow = r.style.overflow, r.dataset.elExistsHeight ? r.style.maxHeight = r.dataset.elExistsHeight : r.scrollHeight !== 0 ? r.style.maxHeight = `${r.scrollHeight}px` : r.style.maxHeight = 0, r.style.paddingTop = r.dataset.oldPaddingTop, r.style.paddingBottom = r.dataset.oldPaddingBottom, r.style.overflow = "hidden"; }); }, afterEnter(r) { r.style.maxHeight = "", r.style.overflow = r.dataset.oldOverflow; }, enterCancelled(r) { t(r); }, beforeLeave(r) { r.dataset || (r.dataset = {}), r.dataset.oldPaddingTop = r.style.paddingTop, r.dataset.oldPaddingBottom = r.style.paddingBottom, r.dataset.oldOverflow = r.style.overflow, r.style.maxHeight = `${r.scrollHeight}px`, r.style.overflow = "hidden"; }, leave(r) { r.scrollHeight !== 0 && (r.style.maxHeight = 0, r.style.paddingTop = 0, r.style.paddingBottom = 0); }, afterLeave(r) { t(r); }, leaveCancelled(r) { t(r); } }; return (r, s) => (pe(), He(hl, Oi({ name: H(e).b() }, o1(i)), { default: fe(() => [ Xe(r.$slots, "default") ]), _: 3 }, 16, ["name"])); } }); var IL = /* @__PURE__ */ at(PL, [["__file", "collapse-transition.vue"]]); const OL = vn(IL), DL = dt({ title: { type: String, default: "" }, name: { type: Ye([String, Number]), default: void 0 }, icon: { type: Zr, default: $r }, disabled: Boolean }), NL = (n) => { const e = ht(vy), { namespace: t } = it("collapse"), i = Ae(!1), r = Ae(!1), s = Cf(), o = ce(() => s.current++), a = ce(() => { var p; return (p = n.name) != null ? p : `${t.value}-id-${s.prefix}-${H(o)}`; }), c = ce(() => e == null ? void 0 : e.activeNames.value.includes(H(a))); return { focusing: i, id: o, isActive: c, handleFocus: () => { setTimeout(() => { r.value ? r.value = !1 : i.value = !0; }, 50); }, handleHeaderClick: () => { n.disabled || (e == null || e.handleItemClick(H(a)), i.value = !1, r.value = !0); }, handleEnterClick: () => { e == null || e.handleItemClick(H(a)); } }; }, FL = (n, { focusing: e, isActive: t, id: i }) => { const r = it("collapse"), s = ce(() => [ r.b("item"), r.is("active", H(t)), r.is("disabled", n.disabled) ]), o = ce(() => [ r.be("item", "header"), r.is("active", H(t)), { focusing: H(e) && !n.disabled } ]), a = ce(() => [ r.be("item", "arrow"), r.is("active", H(t)) ]), c = ce(() => r.be("item", "wrap")), l = ce(() => r.be("item", "content")), d = ce(() => r.b(`content-${H(i)}`)), h = ce(() => r.b(`head-${H(i)}`)); return { arrowKls: a, headKls: o, rootKls: s, itemWrapperKls: c, itemContentKls: l, scopedContentId: d, scopedHeadId: h }; }, BL = De({ name: "ElCollapseItem" }), zL = /* @__PURE__ */ De({ ...BL, props: DL, setup(n, { expose: e }) { const t = n, { focusing: i, id: r, isActive: s, handleFocus: o, handleHeaderClick: a, handleEnterClick: c } = NL(t), { arrowKls: l, headKls: d, rootKls: h, itemWrapperKls: p, itemContentKls: g, scopedContentId: f, scopedHeadId: u } = FL(t, { focusing: i, isActive: s, id: r }); return e({ isActive: s }), (y, v) => (pe(), Re("div", { class: Le(H(h)) }, [ Be("button", { id: H(u), class: Le(H(d)), "aria-expanded": H(s), "aria-controls": H(f), "aria-describedby": H(f), tabindex: y.disabled ? -1 : 0, type: "button", onClick: H(a), onKeydown: vi(fn(H(c), ["stop", "prevent"]), ["space", "enter"]), onFocus: H(o), onBlur: (m) => i.value = !1 }, [ Xe(y.$slots, "title", {}, () => [ yt(wt(y.title), 1) ]), Xe(y.$slots, "icon", { isActive: H(s) }, () => [ ae(H(Bt), { class: Le(H(l)) }, { default: fe(() => [ (pe(), He(zn(y.icon))) ]), _: 1 }, 8, ["class"]) ]) ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]), ae(H(OL), null, { default: fe(() => [ Ft(Be("div", { id: H(f), role: "region", class: Le(H(p)), "aria-hidden": !H(s), "aria-labelledby": H(u) }, [ Be("div", { class: Le(H(g)) }, [ Xe(y.$slots, "default") ], 2) ], 10, ["id", "aria-hidden", "aria-labelledby"]), [ [xn, H(s)] ]) ]), _: 3 }) ], 2)); } }); var yy = /* @__PURE__ */ at(zL, [["__file", "collapse-item.vue"]]); const by = vn(LL, { CollapseItem: yy }), xy = gr(yy), UL = De({ name: "ElContainer" }), VL = /* @__PURE__ */ De({ ...UL, props: { direction: { type: String } }, setup(n) { const e = n, t = ou(), i = it("container"), r = ce(() => e.direction === "vertical" ? !0 : e.direction === "horizontal" ? !1 : t && t.default ? t.default().some((o) => { const a = o.type.name; return a === "ElHeader" || a === "ElFooter"; }) : !1); return (s, o) => (pe(), Re("section", { class: Le([H(i).b(), H(i).is("vertical", H(r))]) }, [ Xe(s.$slots, "default") ], 2)); } }); var kL = /* @__PURE__ */ at(VL, [["__file", "container.vue"]]); const GL = De({ name: "ElAside" }), HL = /* @__PURE__ */ De({ ...GL, props: { width: { type: String, default: null } }, setup(n) { const e = n, t = it("aside"), i = ce(() => e.width ? t.cssVarBlock({ width: e.width }) : {}); return (r, s) => (pe(), Re("aside", { class: Le(H(t).b()), style: Ot(H(i)) }, [ Xe(r.$slots, "default") ], 6)); } }); var wy = /* @__PURE__ */ at(HL, [["__file", "aside.vue"]]); const WL = De({ name: "ElFooter" }), jL = /* @__PURE__ */ De({ ...WL, props: { height: { type: String, default: null } }, setup(n) { const e = n, t = it("footer"), i = ce(() => e.height ? t.cssVarBlock({ height: e.height }) : {}); return (r, s) => (pe(), Re("footer", { class: Le(H(t).b()), style: Ot(H(i)) }, [ Xe(r.$slots, "default") ], 6)); } }); var My = /* @__PURE__ */ at(jL, [["__file", "footer.vue"]]); const $L = De({ name: "ElHeader" }), ZL = /* @__PURE__ */ De({ ...$L, props: { height: { type: String, default: null } }, setup(n) { const e = n, t = it("header"), i = ce(() => e.height ? t.cssVarBlock({ height: e.height }) : {}); return (r, s) => (pe(), Re("header", { class: Le(H(t).b()), style: Ot(H(i)) }, [ Xe(r.$slots, "default") ], 6)); } }); var Sy = /* @__PURE__ */ at(ZL, [["__file", "header.vue"]]); const XL = De({ name: "ElMain" }), YL = /* @__PURE__ */ De({ ...XL, setup(n) { const e = it("main"); return (t, i) => (pe(), Re("main", { class: Le(H(e).b()) }, [ Xe(t.$slots, "default") ], 2)); } }); var _y = /* @__PURE__ */ at(YL, [["__file", "main.vue"]]); const Wi = vn(kL, { Aside: wy, Footer: My, Header: Sy, Main: _y }); gr(wy); const Ty = gr(My), JL = gr(Sy), vr = gr(_y), qL = /* @__PURE__ */ De({ inheritAttrs: !1 }); function KL(n, e, t, i, r, s) { return Xe(n.$slots, "default"); } var QL = /* @__PURE__ */ at(qL, [["render", KL], ["__file", "collection.vue"]]); const eR = /* @__PURE__ */ De({ name: "ElCollectionItem", inheritAttrs: !1 }); function tR(n, e, t, i, r, s) { return Xe(n.$slots, "default"); } var nR = /* @__PURE__ */ at(eR, [["render", tR], ["__file", "collection-item.vue"]]); const iR = "data-el-collection-item", rR = (n) => { const e = `El${n}Collection`, t = `${e}Item`, i = Symbol(e), r = Symbol(t), s = { ...QL, name: e, setup() { const a = Ae(null), c = /* @__PURE__ */ new Map(); gn(i, { itemMap: c, getItems: () => { const d = H(a); if (!d) return []; const h = Array.from(d.querySelectorAll(`[${iR}]`)); return [...c.values()].sort((g, f) => h.indexOf(g.ref) - h.indexOf(f.ref)); }, collectionRef: a }); } }, o = { ...nR, name: t, setup(a, { attrs: c }) { const l = Ae(null), d = ht(i, void 0); gn(r, { collectionItemRef: l }), on(() => { const h = H(l); h && d.itemMap.set(h, { ref: h, ...c }); }), li(() => { const h = H(l); d.itemMap.delete(h); }); } }; return { COLLECTION_INJECTION_KEY: i, COLLECTION_ITEM_INJECTION_KEY: r, ElCollection: s, ElCollectionItem: o }; }, nh = dt({ trigger: qa.trigger, effect: { ...Zn.effect, default: "light" }, type: { type: Ye(String) }, placement: { type: Ye(String), default: "bottom" }, popperOptions: { type: Ye(Object), default: () => ({}) }, id: String, size: { type: String, default: "" }, splitButton: Boolean, hideOnClick: { type: Boolean, default: !0 }, loop: { type: Boolean, default: !0 }, showTimeout: { type: Number, default: 150 }, hideTimeout: { type: Number, default: 150 }, tabindex: { type: Ye([Number, String]), default: 0 }, maxHeight: { type: Ye([Number, String]), default: "" }, popperClass: { type: String, default: "" }, disabled: Boolean, role: { type: String, default: "menu" }, buttonProps: { type: Ye(Object) }, teleported: Zn.teleported }); dt({ command: { type: [Object, String, Number], default: () => ({}) }, disabled: Boolean, divided: Boolean, textValue: String, icon: { type: Zr } }); dt({ onKeydown: { type: Ye(Function) } }); rR("Dropdown"); const sR = dt({ id: { type: String, default: void 0 }, step: { type: Number, default: 1 }, stepStrictly: Boolean, max: { type: Number, default: Number.POSITIVE_INFINITY }, min: { type: Number, default: Number.NEGATIVE_INFINITY }, modelValue: Number, readonly: Boolean, disabled: Boolean, size: Do, controls: { type: Boolean, default: !0 }, controlsPosition: { type: String, default: "", values: ["", "right"] }, valueOnClear: { type: [String, Number, null], validator: (n) => n === null || St(n) || ["min", "max"].includes(n), default: null }, name: String, placeholder: String, precision: { type: Number, validator: (n) => n >= 0 && n === Number.parseInt(`${n}`, 10) }, validateEvent: { type: Boolean, default: !0 }, ...Gs(["ariaLabel"]) }), oR = { [Qr]: (n, e) => e !== n, blur: (n) => n instanceof FocusEvent, focus: (n) => n instanceof FocusEvent, [Ss]: (n) => St(n) || sr(n), [Dt]: (n) => St(n) || sr(n) }, aR = De({ name: "ElInputNumber" }), lR = /* @__PURE__ */ De({ ...aR, props: sR, emits: oR, setup(n, { expose: e, emit: t }) { const i = n, { t: r } = mu(), s = it("input-number"), o = Ae(), a = qn({ currentValue: i.modelValue, userInput: null }), { formItem: c } = gl(), l = ce(() => St(i.modelValue) && i.modelValue <= i.min), d = ce(() => St(i.modelValue) && i.modelValue >= i.max), h = ce(() => { const I = v(i.step); return yi(i.precision) ? Math.max(v(i.modelValue), I) : (I > i.precision && en("InputNumber", "precision should not be less than the decimal places of step"), i.precision); }), p = ce(() => i.controls && i.controlsPosition === "right"), g = ra(), f = yu(), u = ce(() => { if (a.userInput !== null) return a.userInput; let I = a.currentValue; if (sr(I)) return ""; if (St(I)) { if (Number.isNaN(I)) return ""; yi(i.precision) || (I = I.toFixed(i.precision)); } return I; }), y = (I, b) => { if (yi(b) && (b = h.value), b === 0) return Math.round(I); let O = String(I); const N = O.indexOf("."); if (N === -1 || !O.replace(".", "").split("")[N + b]) return I; const U = O.length; return O.charAt(U - 1) === "5" && (O = `${O.slice(0, Math.max(0, U - 1))}6`), Number.parseFloat(Number(O).toFixed(b)); }, v = (I) => { if (sr(I)) return 0; const b = I.toString(), O = b.indexOf("."); let N = 0; return O !== -1 && (N = b.length - O - 1), N; }, m = (I, b = 1) => St(I) ? y(I + i.step * b) : a.currentValue, w = () => { if (i.readonly || f.value || d.value) return; const I = Number(u.value) || 0, b = m(I); M(b), t(Ss, a.currentValue), A(); }, S = () => { if (i.readonly || f.value || l.value) return; const I = Number(u.value) || 0, b = m(I, -1); M(b), t(Ss, a.currentValue), A(); }, T = (I, b) => { const { max: O, min: N, step: D, precision: B, stepStrictly: U, valueOnClear: k } = i; O < N && na("InputNumber", "min should not be greater than max."); let K = Number(I); if (sr(I) || Number.isNaN(K)) return null; if (I === "") { if (k === null) return null; K = On(k) ? { min: N, max: O }[k] : k; } return U && (K = y(Math.round(K / D) * D, B), K !== I && b && t(Dt, K)), yi(B) || (K = y(K, B)), (K > O || K < N) && (K = K > O ? O : N, b && t(Dt, K)), K; }, M = (I, b = !0) => { var O; const N = a.currentValue, D = T(I); if (!b) { t(Dt, D); return; } N === D && I || (a.userInput = null, t(Dt, D), N !== D && t(Qr, D, N), i.validateEvent && ((O = c == null ? void 0 : c.validate) == null || O.call(c, "change").catch((B) => en(B))), a.currentValue = D); }, x = (I) => { a.userInput = I; const b = I === "" ? null : Number(I); t(Ss, b), M(b, !1); }, _ = (I) => { const b = I !== "" ? Number(I) : ""; (St(b) && !Number.isNaN(b) || I === "") && M(b), A(), a.userInput = null; }, E = () => { var I, b; (b = (I = o.value) == null ? void 0 : I.focus) == null || b.call(I); }, L = () => { var I, b; (b = (I = o.value) == null ? void 0 : I.blur) == null || b.call(I); }, R = (I) => { t("focus", I); }, C = (I) => { var b; a.userInput = null, t("blur", I), i.validateEvent && ((b = c == null ? void 0 : c.validate) == null || b.call(c, "blur").catch((O) => en(O))); }, A = () => { a.currentValue !== i.modelValue && (a.currentValue = i.modelValue); }, P = (I) => { document.activeElement === I.target && I.preventDefault(); }; return Ke(() => i.modelValue, (I, b) => { const O = T(I, !0); a.userInput === null && O !== b && (a.currentValue = O); }, { immediate: !0 }), on(() => { var I; const { min: b, max: O, modelValue: N } = i, D = (I = o.value) == null ? void 0 : I.input; if (D.setAttribute("role", "spinbutton"), Number.isFinite(O) ? D.setAttribute("aria-valuemax", String(O)) : D.removeAttribute("aria-valuemax"), Number.isFinite(b) ? D.setAttribute("aria-valuemin", String(b)) : D.removeAttribute("aria-valuemin"), D.setAttribute("aria-valuenow", a.currentValue || a.currentValue === 0 ? String(a.currentValue) : ""), D.setAttribute("aria-disabled", String(f.value)), !St(N) && N != null) { let B = Number(N); Number.isNaN(B) && (B = null), t(Dt, B); } D.addEventListener("wheel", P, { passive: !1 }); }), sf(() => { var I, b; const O = (I = o.value) == null ? void 0 : I.input; O == null || O.setAttribute("aria-valuenow", `${(b = a.currentValue) != null ? b : ""}`); }), e({ focus: E, blur: L }), (I, b) => (pe(), Re("div", { class: Le([ H(s).b(), H(s).m(H(g)), H(s).is("disabled", H(f)), H(s).is("without-controls", !I.controls), H(s).is("controls-right", H(p)) ]), onDragstart: fn(() => { }, ["prevent"]) }, [ I.controls ? Ft((pe(), Re("span", { key: 0, role: "button", "aria-label": H(r)("el.inputNumber.decrease"), class: Le([H(s).e("decrease"), H(s).is("disabled", H(l))]), onKeydown: vi(S, ["enter"]) }, [ Xe(I.$slots, "decrease-icon", {}, () => [ ae(H(Bt), null, { default: fe(() => [ H(p) ? (pe(), He(H(vf), { key: 0 })) : (pe(), He(H(dE), { key: 1 })) ]), _: 1 }) ]) ], 42, ["aria-label", "onKeydown"])), [ [H(rg), S] ]) : Ge("v-if", !0), I.controls ? Ft((pe(), Re("span", { key: 1, role: "button", "aria-label": H(r)("el.inputNumber.increase"), class: Le([H(s).e("increase"), H(s).is("disabled", H(d))]), onKeydown: vi(w, ["enter"]) }, [ Xe(I.$slots, "increase-icon", {}, () => [ ae(H(Bt), null, { default: fe(() => [ H(p) ? (pe(), He(H(nE), { key: 0 })) : (pe(), He(H(fu), { key: 1 })) ]), _: 1 }) ]) ], 42, ["aria-label", "onKeydown"])), [ [H(rg), w] ]) : Ge("v-if", !0), ae(H(mC), { id: I.id, ref_key: "input", ref: o, type: "number", step: I.step, "model-value": H(u), placeholder: I.placeholder, readonly: I.readonly, disabled: H(f), size: H(g), max: I.max, min: I.min, name: I.name, "aria-label": I.ariaLabel, "validate-event": !1, onKeydown: [ vi(fn(w, ["prevent"]), ["up"]), vi(fn(S, ["prevent"]), ["down"]) ], onBlur: C, onFocus: R, onInput: x, onChange: _ }, a1({ _: 2 }, [ I.$slots.prefix ? { name: "prefix", fn: fe(() => [ Xe(I.$slots, "prefix") ]) } : void 0, I.$slots.suffix ? { name: "suffix", fn: fe(() => [ Xe(I.$slots, "suffix") ]) } : void 0 ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"]) ], 42, ["onDragstart"])); } }); var cR = /* @__PURE__ */ at(lR, [["__file", "input-number.vue"]]); const yr = vn(cR), Ey = Symbol("ElSelectGroup"), wu = Symbol("ElSelect"); function uR(n, e) { const t = ht(wu), i = ht(Ey, { disabled: !1 }), r = ce(() => d(Ri(t.props.modelValue), n.value)), s = ce(() => { var g; if (t.props.multiple) { const f = Ri((g = t.props.modelValue) != null ? g : []); return !r.value && f.length >= t.props.multipleLimit && t.props.multipleLimit > 0; } else return !1; }), o = ce(() => n.label || (Pn(n.value) ? "" : n.value)), a = ce(() => n.value || n.label || ""), c = ce(() => n.disabled || e.groupDisabled || s.value), l = cn(), d = (g = [], f) => { if (Pn(n.value)) { const u = t.props.valueKey; return g && g.some((y) => of(er(y, u)) === er(f, u)); } else return g && g.includes(f); }, h = () => { !n.disabled && !i.disabled && (t.states.hoveringIndex = t.optionsArray.indexOf(l.proxy)); }, p = (g) => { const f = new RegExp(YT(g), "i"); e.visible = f.test(o.value) || n.created; }; return Ke(() => o.value, () => { !n.created && !t.props.remote && t.setSelected(); }), Ke(() => n.value, (g, f) => { const { remote: u, valueKey: y } = t.props; if (g !== f && (t.onOptionDestroy(f, l.proxy), t.onOptionCreate(l.proxy)), !n.created && !u) { if (y && Pn(g) && Pn(f) && g[y] === f[y]) return; t.setSelected(); } }), Ke(() => i.disabled, () => { e.groupDisabled = i.disabled; }, { immediate: !0 }), { select: t, currentLabel: o, currentValue: a, itemSelected: r, isDisabled: c, hoverItem: h, updateOption: p }; } const hR = De({ name: "ElOption", componentName: "ElOption", props: { value: { required: !0, type: [String, Number, Boolean, Object] }, label: [String, Number], created: Boolean, disabled: Boolean }, setup(n) { const e = it("select"), t = vu(), i = ce(() => [ e.be("dropdown", "item"), e.is("disabled", H(a)), e.is("selected", H(o)), e.is("hovering", H(p)) ]), r = qn({ index: -1, groupDisabled: !1, visible: !0, hover: !1 }), { currentLabel: s, itemSelected: o, isDisabled: a, select: c, hoverItem: l, updateOption: d } = uR(n, r), { visible: h, hover: p } = cr(r), g = cn().proxy; c.onOptionCreate(g), li(() => { const u = g.value, { selected: y } = c.states, m = (c.props.multiple ? y : [y]).some((w) => w.value === g.value); Mt(() => { c.states.cachedOptions.get(u) === g && !m && c.states.cachedOptions.delete(u); }), c.onOptionDestroy(u, g); }); function f() { a.value || c.handleOptionSelect(g); } return { ns: e, id: t, containerKls: i, currentLabel: s, itemSelected: o, isDisabled: a, select: c, hoverItem: l, updateOption: d, visible: h, hover: p, selectOptionClick: f, states: r }; } }); function dR(n, e, t, i, r, s) { return Ft((pe(), Re("li", { id: n.id, class: Le(n.containerKls), role: "option", "aria-disabled": n.isDisabled || void 0, "aria-selected": n.itemSelected, onMouseenter: n.hoverItem, onClick: fn(n.selectOptionClick, ["stop"]) }, [ Xe(n.$slots, "default", {}, () => [ Be("span", null, wt(n.currentLabel), 1) ]) ], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [ [xn, n.visible] ]); } var zf = /* @__PURE__ */ at(hR, [["render", dR], ["__file", "option.vue"]]); const fR = De({ name: "ElSelectDropdown", componentName: "ElSelectDropdown", setup() { const n = ht(wu), e = it("select"), t = ce(() => n.props.popperClass), i = ce(() => n.props.multiple), r = ce(() => n.props.fitInputWidth), s = Ae(""); function o() { var a; s.value = `${(a = n.selectRef) == null ? void 0 : a.offsetWidth}px`; } return on(() => { o(), ii(n.selectRef, o); }), { ns: e, minWidth: s, popperClass: t, isMultiple: i, isFitInputWidth: r }; } }); function pR(n, e, t, i, r, s) { return pe(), Re("div", { class: Le([n.ns.b("dropdown"), n.ns.is("multiple", n.isMultiple), n.popperClass]), style: Ot({ [n.isFitInputWidth ? "width" : "minWidth"]: n.minWidth }) }, [ n.$slots.header ? (pe(), Re("div", { key: 0, class: Le(n.ns.be("dropdown", "header")) }, [ Xe(n.$slots, "header") ], 2)) : Ge("v-if", !0), Xe(n.$slots, "default"), n.$slots.footer ? (pe(), Re("div", { key: 1, class: Le(n.ns.be("dropdown", "footer")) }, [ Xe(n.$slots, "footer") ], 2)) : Ge("v-if", !0) ], 6); } var mR = /* @__PURE__ */ at(fR, [["render", pR], ["__file", "select-dropdown.vue"]]); const gR = 11, vR = (n, e) => { const { t } = mu(), i = vu(), r = it("select"), s = it("input"), o = qn({ inputValue: "", options: /* @__PURE__ */ new Map(), cachedOptions: /* @__PURE__ */ new Map(), disabledOptions: /* @__PURE__ */ new Map(), optionValues: [], selected: [], selectionWidth: 0, calculatorWidth: 0, collapseItemWidth: 0, selectedLabel: "", hoveringIndex: -1, previousQuery: null, inputHovering: !1, menuVisibleOnFocus: !1, isBeforeHide: !1 }), a = Ae(null), c = Ae(null), l = Ae(null), d = Ae(null), h = Ae(null), p = Ae(null), g = Ae(null), f = Ae(null), u = Ae(null), y = Ae(null), v = Ae(null), m = Ae(null), { isComposing: w, handleCompositionStart: S, handleCompositionUpdate: T, handleCompositionEnd: M } = iy({ afterComposition: (he) => se(he) }), { wrapperRef: x, isFocused: _ } = ny(h, { beforeFocus() { return b.value; }, afterFocus() { n.automaticDropdown && !E.value && (E.value = !0, o.menuVisibleOnFocus = !0); }, beforeBlur(he) { var _e, Ce; return ((_e = l.value) == null ? void 0 : _e.isFocusInsideContent(he)) || ((Ce = d.value) == null ? void 0 : Ce.isFocusInsideContent(he)); }, afterBlur() { E.value = !1, o.menuVisibleOnFocus = !1; } }), E = Ae(!1), L = Ae(), { form: R, formItem: C } = gl(), { inputId: A } = Pf(n, { formItemContext: C }), { valueOnClear: P, isEmptyValue: I } = KA(n), b = ce(() => n.disabled || (R == null ? void 0 : R.disabled)), O = ce(() => Un(n.modelValue) ? n.modelValue.length > 0 : !I(n.modelValue)), N = ce(() => n.clearable && !b.value && o.inputHovering && O.value), D = ce(() => n.remote && n.filterable && !n.remoteShowSuffix ? "" : n.suffixIcon), B = ce(() => r.is("reverse", D.value && E.value)), U = ce(() => (C == null ? void 0 : C.validateState) || ""), k = ce(() => D0[U.value]), K = ce(() => n.remote ? 300 : 0), ie = ce(() => n.loading ? n.loadingText || t("el.select.loading") : n.remote && !o.inputValue && o.options.size === 0 ? !1 : n.filterable && o.inputValue && o.options.size > 0 && j.value === 0 ? n.noMatchText || t("el.select.noMatch") : o.options.size === 0 ? n.noDataText || t("el.select.noData") : null), j = ce(() => G.value.filter((he) => he.visible).length), G = ce(() => { const he = Array.from(o.options.values()), _e = []; return o.optionValues.forEach((Ce) => { const ke = he.findIndex((Ze) => Ze.value === Ce); ke > -1 && _e.push(he[ke]); }), _e.length >= he.length ? _e : he; }), W = ce(() => Array.from(o.cachedOptions.values())), q = ce(() => { const he = G.value.filter((_e) => !_e.created).some((_e) => _e.currentLabel === o.inputValue); return n.filterable && n.allowCreate && o.inputValue !== "" && !he; }), Q = () => { n.filterable && Ln(n.filterMethod) || n.filterable && n.remote && Ln(n.remoteMethod) || G.value.forEach((he) => { var _e; (_e = he.updateOption) == null || _e.call(he, o.inputValue); }); }, ee = ra(), ne = ce(() => ["small"].includes(ee.value) ? "small" : "default"), Y = ce({ get() { return E.value && ie.value !== !1; }, set(he) { E.value = he; } }), te = ce(() => { if (n.multiple && !yi(n.modelValue)) return Ri(n.modelValue).length === 0 && !o.inputValue; const he = Un(n.modelValue) ? n.modelValue[0] : n.modelValue; return n.filterable || yi(he) ? !o.inputValue : !0; }), F = ce(() => { var he; const _e = (he = n.placeholder) != null ? he : t("el.select.placeholder"); return n.multiple || !O.value ? _e : o.selectedLabel; }), $ = ce(() => td ? null : "mouseenter"); Ke(() => n.modelValue, (he, _e) => { n.multiple && n.filterable && !n.reserveKeyword && (o.inputValue = "", J("")), V(), !ld(he, _e) && n.validateEvent && (C == null || C.validate("change").catch((Ce) => en(Ce))); }, { flush: "post", deep: !0 }), Ke(() => E.value, (he) => { he ? J(o.inputValue) : (o.inputValue = "", o.previousQuery = null, o.isBeforeHide = !0), e("visible-change", he); }), Ke(() => o.options.entries(), () => { var he; if (!rn) return; const _e = ((he = a.value) == null ? void 0 : he.querySelectorAll("input")) || []; (!n.filterable && !n.defaultFirstOption && !yi(n.modelValue) || !Array.from(_e).includes(document.activeElement)) && V(), n.defaultFirstOption && (n.filterable || n.remote) && j.value && z(); }, { flush: "post" }), Ke(() => o.hoveringIndex, (he) => { St(he) && he > -1 ? L.value = G.value[he] || {} : L.value = {}, G.value.forEach((_e) => { _e.hover = L.value === _e; }); }), s0(() => { o.isBeforeHide || Q(); }); const J = (he) => { o.previousQuery === he || w.value || (o.previousQuery = he, n.filterable && Ln(n.filterMethod) ? n.filterMethod(he) : n.filterable && n.remote && Ln(n.remoteMethod) && n.remoteMethod(he), n.defaultFirstOption && (n.filterable || n.remote) && j.value ? Mt(z) : Mt(ue)); }, z = () => { const he = G.value.filter((ke) => ke.visible && !ke.disabled && !ke.states.groupDisabled), _e = he.find((ke) => ke.created), Ce = he[0]; o.hoveringIndex = bt(G.value, _e || Ce); }, V = () => { if (n.multiple) o.selectedLabel = ""; else { const _e = Un(n.modelValue) ? n.modelValue[0] : n.modelValue, Ce = oe(_e); o.selectedLabel = Ce.currentLabel, o.selected = [Ce]; return; } const he = []; yi(n.modelValue) || Ri(n.modelValue).forEach((_e) => { he.push(oe(_e)); }), o.selected = he; }, oe = (he) => { let _e; const Ce = ju(he).toLowerCase() === "object", ke = ju(he).toLowerCase() === "null", Ze = ju(he).toLowerCase() === "undefined"; for (let ut = o.cachedOptions.size - 1; ut >= 0; ut--) { const Zt = W.value[ut]; if (Ce ? er(Zt.value, n.valueKey) === er(he, n.valueKey) : Zt.value === he) { _e = { value: he, currentLabel: Zt.currentLabel, get isDisabled() { return Zt.isDisabled; } }; break; } } if (_e) return _e; const Qe = Ce ? he.label : !ke && !Ze ? he : ""; return { value: he, currentLabel: Qe }; }, ue = () => { o.hoveringIndex = G.value.findIndex((he) => o.selected.some((_e) => gt(_e) === gt(he))); }, le = () => { o.selectionWidth = c.value.getBoundingClientRect().width; }, ve = () => { o.calculatorWidth = p.value.getBoundingClientRect().width; }, xe = () => { o.collapseItemWidth = v.value.getBoundingClientRect().width; }, Te = () => { var he, _e; (_e = (he = l.value) == null ? void 0 : he.updatePopper) == null || _e.call(he); }, de = () => { var he, _e; (_e = (he = d.value) == null ? void 0 : he.updatePopper) == null || _e.call(he); }, we = () => { o.inputValue.length > 0 && !E.value && (E.value = !0), J(o.inputValue); }, se = (he) => { if (o.inputValue = he.target.value, n.remote) Se(); else return we(); }, Se = ad(() => { we(); }, K.value), ge = (he) => { ld(n.modelValue, he) || e(Qr, he); }, be = (he) => GT(he, (_e) => !o.disabledOptions.has(_e)), Ie = (he) => { if (n.multiple && he.code !== Di.delete && he.target.value.length <= 0) { const _e = Ri(n.modelValue).slice(), Ce = be(_e); if (Ce < 0) return; const ke = _e[Ce]; _e.splice(Ce, 1), e(Dt, _e), ge(_e), e("remove-tag", ke); } }, et = (he, _e) => { const Ce = o.selected.indexOf(_e); if (Ce > -1 && !b.value) { const ke = Ri(n.modelValue).slice(); ke.splice(Ce, 1), e(Dt, ke), ge(ke), e("remove-tag", _e.value); } he.stopPropagation(), Vt(); }, mt = (he) => { he.stopPropagation(); const _e = n.multiple ? [] : P.value; if (n.multiple) for (const Ce of o.selected) Ce.isDisabled && _e.push(Ce.value); e(Dt, _e), ge(_e), o.hoveringIndex = -1, E.value = !1, e("clear"), Vt(); }, Ue = (he) => { var _e; if (n.multiple) { const Ce = Ri((_e = n.modelValue) != null ? _e : []).slice(), ke = bt(Ce, he.value); ke > -1 ? Ce.splice(ke, 1) : (n.multipleLimit <= 0 || Ce.length < n.multipleLimit) && Ce.push(he.value), e(Dt, Ce), ge(Ce), he.created && J(""), n.filterable && !n.reserveKeyword && (o.inputValue = ""); } else e(Dt, he.value), ge(he.value), E.value = !1; Vt(), !E.value && Mt(() => { Ve(he); }); }, bt = (he = [], _e) => { if (!Pn(_e)) return he.indexOf(_e); const Ce = n.valueKey; let ke = -1; return he.some((Ze, Qe) => of(er(Ze, Ce)) === er(_e, Ce) ? (ke = Qe, !0) : !1), ke; }, Ve = (he) => { var _e, Ce, ke, Ze, Qe; const qe = Un(he) ? he[0] : he; let ut = null; if (qe != null && qe.value) { const Zt = G.value.filter((hn) => hn.value === qe.value); Zt.length > 0 && (ut = Zt[0].$el); } if (l.value && ut) { const Zt = (Ze = (ke = (Ce = (_e = l.value) == null ? void 0 : _e.popperRef) == null ? void 0 : Ce.contentRef) == null ? void 0 : ke.querySelector) == null ? void 0 : Ze.call(ke, `.${r.be("dropdown", "wrap")}`); Zt && qT(Zt, ut); } (Qe = m.value) == null || Qe.handleScroll(); }, lt = (he) => { o.options.set(he.value, he), o.cachedOptions.set(he.value, he), he.disabled && o.disabledOptions.set(he.value, he); }, tt = (he, _e) => { o.options.get(he) === _e && o.options.delete(he); }, xt = ce(() => { var he, _e; return (_e = (he = l.value) == null ? void 0 : he.popperRef) == null ? void 0 : _e.contentRef; }), pt = () => { o.isBeforeHide = !1, Mt(() => Ve(o.selected)); }, Vt = () => { var he; (he = h.value) == null || he.focus(); }, Nt = () => { var he; (he = h.value) == null || he.blur(); }, re = (he) => { mt(he); }, Ee = () => { E.value = !1, _.value && Nt(); }, Ne = () => { o.inputValue.length > 0 ? o.inputValue = "" : E.value = !1; }, je = () => { b.value || (td && (o.inputHovering = !0), o.menuVisibleOnFocus ? o.menuVisibleOnFocus = !1 : E.value = !E.value); }, rt = () => { E.value ? G.value[o.hoveringIndex] && Ue(G.value[o.hoveringIndex]) : je(); }, gt = (he) => Pn(he.value) ? er(he.value, n.valueKey) : he.value, Tt = ce(() => G.value.filter((he) => he.visible).every((he) => he.disabled)), Lt = ce(() => n.multiple ? n.collapseTags ? o.selected.slice(0, n.maxCollapseTags) : o.selected : []), kt = ce(() => n.multiple ? n.collapseTags ? o.selected.slice(n.maxCollapseTags) : [] : []), Z = (he) => { if (!E.value) { E.value = !0; return; } if (!(o.options.size === 0 || o.filteredOptionsCount === 0 || w.value) && !Tt.value) { he === "next" ? (o.hoveringIndex++, o.hoveringIndex === o.options.size && (o.hoveringIndex = 0)) : he === "prev" && (o.hoveringIndex--, o.hoveringIndex < 0 && (o.hoveringIndex = o.options.size - 1)); const _e = G.value[o.hoveringIndex]; (_e.disabled === !0 || _e.states.groupDisabled === !0 || !_e.visible) && Z(he), Mt(() => Ve(L.value)); } }, ye = () => { if (!c.value) return 0; const he = window.getComputedStyle(c.value); return Number.parseFloat(he.gap || "6px"); }, me = ce(() => { const he = ye(); return { maxWidth: `${v.value && n.maxCollapseTags === 1 ? o.selectionWidth - o.collapseItemWidth - he : o.selectionWidth}px` }; }), Me = ce(() => ({ maxWidth: `${o.selectionWidth}px` })), Oe = ce(() => ({ width: `${Math.max(o.calculatorWidth, gR)}px` })); return ii(c, le), ii(p, ve), ii(u, Te), ii(x, Te), ii(y, de), ii(v, xe), on(() => { V(); }), { inputId: A, contentId: i, nsSelect: r, nsInput: s, states: o, isFocused: _, expanded: E, optionsArray: G, hoverOption: L, selectSize: ee, filteredOptionsCount: j, resetCalculatorWidth: ve, updateTooltip: Te, updateTagTooltip: de, debouncedOnInputChange: Se, onInput: se, deletePrevTag: Ie, deleteTag: et, deleteSelected: mt, handleOptionSelect: Ue, scrollToOption: Ve, hasModelValue: O, shouldShowPlaceholder: te, currentPlaceholder: F, mouseEnterEventName: $, showClose: N, iconComponent: D, iconReverse: B, validateState: U, validateIcon: k, showNewOption: q, updateOptions: Q, collapseTagSize: ne, setSelected: V, selectDisabled: b, emptyText: ie, handleCompositionStart: S, handleCompositionUpdate: T, handleCompositionEnd: M, onOptionCreate: lt, onOptionDestroy: tt, handleMenuEnter: pt, focus: Vt, blur: Nt, handleClearClick: re, handleClickOutside: Ee, handleEsc: Ne, toggleMenu: je, selectOption: rt, getValueKey: gt, navigateOptions: Z, dropdownMenuVisible: Y, showTagList: Lt, collapseTagList: kt, tagStyle: me, collapseTagStyle: Me, inputStyle: Oe, popperRef: xt, inputRef: h, tooltipRef: l, tagTooltipRef: d, calculatorRef: p, prefixRef: g, suffixRef: f, selectRef: a, wrapperRef: x, selectionRef: c, scrollbarRef: m, menuRef: u, tagMenuRef: y, collapseItemRef: v }; }; var yR = De({ name: "ElOptions", setup(n, { slots: e }) { const t = ht(wu); let i = []; return () => { var r, s; const o = (r = e.default) == null ? void 0 : r.call(e), a = []; function c(l) { Un(l) && l.forEach((d) => { var h, p, g, f; const u = (h = (d == null ? void 0 : d.type) || {}) == null ? void 0 : h.name; u === "ElOptionGroup" ? c(!On(d.children) && !Un(d.children) && Ln((p = d.children) == null ? void 0 : p.default) ? (g = d.children) == null ? void 0 : g.default() : d.children) : u === "ElOption" ? a.push((f = d.props) == null ? void 0 : f.value) : Un(d.children) && c(d.children); }); } return o.length && c((s = o[0]) == null ? void 0 : s.children), ld(a, i) || (i = a, t && (t.states.optionValues = a)), o; }; } }); const bR = dt({ name: String, id: String, modelValue: { type: [Array, String, Number, Boolean, Object], default: void 0 }, autocomplete: { type: String, default: "off" }, automaticDropdown: Boolean, size: Do, effect: { type: Ye(String), default: "light" }, disabled: Boolean, clearable: Boolean, filterable: Boolean, allowCreate: Boolean, loading: Boolean, popperClass: { type: String, default: "" }, popperOptions: { type: Ye(Object), default: () => ({}) }, remote: Boolean, loadingText: String, noMatchText: String, noDataText: String, remoteMethod: Function, filterMethod: Function, multiple: Boolean, multipleLimit: { type: Number, default: 0 }, placeholder: { type: String }, defaultFirstOption: Boolean, reserveKeyword: { type: Boolean, default: !0 }, valueKey: { type: String, default: "value" }, collapseTags: Boolean, collapseTagsTooltip: Boolean, maxCollapseTags: { type: Number, default: 1 }, teleported: Zn.teleported, persistent: { type: Boolean, default: !0 }, clearIcon: { type: Zr, default: yf }, fitInputWidth: Boolean, suffixIcon: { type: Zr, default: vf }, tagType: { ...md.type, default: "info" }, tagEffect: { ...md.effect, default: "light" }, validateEvent: { type: Boolean, default: !0 }, remoteShowSuffix: Boolean, placement: { type: Ye(String), values: ia, default: "bottom-start" }, fallbackPlacements: { type: Ye(Array), default: ["bottom-start", "top-start", "right", "left"] }, appendTo: String, ...qA, ...Gs(["ariaLabel"]) }), og = "ElSelect", xR = De({ name: og, componentName: og, components: { ElSelectMenu: mR, ElOption: zf, ElOptions: yR, ElTag: dL, ElScrollbar: LC, ElTooltip: Bf, ElIcon: Bt }, directives: { ClickOutside: sL }, props: bR, emits: [ Dt, Qr, "remove-tag", "clear", "visible-change", "focus", "blur" ], setup(n, { emit: e }) { const t = ce(() => { const { modelValue: s, multiple: o } = n, a = o ? [] : void 0; return Un(s) ? o ? s : a : o ? a : s; }), i = qn({ ...cr(n), modelValue: t }), r = vR(i, e); return gn(wu, qn({ props: i, states: r.states, optionsArray: r.optionsArray, handleOptionSelect: r.handleOptionSelect, onOptionCreate: r.onOptionCreate, onOptionDestroy: r.onOptionDestroy, selectRef: r.selectRef, setSelected: r.setSelected })), { ...r, modelValue: t }; } }); function wR(n, e, t, i, r, s) { const o = Xn("el-tag"), a = Xn("el-tooltip"), c = Xn("el-icon"), l = Xn("el-option"), d = Xn("el-options"), h = Xn("el-scrollbar"), p = Xn("el-select-menu"), g = l1("click-outside"); return Ft((pe(), Re("div", { ref: "selectRef", class: Le([n.nsSelect.b(), n.nsSelect.m(n.selectSize)]), [c1(n.mouseEnterEventName)]: (f) => n.states.inputHovering = !0, onMouseleave: (f) => n.states.inputHovering = !1 }, [ ae(a, { ref: "tooltipRef", visible: n.dropdownMenuVisible, placement: n.placement, teleported: n.teleported, "popper-class": [n.nsSelect.e("popper"), n.popperClass], "popper-options": n.popperOptions, "fallback-placements": n.fallbackPlacements, effect: n.effect, pure: "", trigger: "click", transition: `${n.nsSelect.namespace.value}-zoom-in-top`, "stop-popper-mouse-event": !1, "gpu-acceleration": !1, persistent: n.persistent, "append-to": n.appendTo, onBeforeShow: n.handleMenuEnter, onHide: (f) => n.states.isBeforeHide = !1 }, { default: fe(() => { var f; return [ Be("div", { ref: "wrapperRef", class: Le([ n.nsSelect.e("wrapper"), n.nsSelect.is("focused", n.isFocused), n.nsSelect.is("hovering", n.states.inputHovering), n.nsSelect.is("filterable", n.filterable), n.nsSelect.is("disabled", n.selectDisabled) ]), onClick: fn(n.toggleMenu, ["prevent"]) }, [ n.$slots.prefix ? (pe(), Re("div", { key: 0, ref: "prefixRef", class: Le(n.nsSelect.e("prefix")) }, [ Xe(n.$slots, "prefix") ], 2)) : Ge("v-if", !0), Be("div", { ref: "selectionRef", class: Le([ n.nsSelect.e("selection"), n.nsSelect.is("near", n.multiple && !n.$slots.prefix && !!n.states.selected.length) ]) }, [ n.multiple ? Xe(n.$slots, "tag", { key: 0 }, () => [ (pe(!0), Re(Wt, null, ri(n.showTagList, (u) => (pe(), Re("div", { key: n.getValueKey(u), class: Le(n.nsSelect.e("selected-item")) }, [ ae(o, { closable: !n.selectDisabled && !u.isDisabled, size: n.collapseTagSize, type: n.tagType, effect: n.tagEffect, "disable-transitions": "", style: Ot(n.tagStyle), onClose: (y) => n.deleteTag(y, u) }, { default: fe(() => [ Be("span", { class: Le(n.nsSelect.e("tags-text")) }, [ Xe(n.$slots, "label", { label: u.currentLabel, value: u.value }, () => [ yt(wt(u.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "style", "onClose"]) ], 2))), 128)), n.collapseTags && n.states.selected.length > n.maxCollapseTags ? (pe(), He(a, { key: 0, ref: "tagTooltipRef", disabled: n.dropdownMenuVisible || !n.collapseTagsTooltip, "fallback-placements": ["bottom", "top", "right", "left"], effect: n.effect, placement: "bottom", teleported: n.teleported }, { default: fe(() => [ Be("div", { ref: "collapseItemRef", class: Le(n.nsSelect.e("selected-item")) }, [ ae(o, { closable: !1, size: n.collapseTagSize, type: n.tagType, effect: n.tagEffect, "disable-transitions": "", style: Ot(n.collapseTagStyle) }, { default: fe(() => [ Be("span", { class: Le(n.nsSelect.e("tags-text")) }, " + " + wt(n.states.selected.length - n.maxCollapseTags), 3) ]), _: 1 }, 8, ["size", "type", "effect", "style"]) ], 2) ]), content: fe(() => [ Be("div", { ref: "tagMenuRef", class: Le(n.nsSelect.e("selection")) }, [ (pe(!0), Re(Wt, null, ri(n.collapseTagList, (u) => (pe(), Re("div", { key: n.getValueKey(u), class: Le(n.nsSelect.e("selected-item")) }, [ ae(o, { class: "in-tooltip", closable: !n.selectDisabled && !u.isDisabled, size: n.collapseTagSize, type: n.tagType, effect: n.tagEffect, "disable-transitions": "", onClose: (y) => n.deleteTag(y, u) }, { default: fe(() => [ Be("span", { class: Le(n.nsSelect.e("tags-text")) }, [ Xe(n.$slots, "label", { label: u.currentLabel, value: u.value }, () => [ yt(wt(u.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "onClose"]) ], 2))), 128)) ], 2) ]), _: 3 }, 8, ["disabled", "effect", "teleported"])) : Ge("v-if", !0) ]) : Ge("v-if", !0), n.selectDisabled ? Ge("v-if", !0) : (pe(), Re("div", { key: 1, class: Le([ n.nsSelect.e("selected-item"), n.nsSelect.e("input-wrapper"), n.nsSelect.is("hidden", !n.filterable) ]) }, [ Ft(Be("input", { id: n.inputId, ref: "inputRef", "onUpdate:modelValue": (u) => n.states.inputValue = u, type: "text", name: n.name, class: Le([n.nsSelect.e("input"), n.nsSelect.is(n.selectSize)]), disabled: n.selectDisabled, autocomplete: n.autocomplete, style: Ot(n.inputStyle), role: "combobox", readonly: !n.filterable, spellcheck: "false", "aria-activedescendant": ((f = n.hoverOption) == null ? void 0 : f.id) || "", "aria-controls": n.contentId, "aria-expanded": n.dropdownMenuVisible, "aria-label": n.ariaLabel, "aria-autocomplete": "none", "aria-haspopup": "listbox", onKeydown: [ vi(fn((u) => n.navigateOptions("next"), ["stop", "prevent"]), ["down"]), vi(fn((u) => n.navigateOptions("prev"), ["stop", "prevent"]), ["up"]), vi(fn(n.handleEsc, ["stop", "prevent"]), ["esc"]), vi(fn(n.selectOption, ["stop", "prevent"]), ["enter"]), vi(fn(n.deletePrevTag, ["stop"]), ["delete"]) ], onCompositionstart: n.handleCompositionStart, onCompositionupdate: n.handleCompositionUpdate, onCompositionend: n.handleCompositionEnd, onInput: n.onInput, onClick: fn(n.toggleMenu, ["stop"]) }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [ [u1, n.states.inputValue] ]), n.filterable ? (pe(), Re("span", { key: 0, ref: "calculatorRef", "aria-hidden": "true", class: Le(n.nsSelect.e("input-calculator")), textContent: wt(n.states.inputValue) }, null, 10, ["textContent"])) : Ge("v-if", !0) ], 2)), n.shouldShowPlaceholder ? (pe(), Re("div", { key: 2, class: Le([ n.nsSelect.e("selected-item"), n.nsSelect.e("placeholder"), n.nsSelect.is("transparent", !n.hasModelValue || n.expanded && !n.states.inputValue) ]) }, [ n.hasModelValue ? Xe(n.$slots, "label", { key: 0, label: n.currentPlaceholder, value: n.modelValue }, () => [ Be("span", null, wt(n.currentPlaceholder), 1) ]) : (pe(), Re("span", { key: 1 }, wt(n.currentPlaceholder), 1)) ], 2)) : Ge("v-if", !0) ], 2), Be("div", { ref: "suffixRef", class: Le(n.nsSelect.e("suffix")) }, [ n.iconComponent && !n.showClose ? (pe(), He(c, { key: 0, class: Le([n.nsSelect.e("caret"), n.nsSelect.e("icon"), n.iconReverse]) }, { default: fe(() => [ (pe(), He(zn(n.iconComponent))) ]), _: 1 }, 8, ["class"])) : Ge("v-if", !0), n.showClose && n.clearIcon ? (pe(), He(c, { key: 1, class: Le([ n.nsSelect.e("caret"), n.nsSelect.e("icon"), n.nsSelect.e("clear") ]), onClick: n.handleClearClick }, { default: fe(() => [ (pe(), He(zn(n.clearIcon))) ]), _: 1 }, 8, ["class", "onClick"])) : Ge("v-if", !0), n.validateState && n.validateIcon ? (pe(), He(c, { key: 2, class: Le([n.nsInput.e("icon"), n.nsInput.e("validateIcon")]) }, { default: fe(() => [ (pe(), He(zn(n.validateIcon))) ]), _: 1 }, 8, ["class"])) : Ge("v-if", !0) ], 2) ], 10, ["onClick"]) ]; }), content: fe(() => [ ae(p, { ref: "menuRef" }, { default: fe(() => [ n.$slots.header ? (pe(), Re("div", { key: 0, class: Le(n.nsSelect.be("dropdown", "header")), onClick: fn(() => { }, ["stop"]) }, [ Xe(n.$slots, "header") ], 10, ["onClick"])) : Ge("v-if", !0), Ft(ae(h, { id: n.contentId, ref: "scrollbarRef", tag: "ul", "wrap-class": n.nsSelect.be("dropdown", "wrap"), "view-class": n.nsSelect.be("dropdown", "list"), class: Le([n.nsSelect.is("empty", n.filteredOptionsCount === 0)]), role: "listbox", "aria-label": n.ariaLabel, "aria-orientation": "vertical" }, { default: fe(() => [ n.showNewOption ? (pe(), He(l, { key: 0, value: n.states.inputValue, created: !0 }, null, 8, ["value"])) : Ge("v-if", !0), ae(d, null, { default: fe(() => [ Xe(n.$slots, "default") ]), _: 3 }) ]), _: 3 }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [ [xn, n.states.options.size > 0 && !n.loading] ]), n.$slots.loading && n.loading ? (pe(), Re("div", { key: 1, class: Le(n.nsSelect.be("dropdown", "loading")) }, [ Xe(n.$slots, "loading") ], 2)) : n.loading || n.filteredOptionsCount === 0 ? (pe(), Re("div", { key: 2, class: Le(n.nsSelect.be("dropdown", "empty")) }, [ Xe(n.$slots, "empty", {}, () => [ Be("span", null, wt(n.emptyText), 1) ]) ], 2)) : Ge("v-if", !0), n.$slots.footer ? (pe(), Re("div", { key: 3, class: Le(n.nsSelect.be("dropdown", "footer")), onClick: fn(() => { }, ["stop"]) }, [ Xe(n.$slots, "footer") ], 10, ["onClick"])) : Ge("v-if", !0) ]), _: 3 }, 512) ]), _: 3 }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "onBeforeShow", "onHide"]) ], 16, ["onMouseleave"])), [ [g, n.handleClickOutside, n.popperRef] ]); } var MR = /* @__PURE__ */ at(xR, [["render", wR], ["__file", "select.vue"]]); const SR = De({ name: "ElOptionGroup", componentName: "ElOptionGroup", props: { label: String, disabled: Boolean }, setup(n) { const e = it("select"), t = Ae(null), i = cn(), r = Ae([]); gn(Ey, qn({ ...cr(n) })); const s = ce(() => r.value.some((l) => l.visible === !0)), o = (l) => { var d, h; return ((d = l.type) == null ? void 0 : d.name) === "ElOption" && !!((h = l.component) != null && h.proxy); }, a = (l) => { const d = Ri(l), h = []; return d.forEach((p) => { var g, f; o(p) ? h.push(p.component.proxy) : (g = p.children) != null && g.length ? h.push(...a(p.children)) : (f = p.component) != null && f.subTree && h.push(...a(p.component.subTree)); }), h; }, c = () => { r.value = a(i.subTree); }; return on(() => { c(); }), k1(t, c, { attributes: !0, subtree: !0, childList: !0 }), { groupRef: t, visible: s, ns: e }; } }); function _R(n, e, t, i, r, s) { return Ft((pe(), Re("ul", { ref: "groupRef", class: Le(n.ns.be("group", "wrap")) }, [ Be("li", { class: Le(n.ns.be("group", "title")) }, wt(n.label), 3), Be("li", null, [ Be("ul", { class: Le(n.ns.b("group")) }, [ Xe(n.$slots, "default") ], 2) ]) ], 2)), [ [xn, n.visible] ]); } var Ay = /* @__PURE__ */ at(SR, [["render", _R], ["__file", "option-group.vue"]]); const oa = vn(MR, { Option: zf, OptionGroup: Ay }), aa = gr(zf); gr(Ay); const TR = dt({ trigger: qa.trigger, placement: nh.placement, disabled: qa.disabled, visible: Zn.visible, transition: Zn.transition, popperOptions: nh.popperOptions, tabindex: nh.tabindex, content: Zn.content, popperStyle: Zn.popperStyle, popperClass: Zn.popperClass, enterable: { ...Zn.enterable, default: !0 }, effect: { ...Zn.effect, default: "light" }, teleported: Zn.teleported, title: String, width: { type: [String, Number], default: 150 }, offset: { type: Number, default: void 0 }, showAfter: { type: Number, default: 0 }, hideAfter: { type: Number, default: 200 }, autoClose: { type: Number, default: 0 }, showArrow: { type: Boolean, default: !0 }, persistent: { type: Boolean, default: !0 }, "onUpdate:visible": { type: Function } }), ER = { "update:visible": (n) => gf(n), "before-enter": () => !0, "before-leave": () => !0, "after-enter": () => !0, "after-leave": () => !0 }, AR = "onUpdate:visible", CR = De({ name: "ElPopover" }), LR = /* @__PURE__ */ De({ ...CR, props: TR, emits: ER, setup(n, { expose: e, emit: t }) { const i = n, r = ce(() => i[AR]), s = it("popover"), o = Ae(), a = ce(() => { var y; return (y = H(o)) == null ? void 0 : y.popperRef; }), c = ce(() => [ { width: Zc(i.width) }, i.popperStyle ]), l = ce(() => [s.b(), i.popperClass, { [s.m("plain")]: !!i.content }]), d = ce(() => i.transition === `${s.namespace.value}-fade-in-linear`), h = () => { var y; (y = o.value) == null || y.hide(); }, p = () => { t("before-enter"); }, g = () => { t("before-leave"); }, f = () => { t("after-enter"); }, u = () => { t("update:visible", !1), t("after-leave"); }; return e({ popperRef: a, hide: h }), (y, v) => (pe(), He(H(Bf), Oi({ ref_key: "tooltipRef", ref: o }, y.$attrs, { trigger: y.trigger, placement: y.placement, disabled: y.disabled, visible: y.visible, transition: y.transition, "popper-options": y.popperOptions, tabindex: y.tabindex, content: y.content, offset: y.offset, "show-after": y.showAfter, "hide-after": y.hideAfter, "auto-close": y.autoClose, "show-arrow": y.showArrow, "aria-label": y.title, effect: y.effect, enterable: y.enterable, "popper-class": H(l), "popper-style": H(c), teleported: y.teleported, persistent: y.persistent, "gpu-acceleration": H(d), "onUpdate:visible": H(r), onBeforeShow: p, onBeforeHide: g, onShow: f, onHide: u }), { content: fe(() => [ y.title ? (pe(), Re("div", { key: 0, class: Le(H(s).e("title")), role: "title" }, wt(y.title), 3)) : Ge("v-if", !0), Xe(y.$slots, "default", {}, () => [ yt(wt(y.content), 1) ]) ]), default: fe(() => [ y.$slots.reference ? Xe(y.$slots, "reference", { key: 0 }) : Ge("v-if", !0) ]), _: 3 }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"])); } }); var RR = /* @__PURE__ */ at(LR, [["__file", "popover.vue"]]); const ag = (n, e) => { const t = e.arg || e.value, i = t == null ? void 0 : t.popperRef; i && (i.triggerRef = n); }; var PR = { mounted(n, e) { ag(n, e); }, updated(n, e) { ag(n, e); } }; const IR = "popover", OR = yE(PR, IR), Mu = vn(RR, { directive: OR }), Cy = Symbol("sliderContextKey"), DR = dt({ modelValue: { type: Ye([Number, Array]), default: 0 }, id: { type: String, default: void 0 }, min: { type: Number, default: 0 }, max: { type: Number, default: 100 }, step: { type: Number, default: 1 }, showInput: Boolean, showInputControls: { type: Boolean, default: !0 }, size: Do, inputSize: Do, showStops: Boolean, showTooltip: { type: Boolean, default: !0 }, formatTooltip: { type: Ye(Function), default: void 0 }, disabled: Boolean, range: Boolean, vertical: Boolean, height: String, debounce: { type: Number, default: 300 }, rangeStartLabel: { type: String, default: void 0 }, rangeEndLabel: { type: String, default: void 0 }, formatValueText: { type: Ye(Function), default: void 0 }, tooltipClass: { type: String, default: void 0 }, placement: { type: String, values: ia, default: "top" }, marks: { type: Ye(Object) }, validateEvent: { type: Boolean, default: !0 }, ...Gs(["ariaLabel"]) }), ih = (n) => St(n) || Un(n) && n.every(St), NR = { [Dt]: ih, [Ss]: ih, [Qr]: ih }, FR = (n, e, t) => { const i = Ae(); return on(async () => { n.range ? (Array.isArray(n.modelValue) ? (e.firstValue = Math.max(n.min, n.modelValue[0]), e.secondValue = Math.min(n.max, n.modelValue[1])) : (e.firstValue = n.min, e.secondValue = n.max), e.oldValue = [e.firstValue, e.secondValue]) : (typeof n.modelValue != "number" || Number.isNaN(n.modelValue) ? e.firstValue = n.min : e.firstValue = Math.min(n.max, Math.max(n.min, n.modelValue)), e.oldValue = e.firstValue), pn(window, "resize", t), await Mt(), t(); }), { sliderWrapper: i }; }, BR = (n) => ce(() => n.marks ? Object.keys(n.marks).map(Number.parseFloat).sort((t, i) => t - i).filter((t) => t <= n.max && t >= n.min).map((t) => ({ point: t, position: (t - n.min) * 100 / (n.max - n.min), mark: n.marks[t] })) : []), zR = (n, e, t) => { const { form: i, formItem: r } = gl(), s = In(), o = Ae(), a = Ae(), c = { firstButton: o, secondButton: a }, l = ce(() => n.disabled || (i == null ? void 0 : i.disabled) || !1), d = ce(() => Math.min(e.firstValue, e.secondValue)), h = ce(() => Math.max(e.firstValue, e.secondValue)), p = ce(() => n.range ? `${100 * (h.value - d.value) / (n.max - n.min)}%` : `${100 * (e.firstValue - n.min) / (n.max - n.min)}%`), g = ce(() => n.range ? `${100 * (d.value - n.min) / (n.max - n.min)}%` : "0%"), f = ce(() => n.vertical ? { height: n.height } : {}), u = ce(() => n.vertical ? { height: p.value, bottom: g.value } : { width: p.value, left: g.value }), y = () => { s.value && (e.sliderSize = s.value[`client${n.vertical ? "Height" : "Width"}`]); }, v = (C) => { const A = n.min + C * (n.max - n.min) / 100; if (!n.range) return o; let P; return Math.abs(d.value - A) < Math.abs(h.value - A) ? P = e.firstValue < e.secondValue ? "firstButton" : "secondButton" : P = e.firstValue > e.secondValue ? "firstButton" : "secondButton", c[P]; }, m = (C) => { const A = v(C); return A.value.setPosition(C), A; }, w = (C) => { e.firstValue = C ?? n.min, T(n.range ? [d.value, h.value] : C ?? n.min); }, S = (C) => { e.secondValue = C, n.range && T([d.value, h.value]); }, T = (C) => { t(Dt, C), t(Ss, C); }, M = async () => { await Mt(), t(Qr, n.range ? [d.value, h.value] : n.modelValue); }, x = (C) => { var A, P, I, b, O, N; if (l.value || e.dragging) return; y(); let D = 0; if (n.vertical) { const B = (I = (P = (A = C.touches) == null ? void 0 : A.item(0)) == null ? void 0 : P.clientY) != null ? I : C.clientY; D = (s.value.getBoundingClientRect().bottom - B) / e.sliderSize * 100; } else { const B = (N = (O = (b = C.touches) == null ? void 0 : b.item(0)) == null ? void 0 : O.clientX) != null ? N : C.clientX, U = s.value.getBoundingClientRect().left; D = (B - U) / e.sliderSize * 100; } if (!(D < 0 || D > 100)) return m(D); }; return { elFormItem: r, slider: s, firstButton: o, secondButton: a, sliderDisabled: l, minValue: d, maxValue: h, runwayStyle: f, barStyle: u, resetSize: y, setPosition: m, emitChange: M, onSliderWrapperPrevent: (C) => { var A, P; ((A = c.firstButton.value) != null && A.dragging || (P = c.secondButton.value) != null && P.dragging) && C.preventDefault(); }, onSliderClick: (C) => { x(C) && M(); }, onSliderDown: async (C) => { const A = x(C); A && (await Mt(), A.value.onButtonDown(C)); }, onSliderMarkerDown: (C) => { l.value || e.dragging || m(C); }, setFirstValue: w, setSecondValue: S }; }, { left: UR, down: VR, right: kR, up: GR, home: HR, end: WR, pageUp: jR, pageDown: $R } = Di, ZR = (n, e, t) => { const i = Ae(), r = Ae(!1), s = ce(() => e.value instanceof Function), o = ce(() => s.value && e.value(n.modelValue) || n.modelValue), a = ad(() => { t.value && (r.value = !0); }, 50), c = ad(() => { t.value && (r.value = !1); }, 50); return { tooltip: i, tooltipVisible: r, formatValue: o, displayTooltip: a, hideTooltip: c }; }, XR = (n, e, t) => { const { disabled: i, min: r, max: s, step: o, showTooltip: a, precision: c, sliderSize: l, formatTooltip: d, emitChange: h, resetSize: p, updateDragging: g } = ht(Cy), { tooltip: f, tooltipVisible: u, formatValue: y, displayTooltip: v, hideTooltip: m } = ZR(n, d, a), w = Ae(), S = ce(() => `${(n.modelValue - r.value) / (s.value - r.value) * 100}%`), T = ce(() => n.vertical ? { bottom: S.value } : { left: S.value }), M = () => { e.hovering = !0, v(); }, x = () => { e.hovering = !1, e.dragging || m(); }, _ = (k) => { i.value || (k.preventDefault(), N(k), window.addEventListener("mousemove", D), window.addEventListener("touchmove", D), window.addEventListener("mouseup", B), window.addEventListener("touchend", B), window.addEventListener("contextmenu", B), w.value.focus()); }, E = (k) => { i.value || (e.newPosition = Number.parseFloat(S.value) + k / (s.value - r.value) * 100, U(e.newPosition), h()); }, L = () => { E(-o.value); }, R = () => { E(o.value); }, C = () => { E(-o.value * 4); }, A = () => { E(o.value * 4); }, P = () => { i.value || (U(0), h()); }, I = () => { i.value || (U(100), h()); }, b = (k) => { let K = !0; [UR, VR].includes(k.key) ? L() : [kR, GR].includes(k.key) ? R() : k.key === HR ? P() : k.key === WR ? I() : k.key === $R ? C() : k.key === jR ? A() : K = !1, K && k.preventDefault(); }, O = (k) => { let K, ie; return k.type.startsWith("touch") ? (ie = k.touches[0].clientY, K = k.touches[0].clientX) : (ie = k.clientY, K = k.clientX), { clientX: K, clientY: ie }; }, N = (k) => { e.dragging = !0, e.isClick = !0; const { clientX: K, clientY: ie } = O(k); n.vertical ? e.startY = ie : e.startX = K, e.startPosition = Number.parseFloat(S.value), e.newPosition = e.startPosition; }, D = (k) => { if (e.dragging) { e.isClick = !1, v(), p(); let K; const { clientX: ie, clientY: j } = O(k); n.vertical ? (e.currentY = j, K = (e.startY - e.currentY) / l.value * 100) : (e.currentX = ie, K = (e.currentX - e.startX) / l.value * 100), e.newPosition = e.startPosition + K, U(e.newPosition); } }, B = () => { e.dragging && (setTimeout(() => { e.dragging = !1, e.hovering || m(), e.isClick || U(e.newPosition), h(); }, 0), window.removeEventListener("mousemove", D), window.removeEventListener("touchmove", D), window.removeEventListener("mouseup", B), window.removeEventListener("touchend", B), window.removeEventListener("contextmenu", B)); }, U = async (k) => { if (k === null || Number.isNaN(+k)) return; k < 0 ? k = 0 : k > 100 && (k = 100); const K = 100 / ((s.value - r.value) / o.value); let j = Math.round(k / K) * K * (s.value - r.value) * 0.01 + r.value; j = Number.parseFloat(j.toFixed(c.value)), j !== n.modelValue && t(Dt, j), !e.dragging && n.modelValue !== e.oldValue && (e.oldValue = n.modelValue), await Mt(), e.dragging && v(), f.value.updatePopper(); }; return Ke(() => e.dragging, (k) => { g(k); }), pn(w, "touchstart", _, { passive: !1 }), { disabled: i, button: w, tooltip: f, tooltipVisible: u, showTooltip: a, wrapperStyle: T, formatValue: y, handleMouseEnter: M, handleMouseLeave: x, onButtonDown: _, onKeyDown: b, setPosition: U }; }, YR = (n, e, t, i) => ({ stops: ce(() => { if (!n.showStops || n.min > n.max) return []; if (n.step === 0) return en("ElSlider", "step should not be 0."), []; const o = (n.max - n.min) / n.step, a = 100 * n.step / (n.max - n.min), c = Array.from({ length: o - 1 }).map((l, d) => (d + 1) * a); return n.range ? c.filter((l) => l < 100 * (t.value - n.min) / (n.max - n.min) || l > 100 * (i.value - n.min) / (n.max - n.min)) : c.filter((l) => l > 100 * (e.firstValue - n.min) / (n.max - n.min)); }), getStopStyle: (o) => n.vertical ? { bottom: `${o}%` } : { left: `${o}%` } }), JR = (n, e, t, i, r, s) => { const o = (l) => { r(Dt, l), r(Ss, l); }, a = () => n.range ? ![t.value, i.value].every((l, d) => l === e.oldValue[d]) : n.modelValue !== e.oldValue, c = () => { var l, d; n.min > n.max && na("Slider", "min should not be greater than max."); const h = n.modelValue; n.range && Array.isArray(h) ? h[1] < n.min ? o([n.min, n.min]) : h[0] > n.max ? o([n.max, n.max]) : h[0] < n.min ? o([n.min, h[1]]) : h[1] > n.max ? o([h[0], n.max]) : (e.firstValue = h[0], e.secondValue = h[1], a() && (n.validateEvent && ((l = s == null ? void 0 : s.validate) == null || l.call(s, "change").catch((p) => en(p))), e.oldValue = h.slice())) : !n.range && typeof h == "number" && !Number.isNaN(h) && (h < n.min ? o(n.min) : h > n.max ? o(n.max) : (e.firstValue = h, a() && (n.validateEvent && ((d = s == null ? void 0 : s.validate) == null || d.call(s, "change").catch((p) => en(p))), e.oldValue = h))); }; c(), Ke(() => e.dragging, (l) => { l || c(); }), Ke(() => n.modelValue, (l, d) => { e.dragging || Array.isArray(l) && Array.isArray(d) && l.every((h, p) => h === d[p]) && e.firstValue === l[0] && e.secondValue === l[1] || c(); }, { deep: !0 }), Ke(() => [n.min, n.max], () => { c(); }); }, qR = dt({ modelValue: { type: Number, default: 0 }, vertical: Boolean, tooltipClass: String, placement: { type: String, values: ia, default: "top" } }), KR = { [Dt]: (n) => St(n) }, QR = De({ name: "ElSliderButton" }), eP = /* @__PURE__ */ De({ ...QR, props: qR, emits: KR, setup(n, { expose: e, emit: t }) { const i = n, r = it("slider"), s = qn({ hovering: !1, dragging: !1, isClick: !1, startX: 0, currentX: 0, startY: 0, currentY: 0, startPosition: 0, newPosition: 0, oldValue: i.modelValue }), { disabled: o, button: a, tooltip: c, showTooltip: l, tooltipVisible: d, wrapperStyle: h, formatValue: p, handleMouseEnter: g, handleMouseLeave: f, onButtonDown: u, onKeyDown: y, setPosition: v } = XR(i, s, t), { hovering: m, dragging: w } = cr(s); return e({ onButtonDown: u, onKeyDown: y, setPosition: v, hovering: m, dragging: w }), (S, T) => (pe(), Re("div", { ref_key: "button", ref: a, class: Le([H(r).e("button-wrapper"), { hover: H(m), dragging: H(w) }]), style: Ot(H(h)), tabindex: H(o) ? -1 : 0, onMouseenter: H(g), onMouseleave: H(f), onMousedown: H(u), onFocus: H(g), onBlur: H(f), onKeydown: H(y) }, [ ae(H(Bf), { ref_key: "tooltip", ref: c, visible: H(d), placement: S.placement, "fallback-placements": ["top", "bottom", "right", "left"], "stop-popper-mouse-event": !1, "popper-class": S.tooltipClass, disabled: !H(l), persistent: "" }, { content: fe(() => [ Be("span", null, wt(H(p)), 1) ]), default: fe(() => [ Be("div", { class: Le([H(r).e("button"), { hover: H(m), dragging: H(w) }]) }, null, 2) ]), _: 1 }, 8, ["visible", "placement", "popper-class", "disabled"]) ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"])); } }); var lg = /* @__PURE__ */ at(eP, [["__file", "button.vue"]]); const tP = dt({ mark: { type: Ye([String, Object]), default: void 0 } }); var nP = De({ name: "ElSliderMarker", props: tP, setup(n) { const e = it("slider"), t = ce(() => On(n.mark) ? n.mark : n.mark.label), i = ce(() => On(n.mark) ? void 0 : n.mark.style); return () => bo("div", { class: e.e("marks-text"), style: i.value }, t.value); } }); const iP = De({ name: "ElSlider" }), rP = /* @__PURE__ */ De({ ...iP, props: DR, emits: NR, setup(n, { expose: e, emit: t }) { const i = n, r = it("slider"), { t: s } = mu(), o = qn({ firstValue: 0, secondValue: 0, oldValue: 0, dragging: !1, sliderSize: 1 }), { elFormItem: a, slider: c, firstButton: l, secondButton: d, sliderDisabled: h, minValue: p, maxValue: g, runwayStyle: f, barStyle: u, resetSize: y, emitChange: v, onSliderWrapperPrevent: m, onSliderClick: w, onSliderDown: S, onSliderMarkerDown: T, setFirstValue: M, setSecondValue: x } = zR(i, o, t), { stops: _, getStopStyle: E } = YR(i, o, p, g), { inputId: L, isLabeledByFormItem: R } = Pf(i, { formItemContext: a }), C = ra(), A = ce(() => i.inputSize || C.value), P = ce(() => i.ariaLabel || s("el.slider.defaultLabel", { min: i.min, max: i.max })), I = ce(() => i.range ? i.rangeStartLabel || s("el.slider.defaultRangeStartLabel") : P.value), b = ce(() => i.formatValueText ? i.formatValueText(K.value) : `${K.value}`), O = ce(() => i.rangeEndLabel || s("el.slider.defaultRangeEndLabel")), N = ce(() => i.formatValueText ? i.formatValueText(ie.value) : `${ie.value}`), D = ce(() => [ r.b(), r.m(C.value), r.is("vertical", i.vertical), { [r.m("with-input")]: i.showInput } ]), B = BR(i); JR(i, o, p, g, t, a); const U = ce(() => { const W = [i.min, i.max, i.step].map((q) => { const Q = `${q}`.split(".")[1]; return Q ? Q.length : 0; }); return Math.max.apply(null, W); }), { sliderWrapper: k } = FR(i, o, y), { firstValue: K, secondValue: ie, sliderSize: j } = cr(o), G = (W) => { o.dragging = W; }; return pn(k, "touchstart", m, { passive: !1 }), pn(k, "touchmove", m, { passive: !1 }), gn(Cy, { ...cr(i), sliderSize: j, disabled: h, precision: U, emitChange: v, resetSize: y, updateDragging: G }), e({ onSliderClick: w }), (W, q) => { var Q, ee; return pe(), Re("div", { id: W.range ? H(L) : void 0, ref_key: "sliderWrapper", ref: k, class: Le(H(D)), role: W.range ? "group" : void 0, "aria-label": W.range && !H(R) ? H(P) : void 0, "aria-labelledby": W.range && H(R) ? (Q = H(a)) == null ? void 0 : Q.labelId : void 0 }, [ Be("div", { ref_key: "slider", ref: c, class: Le([ H(r).e("runway"), { "show-input": W.showInput && !W.range }, H(r).is("disabled", H(h)) ]), style: Ot(H(f)), onMousedown: H(S), onTouchstartPassive: H(S) }, [ Be("div", { class: Le(H(r).e("bar")), style: Ot(H(u)) }, null, 6), ae(lg, { id: W.range ? void 0 : H(L), ref_key: "firstButton", ref: l, "model-value": H(K), vertical: W.vertical, "tooltip-class": W.tooltipClass, placement: W.placement, role: "slider", "aria-label": W.range || !H(R) ? H(I) : void 0, "aria-labelledby": !W.range && H(R) ? (ee = H(a)) == null ? void 0 : ee.labelId : void 0, "aria-valuemin": W.min, "aria-valuemax": W.range ? H(ie) : W.max, "aria-valuenow": H(K), "aria-valuetext": H(b), "aria-orientation": W.vertical ? "vertical" : "horizontal", "aria-disabled": H(h), "onUpdate:modelValue": H(M) }, null, 8, ["id", "model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-labelledby", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"]), W.range ? (pe(), He(lg, { key: 0, ref_key: "secondButton", ref: d, "model-value": H(ie), vertical: W.vertical, "tooltip-class": W.tooltipClass, placement: W.placement, role: "slider", "aria-label": H(O), "aria-valuemin": H(K), "aria-valuemax": W.max, "aria-valuenow": H(ie), "aria-valuetext": H(N), "aria-orientation": W.vertical ? "vertical" : "horizontal", "aria-disabled": H(h), "onUpdate:modelValue": H(x) }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : Ge("v-if", !0), W.showStops ? (pe(), Re("div", { key: 1 }, [ (pe(!0), Re(Wt, null, ri(H(_), (ne, Y) => (pe(), Re("div", { key: Y, class: Le(H(r).e("stop")), style: Ot(H(E)(ne)) }, null, 6))), 128)) ])) : Ge("v-if", !0), H(B).length > 0 ? (pe(), Re(Wt, { key: 2 }, [ Be("div", null, [ (pe(!0), Re(Wt, null, ri(H(B), (ne, Y) => (pe(), Re("div", { key: Y, style: Ot(H(E)(ne.position)), class: Le([H(r).e("stop"), H(r).e("marks-stop")]) }, null, 6))), 128)) ]), Be("div", { class: Le(H(r).e("marks")) }, [ (pe(!0), Re(Wt, null, ri(H(B), (ne, Y) => (pe(), He(H(nP), { key: Y, mark: ne.mark, style: Ot(H(E)(ne.position)), onMousedown: fn((te) => H(T)(ne.position), ["stop"]) }, null, 8, ["mark", "style", "onMousedown"]))), 128)) ], 2) ], 64)) : Ge("v-if", !0) ], 46, ["onMousedown", "onTouchstartPassive"]), W.showInput && !W.range ? (pe(), He(H(yr), { key: 0, ref: "input", "model-value": H(K), class: Le(H(r).e("input")), step: W.step, disabled: H(h), controls: W.showInputControls, min: W.min, max: W.max, precision: H(U), debounce: W.debounce, size: H(A), "onUpdate:modelValue": H(M), onChange: H(v) }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : Ge("v-if", !0) ], 10, ["id", "role", "aria-label", "aria-labelledby"]); }; } }); var sP = /* @__PURE__ */ at(rP, [["__file", "slider.vue"]]); const ci = vn(sP), Su = Symbol("tabsRootContextKey"), oP = dt({ tabs: { type: Ye(Array), default: () => tr([]) } }), Ly = "ElTabBar", aP = De({ name: Ly }), lP = /* @__PURE__ */ De({ ...aP, props: oP, setup(n, { expose: e }) { const t = n, i = cn(), r = ht(Su); r || na(Ly, ""); const s = it("tabs"), o = Ae(), a = Ae(), c = () => { let g = 0, f = 0; const u = ["top", "bottom"].includes(r.props.tabPosition) ? "width" : "height", y = u === "width" ? "x" : "y", v = y === "x" ? "left" : "top"; return t.tabs.every((m) => { var w, S; const T = (S = (w = i.parent) == null ? void 0 : w.refs) == null ? void 0 : S[`tab-${m.uid}`]; if (!T) return !1; if (!m.active) return !0; g = T[`offset${Br(v)}`], f = T[`client${Br(u)}`]; const M = window.getComputedStyle(T); return u === "width" && (f -= Number.parseFloat(M.paddingLeft) + Number.parseFloat(M.paddingRight), g += Number.parseFloat(M.paddingLeft)), !1; }), { [u]: `${f}px`, transform: `translate${Br(y)}(${g}px)` }; }, l = () => a.value = c(), d = [], h = () => { var g; d.forEach((u) => u.stop()), d.length = 0; const f = (g = i.parent) == null ? void 0 : g.refs; if (f) { for (const u in f) if (u.startsWith("tab-")) { const y = f[u]; y && d.push(ii(y, l)); } } }; Ke(() => t.tabs, async () => { await Mt(), l(), h(); }, { immediate: !0 }); const p = ii(o, () => l()); return li(() => { d.forEach((g) => g.stop()), d.length = 0, p.stop(); }), e({ ref: o, update: l }), (g, f) => (pe(), Re("div", { ref_key: "barRef", ref: o, class: Le([H(s).e("active-bar"), H(s).is(H(r).props.tabPosition)]), style: Ot(a.value) }, null, 6)); } }); var cP = /* @__PURE__ */ at(lP, [["__file", "tab-bar.vue"]]); const uP = dt({ panes: { type: Ye(Array), default: () => tr([]) }, currentName: { type: [String, Number], default: "" }, editable: Boolean, type: { type: String, values: ["card", "border-card", ""], default: "" }, stretch: Boolean }), hP = { tabClick: (n, e, t) => t instanceof Event, tabRemove: (n, e) => e instanceof Event }, cg = "ElTabNav", dP = De({ name: cg, props: uP, emits: hP, setup(n, { expose: e, emit: t }) { const i = ht(Su); i || na(cg, ""); const r = it("tabs"), s = D1(), o = Z1(), a = Ae(), c = Ae(), l = Ae(), d = Ae(), h = Ae(!1), p = Ae(0), g = Ae(!1), f = Ae(!0), u = ce(() => ["top", "bottom"].includes(i.props.tabPosition) ? "width" : "height"), y = ce(() => ({ transform: `translate${u.value === "width" ? "X" : "Y"}(-${p.value}px)` })), v = () => { if (!a.value) return; const _ = a.value[`offset${Br(u.value)}`], E = p.value; if (!E) return; const L = E > _ ? E - _ : 0; p.value = L; }, m = () => { if (!a.value || !c.value) return; const _ = c.value[`offset${Br(u.value)}`], E = a.value[`offset${Br(u.value)}`], L = p.value; if (_ - L <= E) return; const R = _ - L > E * 2 ? L + E : _ - E; p.value = R; }, w = async () => { const _ = c.value; if (!h.value || !l.value || !a.value || !_) return; await Mt(); const E = l.value.querySelector(".is-active"); if (!E) return; const L = a.value, R = ["top", "bottom"].includes(i.props.tabPosition), C = E.getBoundingClientRect(), A = L.getBoundingClientRect(), P = R ? _.offsetWidth - A.width : _.offsetHeight - A.height, I = p.value; let b = I; R ? (C.left < A.left && (b = I - (A.left - C.left)), C.right > A.right && (b = I + C.right - A.right)) : (C.top < A.top && (b = I - (A.top - C.top)), C.bottom > A.bottom && (b = I + (C.bottom - A.bottom))), b = Math.max(b, 0), p.value = Math.min(b, P); }, S = () => { var _; if (!c.value || !a.value) return; n.stretch && ((_ = d.value) == null || _.update()); const E = c.value[`offset${Br(u.value)}`], L = a.value[`offset${Br(u.value)}`], R = p.value; L < E ? (h.value = h.value || {}, h.value.prev = R, h.value.next = R + L < E, E - R < L && (p.value = E - L)) : (h.value = !1, R > 0 && (p.value = 0)); }, T = (_) => { const E = _.code, { up: L, down: R, left: C, right: A } = Di; if (![L, R, C, A].includes(E)) return; const P = Array.from(_.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)")), I = P.indexOf(_.target); let b; E === C || E === L ? I === 0 ? b = P.length - 1 : b = I - 1 : I < P.length - 1 ? b = I + 1 : b = 0, P[b].focus({ preventScroll: !0 }), P[b].click(), M(); }, M = () => { f.value && (g.value = !0); }, x = () => g.value = !1; return Ke(s, (_) => { _ === "hidden" ? f.value = !1 : _ === "visible" && setTimeout(() => f.value = !0, 50); }), Ke(o, (_) => { _ ? setTimeout(() => f.value = !0, 50) : f.value = !1; }), ii(l, S), on(() => setTimeout(() => w(), 0)), sf(() => S()), e({ scrollToActiveTab: w, removeFocus: x }), () => { const _ = h.value ? [ae("span", { class: [r.e("nav-prev"), r.is("disabled", !h.value.prev)], onClick: v }, [ae(Bt, null, { default: () => [ae(jr, null, null)] })]), ae("span", { class: [r.e("nav-next"), r.is("disabled", !h.value.next)], onClick: m }, [ae(Bt, null, { default: () => [ae($r, null, null)] })])] : null, E = n.panes.map((L, R) => { var C, A, P, I; const b = L.uid, O = L.props.disabled, N = (A = (C = L.props.name) != null ? C : L.index) != null ? A : `${R}`, D = !O && (L.isClosable || n.editable); L.index = `${R}`; const B = D ? ae(Bt, { class: "is-icon-close", onClick: (K) => t("tabRemove", L, K) }, { default: () => [ae(cd, null, null)] }) : null, U = ((I = (P = L.slots).label) == null ? void 0 : I.call(P)) || L.props.label, k = !O && L.active ? 0 : -1; return ae("div", { ref: `tab-${b}`, class: [r.e("item"), r.is(i.props.tabPosition), r.is("active", L.active), r.is("disabled", O), r.is("closable", D), r.is("focus", g.value)], id: `tab-${N}`, key: `tab-${b}`, "aria-controls": `pane-${N}`, role: "tab", "aria-selected": L.active, tabindex: k, onFocus: () => M(), onBlur: () => x(), onClick: (K) => { x(), t("tabClick", L, N, K); }, onKeydown: (K) => { D && (K.code === Di.delete || K.code === Di.backspace) && t("tabRemove", L, K); } }, [U, B]); }); return ae("div", { ref: l, class: [r.e("nav-wrap"), r.is("scrollable", !!h.value), r.is(i.props.tabPosition)] }, [_, ae("div", { class: r.e("nav-scroll"), ref: a }, [ae("div", { class: [r.e("nav"), r.is(i.props.tabPosition), r.is("stretch", n.stretch && ["top", "bottom"].includes(i.props.tabPosition))], ref: c, style: y.value, role: "tablist", onKeydown: T }, [n.type ? null : ae(cP, { ref: d, tabs: [...n.panes] }, null), E])])]); }; } }), fP = dt({ type: { type: String, values: ["card", "border-card", ""], default: "" }, closable: Boolean, addable: Boolean, modelValue: { type: [String, Number] }, editable: Boolean, tabPosition: { type: String, values: ["top", "right", "bottom", "left"], default: "top" }, beforeLeave: { type: Ye(Function), default: () => !0 }, stretch: Boolean }), rh = (n) => On(n) || St(n), pP = { [Dt]: (n) => rh(n), tabClick: (n, e) => e instanceof Event, tabChange: (n) => rh(n), edit: (n, e) => ["remove", "add"].includes(e), tabRemove: (n) => rh(n), tabAdd: () => !0 }, mP = De({ name: "ElTabs", props: fP, emits: pP, setup(n, { emit: e, slots: t, expose: i }) { var r; const s = it("tabs"), o = ce(() => ["left", "right"].includes(n.tabPosition)), { children: a, addChild: c, removeChild: l } = $A(cn(), "ElTabPane"), d = Ae(), h = Ae((r = n.modelValue) != null ? r : "0"), p = async (v, m = !1) => { var w, S, T; if (!(h.value === v || yi(v))) try { await ((w = n.beforeLeave) == null ? void 0 : w.call(n, v, h.value)) !== !1 && (h.value = v, m && (e(Dt, v), e("tabChange", v)), (T = (S = d.value) == null ? void 0 : S.removeFocus) == null || T.call(S)); } catch { } }, g = (v, m, w) => { v.props.disabled || (p(m, !0), e("tabClick", v, w)); }, f = (v, m) => { v.props.disabled || yi(v.props.name) || (m.stopPropagation(), e("edit", v.props.name, "remove"), e("tabRemove", v.props.name)); }, u = () => { e("edit", void 0, "add"), e("tabAdd"); }; Ke(() => n.modelValue, (v) => p(v)), Ke(h, async () => { var v; await Mt(), (v = d.value) == null || v.scrollToActiveTab(); }), gn(Su, { props: n, currentName: h, registerPane: (v) => { a.value.push(v); }, sortPane: c, unregisterPane: l }), i({ currentName: h }); const y = ({ render: v }) => v(); return () => { const v = t["add-icon"], m = n.editable || n.addable ? ae("div", { class: [s.e("new-tab"), o.value && s.e("new-tab-vertical")], tabindex: "0", onClick: u, onKeydown: (T) => { T.code === Di.enter && u(); } }, [v ? Xe(t, "add-icon") : ae(Bt, { class: s.is("icon-plus") }, { default: () => [ae(fu, null, null)] })]) : null, w = ae("div", { class: [s.e("header"), o.value && s.e("header-vertical"), s.is(n.tabPosition)] }, [ae(y, { render: () => { const T = a.value.some((M) => M.slots.label); return ae(dP, { ref: d, currentName: h.value, editable: n.editable, type: n.type, panes: a.value, stretch: n.stretch, onTabClick: g, onTabRemove: f }, { $stable: !T }); } }, null), m]), S = ae("div", { class: s.e("content") }, [Xe(t, "default")]); return ae("div", { class: [s.b(), s.m(n.tabPosition), { [s.m("card")]: n.type === "card", [s.m("border-card")]: n.type === "border-card" }] }, [S, w]); }; } }), gP = dt({ label: { type: String, default: "" }, name: { type: [String, Number] }, closable: Boolean, disabled: Boolean, lazy: Boolean }), Ry = "ElTabPane", vP = De({ name: Ry }), yP = /* @__PURE__ */ De({ ...vP, props: gP, setup(n) { const e = n, t = cn(), i = ou(), r = ht(Su); r || na(Ry, "usage: "); const s = it("tab-pane"), o = Ae(), a = ce(() => e.closable || r.props.closable), c = Wp(() => { var g; return r.currentName.value === ((g = e.name) != null ? g : o.value); }), l = Ae(c.value), d = ce(() => { var g; return (g = e.name) != null ? g : o.value; }), h = Wp(() => !e.lazy || l.value || c.value); Ke(c, (g) => { g && (l.value = !0); }); const p = qn({ uid: t.uid, slots: i, props: e, paneName: d, active: c, index: o, isClosable: a }); return r.registerPane(p), on(() => { r.sortPane(p); }), c0(() => { r.unregisterPane(p.uid); }), (g, f) => H(h) ? Ft((pe(), Re("div", { key: 0, id: `pane-${H(d)}`, class: Le(H(s).b()), role: "tabpanel", "aria-hidden": !H(c), "aria-labelledby": `tab-${H(d)}` }, [ Xe(g.$slots, "default") ], 10, ["id", "aria-hidden", "aria-labelledby"])), [ [xn, H(c)] ]) : Ge("v-if", !0); } }); var Py = /* @__PURE__ */ at(yP, [["__file", "tab-pane.vue"]]); const Iy = vn(mP, { TabPane: Py }), Oy = gr(Py); function bP(n) { let e; const t = Ae(!1), i = qn({ ...n, originalPosition: "", originalOverflow: "", visible: !1 }); function r(p) { i.text = p; } function s() { const p = i.parent, g = h.ns; if (!p.vLoadingAddClassList) { let f = p.getAttribute("loading-number"); f = Number.parseInt(f) - 1, f ? p.setAttribute("loading-number", f.toString()) : ($c(p, g.bm("parent", "relative")), p.removeAttribute("loading-number")), $c(p, g.bm("parent", "hidden")); } o(), d.unmount(); } function o() { var p, g; (g = (p = h.$el) == null ? void 0 : p.parentNode) == null || g.removeChild(h.$el); } function a() { var p; n.beforeClose && !n.beforeClose() || (t.value = !0, clearTimeout(e), e = setTimeout(c, 400), i.visible = !1, (p = n.closed) == null || p.call(n)); } function c() { if (!t.value) return; const p = i.parent; t.value = !1, p.vLoadingAddClassList = void 0, s(); } const l = De({ name: "ElLoading", setup(p, { expose: g }) { const { ns: f, zIndex: u } = eC("loading"); return g({ ns: f, zIndex: u }), () => { const y = i.spinner || i.svg, v = bo("svg", { class: "circular", viewBox: i.svgViewBox ? i.svgViewBox : "0 0 50 50", ...y ? { innerHTML: y } : {} }, [ bo("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none" }) ]), m = i.text ? bo("p", { class: f.b("text") }, [i.text]) : void 0; return bo(hl, { name: f.b("fade"), onAfterLeave: c }, { default: fe(() => [ Ft(ae("div", { style: { backgroundColor: i.background || "" }, class: [ f.b("mask"), i.customClass, i.fullscreen ? "is-fullscreen" : "" ] }, [ bo("div", { class: f.b("spinner") }, [v, m]) ]), [[xn, i.visible]]) ]) }); }; } }), d = h1(l), h = d.mount(document.createElement("div")); return { ...cr(i), setText: r, removeElLoadingChild: o, close: a, handleAfterLeave: c, vm: h, get $el() { return h.$el; } }; } let Gl; const gd = function(n = {}) { if (!rn) return; const e = xP(n); if (e.fullscreen && Gl) return Gl; const t = bP({ ...e, closed: () => { var r; (r = e.closed) == null || r.call(e), e.fullscreen && (Gl = void 0); } }); wP(e, e.parent, t), ug(e, e.parent, t), e.parent.vLoadingAddClassList = () => ug(e, e.parent, t); let i = e.parent.getAttribute("loading-number"); return i ? i = `${Number.parseInt(i) + 1}` : i = "1", e.parent.setAttribute("loading-number", i), e.parent.appendChild(t.$el), Mt(() => t.visible.value = e.visible), e.fullscreen && (Gl = t), t; }, xP = (n) => { var e, t, i, r; let s; return On(n.target) ? s = (e = document.querySelector(n.target)) != null ? e : document.body : s = n.target || document.body, { parent: s === document.body || n.body ? document.body : s, background: n.background || "", svg: n.svg || "", svgViewBox: n.svgViewBox || "", spinner: n.spinner || !1, text: n.text || "", fullscreen: s === document.body && ((t = n.fullscreen) != null ? t : !0), lock: (i = n.lock) != null ? i : !1, customClass: n.customClass || "", visible: (r = n.visible) != null ? r : !0, beforeClose: n.beforeClose, closed: n.closed, target: s }; }, wP = async (n, e, t) => { const { nextZIndex: i } = t.vm.zIndex || t.vm._.exposed.zIndex, r = {}; if (n.fullscreen) t.originalPosition.value = va(document.body, "position"), t.originalOverflow.value = va(document.body, "overflow"), r.zIndex = i(); else if (n.parent === document.body) { t.originalPosition.value = va(document.body, "position"), await Mt(); for (const s of ["top", "left"]) { const o = s === "top" ? "scrollTop" : "scrollLeft"; r[s] = `${n.target.getBoundingClientRect()[s] + document.body[o] + document.documentElement[o] - Number.parseInt(va(document.body, `margin-${s}`), 10)}px`; } for (const s of ["height", "width"]) r[s] = `${n.target.getBoundingClientRect()[s]}px`; } else t.originalPosition.value = va(e, "position"); for (const [s, o] of Object.entries(r)) t.$el.style[s] = o; }, ug = (n, e, t) => { const i = t.vm.ns || t.vm._.exposed.ns; ["absolute", "fixed", "sticky"].includes(t.originalPosition.value) ? $c(e, i.bm("parent", "relative")) : Am(e, i.bm("parent", "relative")), n.fullscreen && n.lock ? Am(e, i.bm("parent", "hidden")) : $c(e, i.bm("parent", "hidden")); }, Uc = Symbol("ElLoading"), hg = (n, e) => { var t, i, r, s; const o = e.instance, a = (p) => Pn(e.value) ? e.value[p] : void 0, c = (p) => { const g = On(p) && (o == null ? void 0 : o[p]) || p; return g && Ae(g); }, l = (p) => c(a(p) || n.getAttribute(`element-loading-${tM(p)}`)), d = (t = a("fullscreen")) != null ? t : e.modifiers.fullscreen, h = { text: l("text"), svg: l("svg"), svgViewBox: l("svgViewBox"), spinner: l("spinner"), background: l("background"), customClass: l("customClass"), fullscreen: d, target: (i = a("target")) != null ? i : d ? void 0 : n, body: (r = a("body")) != null ? r : e.modifiers.body, lock: (s = a("lock")) != null ? s : e.modifiers.lock }; n[Uc] = { options: h, instance: gd(h) }; }, MP = (n, e) => { for (const t of Object.keys(e)) Ls(e[t]) && (e[t].value = n[t]); }, vd = { mounted(n, e) { e.value && hg(n, e); }, updated(n, e) { const t = n[Uc]; e.oldValue !== e.value && (e.value && !e.oldValue ? hg(n, e) : e.value && e.oldValue ? Pn(e.value) && MP(e.value, t.options) : t == null || t.instance.close()); }, unmounted(n) { var e; (e = n[Uc]) == null || e.instance.close(), n[Uc] = null; } }, SP = { install(n) { n.directive("loading", vd), n.config.globalProperties.$loading = gd; }, directive: vd, service: gd }; var Dy = { exports: {} }, dg = {}, fg; function _P() { return fg || (fg = 1, function(n) { var e = function() { try { return !!Symbol.iterator; } catch { return !1; } }, t = e(), i = function(l) { var d = { next: function() { var h = l.shift(); return { done: h === void 0, value: h }; } }; return t && (d[Symbol.iterator] = function() { return d; }), d; }, r = function(l) { return encodeURIComponent(l).replace(/%20/g, "+"); }, s = function(l) { return decodeURIComponent(String(l).replace(/\+/g, " ")); }, o = function() { var l = function(h) { Object.defineProperty(this, "_entries", { writable: !0, value: {} }); var p = typeof h; if (p !== "undefined") if (p === "string") h !== "" && this._fromString(h); else if (h instanceof l) { var g = this; h.forEach(function(v, m) { g.append(m, v); }); } else if (h !== null && p === "object") if (Object.prototype.toString.call(h) === "[object Array]") for (var f = 0; f < h.length; f++) { var u = h[f]; if (Object.prototype.toString.call(u) === "[object Array]" || u.length !== 2) this.append(u[0], u[1]); else throw new TypeError("Expected [string, any] as entry at index " + f + " of URLSearchParams's input"); } else for (var y in h) h.hasOwnProperty(y) && this.append(y, h[y]); else throw new TypeError("Unsupported input's type for URLSearchParams"); }, d = l.prototype; d.append = function(h, p) { h in this._entries ? this._entries[h].push(String(p)) : this._entries[h] = [String(p)]; }, d.delete = function(h) { delete this._entries[h]; }, d.get = function(h) { return h in this._entries ? this._entries[h][0] : null; }, d.getAll = function(h) { return h in this._entries ? this._entries[h].slice(0) : []; }, d.has = function(h) { return h in this._entries; }, d.set = function(h, p) { this._entries[h] = [String(p)]; }, d.forEach = function(h, p) { var g; for (var f in this._entries) if (this._entries.hasOwnProperty(f)) { g = this._entries[f]; for (var u = 0; u < g.length; u++) h.call(p, g[u], f, this); } }, d.keys = function() { var h = []; return this.forEach(function(p, g) { h.push(g); }), i(h); }, d.values = function() { var h = []; return this.forEach(function(p) { h.push(p); }), i(h); }, d.entries = function() { var h = []; return this.forEach(function(p, g) { h.push([g, p]); }), i(h); }, t && (d[Symbol.iterator] = d.entries), d.toString = function() { var h = []; return this.forEach(function(p, g) { h.push(r(g) + "=" + r(p)); }), h.join("&"); }, n.URLSearchParams = l; }, a = function() { try { var l = n.URLSearchParams; return new l("?a=1").toString() === "a=1" && typeof l.prototype.set == "function" && typeof l.prototype.entries == "function"; } catch { return !1; } }; a() || o(); var c = n.URLSearchParams.prototype; typeof c.sort != "function" && (c.sort = function() { var l = this, d = []; this.forEach(function(p, g) { d.push([g, p]), l._entries || l.delete(g); }), d.sort(function(p, g) { return p[0] < g[0] ? -1 : p[0] > g[0] ? 1 : 0; }), l._entries && (l._entries = {}); for (var h = 0; h < d.length; h++) this.append(d[h][0], d[h][1]); }), typeof c._fromString != "function" && Object.defineProperty(c, "_fromString", { enumerable: !1, configurable: !1, writable: !1, value: function(l) { if (this._entries) this._entries = {}; else { var d = []; this.forEach(function(f, u) { d.push(u); }); for (var h = 0; h < d.length; h++) this.delete(d[h]); } l = l.replace(/^\?/, ""); for (var p = l.split("&"), g, h = 0; h < p.length; h++) g = p[h].split("="), this.append( s(g[0]), g.length > 1 ? s(g[1]) : "" ); } }); }( typeof Fr < "u" ? Fr : typeof window < "u" ? window : typeof self < "u" ? self : Fr ), function(n) { var e = function() { try { var r = new n.URL("b", "http://a"); return r.pathname = "c d", r.href === "http://a/c%20d" && r.searchParams; } catch { return !1; } }, t = function() { var r = n.URL, s = function(c, l) { typeof c != "string" && (c = String(c)), l && typeof l != "string" && (l = String(l)); var d = document, h; if (l && (n.location === void 0 || l !== n.location.href)) { l = l.toLowerCase(), d = document.implementation.createHTMLDocument(""), h = d.createElement("base"), h.href = l, d.head.appendChild(h); try { if (h.href.indexOf(l) !== 0) throw new Error(h.href); } catch (w) { throw new Error("URL unable to set base " + l + " due to " + w); } } var p = d.createElement("a"); p.href = c, h && (d.body.appendChild(p), p.href = p.href); var g = d.createElement("input"); if (g.type = "url", g.value = c, p.protocol === ":" || !/:/.test(p.href) || !g.checkValidity() && !l) throw new TypeError("Invalid URL"); Object.defineProperty(this, "_anchorElement", { value: p }); var f = new n.URLSearchParams(this.search), u = !0, y = !0, v = this; ["append", "delete", "set"].forEach(function(w) { var S = f[w]; f[w] = function() { S.apply(f, arguments), u && (y = !1, v.search = f.toString(), y = !0); }; }), Object.defineProperty(this, "searchParams", { value: f, enumerable: !0 }); var m = void 0; Object.defineProperty(this, "_updateSearchParams", { enumerable: !1, configurable: !1, writable: !1, value: function() { this.search !== m && (m = this.search, y && (u = !1, this.searchParams._fromString(this.search), u = !0)); } }); }, o = s.prototype, a = function(c) { Object.defineProperty(o, c, { get: function() { return this._anchorElement[c]; }, set: function(l) { this._anchorElement[c] = l; }, enumerable: !0 }); }; ["hash", "host", "hostname", "port", "protocol"].forEach(function(c) { a(c); }), Object.defineProperty(o, "search", { get: function() { return this._anchorElement.search; }, set: function(c) { this._anchorElement.search = c, this._updateSearchParams(); }, enumerable: !0 }), Object.defineProperties(o, { toString: { get: function() { var c = this; return function() { return c.href; }; } }, href: { get: function() { return this._anchorElement.href.replace(/\?$/, ""); }, set: function(c) { this._anchorElement.href = c, this._updateSearchParams(); }, enumerable: !0 }, pathname: { get: function() { return this._anchorElement.pathname.replace(/(^\/?)/, "/"); }, set: function(c) { this._anchorElement.pathname = c; }, enumerable: !0 }, origin: { get: function() { var c = { "http:": 80, "https:": 443, "ftp:": 21 }[this._anchorElement.protocol], l = this._anchorElement.port != c && this._anchorElement.port !== ""; return this._anchorElement.protocol + "//" + this._anchorElement.hostname + (l ? ":" + this._anchorElement.port : ""); }, enumerable: !0 }, password: { // TODO get: function() { return ""; }, set: function(c) { }, enumerable: !0 }, username: { // TODO get: function() { return ""; }, set: function(c) { }, enumerable: !0 } }), s.createObjectURL = function(c) { return r.createObjectURL.apply(r, arguments); }, s.revokeObjectURL = function(c) { return r.revokeObjectURL.apply(r, arguments); }, n.URL = s; }; if (e() || t(), n.location !== void 0 && !("origin" in n.location)) { var i = function() { return n.location.protocol + "//" + n.location.hostname + (n.location.port ? ":" + n.location.port : ""); }; try { Object.defineProperty(n.location, "origin", { get: i, enumerable: !0 }); } catch { setInterval(function() { n.location.origin = i(); }, 100); } } }( typeof Fr < "u" ? Fr : typeof window < "u" ? window : typeof self < "u" ? self : Fr )), dg; } /** * @license * Copyright 2010-2021 Three.js Authors * SPDX-License-Identifier: MIT */ const Uf = "130", TP = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }, EP = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, Ny = 0, yd = 1, Fy = 2, AP = 3, CP = 0, Vf = 1, By = 2, wo = 3, Xr = 0, qt = 1, Yr = 2, kf = 1, LP = 2, or = 0, _o = 1, bd = 2, xd = 3, wd = 4, zy = 5, ys = 100, Uy = 101, Vy = 102, Md = 103, Sd = 104, ky = 200, Gy = 201, Hy = 202, Wy = 203, Gf = 204, Hf = 205, jy = 206, $y = 207, Zy = 208, Xy = 209, Yy = 210, Jy = 0, qy = 1, Ky = 2, Kc = 3, Qy = 4, eb = 5, tb = 6, nb = 7, vl = 0, ib = 1, rb = 2, Vr = 0, sb = 1, ob = 2, ab = 3, lb = 4, cb = 5, _u = 300, yl = 301, bl = 302, Qc = 303, eu = 304, la = 306, xl = 307, Jr = 1e3, mn = 1001, No = 1002, Kt = 1003, Ka = 1004, RP = 1004, Qa = 1005, PP = 1005, jt = 1006, Tu = 1007, IP = 1007, br = 1008, OP = 1008, Ps = 1009, ub = 1010, hb = 1011, el = 1012, db = 1013, Va = 1014, nr = 1015, Ts = 1016, fb = 1017, pb = 1018, mb = 1019, To = 1020, gb = 1021, ar = 1022, Yn = 1023, vb = 1024, yb = 1025, bb = Yn, Es = 1026, Fo = 1027, xb = 1028, wb = 1029, Mb = 1030, Sb = 1031, _b = 1032, Tb = 1033, _d = 33776, Td = 33777, Ed = 33778, Ad = 33779, Cd = 35840, Ld = 35841, Rd = 35842, Pd = 35843, Eb = 36196, Id = 37492, Od = 37496, Ab = 37808, Cb = 37809, Lb = 37810, Rb = 37811, Pb = 37812, Ib = 37813, Ob = 37814, Db = 37815, Nb = 37816, Fb = 37817, Bb = 37818, zb = 37819, Ub = 37820, Vb = 37821, kb = 36492, Gb = 37840, Hb = 37841, Wb = 37842, jb = 37843, $b = 37844, Zb = 37845, Xb = 37846, Yb = 37847, Jb = 37848, qb = 37849, Kb = 37850, Qb = 37851, ex = 37852, tx = 37853, nx = 2200, ix = 2201, rx = 2202, Bo = 2300, Is = 2301, Vc = 2302, xs = 2400, ws = 2401, tl = 2402, Eu = 2500, Wf = 2501, sx = 0, ox = 1, jf = 2, Dn = 3e3, Os = 3001, Au = 3007, Cu = 3002, ax = 3003, $f = 3004, Zf = 3005, Xf = 3006, lx = 3200, cx = 3201, ts = 0, ux = 1, DP = 0, kc = 7680, NP = 7681, FP = 7682, BP = 7683, zP = 34055, UP = 34056, VP = 5386, kP = 512, GP = 513, HP = 514, WP = 515, jP = 516, $P = 517, ZP = 518, hx = 519, zo = 35044, Uo = 35048, XP = 35040, YP = 35045, JP = 35049, qP = 35041, KP = 35046, QP = 35050, eI = 35042, tI = "100", Dd = "300 es"; class ns { addEventListener(e, t) { this._listeners === void 0 && (this._listeners = {}); const i = this._listeners; i[e] === void 0 && (i[e] = []), i[e].indexOf(t) === -1 && i[e].push(t); } hasEventListener(e, t) { if (this._listeners === void 0) return !1; const i = this._listeners; return i[e] !== void 0 && i[e].indexOf(t) !== -1; } removeEventListener(e, t) { if (this._listeners === void 0) return; const r = this._listeners[e]; if (r !== void 0) { const s = r.indexOf(t); s !== -1 && r.splice(s, 1); } } dispatchEvent(e) { if (this._listeners === void 0) return; const i = this._listeners[e.type]; if (i !== void 0) { e.target = this; const r = i.slice(0); for (let s = 0, o = r.length; s < o; s++) r[s].call(this, e); e.target = null; } } } const yn = []; for (let n = 0; n < 256; n++) yn[n] = (n < 16 ? "0" : "") + n.toString(16); let Hl = 1234567; const As = Math.PI / 180, nl = 180 / Math.PI; function Jn() { const n = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, i = Math.random() * 4294967295 | 0; return (yn[n & 255] + yn[n >> 8 & 255] + yn[n >> 16 & 255] + yn[n >> 24 & 255] + "-" + yn[e & 255] + yn[e >> 8 & 255] + "-" + yn[e >> 16 & 15 | 64] + yn[e >> 24 & 255] + "-" + yn[t & 63 | 128] + yn[t >> 8 & 255] + "-" + yn[t >> 16 & 255] + yn[t >> 24 & 255] + yn[i & 255] + yn[i >> 8 & 255] + yn[i >> 16 & 255] + yn[i >> 24 & 255]).toUpperCase(); } function wn(n, e, t) { return Math.max(e, Math.min(t, n)); } function Yf(n, e) { return (n % e + e) % e; } function nI(n, e, t, i, r) { return i + (n - e) * (r - i) / (t - e); } function iI(n, e, t) { return n !== e ? (t - n) / (e - n) : 0; } function ka(n, e, t) { return (1 - t) * n + t * e; } function rI(n, e, t, i) { return ka(n, e, 1 - Math.exp(-t * i)); } function sI(n, e = 1) { return e - Math.abs(Yf(n, e * 2) - e); } function oI(n, e, t) { return n <= e ? 0 : n >= t ? 1 : (n = (n - e) / (t - e), n * n * (3 - 2 * n)); } function aI(n, e, t) { return n <= e ? 0 : n >= t ? 1 : (n = (n - e) / (t - e), n * n * n * (n * (n * 6 - 15) + 10)); } function lI(n, e) { return n + Math.floor(Math.random() * (e - n + 1)); } function cI(n, e) { return n + Math.random() * (e - n); } function uI(n) { return n * (0.5 - Math.random()); } function hI(n) { return n !== void 0 && (Hl = n % 2147483647), Hl = Hl * 16807 % 2147483647, (Hl - 1) / 2147483646; } function dI(n) { return n * As; } function fI(n) { return n * nl; } function Nd(n) { return (n & n - 1) === 0 && n !== 0; } function dx(n) { return Math.pow(2, Math.ceil(Math.log(n) / Math.LN2)); } function fx(n) { return Math.pow(2, Math.floor(Math.log(n) / Math.LN2)); } function pI(n, e, t, i, r) { const s = Math.cos, o = Math.sin, a = s(t / 2), c = o(t / 2), l = s((e + i) / 2), d = o((e + i) / 2), h = s((e - i) / 2), p = o((e - i) / 2), g = s((i - e) / 2), f = o((i - e) / 2); switch (r) { case "XYX": n.set(a * d, c * h, c * p, a * l); break; case "YZY": n.set(c * p, a * d, c * h, a * l); break; case "ZXZ": n.set(c * h, c * p, a * d, a * l); break; case "XZX": n.set(a * d, c * f, c * g, a * l); break; case "YXY": n.set(c * g, a * d, c * f, a * l); break; case "ZYZ": n.set(c * f, c * g, a * d, a * l); break; default: console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + r); } } var Fd = /* @__PURE__ */ Object.freeze({ __proto__: null, DEG2RAD: As, RAD2DEG: nl, generateUUID: Jn, clamp: wn, euclideanModulo: Yf, mapLinear: nI, inverseLerp: iI, lerp: ka, damp: rI, pingpong: sI, smoothstep: oI, smootherstep: aI, randInt: lI, randFloat: cI, randFloatSpread: uI, seededRandom: hI, degToRad: dI, radToDeg: fI, isPowerOfTwo: Nd, ceilPowerOfTwo: dx, floorPowerOfTwo: fx, setQuaternionFromProperEuler: pI }); class Pe { constructor(e = 0, t = 0) { this.x = e, this.y = t; } get width() { return this.x; } set width(e) { this.x = e; } get height() { return this.y; } set height(e) { this.y = e; } set(e, t) { return this.x = e, this.y = t, this; } setScalar(e) { return this.x = e, this.y = e, this; } setX(e) { return this.x = e, this; } setY(e) { return this.y = e, this; } setComponent(e, t) { switch (e) { case 0: this.x = t; break; case 1: this.y = t; break; default: throw new Error("index is out of range: " + e); } return this; } getComponent(e) { switch (e) { case 0: return this.x; case 1: return this.y; default: throw new Error("index is out of range: " + e); } } clone() { return new this.constructor(this.x, this.y); } copy(e) { return this.x = e.x, this.y = e.y, this; } add(e, t) { return t !== void 0 ? (console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this); } addScalar(e) { return this.x += e, this.y += e, this; } addVectors(e, t) { return this.x = e.x + t.x, this.y = e.y + t.y, this; } addScaledVector(e, t) { return this.x += e.x * t, this.y += e.y * t, this; } sub(e, t) { return t !== void 0 ? (console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this); } subScalar(e) { return this.x -= e, this.y -= e, this; } subVectors(e, t) { return this.x = e.x - t.x, this.y = e.y - t.y, this; } multiply(e) { return this.x *= e.x, this.y *= e.y, this; } multiplyScalar(e) { return this.x *= e, this.y *= e, this; } divide(e) { return this.x /= e.x, this.y /= e.y, this; } divideScalar(e) { return this.multiplyScalar(1 / e); } applyMatrix3(e) { const t = this.x, i = this.y, r = e.elements; return this.x = r[0] * t + r[3] * i + r[6], this.y = r[1] * t + r[4] * i + r[7], this; } min(e) { return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this; } max(e) { return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this; } clamp(e, t) { return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this; } clampScalar(e, t) { return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this; } clampLength(e, t) { const i = this.length(); return this.divideScalar(i || 1).multiplyScalar(Math.max(e, Math.min(t, i))); } floor() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this; } ceil() { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this; } round() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this; } roundToZero() { return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this; } negate() { return this.x = -this.x, this.y = -this.y, this; } dot(e) { return this.x * e.x + this.y * e.y; } cross(e) { return this.x * e.y - this.y * e.x; } lengthSq() { return this.x * this.x + this.y * this.y; } length() { return Math.sqrt(this.x * this.x + this.y * this.y); } manhattanLength() { return Math.abs(this.x) + Math.abs(this.y); } normalize() { return this.divideScalar(this.length() || 1); } angle() { return Math.atan2(-this.y, -this.x) + Math.PI; } distanceTo(e) { return Math.sqrt(this.distanceToSquared(e)); } distanceToSquared(e) { const t = this.x - e.x, i = this.y - e.y; return t * t + i * i; } manhattanDistanceTo(e) { return Math.abs(this.x - e.x) + Math.abs(this.y - e.y); } setLength(e) { return this.normalize().multiplyScalar(e); } lerp(e, t) { return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this; } lerpVectors(e, t, i) { return this.x = e.x + (t.x - e.x) * i, this.y = e.y + (t.y - e.y) * i, this; } equals(e) { return e.x === this.x && e.y === this.y; } fromArray(e, t = 0) { return this.x = e[t], this.y = e[t + 1], this; } toArray(e = [], t = 0) { return e[t] = this.x, e[t + 1] = this.y, e; } fromBufferAttribute(e, t, i) { return i !== void 0 && console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this; } rotateAround(e, t) { const i = Math.cos(t), r = Math.sin(t), s = this.x - e.x, o = this.y - e.y; return this.x = s * i - o * r + e.x, this.y = s * r + o * i + e.y, this; } random() { return this.x = Math.random(), this.y = Math.random(), this; } } Pe.prototype.isVector2 = !0; class ln { constructor() { this.elements = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ], arguments.length > 0 && console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead."); } set(e, t, i, r, s, o, a, c, l) { const d = this.elements; return d[0] = e, d[1] = r, d[2] = a, d[3] = t, d[4] = s, d[5] = c, d[6] = i, d[7] = o, d[8] = l, this; } identity() { return this.set( 1, 0, 0, 0, 1, 0, 0, 0, 1 ), this; } copy(e) { const t = this.elements, i = e.elements; return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t[6] = i[6], t[7] = i[7], t[8] = i[8], this; } extractBasis(e, t, i) { return e.setFromMatrix3Column(this, 0), t.setFromMatrix3Column(this, 1), i.setFromMatrix3Column(this, 2), this; } setFromMatrix4(e) { const t = e.elements; return this.set( t[0], t[4], t[8], t[1], t[5], t[9], t[2], t[6], t[10] ), this; } multiply(e) { return this.multiplyMatrices(this, e); } premultiply(e) { return this.multiplyMatrices(e, this); } multiplyMatrices(e, t) { const i = e.elements, r = t.elements, s = this.elements, o = i[0], a = i[3], c = i[6], l = i[1], d = i[4], h = i[7], p = i[2], g = i[5], f = i[8], u = r[0], y = r[3], v = r[6], m = r[1], w = r[4], S = r[7], T = r[2], M = r[5], x = r[8]; return s[0] = o * u + a * m + c * T, s[3] = o * y + a * w + c * M, s[6] = o * v + a * S + c * x, s[1] = l * u + d * m + h * T, s[4] = l * y + d * w + h * M, s[7] = l * v + d * S + h * x, s[2] = p * u + g * m + f * T, s[5] = p * y + g * w + f * M, s[8] = p * v + g * S + f * x, this; } multiplyScalar(e) { const t = this.elements; return t[0] *= e, t[3] *= e, t[6] *= e, t[1] *= e, t[4] *= e, t[7] *= e, t[2] *= e, t[5] *= e, t[8] *= e, this; } determinant() { const e = this.elements, t = e[0], i = e[1], r = e[2], s = e[3], o = e[4], a = e[5], c = e[6], l = e[7], d = e[8]; return t * o * d - t * a * l - i * s * d + i * a * c + r * s * l - r * o * c; } invert() { const e = this.elements, t = e[0], i = e[1], r = e[2], s = e[3], o = e[4], a = e[5], c = e[6], l = e[7], d = e[8], h = d * o - a * l, p = a * c - d * s, g = l * s - o * c, f = t * h + i * p + r * g; if (f === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); const u = 1 / f; return e[0] = h * u, e[1] = (r * l - d * i) * u, e[2] = (a * i - r * o) * u, e[3] = p * u, e[4] = (d * t - r * c) * u, e[5] = (r * s - a * t) * u, e[6] = g * u, e[7] = (i * c - l * t) * u, e[8] = (o * t - i * s) * u, this; } transpose() { let e; const t = this.elements; return e = t[1], t[1] = t[3], t[3] = e, e = t[2], t[2] = t[6], t[6] = e, e = t[5], t[5] = t[7], t[7] = e, this; } getNormalMatrix(e) { return this.setFromMatrix4(e).invert().transpose(); } transposeIntoArray(e) { const t = this.elements; return e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8], this; } setUvTransform(e, t, i, r, s, o, a) { const c = Math.cos(s), l = Math.sin(s); return this.set( i * c, i * l, -i * (c * o + l * a) + o + e, -r * l, r * c, -r * (-l * o + c * a) + a + t, 0, 0, 1 ), this; } scale(e, t) { const i = this.elements; return i[0] *= e, i[3] *= e, i[6] *= e, i[1] *= t, i[4] *= t, i[7] *= t, this; } rotate(e) { const t = Math.cos(e), i = Math.sin(e), r = this.elements, s = r[0], o = r[3], a = r[6], c = r[1], l = r[4], d = r[7]; return r[0] = t * s + i * c, r[3] = t * o + i * l, r[6] = t * a + i * d, r[1] = -i * s + t * c, r[4] = -i * o + t * l, r[7] = -i * a + t * d, this; } translate(e, t) { const i = this.elements; return i[0] += e * i[2], i[3] += e * i[5], i[6] += e * i[8], i[1] += t * i[2], i[4] += t * i[5], i[7] += t * i[8], this; } equals(e) { const t = this.elements, i = e.elements; for (let r = 0; r < 9; r++) if (t[r] !== i[r]) return !1; return !0; } fromArray(e, t = 0) { for (let i = 0; i < 9; i++) this.elements[i] = e[i + t]; return this; } toArray(e = [], t = 0) { const i = this.elements; return e[t] = i[0], e[t + 1] = i[1], e[t + 2] = i[2], e[t + 3] = i[3], e[t + 4] = i[4], e[t + 5] = i[5], e[t + 6] = i[6], e[t + 7] = i[7], e[t + 8] = i[8], e; } clone() { return new this.constructor().fromArray(this.elements); } } ln.prototype.isMatrix3 = !0; let qs; class Hs { static getDataURL(e) { if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u") return e.src; let t; if (e instanceof HTMLCanvasElement) t = e; else { qs === void 0 && (qs = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")), qs.width = e.width, qs.height = e.height; const i = qs.getContext("2d"); e instanceof ImageData ? i.putImageData(e, 0, 0) : i.drawImage(e, 0, 0, e.width, e.height), t = qs; } return t.width > 2048 || t.height > 2048 ? (console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons", e), t.toDataURL("image/jpeg", 0.6)) : t.toDataURL("image/png"); } } let mI = 0; class nn extends ns { constructor(e = nn.DEFAULT_IMAGE, t = nn.DEFAULT_MAPPING, i = mn, r = mn, s = jt, o = br, a = Yn, c = Ps, l = 1, d = Dn) { super(), Object.defineProperty(this, "id", { value: mI++ }), this.uuid = Jn(), this.name = "", this.image = e, this.mipmaps = [], this.mapping = t, this.wrapS = i, this.wrapT = r, this.magFilter = s, this.minFilter = o, this.anisotropy = l, this.format = a, this.internalFormat = null, this.type = c, this.offset = new Pe(0, 0), this.repeat = new Pe(1, 1), this.center = new Pe(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new ln(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.encoding = d, this.version = 0, this.onUpdate = null; } updateMatrix() { this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y); } clone() { return new this.constructor().copy(this); } copy(e) { return this.name = e.name, this.image = e.image, this.mipmaps = e.mipmaps.slice(0), this.mapping = e.mapping, this.wrapS = e.wrapS, this.wrapT = e.wrapT, this.magFilter = e.magFilter, this.minFilter = e.minFilter, this.anisotropy = e.anisotropy, this.format = e.format, this.internalFormat = e.internalFormat, this.type = e.type, this.offset.copy(e.offset), this.repeat.copy(e.repeat), this.center.copy(e.center), this.rotation = e.rotation, this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrix.copy(e.matrix), this.generateMipmaps = e.generateMipmaps, this.premultiplyAlpha = e.premultiplyAlpha, this.flipY = e.flipY, this.unpackAlignment = e.unpackAlignment, this.encoding = e.encoding, this; } toJSON(e) { const t = e === void 0 || typeof e == "string"; if (!t && e.textures[this.uuid] !== void 0) return e.textures[this.uuid]; const i = { metadata: { version: 4.5, type: "Texture", generator: "Texture.toJSON" }, uuid: this.uuid, name: this.name, mapping: this.mapping, repeat: [this.repeat.x, this.repeat.y], offset: [this.offset.x, this.offset.y], center: [this.center.x, this.center.y], rotation: this.rotation, wrap: [this.wrapS, this.wrapT], format: this.format, type: this.type, encoding: this.encoding, minFilter: this.minFilter, magFilter: this.magFilter, anisotropy: this.anisotropy, flipY: this.flipY, premultiplyAlpha: this.premultiplyAlpha, unpackAlignment: this.unpackAlignment }; if (this.image !== void 0) { const r = this.image; if (r.uuid === void 0 && (r.uuid = Jn()), !t && e.images[r.uuid] === void 0) { let s; if (Array.isArray(r)) { s = []; for (let o = 0, a = r.length; o < a; o++) r[o].isDataTexture ? s.push(sh(r[o].image)) : s.push(sh(r[o])); } else s = sh(r); e.images[r.uuid] = { uuid: r.uuid, url: s }; } i.image = r.uuid; } return t || (e.textures[this.uuid] = i), i; } dispose() { this.dispatchEvent({ type: "dispose" }); } transformUv(e) { if (this.mapping !== _u) return e; if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1) switch (this.wrapS) { case Jr: e.x = e.x - Math.floor(e.x); break; case mn: e.x = e.x < 0 ? 0 : 1; break; case No: Math.abs(Math.floor(e.x) % 2) === 1 ? e.x = Math.ceil(e.x) - e.x : e.x = e.x - Math.floor(e.x); break; } if (e.y < 0 || e.y > 1) switch (this.wrapT) { case Jr: e.y = e.y - Math.floor(e.y); break; case mn: e.y = e.y < 0 ? 0 : 1; break; case No: Math.abs(Math.floor(e.y) % 2) === 1 ? e.y = Math.ceil(e.y) - e.y : e.y = e.y - Math.floor(e.y); break; } return this.flipY && (e.y = 1 - e.y), e; } set needsUpdate(e) { e === !0 && this.version++; } } nn.DEFAULT_IMAGE = void 0; nn.DEFAULT_MAPPING = _u; nn.prototype.isTexture = !0; function sh(n) { return typeof HTMLImageElement < "u" && n instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && n instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && n instanceof ImageBitmap ? Hs.getDataURL(n) : n.data ? { data: Array.prototype.slice.call(n.data), width: n.width, height: n.height, type: n.data.constructor.name } : (console.warn("THREE.Texture: Unable to serialize Texture."), {}); } class _t { constructor(e = 0, t = 0, i = 0, r = 1) { this.x = e, this.y = t, this.z = i, this.w = r; } get width() { return this.z; } set width(e) { this.z = e; } get height() { return this.w; } set height(e) { this.w = e; } set(e, t, i, r) { return this.x = e, this.y = t, this.z = i, this.w = r, this; } setScalar(e) { return this.x = e, this.y = e, this.z = e, this.w = e, this; } setX(e) { return this.x = e, this; } setY(e) { return this.y = e, this; } setZ(e) { return this.z = e, this; } setW(e) { return this.w = e, this; } setComponent(e, t) { switch (e) { case 0: this.x = t; break; case 1: this.y = t; break; case 2: this.z = t; break; case 3: this.w = t; break; default: throw new Error("index is out of range: " + e); } return this; } getComponent(e) { switch (e) { case 0: return this.x; case 1: return this.y; case 2: return this.z; case 3: return this.w; default: throw new Error("index is out of range: " + e); } } clone() { return new this.constructor(this.x, this.y, this.z, this.w); } copy(e) { return this.x = e.x, this.y = e.y, this.z = e.z, this.w = e.w !== void 0 ? e.w : 1, this; } add(e, t) { return t !== void 0 ? (console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this.z += e.z, this.w += e.w, this); } addScalar(e) { return this.x += e, this.y += e, this.z += e, this.w += e, this; } addVectors(e, t) { return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this.w = e.w + t.w, this; } addScaledVector(e, t) { return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this.w += e.w * t, this; } sub(e, t) { return t !== void 0 ? (console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this.z -= e.z, this.w -= e.w, this); } subScalar(e) { return this.x -= e, this.y -= e, this.z -= e, this.w -= e, this; } subVectors(e, t) { return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this.w = e.w - t.w, this; } multiply(e) { return this.x *= e.x, this.y *= e.y, this.z *= e.z, this.w *= e.w, this; } multiplyScalar(e) { return this.x *= e, this.y *= e, this.z *= e, this.w *= e, this; } applyMatrix4(e) { const t = this.x, i = this.y, r = this.z, s = this.w, o = e.elements; return this.x = o[0] * t + o[4] * i + o[8] * r + o[12] * s, this.y = o[1] * t + o[5] * i + o[9] * r + o[13] * s, this.z = o[2] * t + o[6] * i + o[10] * r + o[14] * s, this.w = o[3] * t + o[7] * i + o[11] * r + o[15] * s, this; } divideScalar(e) { return this.multiplyScalar(1 / e); } setAxisAngleFromQuaternion(e) { this.w = 2 * Math.acos(e.w); const t = Math.sqrt(1 - e.w * e.w); return t < 1e-4 ? (this.x = 1, this.y = 0, this.z = 0) : (this.x = e.x / t, this.y = e.y / t, this.z = e.z / t), this; } setAxisAngleFromRotationMatrix(e) { let t, i, r, s; const c = e.elements, l = c[0], d = c[4], h = c[8], p = c[1], g = c[5], f = c[9], u = c[2], y = c[6], v = c[10]; if (Math.abs(d - p) < 0.01 && Math.abs(h - u) < 0.01 && Math.abs(f - y) < 0.01) { if (Math.abs(d + p) < 0.1 && Math.abs(h + u) < 0.1 && Math.abs(f + y) < 0.1 && Math.abs(l + g + v - 3) < 0.1) return this.set(1, 0, 0, 0), this; t = Math.PI; const w = (l + 1) / 2, S = (g + 1) / 2, T = (v + 1) / 2, M = (d + p) / 4, x = (h + u) / 4, _ = (f + y) / 4; return w > S && w > T ? w < 0.01 ? (i = 0, r = 0.707106781, s = 0.707106781) : (i = Math.sqrt(w), r = M / i, s = x / i) : S > T ? S < 0.01 ? (i = 0.707106781, r = 0, s = 0.707106781) : (r = Math.sqrt(S), i = M / r, s = _ / r) : T < 0.01 ? (i = 0.707106781, r = 0.707106781, s = 0) : (s = Math.sqrt(T), i = x / s, r = _ / s), this.set(i, r, s, t), this; } let m = Math.sqrt((y - f) * (y - f) + (h - u) * (h - u) + (p - d) * (p - d)); return Math.abs(m) < 1e-3 && (m = 1), this.x = (y - f) / m, this.y = (h - u) / m, this.z = (p - d) / m, this.w = Math.acos((l + g + v - 1) / 2), this; } min(e) { return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this.w = Math.min(this.w, e.w), this; } max(e) { return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this.w = Math.max(this.w, e.w), this; } clamp(e, t) { return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this.z = Math.max(e.z, Math.min(t.z, this.z)), this.w = Math.max(e.w, Math.min(t.w, this.w)), this; } clampScalar(e, t) { return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this.z = Math.max(e, Math.min(t, this.z)), this.w = Math.max(e, Math.min(t, this.w)), this; } clampLength(e, t) { const i = this.length(); return this.divideScalar(i || 1).multiplyScalar(Math.max(e, Math.min(t, i))); } floor() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this.w = Math.floor(this.w), this; } ceil() { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this.w = Math.ceil(this.w), this; } round() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this.w = Math.round(this.w), this; } roundToZero() { return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w), this; } negate() { return this.x = -this.x, this.y = -this.y, this.z = -this.z, this.w = -this.w, this; } dot(e) { return this.x * e.x + this.y * e.y + this.z * e.z + this.w * e.w; } lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; } length() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); } manhattanLength() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w); } normalize() { return this.divideScalar(this.length() || 1); } setLength(e) { return this.normalize().multiplyScalar(e); } lerp(e, t) { return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this.w += (e.w - this.w) * t, this; } lerpVectors(e, t, i) { return this.x = e.x + (t.x - e.x) * i, this.y = e.y + (t.y - e.y) * i, this.z = e.z + (t.z - e.z) * i, this.w = e.w + (t.w - e.w) * i, this; } equals(e) { return e.x === this.x && e.y === this.y && e.z === this.z && e.w === this.w; } fromArray(e, t = 0) { return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this.w = e[t + 3], this; } toArray(e = [], t = 0) { return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e[t + 3] = this.w, e; } fromBufferAttribute(e, t, i) { return i !== void 0 && console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this.w = e.getW(t), this; } random() { return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this.w = Math.random(), this; } } _t.prototype.isVector4 = !0; class bi extends ns { constructor(e, t, i = {}) { super(), this.width = e, this.height = t, this.depth = 1, this.scissor = new _t(0, 0, e, t), this.scissorTest = !1, this.viewport = new _t(0, 0, e, t), this.texture = new nn(void 0, i.mapping, i.wrapS, i.wrapT, i.magFilter, i.minFilter, i.format, i.type, i.anisotropy, i.encoding), this.texture.image = { width: e, height: t, depth: 1 }, this.texture.generateMipmaps = i.generateMipmaps !== void 0 ? i.generateMipmaps : !1, this.texture.minFilter = i.minFilter !== void 0 ? i.minFilter : jt, this.depthBuffer = i.depthBuffer !== void 0 ? i.depthBuffer : !0, this.stencilBuffer = i.stencilBuffer !== void 0 ? i.stencilBuffer : !1, this.depthTexture = i.depthTexture !== void 0 ? i.depthTexture : null; } setTexture(e) { e.image = { width: this.width, height: this.height, depth: this.depth }, this.texture = e; } setSize(e, t, i = 1) { (this.width !== e || this.height !== t || this.depth !== i) && (this.width = e, this.height = t, this.depth = i, this.texture.image.width = e, this.texture.image.height = t, this.texture.image.depth = i, this.dispose()), this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t); } clone() { return new this.constructor().copy(this); } copy(e) { return this.width = e.width, this.height = e.height, this.depth = e.depth, this.viewport.copy(e.viewport), this.texture = e.texture.clone(), this.texture.image = { ...this.texture.image }, this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, this.depthTexture = e.depthTexture, this; } dispose() { this.dispatchEvent({ type: "dispose" }); } } bi.prototype.isWebGLRenderTarget = !0; class px extends bi { constructor(e, t, i) { super(e, t); const r = this.texture; this.texture = []; for (let s = 0; s < i; s++) this.texture[s] = r.clone(); } setSize(e, t, i = 1) { if (this.width !== e || this.height !== t || this.depth !== i) { this.width = e, this.height = t, this.depth = i; for (let r = 0, s = this.texture.length; r < s; r++) this.texture[r].image.width = e, this.texture[r].image.height = t, this.texture[r].image.depth = i; this.dispose(); } return this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t), this; } copy(e) { this.dispose(), this.width = e.width, this.height = e.height, this.depth = e.depth, this.viewport.set(0, 0, this.width, this.height), this.scissor.set(0, 0, this.width, this.height), this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, this.depthTexture = e.depthTexture, this.texture.length = 0; for (let t = 0, i = e.texture.length; t < i; t++) this.texture[t] = e.texture[t].clone(); return this; } } px.prototype.isWebGLMultipleRenderTargets = !0; class Jf extends bi { constructor(e, t, i) { super(e, t, i), this.samples = 4; } copy(e) { return super.copy.call(this, e), this.samples = e.samples, this; } } Jf.prototype.isWebGLMultisampleRenderTarget = !0; class Sn { constructor(e = 0, t = 0, i = 0, r = 1) { this._x = e, this._y = t, this._z = i, this._w = r; } static slerp(e, t, i, r) { return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."), i.slerpQuaternions(e, t, r); } static slerpFlat(e, t, i, r, s, o, a) { let c = i[r + 0], l = i[r + 1], d = i[r + 2], h = i[r + 3]; const p = s[o + 0], g = s[o + 1], f = s[o + 2], u = s[o + 3]; if (a === 0) { e[t + 0] = c, e[t + 1] = l, e[t + 2] = d, e[t + 3] = h; return; } if (a === 1) { e[t + 0] = p, e[t + 1] = g, e[t + 2] = f, e[t + 3] = u; return; } if (h !== u || c !== p || l !== g || d !== f) { let y = 1 - a; const v = c * p + l * g + d * f + h * u, m = v >= 0 ? 1 : -1, w = 1 - v * v; if (w > Number.EPSILON) { const T = Math.sqrt(w), M = Math.atan2(T, v * m); y = Math.sin(y * M) / T, a = Math.sin(a * M) / T; } const S = a * m; if (c = c * y + p * S, l = l * y + g * S, d = d * y + f * S, h = h * y + u * S, y === 1 - a) { const T = 1 / Math.sqrt(c * c + l * l + d * d + h * h); c *= T, l *= T, d *= T, h *= T; } } e[t] = c, e[t + 1] = l, e[t + 2] = d, e[t + 3] = h; } static multiplyQuaternionsFlat(e, t, i, r, s, o) { const a = i[r], c = i[r + 1], l = i[r + 2], d = i[r + 3], h = s[o], p = s[o + 1], g = s[o + 2], f = s[o + 3]; return e[t] = a * f + d * h + c * g - l * p, e[t + 1] = c * f + d * p + l * h - a * g, e[t + 2] = l * f + d * g + a * p - c * h, e[t + 3] = d * f - a * h - c * p - l * g, e; } get x() { return this._x; } set x(e) { this._x = e, this._onChangeCallback(); } get y() { return this._y; } set y(e) { this._y = e, this._onChangeCallback(); } get z() { return this._z; } set z(e) { this._z = e, this._onChangeCallback(); } get w() { return this._w; } set w(e) { this._w = e, this._onChangeCallback(); } set(e, t, i, r) { return this._x = e, this._y = t, this._z = i, this._w = r, this._onChangeCallback(), this; } clone() { return new this.constructor(this._x, this._y, this._z, this._w); } copy(e) { return this._x = e.x, this._y = e.y, this._z = e.z, this._w = e.w, this._onChangeCallback(), this; } setFromEuler(e, t) { if (!(e && e.isEuler)) throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order."); const i = e._x, r = e._y, s = e._z, o = e._order, a = Math.cos, c = Math.sin, l = a(i / 2), d = a(r / 2), h = a(s / 2), p = c(i / 2), g = c(r / 2), f = c(s / 2); switch (o) { case "XYZ": this._x = p * d * h + l * g * f, this._y = l * g * h - p * d * f, this._z = l * d * f + p * g * h, this._w = l * d * h - p * g * f; break; case "YXZ": this._x = p * d * h + l * g * f, this._y = l * g * h - p * d * f, this._z = l * d * f - p * g * h, this._w = l * d * h + p * g * f; break; case "ZXY": this._x = p * d * h - l * g * f, this._y = l * g * h + p * d * f, this._z = l * d * f + p * g * h, this._w = l * d * h - p * g * f; break; case "ZYX": this._x = p * d * h - l * g * f, this._y = l * g * h + p * d * f, this._z = l * d * f - p * g * h, this._w = l * d * h + p * g * f; break; case "YZX": this._x = p * d * h + l * g * f, this._y = l * g * h + p * d * f, this._z = l * d * f - p * g * h, this._w = l * d * h - p * g * f; break; case "XZY": this._x = p * d * h - l * g * f, this._y = l * g * h - p * d * f, this._z = l * d * f + p * g * h, this._w = l * d * h + p * g * f; break; default: console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + o); } return t !== !1 && this._onChangeCallback(), this; } setFromAxisAngle(e, t) { const i = t / 2, r = Math.sin(i); return this._x = e.x * r, this._y = e.y * r, this._z = e.z * r, this._w = Math.cos(i), this._onChangeCallback(), this; } setFromRotationMatrix(e) { const t = e.elements, i = t[0], r = t[4], s = t[8], o = t[1], a = t[5], c = t[9], l = t[2], d = t[6], h = t[10], p = i + a + h; if (p > 0) { const g = 0.5 / Math.sqrt(p + 1); this._w = 0.25 / g, this._x = (d - c) * g, this._y = (s - l) * g, this._z = (o - r) * g; } else if (i > a && i > h) { const g = 2 * Math.sqrt(1 + i - a - h); this._w = (d - c) / g, this._x = 0.25 * g, this._y = (r + o) / g, this._z = (s + l) / g; } else if (a > h) { const g = 2 * Math.sqrt(1 + a - i - h); this._w = (s - l) / g, this._x = (r + o) / g, this._y = 0.25 * g, this._z = (c + d) / g; } else { const g = 2 * Math.sqrt(1 + h - i - a); this._w = (o - r) / g, this._x = (s + l) / g, this._y = (c + d) / g, this._z = 0.25 * g; } return this._onChangeCallback(), this; } setFromUnitVectors(e, t) { let i = e.dot(t) + 1; return i < Number.EPSILON ? (i = 0, Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y, this._y = e.x, this._z = 0, this._w = i) : (this._x = 0, this._y = -e.z, this._z = e.y, this._w = i)) : (this._x = e.y * t.z - e.z * t.y, this._y = e.z * t.x - e.x * t.z, this._z = e.x * t.y - e.y * t.x, this._w = i), this.normalize(); } angleTo(e) { return 2 * Math.acos(Math.abs(wn(this.dot(e), -1, 1))); } rotateTowards(e, t) { const i = this.angleTo(e); if (i === 0) return this; const r = Math.min(1, t / i); return this.slerp(e, r), this; } identity() { return this.set(0, 0, 0, 1); } invert() { return this.conjugate(); } conjugate() { return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this; } dot(e) { return this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w; } lengthSq() { return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; } length() { return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w); } normalize() { let e = this.length(); return e === 0 ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (e = 1 / e, this._x = this._x * e, this._y = this._y * e, this._z = this._z * e, this._w = this._w * e), this._onChangeCallback(), this; } multiply(e, t) { return t !== void 0 ? (console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), this.multiplyQuaternions(e, t)) : this.multiplyQuaternions(this, e); } premultiply(e) { return this.multiplyQuaternions(e, this); } multiplyQuaternions(e, t) { const i = e._x, r = e._y, s = e._z, o = e._w, a = t._x, c = t._y, l = t._z, d = t._w; return this._x = i * d + o * a + r * l - s * c, this._y = r * d + o * c + s * a - i * l, this._z = s * d + o * l + i * c - r * a, this._w = o * d - i * a - r * c - s * l, this._onChangeCallback(), this; } slerp(e, t) { if (t === 0) return this; if (t === 1) return this.copy(e); const i = this._x, r = this._y, s = this._z, o = this._w; let a = o * e._w + i * e._x + r * e._y + s * e._z; if (a < 0 ? (this._w = -e._w, this._x = -e._x, this._y = -e._y, this._z = -e._z, a = -a) : this.copy(e), a >= 1) return this._w = o, this._x = i, this._y = r, this._z = s, this; const c = 1 - a * a; if (c <= Number.EPSILON) { const g = 1 - t; return this._w = g * o + t * this._w, this._x = g * i + t * this._x, this._y = g * r + t * this._y, this._z = g * s + t * this._z, this.normalize(), this._onChangeCallback(), this; } const l = Math.sqrt(c), d = Math.atan2(l, a), h = Math.sin((1 - t) * d) / l, p = Math.sin(t * d) / l; return this._w = o * h + this._w * p, this._x = i * h + this._x * p, this._y = r * h + this._y * p, this._z = s * h + this._z * p, this._onChangeCallback(), this; } slerpQuaternions(e, t, i) { this.copy(e).slerp(t, i); } equals(e) { return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w; } fromArray(e, t = 0) { return this._x = e[t], this._y = e[t + 1], this._z = e[t + 2], this._w = e[t + 3], this._onChangeCallback(), this; } toArray(e = [], t = 0) { return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._w, e; } fromBufferAttribute(e, t) { return this._x = e.getX(t), this._y = e.getY(t), this._z = e.getZ(t), this._w = e.getW(t), this; } _onChange(e) { return this._onChangeCallback = e, this; } _onChangeCallback() { } } Sn.prototype.isQuaternion = !0; class X { constructor(e = 0, t = 0, i = 0) { this.x = e, this.y = t, this.z = i; } set(e, t, i) { return i === void 0 && (i = this.z), this.x = e, this.y = t, this.z = i, this; } setScalar(e) { return this.x = e, this.y = e, this.z = e, this; } setX(e) { return this.x = e, this; } setY(e) { return this.y = e, this; } setZ(e) { return this.z = e, this; } setComponent(e, t) { switch (e) { case 0: this.x = t; break; case 1: this.y = t; break; case 2: this.z = t; break; default: throw new Error("index is out of range: " + e); } return this; } getComponent(e) { switch (e) { case 0: return this.x; case 1: return this.y; case 2: return this.z; default: throw new Error("index is out of range: " + e); } } clone() { return new this.constructor(this.x, this.y, this.z); } copy(e) { return this.x = e.x, this.y = e.y, this.z = e.z, this; } add(e, t) { return t !== void 0 ? (console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this.z += e.z, this); } addScalar(e) { return this.x += e, this.y += e, this.z += e, this; } addVectors(e, t) { return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this; } addScaledVector(e, t) { return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this; } sub(e, t) { return t !== void 0 ? (console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this.z -= e.z, this); } subScalar(e) { return this.x -= e, this.y -= e, this.z -= e, this; } subVectors(e, t) { return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this; } multiply(e, t) { return t !== void 0 ? (console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."), this.multiplyVectors(e, t)) : (this.x *= e.x, this.y *= e.y, this.z *= e.z, this); } multiplyScalar(e) { return this.x *= e, this.y *= e, this.z *= e, this; } multiplyVectors(e, t) { return this.x = e.x * t.x, this.y = e.y * t.y, this.z = e.z * t.z, this; } applyEuler(e) { return e && e.isEuler || console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."), this.applyQuaternion(pg.setFromEuler(e)); } applyAxisAngle(e, t) { return this.applyQuaternion(pg.setFromAxisAngle(e, t)); } applyMatrix3(e) { const t = this.x, i = this.y, r = this.z, s = e.elements; return this.x = s[0] * t + s[3] * i + s[6] * r, this.y = s[1] * t + s[4] * i + s[7] * r, this.z = s[2] * t + s[5] * i + s[8] * r, this; } applyNormalMatrix(e) { return this.applyMatrix3(e).normalize(); } applyMatrix4(e) { const t = this.x, i = this.y, r = this.z, s = e.elements, o = 1 / (s[3] * t + s[7] * i + s[11] * r + s[15]); return this.x = (s[0] * t + s[4] * i + s[8] * r + s[12]) * o, this.y = (s[1] * t + s[5] * i + s[9] * r + s[13]) * o, this.z = (s[2] * t + s[6] * i + s[10] * r + s[14]) * o, this; } applyQuaternion(e) { const t = this.x, i = this.y, r = this.z, s = e.x, o = e.y, a = e.z, c = e.w, l = c * t + o * r - a * i, d = c * i + a * t - s * r, h = c * r + s * i - o * t, p = -s * t - o * i - a * r; return this.x = l * c + p * -s + d * -a - h * -o, this.y = d * c + p * -o + h * -s - l * -a, this.z = h * c + p * -a + l * -o - d * -s, this; } project(e) { return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix); } unproject(e) { return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld); } transformDirection(e) { const t = this.x, i = this.y, r = this.z, s = e.elements; return this.x = s[0] * t + s[4] * i + s[8] * r, this.y = s[1] * t + s[5] * i + s[9] * r, this.z = s[2] * t + s[6] * i + s[10] * r, this.normalize(); } divide(e) { return this.x /= e.x, this.y /= e.y, this.z /= e.z, this; } divideScalar(e) { return this.multiplyScalar(1 / e); } min(e) { return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this; } max(e) { return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this; } clamp(e, t) { return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this.z = Math.max(e.z, Math.min(t.z, this.z)), this; } clampScalar(e, t) { return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this.z = Math.max(e, Math.min(t, this.z)), this; } clampLength(e, t) { const i = this.length(); return this.divideScalar(i || 1).multiplyScalar(Math.max(e, Math.min(t, i))); } floor() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this; } ceil() { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this; } round() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this; } roundToZero() { return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this; } negate() { return this.x = -this.x, this.y = -this.y, this.z = -this.z, this; } dot(e) { return this.x * e.x + this.y * e.y + this.z * e.z; } // TODO lengthSquared? lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z; } length() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); } manhattanLength() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z); } normalize() { return this.divideScalar(this.length() || 1); } setLength(e) { return this.normalize().multiplyScalar(e); } lerp(e, t) { return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this; } lerpVectors(e, t, i) { return this.x = e.x + (t.x - e.x) * i, this.y = e.y + (t.y - e.y) * i, this.z = e.z + (t.z - e.z) * i, this; } cross(e, t) { return t !== void 0 ? (console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."), this.crossVectors(e, t)) : this.crossVectors(this, e); } crossVectors(e, t) { const i = e.x, r = e.y, s = e.z, o = t.x, a = t.y, c = t.z; return this.x = r * c - s * a, this.y = s * o - i * c, this.z = i * a - r * o, this; } projectOnVector(e) { const t = e.lengthSq(); if (t === 0) return this.set(0, 0, 0); const i = e.dot(this) / t; return this.copy(e).multiplyScalar(i); } projectOnPlane(e) { return oh.copy(this).projectOnVector(e), this.sub(oh); } reflect(e) { return this.sub(oh.copy(e).multiplyScalar(2 * this.dot(e))); } angleTo(e) { const t = Math.sqrt(this.lengthSq() * e.lengthSq()); if (t === 0) return Math.PI / 2; const i = this.dot(e) / t; return Math.acos(wn(i, -1, 1)); } distanceTo(e) { return Math.sqrt(this.distanceToSquared(e)); } distanceToSquared(e) { const t = this.x - e.x, i = this.y - e.y, r = this.z - e.z; return t * t + i * i + r * r; } manhattanDistanceTo(e) { return Math.abs(this.x - e.x) + Math.abs(this.y - e.y) + Math.abs(this.z - e.z); } setFromSpherical(e) { return this.setFromSphericalCoords(e.radius, e.phi, e.theta); } setFromSphericalCoords(e, t, i) { const r = Math.sin(t) * e; return this.x = r * Math.sin(i), this.y = Math.cos(t) * e, this.z = r * Math.cos(i), this; } setFromCylindrical(e) { return this.setFromCylindricalCoords(e.radius, e.theta, e.y); } setFromCylindricalCoords(e, t, i) { return this.x = e * Math.sin(t), this.y = i, this.z = e * Math.cos(t), this; } setFromMatrixPosition(e) { const t = e.elements; return this.x = t[12], this.y = t[13], this.z = t[14], this; } setFromMatrixScale(e) { const t = this.setFromMatrixColumn(e, 0).length(), i = this.setFromMatrixColumn(e, 1).length(), r = this.setFromMatrixColumn(e, 2).length(); return this.x = t, this.y = i, this.z = r, this; } setFromMatrixColumn(e, t) { return this.fromArray(e.elements, t * 4); } setFromMatrix3Column(e, t) { return this.fromArray(e.elements, t * 3); } equals(e) { return e.x === this.x && e.y === this.y && e.z === this.z; } fromArray(e, t = 0) { return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this; } toArray(e = [], t = 0) { return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e; } fromBufferAttribute(e, t, i) { return i !== void 0 && console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this; } random() { return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this; } } X.prototype.isVector3 = !0; const oh = /* @__PURE__ */ new X(), pg = /* @__PURE__ */ new Sn(); class Hn { constructor(e = new X(1 / 0, 1 / 0, 1 / 0), t = new X(-1 / 0, -1 / 0, -1 / 0)) { this.min = e, this.max = t; } set(e, t) { return this.min.copy(e), this.max.copy(t), this; } setFromArray(e) { let t = 1 / 0, i = 1 / 0, r = 1 / 0, s = -1 / 0, o = -1 / 0, a = -1 / 0; for (let c = 0, l = e.length; c < l; c += 3) { const d = e[c], h = e[c + 1], p = e[c + 2]; d < t && (t = d), h < i && (i = h), p < r && (r = p), d > s && (s = d), h > o && (o = h), p > a && (a = p); } return this.min.set(t, i, r), this.max.set(s, o, a), this; } setFromBufferAttribute(e) { let t = 1 / 0, i = 1 / 0, r = 1 / 0, s = -1 / 0, o = -1 / 0, a = -1 / 0; for (let c = 0, l = e.count; c < l; c++) { const d = e.getX(c), h = e.getY(c), p = e.getZ(c); d < t && (t = d), h < i && (i = h), p < r && (r = p), d > s && (s = d), h > o && (o = h), p > a && (a = p); } return this.min.set(t, i, r), this.max.set(s, o, a), this; } setFromPoints(e) { this.makeEmpty(); for (let t = 0, i = e.length; t < i; t++) this.expandByPoint(e[t]); return this; } setFromCenterAndSize(e, t) { const i = ba.copy(t).multiplyScalar(0.5); return this.min.copy(e).sub(i), this.max.copy(e).add(i), this; } setFromObject(e) { return this.makeEmpty(), this.expandByObject(e); } clone() { return new this.constructor().copy(this); } copy(e) { return this.min.copy(e.min), this.max.copy(e.max), this; } makeEmpty() { return this.min.x = this.min.y = this.min.z = 1 / 0, this.max.x = this.max.y = this.max.z = -1 / 0, this; } isEmpty() { return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z; } getCenter(e) { return this.isEmpty() ? e.set(0, 0, 0) : e.addVectors(this.min, this.max).multiplyScalar(0.5); } getSize(e) { return this.isEmpty() ? e.set(0, 0, 0) : e.subVectors(this.max, this.min); } expandByPoint(e) { return this.min.min(e), this.max.max(e), this; } expandByVector(e) { return this.min.sub(e), this.max.add(e), this; } expandByScalar(e) { return this.min.addScalar(-e), this.max.addScalar(e), this; } expandByObject(e) { e.updateWorldMatrix(!1, !1); const t = e.geometry; t !== void 0 && (t.boundingBox === null && t.computeBoundingBox(), ah.copy(t.boundingBox), ah.applyMatrix4(e.matrixWorld), this.union(ah)); const i = e.children; for (let r = 0, s = i.length; r < s; r++) this.expandByObject(i[r]); return this; } containsPoint(e) { return !(e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y || e.z < this.min.z || e.z > this.max.z); } containsBox(e) { return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y && this.min.z <= e.min.z && e.max.z <= this.max.z; } getParameter(e, t) { return t.set( (e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y), (e.z - this.min.z) / (this.max.z - this.min.z) ); } intersectsBox(e) { return !(e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y || e.max.z < this.min.z || e.min.z > this.max.z); } intersectsSphere(e) { return this.clampPoint(e.center, ba), ba.distanceToSquared(e.center) <= e.radius * e.radius; } intersectsPlane(e) { let t, i; return e.normal.x > 0 ? (t = e.normal.x * this.min.x, i = e.normal.x * this.max.x) : (t = e.normal.x * this.max.x, i = e.normal.x * this.min.x), e.normal.y > 0 ? (t += e.normal.y * this.min.y, i += e.normal.y * this.max.y) : (t += e.normal.y * this.max.y, i += e.normal.y * this.min.y), e.normal.z > 0 ? (t += e.normal.z * this.min.z, i += e.normal.z * this.max.z) : (t += e.normal.z * this.max.z, i += e.normal.z * this.min.z), t <= -e.constant && i >= -e.constant; } intersectsTriangle(e) { if (this.isEmpty()) return !1; this.getCenter(xa), Wl.subVectors(this.max, xa), Ks.subVectors(e.a, xa), Qs.subVectors(e.b, xa), eo.subVectors(e.c, xa), Sr.subVectors(Qs, Ks), _r.subVectors(eo, Qs), cs.subVectors(Ks, eo); let t = [ 0, -Sr.z, Sr.y, 0, -_r.z, _r.y, 0, -cs.z, cs.y, Sr.z, 0, -Sr.x, _r.z, 0, -_r.x, cs.z, 0, -cs.x, -Sr.y, Sr.x, 0, -_r.y, _r.x, 0, -cs.y, cs.x, 0 ]; return !lh(t, Ks, Qs, eo, Wl) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !lh(t, Ks, Qs, eo, Wl)) ? !1 : (jl.crossVectors(Sr, _r), t = [jl.x, jl.y, jl.z], lh(t, Ks, Qs, eo, Wl)); } clampPoint(e, t) { return t.copy(e).clamp(this.min, this.max); } distanceToPoint(e) { return ba.copy(e).clamp(this.min, this.max).sub(e).length(); } getBoundingSphere(e) { return this.getCenter(e.center), e.radius = this.getSize(ba).length() * 0.5, e; } intersect(e) { return this.min.max(e.min), this.max.min(e.max), this.isEmpty() && this.makeEmpty(), this; } union(e) { return this.min.min(e.min), this.max.max(e.max), this; } applyMatrix4(e) { return this.isEmpty() ? this : ($i[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), $i[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), $i[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), $i[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), $i[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), $i[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), $i[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), $i[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints($i), this); } translate(e) { return this.min.add(e), this.max.add(e), this; } equals(e) { return e.min.equals(this.min) && e.max.equals(this.max); } } Hn.prototype.isBox3 = !0; const $i = [ /* @__PURE__ */ new X(), /* @__PURE__ */ new X(), /* @__PURE__ */ new X(), /* @__PURE__ */ new X(), /* @__PURE__ */ new X(), /* @__PURE__ */ new X(), /* @__PURE__ */ new X(), /* @__PURE__ */ new X() ], ba = /* @__PURE__ */ new X(), ah = /* @__PURE__ */ new Hn(), Ks = /* @__PURE__ */ new X(), Qs = /* @__PURE__ */ new X(), eo = /* @__PURE__ */ new X(), Sr = /* @__PURE__ */ new X(), _r = /* @__PURE__ */ new X(), cs = /* @__PURE__ */ new X(), xa = /* @__PURE__ */ new X(), Wl = /* @__PURE__ */ new X(), jl = /* @__PURE__ */ new X(), us = /* @__PURE__ */ new X(); function lh(n, e, t, i, r) { for (let s = 0, o = n.length - 3; s <= o; s += 3) { us.fromArray(n, s); const a = r.x * Math.abs(us.x) + r.y * Math.abs(us.y) + r.z * Math.abs(us.z), c = e.dot(us), l = t.dot(us), d = i.dot(us); if (Math.max(-Math.max(c, l, d), Math.min(c, l, d)) > a) return !1; } return !0; } const gI = /* @__PURE__ */ new Hn(), mg = /* @__PURE__ */ new X(), ch = /* @__PURE__ */ new X(), uh = /* @__PURE__ */ new X(); class xr { constructor(e = new X(), t = -1) { this.center = e, this.radius = t; } set(e, t) { return this.center.copy(e), this.radius = t, this; } setFromPoints(e, t) { const i = this.center; t !== void 0 ? i.copy(t) : gI.setFromPoints(e).getCenter(i); let r = 0; for (let s = 0, o = e.length; s < o; s++) r = Math.max(r, i.distanceToSquared(e[s])); return this.radius = Math.sqrt(r), this; } copy(e) { return this.center.copy(e.center), this.radius = e.radius, this; } isEmpty() { return this.radius < 0; } makeEmpty() { return this.center.set(0, 0, 0), this.radius = -1, this; } containsPoint(e) { return e.distanceToSquared(this.center) <= this.radius * this.radius; } distanceToPoint(e) { return e.distanceTo(this.center) - this.radius; } intersectsSphere(e) { const t = this.radius + e.radius; return e.center.distanceToSquared(this.center) <= t * t; } intersectsBox(e) { return e.intersectsSphere(this); } intersectsPlane(e) { return Math.abs(e.distanceToPoint(this.center)) <= this.radius; } clampPoint(e, t) { const i = this.center.distanceToSquared(e); return t.copy(e), i > this.radius * this.radius && (t.sub(this.center).normalize(), t.multiplyScalar(this.radius).add(this.center)), t; } getBoundingBox(e) { return this.isEmpty() ? (e.makeEmpty(), e) : (e.set(this.center, this.center), e.expandByScalar(this.radius), e); } applyMatrix4(e) { return this.center.applyMatrix4(e), this.radius = this.radius * e.getMaxScaleOnAxis(), this; } translate(e) { return this.center.add(e), this; } expandByPoint(e) { uh.subVectors(e, this.center); const t = uh.lengthSq(); if (t > this.radius * this.radius) { const i = Math.sqrt(t), r = (i - this.radius) * 0.5; this.center.add(uh.multiplyScalar(r / i)), this.radius += r; } return this; } union(e) { return ch.subVectors(e.center, this.center).normalize().multiplyScalar(e.radius), this.expandByPoint(mg.copy(e.center).add(ch)), this.expandByPoint(mg.copy(e.center).sub(ch)), this; } equals(e) { return e.center.equals(this.center) && e.radius === this.radius; } clone() { return new this.constructor().copy(this); } } const Zi = /* @__PURE__ */ new X(), hh = /* @__PURE__ */ new X(), $l = /* @__PURE__ */ new X(), Tr = /* @__PURE__ */ new X(), dh = /* @__PURE__ */ new X(), Zl = /* @__PURE__ */ new X(), fh = /* @__PURE__ */ new X(); class is { constructor(e = new X(), t = new X(0, 0, -1)) { this.origin = e, this.direction = t; } set(e, t) { return this.origin.copy(e), this.direction.copy(t), this; } copy(e) { return this.origin.copy(e.origin), this.direction.copy(e.direction), this; } at(e, t) { return t.copy(this.direction).multiplyScalar(e).add(this.origin); } lookAt(e) { return this.direction.copy(e).sub(this.origin).normalize(), this; } recast(e) { return this.origin.copy(this.at(e, Zi)), this; } closestPointToPoint(e, t) { t.subVectors(e, this.origin); const i = t.dot(this.direction); return i < 0 ? t.copy(this.origin) : t.copy(this.direction).multiplyScalar(i).add(this.origin); } distanceToPoint(e) { return Math.sqrt(this.distanceSqToPoint(e)); } distanceSqToPoint(e) { const t = Zi.subVectors(e, this.origin).dot(this.direction); return t < 0 ? this.origin.distanceToSquared(e) : (Zi.copy(this.direction).multiplyScalar(t).add(this.origin), Zi.distanceToSquared(e)); } distanceSqToSegment(e, t, i, r) { hh.copy(e).add(t).multiplyScalar(0.5), $l.copy(t).sub(e).normalize(), Tr.copy(this.origin).sub(hh); const s = e.distanceTo(t) * 0.5, o = -this.direction.dot($l), a = Tr.dot(this.direction), c = -Tr.dot($l), l = Tr.lengthSq(), d = Math.abs(1 - o * o); let h, p, g, f; if (d > 0) if (h = o * c - a, p = o * a - c, f = s * d, h >= 0) if (p >= -f) if (p <= f) { const u = 1 / d; h *= u, p *= u, g = h * (h + o * p + 2 * a) + p * (o * h + p + 2 * c) + l; } else p = s, h = Math.max(0, -(o * p + a)), g = -h * h + p * (p + 2 * c) + l; else p = -s, h = Math.max(0, -(o * p + a)), g = -h * h + p * (p + 2 * c) + l; else p <= -f ? (h = Math.max(0, -(-o * s + a)), p = h > 0 ? -s : Math.min(Math.max(-s, -c), s), g = -h * h + p * (p + 2 * c) + l) : p <= f ? (h = 0, p = Math.min(Math.max(-s, -c), s), g = p * (p + 2 * c) + l) : (h = Math.max(0, -(o * s + a)), p = h > 0 ? s : Math.min(Math.max(-s, -c), s), g = -h * h + p * (p + 2 * c) + l); else p = o > 0 ? -s : s, h = Math.max(0, -(o * p + a)), g = -h * h + p * (p + 2 * c) + l; return i && i.copy(this.direction).multiplyScalar(h).add(this.origin), r && r.copy($l).multiplyScalar(p).add(hh), g; } intersectSphere(e, t) { Zi.subVectors(e.center, this.origin); const i = Zi.dot(this.direction), r = Zi.dot(Zi) - i * i, s = e.radius * e.radius; if (r > s) return null; const o = Math.sqrt(s - r), a = i - o, c = i + o; return a < 0 && c < 0 ? null : a < 0 ? this.at(c, t) : this.at(a, t); } intersectsSphere(e) { return this.distanceSqToPoint(e.center) <= e.radius * e.radius; } distanceToPlane(e) { const t = e.normal.dot(this.direction); if (t === 0) return e.distanceToPoint(this.origin) === 0 ? 0 : null; const i = -(this.origin.dot(e.normal) + e.constant) / t; return i >= 0 ? i : null; } intersectPlane(e, t) { const i = this.distanceToPlane(e); return i === null ? null : this.at(i, t); } intersectsPlane(e) { const t = e.distanceToPoint(this.origin); return t === 0 || e.normal.dot(this.direction) * t < 0; } intersectBox(e, t) { let i, r, s, o, a, c; const l = 1 / this.direction.x, d = 1 / this.direction.y, h = 1 / this.direction.z, p = this.origin; return l >= 0 ? (i = (e.min.x - p.x) * l, r = (e.max.x - p.x) * l) : (i = (e.max.x - p.x) * l, r = (e.min.x - p.x) * l), d >= 0 ? (s = (e.min.y - p.y) * d, o = (e.max.y - p.y) * d) : (s = (e.max.y - p.y) * d, o = (e.min.y - p.y) * d), i > o || s > r || ((s > i || i !== i) && (i = s), (o < r || r !== r) && (r = o), h >= 0 ? (a = (e.min.z - p.z) * h, c = (e.max.z - p.z) * h) : (a = (e.max.z - p.z) * h, c = (e.min.z - p.z) * h), i > c || a > r) || ((a > i || i !== i) && (i = a), (c < r || r !== r) && (r = c), r < 0) ? null : this.at(i >= 0 ? i : r, t); } intersectsBox(e) { return this.intersectBox(e, Zi) !== null; } intersectTriangle(e, t, i, r, s) { dh.subVectors(t, e), Zl.subVectors(i, e), fh.crossVectors(dh, Zl); let o = this.direction.dot(fh), a; if (o > 0) { if (r) return null; a = 1; } else if (o < 0) a = -1, o = -o; else return null; Tr.subVectors(this.origin, e); const c = a * this.direction.dot(Zl.crossVectors(Tr, Zl)); if (c < 0) return null; const l = a * this.direction.dot(dh.cross(Tr)); if (l < 0 || c + l > o) return null; const d = -a * Tr.dot(fh); return d < 0 ? null : this.at(d / o, s); } applyMatrix4(e) { return this.origin.applyMatrix4(e), this.direction.transformDirection(e), this; } equals(e) { return e.origin.equals(this.origin) && e.direction.equals(this.direction); } clone() { return new this.constructor().copy(this); } } class $e { constructor() { this.elements = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ], arguments.length > 0 && console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead."); } set(e, t, i, r, s, o, a, c, l, d, h, p, g, f, u, y) { const v = this.elements; return v[0] = e, v[4] = t, v[8] = i, v[12] = r, v[1] = s, v[5] = o, v[9] = a, v[13] = c, v[2] = l, v[6] = d, v[10] = h, v[14] = p, v[3] = g, v[7] = f, v[11] = u, v[15] = y, this; } identity() { return this.set( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ), this; } clone() { return new $e().fromArray(this.elements); } copy(e) { const t = this.elements, i = e.elements; return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t[6] = i[6], t[7] = i[7], t[8] = i[8], t[9] = i[9], t[10] = i[10], t[11] = i[11], t[12] = i[12], t[13] = i[13], t[14] = i[14], t[15] = i[15], this; } copyPosition(e) { const t = this.elements, i = e.elements; return t[12] = i[12], t[13] = i[13], t[14] = i[14], this; } setFromMatrix3(e) { const t = e.elements; return this.set( t[0], t[3], t[6], 0, t[1], t[4], t[7], 0, t[2], t[5], t[8], 0, 0, 0, 0, 1 ), this; } extractBasis(e, t, i) { return e.setFromMatrixColumn(this, 0), t.setFromMatrixColumn(this, 1), i.setFromMatrixColumn(this, 2), this; } makeBasis(e, t, i) { return this.set( e.x, t.x, i.x, 0, e.y, t.y, i.y, 0, e.z, t.z, i.z, 0, 0, 0, 0, 1 ), this; } extractRotation(e) { const t = this.elements, i = e.elements, r = 1 / to.setFromMatrixColumn(e, 0).length(), s = 1 / to.setFromMatrixColumn(e, 1).length(), o = 1 / to.setFromMatrixColumn(e, 2).length(); return t[0] = i[0] * r, t[1] = i[1] * r, t[2] = i[2] * r, t[3] = 0, t[4] = i[4] * s, t[5] = i[5] * s, t[6] = i[6] * s, t[7] = 0, t[8] = i[8] * o, t[9] = i[9] * o, t[10] = i[10] * o, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this; } makeRotationFromEuler(e) { e && e.isEuler || console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order."); const t = this.elements, i = e.x, r = e.y, s = e.z, o = Math.cos(i), a = Math.sin(i), c = Math.cos(r), l = Math.sin(r), d = Math.cos(s), h = Math.sin(s); if (e.order === "XYZ") { const p = o * d, g = o * h, f = a * d, u = a * h; t[0] = c * d, t[4] = -c * h, t[8] = l, t[1] = g + f * l, t[5] = p - u * l, t[9] = -a * c, t[2] = u - p * l, t[6] = f + g * l, t[10] = o * c; } else if (e.order === "YXZ") { const p = c * d, g = c * h, f = l * d, u = l * h; t[0] = p + u * a, t[4] = f * a - g, t[8] = o * l, t[1] = o * h, t[5] = o * d, t[9] = -a, t[2] = g * a - f, t[6] = u + p * a, t[10] = o * c; } else if (e.order === "ZXY") { const p = c * d, g = c * h, f = l * d, u = l * h; t[0] = p - u * a, t[4] = -o * h, t[8] = f + g * a, t[1] = g + f * a, t[5] = o * d, t[9] = u - p * a, t[2] = -o * l, t[6] = a, t[10] = o * c; } else if (e.order === "ZYX") { const p = o * d, g = o * h, f = a * d, u = a * h; t[0] = c * d, t[4] = f * l - g, t[8] = p * l + u, t[1] = c * h, t[5] = u * l + p, t[9] = g * l - f, t[2] = -l, t[6] = a * c, t[10] = o * c; } else if (e.order === "YZX") { const p = o * c, g = o * l, f = a * c, u = a * l; t[0] = c * d, t[4] = u - p * h, t[8] = f * h + g, t[1] = h, t[5] = o * d, t[9] = -a * d, t[2] = -l * d, t[6] = g * h + f, t[10] = p - u * h; } else if (e.order === "XZY") { const p = o * c, g = o * l, f = a * c, u = a * l; t[0] = c * d, t[4] = -h, t[8] = l * d, t[1] = p * h + u, t[5] = o * d, t[9] = g * h - f, t[2] = f * h - g, t[6] = a * d, t[10] = u * h + p; } return t[3] = 0, t[7] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this; } makeRotationFromQuaternion(e) { return this.compose(vI, e, yI); } lookAt(e, t, i) { const r = this.elements; return Wn.subVectors(e, t), Wn.lengthSq() === 0 && (Wn.z = 1), Wn.normalize(), Er.crossVectors(i, Wn), Er.lengthSq() === 0 && (Math.abs(i.z) === 1 ? Wn.x += 1e-4 : Wn.z += 1e-4, Wn.normalize(), Er.crossVectors(i, Wn)), Er.normalize(), Xl.crossVectors(Wn, Er), r[0] = Er.x, r[4] = Xl.x, r[8] = Wn.x, r[1] = Er.y, r[5] = Xl.y, r[9] = Wn.y, r[2] = Er.z, r[6] = Xl.z, r[10] = Wn.z, this; } multiply(e, t) { return t !== void 0 ? (console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), this.multiplyMatrices(e, t)) : this.multiplyMatrices(this, e); } premultiply(e) { return this.multiplyMatrices(e, this); } multiplyMatrices(e, t) { const i = e.elements, r = t.elements, s = this.elements, o = i[0], a = i[4], c = i[8], l = i[12], d = i[1], h = i[5], p = i[9], g = i[13], f = i[2], u = i[6], y = i[10], v = i[14], m = i[3], w = i[7], S = i[11], T = i[15], M = r[0], x = r[4], _ = r[8], E = r[12], L = r[1], R = r[5], C = r[9], A = r[13], P = r[2], I = r[6], b = r[10], O = r[14], N = r[3], D = r[7], B = r[11], U = r[15]; return s[0] = o * M + a * L + c * P + l * N, s[4] = o * x + a * R + c * I + l * D, s[8] = o * _ + a * C + c * b + l * B, s[12] = o * E + a * A + c * O + l * U, s[1] = d * M + h * L + p * P + g * N, s[5] = d * x + h * R + p * I + g * D, s[9] = d * _ + h * C + p * b + g * B, s[13] = d * E + h * A + p * O + g * U, s[2] = f * M + u * L + y * P + v * N, s[6] = f * x + u * R + y * I + v * D, s[10] = f * _ + u * C + y * b + v * B, s[14] = f * E + u * A + y * O + v * U, s[3] = m * M + w * L + S * P + T * N, s[7] = m * x + w * R + S * I + T * D, s[11] = m * _ + w * C + S * b + T * B, s[15] = m * E + w * A + S * O + T * U, this; } multiplyScalar(e) { const t = this.elements; return t[0] *= e, t[4] *= e, t[8] *= e, t[12] *= e, t[1] *= e, t[5] *= e, t[9] *= e, t[13] *= e, t[2] *= e, t[6] *= e, t[10] *= e, t[14] *= e, t[3] *= e, t[7] *= e, t[11] *= e, t[15] *= e, this; } determinant() { const e = this.elements, t = e[0], i = e[4], r = e[8], s = e[12], o = e[1], a = e[5], c = e[9], l = e[13], d = e[2], h = e[6], p = e[10], g = e[14], f = e[3], u = e[7], y = e[11], v = e[15]; return f * (+s * c * h - r * l * h - s * a * p + i * l * p + r * a * g - i * c * g) + u * (+t * c * g - t * l * p + s * o * p - r * o * g + r * l * d - s * c * d) + y * (+t * l * h - t * a * g - s * o * h + i * o * g + s * a * d - i * l * d) + v * (-r * a * d - t * c * h + t * a * p + r * o * h - i * o * p + i * c * d); } transpose() { const e = this.elements; let t; return t = e[1], e[1] = e[4], e[4] = t, t = e[2], e[2] = e[8], e[8] = t, t = e[6], e[6] = e[9], e[9] = t, t = e[3], e[3] = e[12], e[12] = t, t = e[7], e[7] = e[13], e[13] = t, t = e[11], e[11] = e[14], e[14] = t, this; } setPosition(e, t, i) { const r = this.elements; return e.isVector3 ? (r[12] = e.x, r[13] = e.y, r[14] = e.z) : (r[12] = e, r[13] = t, r[14] = i), this; } invert() { const e = this.elements, t = e[0], i = e[1], r = e[2], s = e[3], o = e[4], a = e[5], c = e[6], l = e[7], d = e[8], h = e[9], p = e[10], g = e[11], f = e[12], u = e[13], y = e[14], v = e[15], m = h * y * l - u * p * l + u * c * g - a * y * g - h * c * v + a * p * v, w = f * p * l - d * y * l - f * c * g + o * y * g + d * c * v - o * p * v, S = d * u * l - f * h * l + f * a * g - o * u * g - d * a * v + o * h * v, T = f * h * c - d * u * c - f * a * p + o * u * p + d * a * y - o * h * y, M = t * m + i * w + r * S + s * T; if (M === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); const x = 1 / M; return e[0] = m * x, e[1] = (u * p * s - h * y * s - u * r * g + i * y * g + h * r * v - i * p * v) * x, e[2] = (a * y * s - u * c * s + u * r * l - i * y * l - a * r * v + i * c * v) * x, e[3] = (h * c * s - a * p * s - h * r * l + i * p * l + a * r * g - i * c * g) * x, e[4] = w * x, e[5] = (d * y * s - f * p * s + f * r * g - t * y * g - d * r * v + t * p * v) * x, e[6] = (f * c * s - o * y * s - f * r * l + t * y * l + o * r * v - t * c * v) * x, e[7] = (o * p * s - d * c * s + d * r * l - t * p * l - o * r * g + t * c * g) * x, e[8] = S * x, e[9] = (f * h * s - d * u * s - f * i * g + t * u * g + d * i * v - t * h * v) * x, e[10] = (o * u * s - f * a * s + f * i * l - t * u * l - o * i * v + t * a * v) * x, e[11] = (d * a * s - o * h * s - d * i * l + t * h * l + o * i * g - t * a * g) * x, e[12] = T * x, e[13] = (d * u * r - f * h * r + f * i * p - t * u * p - d * i * y + t * h * y) * x, e[14] = (f * a * r - o * u * r - f * i * c + t * u * c + o * i * y - t * a * y) * x, e[15] = (o * h * r - d * a * r + d * i * c - t * h * c - o * i * p + t * a * p) * x, this; } scale(e) { const t = this.elements, i = e.x, r = e.y, s = e.z; return t[0] *= i, t[4] *= r, t[8] *= s, t[1] *= i, t[5] *= r, t[9] *= s, t[2] *= i, t[6] *= r, t[10] *= s, t[3] *= i, t[7] *= r, t[11] *= s, this; } getMaxScaleOnAxis() { const e = this.elements, t = e[0] * e[0] + e[1] * e[1] + e[2] * e[2], i = e[4] * e[4] + e[5] * e[5] + e[6] * e[6], r = e[8] * e[8] + e[9] * e[9] + e[10] * e[10]; return Math.sqrt(Math.max(t, i, r)); } makeTranslation(e, t, i) { return this.set( 1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, i, 0, 0, 0, 1 ), this; } makeRotationX(e) { const t = Math.cos(e), i = Math.sin(e); return this.set( 1, 0, 0, 0, 0, t, -i, 0, 0, i, t, 0, 0, 0, 0, 1 ), this; } makeRotationY(e) { const t = Math.cos(e), i = Math.sin(e); return this.set( t, 0, i, 0, 0, 1, 0, 0, -i, 0, t, 0, 0, 0, 0, 1 ), this; } makeRotationZ(e) { const t = Math.cos(e), i = Math.sin(e); return this.set( t, -i, 0, 0, i, t, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ), this; } makeRotationAxis(e, t) { const i = Math.cos(t), r = Math.sin(t), s = 1 - i, o = e.x, a = e.y, c = e.z, l = s * o, d = s * a; return this.set( l * o + i, l * a - r * c, l * c + r * a, 0, l * a + r * c, d * a + i, d * c - r * o, 0, l * c - r * a, d * c + r * o, s * c * c + i, 0, 0, 0, 0, 1 ), this; } makeScale(e, t, i) { return this.set( e, 0, 0, 0, 0, t, 0, 0, 0, 0, i, 0, 0, 0, 0, 1 ), this; } makeShear(e, t, i, r, s, o) { return this.set( 1, i, s, 0, e, 1, o, 0, t, r, 1, 0, 0, 0, 0, 1 ), this; } compose(e, t, i) { const r = this.elements, s = t._x, o = t._y, a = t._z, c = t._w, l = s + s, d = o + o, h = a + a, p = s * l, g = s * d, f = s * h, u = o * d, y = o * h, v = a * h, m = c * l, w = c * d, S = c * h, T = i.x, M = i.y, x = i.z; return r[0] = (1 - (u + v)) * T, r[1] = (g + S) * T, r[2] = (f - w) * T, r[3] = 0, r[4] = (g - S) * M, r[5] = (1 - (p + v)) * M, r[6] = (y + m) * M, r[7] = 0, r[8] = (f + w) * x, r[9] = (y - m) * x, r[10] = (1 - (p + u)) * x, r[11] = 0, r[12] = e.x, r[13] = e.y, r[14] = e.z, r[15] = 1, this; } decompose(e, t, i) { const r = this.elements; let s = to.set(r[0], r[1], r[2]).length(); const o = to.set(r[4], r[5], r[6]).length(), a = to.set(r[8], r[9], r[10]).length(); this.determinant() < 0 && (s = -s), e.x = r[12], e.y = r[13], e.z = r[14], hi.copy(this); const l = 1 / s, d = 1 / o, h = 1 / a; return hi.elements[0] *= l, hi.elements[1] *= l, hi.elements[2] *= l, hi.elements[4] *= d, hi.elements[5] *= d, hi.elements[6] *= d, hi.elements[8] *= h, hi.elements[9] *= h, hi.elements[10] *= h, t.setFromRotationMatrix(hi), i.x = s, i.y = o, i.z = a, this; } makePerspective(e, t, i, r, s, o) { o === void 0 && console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); const a = this.elements, c = 2 * s / (t - e), l = 2 * s / (i - r), d = (t + e) / (t - e), h = (i + r) / (i - r), p = -(o + s) / (o - s), g = -2 * o * s / (o - s); return a[0] = c, a[4] = 0, a[8] = d, a[12] = 0, a[1] = 0, a[5] = l, a[9] = h, a[13] = 0, a[2] = 0, a[6] = 0, a[10] = p, a[14] = g, a[3] = 0, a[7] = 0, a[11] = -1, a[15] = 0, this; } makeOrthographic(e, t, i, r, s, o) { const a = this.elements, c = 1 / (t - e), l = 1 / (i - r), d = 1 / (o - s), h = (t + e) * c, p = (i + r) * l, g = (o + s) * d; return a[0] = 2 * c, a[4] = 0, a[8] = 0, a[12] = -h, a[1] = 0, a[5] = 2 * l, a[9] = 0, a[13] = -p, a[2] = 0, a[6] = 0, a[10] = -2 * d, a[14] = -g, a[3] = 0, a[7] = 0, a[11] = 0, a[15] = 1, this; } equals(e) { const t = this.elements, i = e.elements; for (let r = 0; r < 16; r++) if (t[r] !== i[r]) return !1; return !0; } fromArray(e, t = 0) { for (let i = 0; i < 16; i++) this.elements[i] = e[i + t]; return this; } toArray(e = [], t = 0) { const i = this.elements; return e[t] = i[0], e[t + 1] = i[1], e[t + 2] = i[2], e[t + 3] = i[3], e[t + 4] = i[4], e[t + 5] = i[5], e[t + 6] = i[6], e[t + 7] = i[7], e[t + 8] = i[8], e[t + 9] = i[9], e[t + 10] = i[10], e[t + 11] = i[11], e[t + 12] = i[12], e[t + 13] = i[13], e[t + 14] = i[14], e[t + 15] = i[15], e; } } $e.prototype.isMatrix4 = !0; const to = /* @__PURE__ */ new X(), hi = /* @__PURE__ */ new $e(), vI = /* @__PURE__ */ new X(0, 0, 0), yI = /* @__PURE__ */ new X(1, 1, 1), Er = /* @__PURE__ */ new X(), Xl = /* @__PURE__ */ new X(), Wn = /* @__PURE__ */ new X(), gg = /* @__PURE__ */ new $e(), vg = /* @__PURE__ */ new Sn(); class Ws { constructor(e = 0, t = 0, i = 0, r = Ws.DefaultOrder) { this._x = e, this._y = t, this._z = i, this._order = r; } get x() { return this._x; } set x(e) { this._x = e, this._onChangeCallback(); } get y() { return this._y; } set y(e) { this._y = e, this._onChangeCallback(); } get z() { return this._z; } set z(e) { this._z = e, this._onChangeCallback(); } get order() { return this._order; } set order(e) { this._order = e, this._onChangeCallback(); } set(e, t, i, r = this._order) { return this._x = e, this._y = t, this._z = i, this._order = r, this._onChangeCallback(), this; } clone() { return new this.constructor(this._x, this._y, this._z, this._order); } copy(e) { return this._x = e._x, this._y = e._y, this._z = e._z, this._order = e._order, this._onChangeCallback(), this; } setFromRotationMatrix(e, t = this._order, i = !0) { const r = e.elements, s = r[0], o = r[4], a = r[8], c = r[1], l = r[5], d = r[9], h = r[2], p = r[6], g = r[10]; switch (t) { case "XYZ": this._y = Math.asin(wn(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(-d, g), this._z = Math.atan2(-o, s)) : (this._x = Math.atan2(p, l), this._z = 0); break; case "YXZ": this._x = Math.asin(-wn(d, -1, 1)), Math.abs(d) < 0.9999999 ? (this._y = Math.atan2(a, g), this._z = Math.atan2(c, l)) : (this._y = Math.atan2(-h, s), this._z = 0); break; case "ZXY": this._x = Math.asin(wn(p, -1, 1)), Math.abs(p) < 0.9999999 ? (this._y = Math.atan2(-h, g), this._z = Math.atan2(-o, l)) : (this._y = 0, this._z = Math.atan2(c, s)); break; case "ZYX": this._y = Math.asin(-wn(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._x = Math.atan2(p, g), this._z = Math.atan2(c, s)) : (this._x = 0, this._z = Math.atan2(-o, l)); break; case "YZX": this._z = Math.asin(wn(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._x = Math.atan2(-d, l), this._y = Math.atan2(-h, s)) : (this._x = 0, this._y = Math.atan2(a, g)); break; case "XZY": this._z = Math.asin(-wn(o, -1, 1)), Math.abs(o) < 0.9999999 ? (this._x = Math.atan2(p, l), this._y = Math.atan2(a, s)) : (this._x = Math.atan2(-d, g), this._y = 0); break; default: console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + t); } return this._order = t, i === !0 && this._onChangeCallback(), this; } setFromQuaternion(e, t, i) { return gg.makeRotationFromQuaternion(e), this.setFromRotationMatrix(gg, t, i); } setFromVector3(e, t = this._order) { return this.set(e.x, e.y, e.z, t); } reorder(e) { return vg.setFromEuler(this), this.setFromQuaternion(vg, e); } equals(e) { return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order; } fromArray(e) { return this._x = e[0], this._y = e[1], this._z = e[2], e[3] !== void 0 && (this._order = e[3]), this._onChangeCallback(), this; } toArray(e = [], t = 0) { return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._order, e; } toVector3(e) { return e ? e.set(this._x, this._y, this._z) : new X(this._x, this._y, this._z); } _onChange(e) { return this._onChangeCallback = e, this; } _onChangeCallback() { } } Ws.prototype.isEuler = !0; Ws.DefaultOrder = "XYZ"; Ws.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"]; class qf { constructor() { this.mask = 1; } set(e) { this.mask = 1 << e | 0; } enable(e) { this.mask |= 1 << e | 0; } enableAll() { this.mask = -1; } toggle(e) { this.mask ^= 1 << e | 0; } disable(e) { this.mask &= ~(1 << e | 0); } disableAll() { this.mask = 0; } test(e) { return (this.mask & e.mask) !== 0; } } let bI = 0; const yg = /* @__PURE__ */ new X(), no = /* @__PURE__ */ new Sn(), Xi = /* @__PURE__ */ new $e(), Yl = /* @__PURE__ */ new X(), wa = /* @__PURE__ */ new X(), xI = /* @__PURE__ */ new X(), wI = /* @__PURE__ */ new Sn(), bg = /* @__PURE__ */ new X(1, 0, 0), xg = /* @__PURE__ */ new X(0, 1, 0), wg = /* @__PURE__ */ new X(0, 0, 1), MI = { type: "added" }, Mg = { type: "removed" }; class ot extends ns { constructor() { super(), Object.defineProperty(this, "id", { value: bI++ }), this.uuid = Jn(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = ot.DefaultUp.clone(); const e = new X(), t = new Ws(), i = new Sn(), r = new X(1, 1, 1); function s() { i.setFromEuler(t, !1); } function o() { t.setFromQuaternion(i, void 0, !1); } t._onChange(s), i._onChange(o), Object.defineProperties(this, { position: { configurable: !0, enumerable: !0, value: e }, rotation: { configurable: !0, enumerable: !0, value: t }, quaternion: { configurable: !0, enumerable: !0, value: i }, scale: { configurable: !0, enumerable: !0, value: r }, modelViewMatrix: { value: new $e() }, normalMatrix: { value: new ln() } }), this.matrix = new $e(), this.matrixWorld = new $e(), this.matrixAutoUpdate = ot.DefaultMatrixAutoUpdate, this.matrixWorldNeedsUpdate = !1, this.layers = new qf(), this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.userData = {}; } onBeforeRender() { } onAfterRender() { } applyMatrix4(e) { this.matrixAutoUpdate && this.updateMatrix(), this.matrix.premultiply(e), this.matrix.decompose(this.position, this.quaternion, this.scale); } applyQuaternion(e) { return this.quaternion.premultiply(e), this; } setRotationFromAxisAngle(e, t) { this.quaternion.setFromAxisAngle(e, t); } setRotationFromEuler(e) { this.quaternion.setFromEuler(e, !0); } setRotationFromMatrix(e) { this.quaternion.setFromRotationMatrix(e); } setRotationFromQuaternion(e) { this.quaternion.copy(e); } rotateOnAxis(e, t) { return no.setFromAxisAngle(e, t), this.quaternion.multiply(no), this; } rotateOnWorldAxis(e, t) { return no.setFromAxisAngle(e, t), this.quaternion.premultiply(no), this; } rotateX(e) { return this.rotateOnAxis(bg, e); } rotateY(e) { return this.rotateOnAxis(xg, e); } rotateZ(e) { return this.rotateOnAxis(wg, e); } translateOnAxis(e, t) { return yg.copy(e).applyQuaternion(this.quaternion), this.position.add(yg.multiplyScalar(t)), this; } translateX(e) { return this.translateOnAxis(bg, e); } translateY(e) { return this.translateOnAxis(xg, e); } translateZ(e) { return this.translateOnAxis(wg, e); } localToWorld(e) { return e.applyMatrix4(this.matrixWorld); } worldToLocal(e) { return e.applyMatrix4(Xi.copy(this.matrixWorld).invert()); } lookAt(e, t, i) { e.isVector3 ? Yl.copy(e) : Yl.set(e, t, i); const r = this.parent; this.updateWorldMatrix(!0, !1), wa.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? Xi.lookAt(wa, Yl, this.up) : Xi.lookAt(Yl, wa, this.up), this.quaternion.setFromRotationMatrix(Xi), r && (Xi.extractRotation(r.matrixWorld), no.setFromRotationMatrix(Xi), this.quaternion.premultiply(no.invert())); } add(e) { if (arguments.length > 1) { for (let t = 0; t < arguments.length; t++) this.add(arguments[t]); return this; } return e === this ? (console.error("THREE.Object3D.add: object can't be added as a child of itself.", e), this) : (e && e.isObject3D ? (e.parent !== null && e.parent.remove(e), e.parent = this, this.children.push(e), e.dispatchEvent(MI)) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this); } remove(e) { if (arguments.length > 1) { for (let i = 0; i < arguments.length; i++) this.remove(arguments[i]); return this; } const t = this.children.indexOf(e); return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(Mg)), this; } removeFromParent() { const e = this.parent; return e !== null && e.remove(this), this; } clear() { for (let e = 0; e < this.children.length; e++) { const t = this.children[e]; t.parent = null, t.dispatchEvent(Mg); } return this.children.length = 0, this; } attach(e) { return this.updateWorldMatrix(!0, !1), Xi.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), Xi.multiply(e.parent.matrixWorld)), e.applyMatrix4(Xi), this.add(e), e.updateWorldMatrix(!1, !0), this; } getObjectById(e) { return this.getObjectByProperty("id", e); } getObjectByName(e) { return this.getObjectByProperty("name", e); } getObjectByProperty(e, t) { if (this[e] === t) return this; for (let i = 0, r = this.children.length; i < r; i++) { const o = this.children[i].getObjectByProperty(e, t); if (o !== void 0) return o; } } getWorldPosition(e) { return this.updateWorldMatrix(!0, !1), e.setFromMatrixPosition(this.matrixWorld); } getWorldQuaternion(e) { return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(wa, e, xI), e; } getWorldScale(e) { return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(wa, wI, e), e; } getWorldDirection(e) { this.updateWorldMatrix(!0, !1); const t = this.matrixWorld.elements; return e.set(t[8], t[9], t[10]).normalize(); } raycast() { } traverse(e) { e(this); const t = this.children; for (let i = 0, r = t.length; i < r; i++) t[i].traverse(e); } traverseVisible(e) { if (this.visible === !1) return; e(this); const t = this.children; for (let i = 0, r = t.length; i < r; i++) t[i].traverseVisible(e); } traverseAncestors(e) { const t = this.parent; t !== null && (e(t), t.traverseAncestors(e)); } updateMatrix() { this.matrix.compose(this.position, this.quaternion, this.scale), this.matrixWorldNeedsUpdate = !0; } updateMatrixWorld(e) { this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || e) && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), this.matrixWorldNeedsUpdate = !1, e = !0); const t = this.children; for (let i = 0, r = t.length; i < r; i++) t[i].updateMatrixWorld(e); } updateWorldMatrix(e, t) { const i = this.parent; if (e === !0 && i !== null && i.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), t === !0) { const r = this.children; for (let s = 0, o = r.length; s < o; s++) r[s].updateWorldMatrix(!1, !0); } } toJSON(e) { const t = e === void 0 || typeof e == "string", i = {}; t && (e = { geometries: {}, materials: {}, textures: {}, images: {}, shapes: {}, skeletons: {}, animations: {} }, i.metadata = { version: 4.5, type: "Object", generator: "Object3D.toJSON" }); const r = {}; r.uuid = this.uuid, r.type = this.type, this.name !== "" && (r.name = this.name), this.castShadow === !0 && (r.castShadow = !0), this.receiveShadow === !0 && (r.receiveShadow = !0), this.visible === !1 && (r.visible = !1), this.frustumCulled === !1 && (r.frustumCulled = !1), this.renderOrder !== 0 && (r.renderOrder = this.renderOrder), JSON.stringify(this.userData) !== "{}" && (r.userData = this.userData), r.layers = this.layers.mask, r.matrix = this.matrix.toArray(), this.matrixAutoUpdate === !1 && (r.matrixAutoUpdate = !1), this.isInstancedMesh && (r.type = "InstancedMesh", r.count = this.count, r.instanceMatrix = this.instanceMatrix.toJSON(), this.instanceColor !== null && (r.instanceColor = this.instanceColor.toJSON())); function s(a, c) { return a[c.uuid] === void 0 && (a[c.uuid] = c.toJSON(e)), c.uuid; } if (this.isScene) this.background && (this.background.isColor ? r.background = this.background.toJSON() : this.background.isTexture && (r.background = this.background.toJSON(e).uuid)), this.environment && this.environment.isTexture && (r.environment = this.environment.toJSON(e).uuid); else if (this.isMesh || this.isLine || this.isPoints) { r.geometry = s(e.geometries, this.geometry); const a = this.geometry.parameters; if (a !== void 0 && a.shapes !== void 0) { const c = a.shapes; if (Array.isArray(c)) for (let l = 0, d = c.length; l < d; l++) { const h = c[l]; s(e.shapes, h); } else s(e.shapes, c); } } if (this.isSkinnedMesh && (r.bindMode = this.bindMode, r.bindMatrix = this.bindMatrix.toArray(), this.skeleton !== void 0 && (s(e.skeletons, this.skeleton), r.skeleton = this.skeleton.uuid)), this.material !== void 0) if (Array.isArray(this.material)) { const a = []; for (let c = 0, l = this.material.length; c < l; c++) a.push(s(e.materials, this.material[c])); r.material = a; } else r.material = s(e.materials, this.material); if (this.children.length > 0) { r.children = []; for (let a = 0; a < this.children.length; a++) r.children.push(this.children[a].toJSON(e).object); } if (this.animations.length > 0) { r.animations = []; for (let a = 0; a < this.animations.length; a++) { const c = this.animations[a]; r.animations.push(s(e.animations, c)); } } if (t) { const a = o(e.geometries), c = o(e.materials), l = o(e.textures), d = o(e.images), h = o(e.shapes), p = o(e.skeletons), g = o(e.animations); a.length > 0 && (i.geometries = a), c.length > 0 && (i.materials = c), l.length > 0 && (i.textures = l), d.length > 0 && (i.images = d), h.length > 0 && (i.shapes = h), p.length > 0 && (i.skeletons = p), g.length > 0 && (i.animations = g); } return i.object = r, i; function o(a) { const c = []; for (const l in a) { const d = a[l]; delete d.metadata, c.push(d); } return c; } } clone(e) { return new this.constructor().copy(this, e); } copy(e, t = !0) { if (this.name = e.name, this.up.copy(e.up), this.position.copy(e.position), this.rotation.order = e.rotation.order, this.quaternion.copy(e.quaternion), this.scale.copy(e.scale), this.matrix.copy(e.matrix), this.matrixWorld.copy(e.matrixWorld), this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate, this.layers.mask = e.layers.mask, this.visible = e.visible, this.castShadow = e.castShadow, this.receiveShadow = e.receiveShadow, this.frustumCulled = e.frustumCulled, this.renderOrder = e.renderOrder, this.userData = JSON.parse(JSON.stringify(e.userData)), t === !0) for (let i = 0; i < e.children.length; i++) { const r = e.children[i]; this.add(r.clone()); } return this; } } ot.DefaultUp = new X(0, 1, 0); ot.DefaultMatrixAutoUpdate = !0; ot.prototype.isObject3D = !0; const di = /* @__PURE__ */ new X(), Yi = /* @__PURE__ */ new X(), ph = /* @__PURE__ */ new X(), Ji = /* @__PURE__ */ new X(), io = /* @__PURE__ */ new X(), ro = /* @__PURE__ */ new X(), Sg = /* @__PURE__ */ new X(), mh = /* @__PURE__ */ new X(), gh = /* @__PURE__ */ new X(), vh = /* @__PURE__ */ new X(); class Qt { constructor(e = new X(), t = new X(), i = new X()) { this.a = e, this.b = t, this.c = i; } static getNormal(e, t, i, r) { r.subVectors(i, t), di.subVectors(e, t), r.cross(di); const s = r.lengthSq(); return s > 0 ? r.multiplyScalar(1 / Math.sqrt(s)) : r.set(0, 0, 0); } // static/instance method to calculate barycentric coordinates // based on: http://www.blackpawn.com/texts/pointinpoly/default.html static getBarycoord(e, t, i, r, s) { di.subVectors(r, t), Yi.subVectors(i, t), ph.subVectors(e, t); const o = di.dot(di), a = di.dot(Yi), c = di.dot(ph), l = Yi.dot(Yi), d = Yi.dot(ph), h = o * l - a * a; if (h === 0) return s.set(-2, -1, -1); const p = 1 / h, g = (l * c - a * d) * p, f = (o * d - a * c) * p; return s.set(1 - g - f, f, g); } static containsPoint(e, t, i, r) { return this.getBarycoord(e, t, i, r, Ji), Ji.x >= 0 && Ji.y >= 0 && Ji.x + Ji.y <= 1; } static getUV(e, t, i, r, s, o, a, c) { return this.getBarycoord(e, t, i, r, Ji), c.set(0, 0), c.addScaledVector(s, Ji.x), c.addScaledVector(o, Ji.y), c.addScaledVector(a, Ji.z), c; } static isFrontFacing(e, t, i, r) { return di.subVectors(i, t), Yi.subVectors(e, t), di.cross(Yi).dot(r) < 0; } set(e, t, i) { return this.a.copy(e), this.b.copy(t), this.c.copy(i), this; } setFromPointsAndIndices(e, t, i, r) { return this.a.copy(e[t]), this.b.copy(e[i]), this.c.copy(e[r]), this; } clone() { return new this.constructor().copy(this); } copy(e) { return this.a.copy(e.a), this.b.copy(e.b), this.c.copy(e.c), this; } getArea() { return di.subVectors(this.c, this.b), Yi.subVectors(this.a, this.b), di.cross(Yi).length() * 0.5; } getMidpoint(e) { return e.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3); } getNormal(e) { return Qt.getNormal(this.a, this.b, this.c, e); } getPlane(e) { return e.setFromCoplanarPoints(this.a, this.b, this.c); } getBarycoord(e, t) { return Qt.getBarycoord(e, this.a, this.b, this.c, t); } getUV(e, t, i, r, s) { return Qt.getUV(e, this.a, this.b, this.c, t, i, r, s); } containsPoint(e) { return Qt.containsPoint(e, this.a, this.b, this.c); } isFrontFacing(e) { return Qt.isFrontFacing(this.a, this.b, this.c, e); } intersectsBox(e) { return e.intersectsTriangle(this); } closestPointToPoint(e, t) { const i = this.a, r = this.b, s = this.c; let o, a; io.subVectors(r, i), ro.subVectors(s, i), mh.subVectors(e, i); const c = io.dot(mh), l = ro.dot(mh); if (c <= 0 && l <= 0) return t.copy(i); gh.subVectors(e, r); const d = io.dot(gh), h = ro.dot(gh); if (d >= 0 && h <= d) return t.copy(r); const p = c * h - d * l; if (p <= 0 && c >= 0 && d <= 0) return o = c / (c - d), t.copy(i).addScaledVector(io, o); vh.subVectors(e, s); const g = io.dot(vh), f = ro.dot(vh); if (f >= 0 && g <= f) return t.copy(s); const u = g * l - c * f; if (u <= 0 && l >= 0 && f <= 0) return a = l / (l - f), t.copy(i).addScaledVector(ro, a); const y = d * f - g * h; if (y <= 0 && h - d >= 0 && g - f >= 0) return Sg.subVectors(s, r), a = (h - d) / (h - d + (g - f)), t.copy(r).addScaledVector(Sg, a); const v = 1 / (y + u + p); return o = u * v, a = p * v, t.copy(i).addScaledVector(io, o).addScaledVector(ro, a); } equals(e) { return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c); } } let SI = 0; class sn extends ns { constructor() { super(), Object.defineProperty(this, "id", { value: SI++ }), this.uuid = Jn(), this.name = "", this.type = "Material", this.fog = !0, this.blending = _o, this.side = Xr, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.blendSrc = Gf, this.blendDst = Hf, this.blendEquation = ys, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.depthFunc = Kc, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = hx, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = kc, this.stencilZFail = kc, this.stencilZPass = kc, this.stencilWrite = !1, this.clippingPlanes = null, this.clipIntersection = !1, this.clipShadows = !1, this.shadowSide = null, this.colorWrite = !0, this.precision = null, this.polygonOffset = !1, this.polygonOffsetFactor = 0, this.polygonOffsetUnits = 0, this.dithering = !1, this.alphaTest = 0, this.alphaToCoverage = !1, this.premultipliedAlpha = !1, this.visible = !0, this.toneMapped = !0, this.userData = {}, this.version = 0; } onBuild() { } onBeforeCompile() { } customProgramCacheKey() { return this.onBeforeCompile.toString(); } setValues(e) { if (e !== void 0) for (const t in e) { const i = e[t]; if (i === void 0) { console.warn("THREE.Material: '" + t + "' parameter is undefined."); continue; } if (t === "shading") { console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."), this.flatShading = i === kf; continue; } const r = this[t]; if (r === void 0) { console.warn("THREE." + this.type + ": '" + t + "' is not a property of this material."); continue; } r && r.isColor ? r.set(i) : r && r.isVector3 && i && i.isVector3 ? r.copy(i) : this[t] = i; } } toJSON(e) { const t = e === void 0 || typeof e == "string"; t && (e = { textures: {}, images: {} }); const i = { metadata: { version: 4.5, type: "Material", generator: "Material.toJSON" } }; i.uuid = this.uuid, i.type = this.type, this.name !== "" && (i.name = this.name), this.color && this.color.isColor && (i.color = this.color.getHex()), this.roughness !== void 0 && (i.roughness = this.roughness), this.metalness !== void 0 && (i.metalness = this.metalness), this.sheen && this.sheen.isColor && (i.sheen = this.sheen.getHex()), this.emissive && this.emissive.isColor && (i.emissive = this.emissive.getHex()), this.emissiveIntensity && this.emissiveIntensity !== 1 && (i.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (i.specular = this.specular.getHex()), this.shininess !== void 0 && (i.shininess = this.shininess), this.clearcoat !== void 0 && (i.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (i.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (i.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (i.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (i.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, i.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.map && this.map.isTexture && (i.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (i.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (i.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (i.lightMap = this.lightMap.toJSON(e).uuid, i.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (i.aoMap = this.aoMap.toJSON(e).uuid, i.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (i.bumpMap = this.bumpMap.toJSON(e).uuid, i.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (i.normalMap = this.normalMap.toJSON(e).uuid, i.normalMapType = this.normalMapType, i.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (i.displacementMap = this.displacementMap.toJSON(e).uuid, i.displacementScale = this.displacementScale, i.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (i.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (i.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (i.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (i.specularMap = this.specularMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (i.envMap = this.envMap.toJSON(e).uuid, this.combine !== void 0 && (i.combine = this.combine)), this.envMapIntensity !== void 0 && (i.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (i.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (i.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (i.gradientMap = this.gradientMap.toJSON(e).uuid), this.transmission !== void 0 && (i.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (i.transmissionMap = this.transmissionMap.toJSON(e).uuid), this.thickness !== void 0 && (i.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (i.thicknessMap = this.thicknessMap.toJSON(e).uuid), this.attenuationDistance !== void 0 && (i.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (i.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (i.size = this.size), this.shadowSide !== null && (i.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (i.sizeAttenuation = this.sizeAttenuation), this.blending !== _o && (i.blending = this.blending), this.side !== Xr && (i.side = this.side), this.vertexColors && (i.vertexColors = !0), this.opacity < 1 && (i.opacity = this.opacity), this.transparent === !0 && (i.transparent = this.transparent), i.depthFunc = this.depthFunc, i.depthTest = this.depthTest, i.depthWrite = this.depthWrite, i.colorWrite = this.colorWrite, i.stencilWrite = this.stencilWrite, i.stencilWriteMask = this.stencilWriteMask, i.stencilFunc = this.stencilFunc, i.stencilRef = this.stencilRef, i.stencilFuncMask = this.stencilFuncMask, i.stencilFail = this.stencilFail, i.stencilZFail = this.stencilZFail, i.stencilZPass = this.stencilZPass, this.rotation && this.rotation !== 0 && (i.rotation = this.rotation), this.polygonOffset === !0 && (i.polygonOffset = !0), this.polygonOffsetFactor !== 0 && (i.polygonOffsetFactor = this.polygonOffsetFactor), this.polygonOffsetUnits !== 0 && (i.polygonOffsetUnits = this.polygonOffsetUnits), this.linewidth && this.linewidth !== 1 && (i.linewidth = this.linewidth), this.dashSize !== void 0 && (i.dashSize = this.dashSize), this.gapSize !== void 0 && (i.gapSize = this.gapSize), this.scale !== void 0 && (i.scale = this.scale), this.dithering === !0 && (i.dithering = !0), this.alphaTest > 0 && (i.alphaTest = this.alphaTest), this.alphaToCoverage === !0 && (i.alphaToCoverage = this.alphaToCoverage), this.premultipliedAlpha === !0 && (i.premultipliedAlpha = this.premultipliedAlpha), this.wireframe === !0 && (i.wireframe = this.wireframe), this.wireframeLinewidth > 1 && (i.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== "round" && (i.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== "round" && (i.wireframeLinejoin = this.wireframeLinejoin), this.morphTargets === !0 && (i.morphTargets = !0), this.morphNormals === !0 && (i.morphNormals = !0), this.flatShading === !0 && (i.flatShading = this.flatShading), this.visible === !1 && (i.visible = !1), this.toneMapped === !1 && (i.toneMapped = !1), JSON.stringify(this.userData) !== "{}" && (i.userData = this.userData); function r(s) { const o = []; for (const a in s) { const c = s[a]; delete c.metadata, o.push(c); } return o; } if (t) { const s = r(e.textures), o = r(e.images); s.length > 0 && (i.textures = s), o.length > 0 && (i.images = o); } return i; } clone() { return new this.constructor().copy(this); } copy(e) { this.name = e.name, this.fog = e.fog, this.blending = e.blending, this.side = e.side, this.vertexColors = e.vertexColors, this.opacity = e.opacity, this.transparent = e.transparent, this.blendSrc = e.blendSrc, this.blendDst = e.blendDst, this.blendEquation = e.blendEquation, this.blendSrcAlpha = e.blendSrcAlpha, this.blendDstAlpha = e.blendDstAlpha, this.blendEquationAlpha = e.blendEquationAlpha, this.depthFunc = e.depthFunc, this.depthTest = e.depthTest, this.depthWrite = e.depthWrite, this.stencilWriteMask = e.stencilWriteMask, this.stencilFunc = e.stencilFunc, this.stencilRef = e.stencilRef, this.stencilFuncMask = e.stencilFuncMask, this.stencilFail = e.stencilFail, this.stencilZFail = e.stencilZFail, this.stencilZPass = e.stencilZPass, this.stencilWrite = e.stencilWrite; const t = e.clippingPlanes; let i = null; if (t !== null) { const r = t.length; i = new Array(r); for (let s = 0; s !== r; ++s) i[s] = t[s].clone(); } return this.clippingPlanes = i, this.clipIntersection = e.clipIntersection, this.clipShadows = e.clipShadows, this.shadowSide = e.shadowSide, this.colorWrite = e.colorWrite, this.precision = e.precision, this.polygonOffset = e.polygonOffset, this.polygonOffsetFactor = e.polygonOffsetFactor, this.polygonOffsetUnits = e.polygonOffsetUnits, this.dithering = e.dithering, this.alphaTest = e.alphaTest, this.alphaToCoverage = e.alphaToCoverage, this.premultipliedAlpha = e.premultipliedAlpha, this.visible = e.visible, this.toneMapped = e.toneMapped, this.userData = JSON.parse(JSON.stringify(e.userData)), this; } dispose() { this.dispatchEvent({ type: "dispose" }); } set needsUpdate(e) { e === !0 && this.version++; } } sn.prototype.isMaterial = !0; const mx = { aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategray: 7372944, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 }, fi = { h: 0, s: 0, l: 0 }, Jl = { h: 0, s: 0, l: 0 }; function yh(n, e, t) { return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? n + (e - n) * 6 * t : t < 1 / 2 ? e : t < 2 / 3 ? n + (e - n) * 6 * (2 / 3 - t) : n; } function bh(n) { return n < 0.04045 ? n * 0.0773993808 : Math.pow(n * 0.9478672986 + 0.0521327014, 2.4); } function xh(n) { return n < 31308e-7 ? n * 12.92 : 1.055 * Math.pow(n, 0.41666) - 0.055; } class Fe { constructor(e, t, i) { return t === void 0 && i === void 0 ? this.set(e) : this.setRGB(e, t, i); } set(e) { return e && e.isColor ? this.copy(e) : typeof e == "number" ? this.setHex(e) : typeof e == "string" && this.setStyle(e), this; } setScalar(e) { return this.r = e, this.g = e, this.b = e, this; } setHex(e) { return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255, this; } setRGB(e, t, i) { return this.r = e, this.g = t, this.b = i, this; } setHSL(e, t, i) { if (e = Yf(e, 1), t = wn(t, 0, 1), i = wn(i, 0, 1), t === 0) this.r = this.g = this.b = i; else { const r = i <= 0.5 ? i * (1 + t) : i + t - i * t, s = 2 * i - r; this.r = yh(s, r, e + 1 / 3), this.g = yh(s, r, e), this.b = yh(s, r, e - 1 / 3); } return this; } setStyle(e) { function t(r) { r !== void 0 && parseFloat(r) < 1 && console.warn("THREE.Color: Alpha component of " + e + " will be ignored."); } let i; if (i = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)) { let r; const s = i[1], o = i[2]; switch (s) { case "rgb": case "rgba": if (r = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return this.r = Math.min(255, parseInt(r[1], 10)) / 255, this.g = Math.min(255, parseInt(r[2], 10)) / 255, this.b = Math.min(255, parseInt(r[3], 10)) / 255, t(r[4]), this; if (r = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return this.r = Math.min(100, parseInt(r[1], 10)) / 100, this.g = Math.min(100, parseInt(r[2], 10)) / 100, this.b = Math.min(100, parseInt(r[3], 10)) / 100, t(r[4]), this; break; case "hsl": case "hsla": if (r = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) { const a = parseFloat(r[1]) / 360, c = parseInt(r[2], 10) / 100, l = parseInt(r[3], 10) / 100; return t(r[4]), this.setHSL(a, c, l); } break; } } else if (i = /^\#([A-Fa-f\d]+)$/.exec(e)) { const r = i[1], s = r.length; if (s === 3) return this.r = parseInt(r.charAt(0) + r.charAt(0), 16) / 255, this.g = parseInt(r.charAt(1) + r.charAt(1), 16) / 255, this.b = parseInt(r.charAt(2) + r.charAt(2), 16) / 255, this; if (s === 6) return this.r = parseInt(r.charAt(0) + r.charAt(1), 16) / 255, this.g = parseInt(r.charAt(2) + r.charAt(3), 16) / 255, this.b = parseInt(r.charAt(4) + r.charAt(5), 16) / 255, this; } return e && e.length > 0 ? this.setColorName(e) : this; } setColorName(e) { const t = mx[e.toLowerCase()]; return t !== void 0 ? this.setHex(t) : console.warn("THREE.Color: Unknown color " + e), this; } clone() { return new this.constructor(this.r, this.g, this.b); } copy(e) { return this.r = e.r, this.g = e.g, this.b = e.b, this; } copyGammaToLinear(e, t = 2) { return this.r = Math.pow(e.r, t), this.g = Math.pow(e.g, t), this.b = Math.pow(e.b, t), this; } copyLinearToGamma(e, t = 2) { const i = t > 0 ? 1 / t : 1; return this.r = Math.pow(e.r, i), this.g = Math.pow(e.g, i), this.b = Math.pow(e.b, i), this; } convertGammaToLinear(e) { return this.copyGammaToLinear(this, e), this; } convertLinearToGamma(e) { return this.copyLinearToGamma(this, e), this; } copySRGBToLinear(e) { return this.r = bh(e.r), this.g = bh(e.g), this.b = bh(e.b), this; } copyLinearToSRGB(e) { return this.r = xh(e.r), this.g = xh(e.g), this.b = xh(e.b), this; } convertSRGBToLinear() { return this.copySRGBToLinear(this), this; } convertLinearToSRGB() { return this.copyLinearToSRGB(this), this; } getHex() { return this.r * 255 << 16 ^ this.g * 255 << 8 ^ this.b * 255 << 0; } getHexString() { return ("000000" + this.getHex().toString(16)).slice(-6); } getHSL(e) { const t = this.r, i = this.g, r = this.b, s = Math.max(t, i, r), o = Math.min(t, i, r); let a, c; const l = (o + s) / 2; if (o === s) a = 0, c = 0; else { const d = s - o; switch (c = l <= 0.5 ? d / (s + o) : d / (2 - s - o), s) { case t: a = (i - r) / d + (i < r ? 6 : 0); break; case i: a = (r - t) / d + 2; break; case r: a = (t - i) / d + 4; break; } a /= 6; } return e.h = a, e.s = c, e.l = l, e; } getStyle() { return "rgb(" + (this.r * 255 | 0) + "," + (this.g * 255 | 0) + "," + (this.b * 255 | 0) + ")"; } offsetHSL(e, t, i) { return this.getHSL(fi), fi.h += e, fi.s += t, fi.l += i, this.setHSL(fi.h, fi.s, fi.l), this; } add(e) { return this.r += e.r, this.g += e.g, this.b += e.b, this; } addColors(e, t) { return this.r = e.r + t.r, this.g = e.g + t.g, this.b = e.b + t.b, this; } addScalar(e) { return this.r += e, this.g += e, this.b += e, this; } sub(e) { return this.r = Math.max(0, this.r - e.r), this.g = Math.max(0, this.g - e.g), this.b = Math.max(0, this.b - e.b), this; } multiply(e) { return this.r *= e.r, this.g *= e.g, this.b *= e.b, this; } multiplyScalar(e) { return this.r *= e, this.g *= e, this.b *= e, this; } lerp(e, t) { return this.r += (e.r - this.r) * t, this.g += (e.g - this.g) * t, this.b += (e.b - this.b) * t, this; } lerpColors(e, t, i) { return this.r = e.r + (t.r - e.r) * i, this.g = e.g + (t.g - e.g) * i, this.b = e.b + (t.b - e.b) * i, this; } lerpHSL(e, t) { this.getHSL(fi), e.getHSL(Jl); const i = ka(fi.h, Jl.h, t), r = ka(fi.s, Jl.s, t), s = ka(fi.l, Jl.l, t); return this.setHSL(i, r, s), this; } equals(e) { return e.r === this.r && e.g === this.g && e.b === this.b; } fromArray(e, t = 0) { return this.r = e[t], this.g = e[t + 1], this.b = e[t + 2], this; } toArray(e = [], t = 0) { return e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, e; } fromBufferAttribute(e, t) { return this.r = e.getX(t), this.g = e.getY(t), this.b = e.getZ(t), e.normalized === !0 && (this.r /= 255, this.g /= 255, this.b /= 255), this; } toJSON() { return this.getHex(); } } Fe.NAMES = mx; Fe.prototype.isColor = !0; Fe.prototype.r = 1; Fe.prototype.g = 1; Fe.prototype.b = 1; class Vn extends sn { constructor(e) { super(), this.type = "MeshBasicMaterial", this.color = new Fe(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = vl, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this; } } Vn.prototype.isMeshBasicMaterial = !0; const At = /* @__PURE__ */ new X(), ql = /* @__PURE__ */ new Pe(); class nt { constructor(e, t, i) { if (Array.isArray(e)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); this.name = "", this.array = e, this.itemSize = t, this.count = e !== void 0 ? e.length / t : 0, this.normalized = i === !0, this.usage = zo, this.updateRange = { offset: 0, count: -1 }, this.version = 0; } onUploadCallback() { } set needsUpdate(e) { e === !0 && this.version++; } setUsage(e) { return this.usage = e, this; } copy(e) { return this.name = e.name, this.array = new e.array.constructor(e.array), this.itemSize = e.itemSize, this.count = e.count, this.normalized = e.normalized, this.usage = e.usage, this; } copyAt(e, t, i) { e *= this.itemSize, i *= t.itemSize; for (let r = 0, s = this.itemSize; r < s; r++) this.array[e + r] = t.array[i + r]; return this; } copyArray(e) { return this.array.set(e), this; } copyColorsArray(e) { const t = this.array; let i = 0; for (let r = 0, s = e.length; r < s; r++) { let o = e[r]; o === void 0 && (console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined", r), o = new Fe()), t[i++] = o.r, t[i++] = o.g, t[i++] = o.b; } return this; } copyVector2sArray(e) { const t = this.array; let i = 0; for (let r = 0, s = e.length; r < s; r++) { let o = e[r]; o === void 0 && (console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined", r), o = new Pe()), t[i++] = o.x, t[i++] = o.y; } return this; } copyVector3sArray(e) { const t = this.array; let i = 0; for (let r = 0, s = e.length; r < s; r++) { let o = e[r]; o === void 0 && (console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined", r), o = new X()), t[i++] = o.x, t[i++] = o.y, t[i++] = o.z; } return this; } copyVector4sArray(e) { const t = this.array; let i = 0; for (let r = 0, s = e.length; r < s; r++) { let o = e[r]; o === void 0 && (console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined", r), o = new _t()), t[i++] = o.x, t[i++] = o.y, t[i++] = o.z, t[i++] = o.w; } return this; } applyMatrix3(e) { if (this.itemSize === 2) for (let t = 0, i = this.count; t < i; t++) ql.fromBufferAttribute(this, t), ql.applyMatrix3(e), this.setXY(t, ql.x, ql.y); else if (this.itemSize === 3) for (let t = 0, i = this.count; t < i; t++) At.fromBufferAttribute(this, t), At.applyMatrix3(e), this.setXYZ(t, At.x, At.y, At.z); return this; } applyMatrix4(e) { for (let t = 0, i = this.count; t < i; t++) At.x = this.getX(t), At.y = this.getY(t), At.z = this.getZ(t), At.applyMatrix4(e), this.setXYZ(t, At.x, At.y, At.z); return this; } applyNormalMatrix(e) { for (let t = 0, i = this.count; t < i; t++) At.x = this.getX(t), At.y = this.getY(t), At.z = this.getZ(t), At.applyNormalMatrix(e), this.setXYZ(t, At.x, At.y, At.z); return this; } transformDirection(e) { for (let t = 0, i = this.count; t < i; t++) At.x = this.getX(t), At.y = this.getY(t), At.z = this.getZ(t), At.transformDirection(e), this.setXYZ(t, At.x, At.y, At.z); return this; } set(e, t = 0) { return this.array.set(e, t), this; } getX(e) { return this.array[e * this.itemSize]; } setX(e, t) { return this.array[e * this.itemSize] = t, this; } getY(e) { return this.array[e * this.itemSize + 1]; } setY(e, t) { return this.array[e * this.itemSize + 1] = t, this; } getZ(e) { return this.array[e * this.itemSize + 2]; } setZ(e, t) { return this.array[e * this.itemSize + 2] = t, this; } getW(e) { return this.array[e * this.itemSize + 3]; } setW(e, t) { return this.array[e * this.itemSize + 3] = t, this; } setXY(e, t, i) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = i, this; } setXYZ(e, t, i, r) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = i, this.array[e + 2] = r, this; } setXYZW(e, t, i, r, s) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = i, this.array[e + 2] = r, this.array[e + 3] = s, this; } onUpload(e) { return this.onUploadCallback = e, this; } clone() { return new this.constructor(this.array, this.itemSize).copy(this); } toJSON() { const e = { itemSize: this.itemSize, type: this.array.constructor.name, array: Array.prototype.slice.call(this.array), normalized: this.normalized }; return this.name !== "" && (e.name = this.name), this.usage !== zo && (e.usage = this.usage), (this.updateRange.offset !== 0 || this.updateRange.count !== -1) && (e.updateRange = this.updateRange), e; } } nt.prototype.isBufferAttribute = !0; class gx extends nt { constructor(e, t, i) { super(new Int8Array(e), t, i); } } class vx extends nt { constructor(e, t, i) { super(new Uint8Array(e), t, i); } } class yx extends nt { constructor(e, t, i) { super(new Uint8ClampedArray(e), t, i); } } class bx extends nt { constructor(e, t, i) { super(new Int16Array(e), t, i); } } class Lu extends nt { constructor(e, t, i) { super(new Uint16Array(e), t, i); } } class xx extends nt { constructor(e, t, i) { super(new Int32Array(e), t, i); } } class Ru extends nt { constructor(e, t, i) { super(new Uint32Array(e), t, i); } } class wx extends nt { constructor(e, t, i) { super(new Uint16Array(e), t, i); } } wx.prototype.isFloat16BufferAttribute = !0; class We extends nt { constructor(e, t, i) { super(new Float32Array(e), t, i); } } class Mx extends nt { constructor(e, t, i) { super(new Float64Array(e), t, i); } } function Sx(n) { if (n.length === 0) return -1 / 0; let e = n[0]; for (let t = 1, i = n.length; t < i; ++t) n[t] > e && (e = n[t]); return e; } const _I = { Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array }; function Mo(n, e) { return new _I[n](e); } let TI = 0; const ti = /* @__PURE__ */ new $e(), wh = /* @__PURE__ */ new ot(), so = /* @__PURE__ */ new X(), jn = /* @__PURE__ */ new Hn(), Ma = /* @__PURE__ */ new Hn(), dn = /* @__PURE__ */ new X(); class Je extends ns { constructor() { super(), Object.defineProperty(this, "id", { value: TI++ }), this.uuid = Jn(), this.name = "", this.type = "BufferGeometry", this.index = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = { start: 0, count: 1 / 0 }, this.userData = {}; } getIndex() { return this.index; } setIndex(e) { return Array.isArray(e) ? this.index = new (Sx(e) > 65535 ? Ru : Lu)(e, 1) : this.index = e, this; } getAttribute(e) { return this.attributes[e]; } setAttribute(e, t) { return this.attributes[e] = t, this; } deleteAttribute(e) { return delete this.attributes[e], this; } hasAttribute(e) { return this.attributes[e] !== void 0; } addGroup(e, t, i = 0) { this.groups.push({ start: e, count: t, materialIndex: i }); } clearGroups() { this.groups = []; } setDrawRange(e, t) { this.drawRange.start = e, this.drawRange.count = t; } applyMatrix4(e) { const t = this.attributes.position; t !== void 0 && (t.applyMatrix4(e), t.needsUpdate = !0); const i = this.attributes.normal; if (i !== void 0) { const s = new ln().getNormalMatrix(e); i.applyNormalMatrix(s), i.needsUpdate = !0; } const r = this.attributes.tangent; return r !== void 0 && (r.transformDirection(e), r.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this; } applyQuaternion(e) { return ti.makeRotationFromQuaternion(e), this.applyMatrix4(ti), this; } rotateX(e) { return ti.makeRotationX(e), this.applyMatrix4(ti), this; } rotateY(e) { return ti.makeRotationY(e), this.applyMatrix4(ti), this; } rotateZ(e) { return ti.makeRotationZ(e), this.applyMatrix4(ti), this; } translate(e, t, i) { return ti.makeTranslation(e, t, i), this.applyMatrix4(ti), this; } scale(e, t, i) { return ti.makeScale(e, t, i), this.applyMatrix4(ti), this; } lookAt(e) { return wh.lookAt(e), wh.updateMatrix(), this.applyMatrix4(wh.matrix), this; } center() { return this.computeBoundingBox(), this.boundingBox.getCenter(so).negate(), this.translate(so.x, so.y, so.z), this; } setFromPoints(e) { const t = []; for (let i = 0, r = e.length; i < r; i++) { const s = e[i]; t.push(s.x, s.y, s.z || 0); } return this.setAttribute("position", new We(t, 3)), this; } computeBoundingBox() { this.boundingBox === null && (this.boundingBox = new Hn()); const e = this.attributes.position, t = this.morphAttributes.position; if (e && e.isGLBufferAttribute) { console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this), this.boundingBox.set( new X(-1 / 0, -1 / 0, -1 / 0), new X(1 / 0, 1 / 0, 1 / 0) ); return; } if (e !== void 0) { if (this.boundingBox.setFromBufferAttribute(e), t) for (let i = 0, r = t.length; i < r; i++) { const s = t[i]; jn.setFromBufferAttribute(s), this.morphTargetsRelative ? (dn.addVectors(this.boundingBox.min, jn.min), this.boundingBox.expandByPoint(dn), dn.addVectors(this.boundingBox.max, jn.max), this.boundingBox.expandByPoint(dn)) : (this.boundingBox.expandByPoint(jn.min), this.boundingBox.expandByPoint(jn.max)); } } else this.boundingBox.makeEmpty(); (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) && console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this); } computeBoundingSphere() { this.boundingSphere === null && (this.boundingSphere = new xr()); const e = this.attributes.position, t = this.morphAttributes.position; if (e && e.isGLBufferAttribute) { console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this), this.boundingSphere.set(new X(), 1 / 0); return; } if (e) { const i = this.boundingSphere.center; if (jn.setFromBufferAttribute(e), t) for (let s = 0, o = t.length; s < o; s++) { const a = t[s]; Ma.setFromBufferAttribute(a), this.morphTargetsRelative ? (dn.addVectors(jn.min, Ma.min), jn.expandByPoint(dn), dn.addVectors(jn.max, Ma.max), jn.expandByPoint(dn)) : (jn.expandByPoint(Ma.min), jn.expandByPoint(Ma.max)); } jn.getCenter(i); let r = 0; for (let s = 0, o = e.count; s < o; s++) dn.fromBufferAttribute(e, s), r = Math.max(r, i.distanceToSquared(dn)); if (t) for (let s = 0, o = t.length; s < o; s++) { const a = t[s], c = this.morphTargetsRelative; for (let l = 0, d = a.count; l < d; l++) dn.fromBufferAttribute(a, l), c && (so.fromBufferAttribute(e, l), dn.add(so)), r = Math.max(r, i.distanceToSquared(dn)); } this.boundingSphere.radius = Math.sqrt(r), isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this); } } computeFaceNormals() { } computeTangents() { const e = this.index, t = this.attributes; if (e === null || t.position === void 0 || t.normal === void 0 || t.uv === void 0) { console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)"); return; } const i = e.array, r = t.position.array, s = t.normal.array, o = t.uv.array, a = r.length / 3; t.tangent === void 0 && this.setAttribute("tangent", new nt(new Float32Array(4 * a), 4)); const c = t.tangent.array, l = [], d = []; for (let L = 0; L < a; L++) l[L] = new X(), d[L] = new X(); const h = new X(), p = new X(), g = new X(), f = new Pe(), u = new Pe(), y = new Pe(), v = new X(), m = new X(); function w(L, R, C) { h.fromArray(r, L * 3), p.fromArray(r, R * 3), g.fromArray(r, C * 3), f.fromArray(o, L * 2), u.fromArray(o, R * 2), y.fromArray(o, C * 2), p.sub(h), g.sub(h), u.sub(f), y.sub(f); const A = 1 / (u.x * y.y - y.x * u.y); isFinite(A) && (v.copy(p).multiplyScalar(y.y).addScaledVector(g, -u.y).multiplyScalar(A), m.copy(g).multiplyScalar(u.x).addScaledVector(p, -y.x).multiplyScalar(A), l[L].add(v), l[R].add(v), l[C].add(v), d[L].add(m), d[R].add(m), d[C].add(m)); } let S = this.groups; S.length === 0 && (S = [{ start: 0, count: i.length }]); for (let L = 0, R = S.length; L < R; ++L) { const C = S[L], A = C.start, P = C.count; for (let I = A, b = A + P; I < b; I += 3) w( i[I + 0], i[I + 1], i[I + 2] ); } const T = new X(), M = new X(), x = new X(), _ = new X(); function E(L) { x.fromArray(s, L * 3), _.copy(x); const R = l[L]; T.copy(R), T.sub(x.multiplyScalar(x.dot(R))).normalize(), M.crossVectors(_, R); const A = M.dot(d[L]) < 0 ? -1 : 1; c[L * 4] = T.x, c[L * 4 + 1] = T.y, c[L * 4 + 2] = T.z, c[L * 4 + 3] = A; } for (let L = 0, R = S.length; L < R; ++L) { const C = S[L], A = C.start, P = C.count; for (let I = A, b = A + P; I < b; I += 3) E(i[I + 0]), E(i[I + 1]), E(i[I + 2]); } } computeVertexNormals() { const e = this.index, t = this.getAttribute("position"); if (t !== void 0) { let i = this.getAttribute("normal"); if (i === void 0) i = new nt(new Float32Array(t.count * 3), 3), this.setAttribute("normal", i); else for (let p = 0, g = i.count; p < g; p++) i.setXYZ(p, 0, 0, 0); const r = new X(), s = new X(), o = new X(), a = new X(), c = new X(), l = new X(), d = new X(), h = new X(); if (e) for (let p = 0, g = e.count; p < g; p += 3) { const f = e.getX(p + 0), u = e.getX(p + 1), y = e.getX(p + 2); r.fromBufferAttribute(t, f), s.fromBufferAttribute(t, u), o.fromBufferAttribute(t, y), d.subVectors(o, s), h.subVectors(r, s), d.cross(h), a.fromBufferAttribute(i, f), c.fromBufferAttribute(i, u), l.fromBufferAttribute(i, y), a.add(d), c.add(d), l.add(d), i.setXYZ(f, a.x, a.y, a.z), i.setXYZ(u, c.x, c.y, c.z), i.setXYZ(y, l.x, l.y, l.z); } else for (let p = 0, g = t.count; p < g; p += 3) r.fromBufferAttribute(t, p + 0), s.fromBufferAttribute(t, p + 1), o.fromBufferAttribute(t, p + 2), d.subVectors(o, s), h.subVectors(r, s), d.cross(h), i.setXYZ(p + 0, d.x, d.y, d.z), i.setXYZ(p + 1, d.x, d.y, d.z), i.setXYZ(p + 2, d.x, d.y, d.z); this.normalizeNormals(), i.needsUpdate = !0; } } merge(e, t) { if (!(e && e.isBufferGeometry)) { console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.", e); return; } t === void 0 && (t = 0, console.warn( "THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge." )); const i = this.attributes; for (const r in i) { if (e.attributes[r] === void 0) continue; const o = i[r].array, a = e.attributes[r], c = a.array, l = a.itemSize * t, d = Math.min(c.length, o.length - l); for (let h = 0, p = l; h < d; h++, p++) o[p] = c[h]; } return this; } normalizeNormals() { const e = this.attributes.normal; for (let t = 0, i = e.count; t < i; t++) dn.fromBufferAttribute(e, t), dn.normalize(), e.setXYZ(t, dn.x, dn.y, dn.z); } toNonIndexed() { function e(a, c) { const l = a.array, d = a.itemSize, h = a.normalized, p = new l.constructor(c.length * d); let g = 0, f = 0; for (let u = 0, y = c.length; u < y; u++) { a.isInterleavedBufferAttribute ? g = c[u] * a.data.stride + a.offset : g = c[u] * d; for (let v = 0; v < d; v++) p[f++] = l[g++]; } return new nt(p, d, h); } if (this.index === null) return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."), this; const t = new Je(), i = this.index.array, r = this.attributes; for (const a in r) { const c = r[a], l = e(c, i); t.setAttribute(a, l); } const s = this.morphAttributes; for (const a in s) { const c = [], l = s[a]; for (let d = 0, h = l.length; d < h; d++) { const p = l[d], g = e(p, i); c.push(g); } t.morphAttributes[a] = c; } t.morphTargetsRelative = this.morphTargetsRelative; const o = this.groups; for (let a = 0, c = o.length; a < c; a++) { const l = o[a]; t.addGroup(l.start, l.count, l.materialIndex); } return t; } toJSON() { const e = { metadata: { version: 4.5, type: "BufferGeometry", generator: "BufferGeometry.toJSON" } }; if (e.uuid = this.uuid, e.type = this.type, this.name !== "" && (e.name = this.name), Object.keys(this.userData).length > 0 && (e.userData = this.userData), this.parameters !== void 0) { const c = this.parameters; for (const l in c) c[l] !== void 0 && (e[l] = c[l]); return e; } e.data = { attributes: {} }; const t = this.index; t !== null && (e.data.index = { type: t.array.constructor.name, array: Array.prototype.slice.call(t.array) }); const i = this.attributes; for (const c in i) { const l = i[c]; e.data.attributes[c] = l.toJSON(e.data); } const r = {}; let s = !1; for (const c in this.morphAttributes) { const l = this.morphAttributes[c], d = []; for (let h = 0, p = l.length; h < p; h++) { const g = l[h]; d.push(g.toJSON(e.data)); } d.length > 0 && (r[c] = d, s = !0); } s && (e.data.morphAttributes = r, e.data.morphTargetsRelative = this.morphTargetsRelative); const o = this.groups; o.length > 0 && (e.data.groups = JSON.parse(JSON.stringify(o))); const a = this.boundingSphere; return a !== null && (e.data.boundingSphere = { center: a.center.toArray(), radius: a.radius }), e; } clone() { return new Je().copy(this); } copy(e) { this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.boundingBox = null, this.boundingSphere = null; const t = {}; this.name = e.name; const i = e.index; i !== null && this.setIndex(i.clone(t)); const r = e.attributes; for (const l in r) { const d = r[l]; this.setAttribute(l, d.clone(t)); } const s = e.morphAttributes; for (const l in s) { const d = [], h = s[l]; for (let p = 0, g = h.length; p < g; p++) d.push(h[p].clone(t)); this.morphAttributes[l] = d; } this.morphTargetsRelative = e.morphTargetsRelative; const o = e.groups; for (let l = 0, d = o.length; l < d; l++) { const h = o[l]; this.addGroup(h.start, h.count, h.materialIndex); } const a = e.boundingBox; a !== null && (this.boundingBox = a.clone()); const c = e.boundingSphere; return c !== null && (this.boundingSphere = c.clone()), this.drawRange.start = e.drawRange.start, this.drawRange.count = e.drawRange.count, this.userData = e.userData, this; } dispose() { this.dispatchEvent({ type: "dispose" }); } } Je.prototype.isBufferGeometry = !0; const _g = /* @__PURE__ */ new $e(), oo = /* @__PURE__ */ new is(), Mh = /* @__PURE__ */ new xr(), Ar = /* @__PURE__ */ new X(), Cr = /* @__PURE__ */ new X(), Lr = /* @__PURE__ */ new X(), Sh = /* @__PURE__ */ new X(), _h = /* @__PURE__ */ new X(), Th = /* @__PURE__ */ new X(), Kl = /* @__PURE__ */ new X(), Ql = /* @__PURE__ */ new X(), ec = /* @__PURE__ */ new X(), tc = /* @__PURE__ */ new Pe(), nc = /* @__PURE__ */ new Pe(), ic = /* @__PURE__ */ new Pe(), Eh = /* @__PURE__ */ new X(), rc = /* @__PURE__ */ new X(); class tn extends ot { constructor(e = new Je(), t = new Vn()) { super(), this.type = "Mesh", this.geometry = e, this.material = t, this.updateMorphTargets(); } copy(e) { return super.copy(e), e.morphTargetInfluences !== void 0 && (this.morphTargetInfluences = e.morphTargetInfluences.slice()), e.morphTargetDictionary !== void 0 && (this.morphTargetDictionary = Object.assign({}, e.morphTargetDictionary)), this.material = e.material, this.geometry = e.geometry, this; } updateMorphTargets() { const e = this.geometry; if (e.isBufferGeometry) { const t = e.morphAttributes, i = Object.keys(t); if (i.length > 0) { const r = t[i[0]]; if (r !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (let s = 0, o = r.length; s < o; s++) { const a = r[s].name || String(s); this.morphTargetInfluences.push(0), this.morphTargetDictionary[a] = s; } } } } else { const t = e.morphTargets; t !== void 0 && t.length > 0 && console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } } raycast(e, t) { const i = this.geometry, r = this.material, s = this.matrixWorld; if (r === void 0 || (i.boundingSphere === null && i.computeBoundingSphere(), Mh.copy(i.boundingSphere), Mh.applyMatrix4(s), e.ray.intersectsSphere(Mh) === !1) || (_g.copy(s).invert(), oo.copy(e.ray).applyMatrix4(_g), i.boundingBox !== null && oo.intersectsBox(i.boundingBox) === !1)) return; let o; if (i.isBufferGeometry) { const a = i.index, c = i.attributes.position, l = i.morphAttributes.position, d = i.morphTargetsRelative, h = i.attributes.uv, p = i.attributes.uv2, g = i.groups, f = i.drawRange; if (a !== null) if (Array.isArray(r)) for (let u = 0, y = g.length; u < y; u++) { const v = g[u], m = r[v.materialIndex], w = Math.max(v.start, f.start), S = Math.min(v.start + v.count, f.start + f.count); for (let T = w, M = S; T < M; T += 3) { const x = a.getX(T), _ = a.getX(T + 1), E = a.getX(T + 2); o = sc(this, m, e, oo, c, l, d, h, p, x, _, E), o && (o.faceIndex = Math.floor(T / 3), o.face.materialIndex = v.materialIndex, t.push(o)); } } else { const u = Math.max(0, f.start), y = Math.min(a.count, f.start + f.count); for (let v = u, m = y; v < m; v += 3) { const w = a.getX(v), S = a.getX(v + 1), T = a.getX(v + 2); o = sc(this, r, e, oo, c, l, d, h, p, w, S, T), o && (o.faceIndex = Math.floor(v / 3), t.push(o)); } } else if (c !== void 0) if (Array.isArray(r)) for (let u = 0, y = g.length; u < y; u++) { const v = g[u], m = r[v.materialIndex], w = Math.max(v.start, f.start), S = Math.min(v.start + v.count, f.start + f.count); for (let T = w, M = S; T < M; T += 3) { const x = T, _ = T + 1, E = T + 2; o = sc(this, m, e, oo, c, l, d, h, p, x, _, E), o && (o.faceIndex = Math.floor(T / 3), o.face.materialIndex = v.materialIndex, t.push(o)); } } else { const u = Math.max(0, f.start), y = Math.min(c.count, f.start + f.count); for (let v = u, m = y; v < m; v += 3) { const w = v, S = v + 1, T = v + 2; o = sc(this, r, e, oo, c, l, d, h, p, w, S, T), o && (o.faceIndex = Math.floor(v / 3), t.push(o)); } } } else i.isGeometry && console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } } tn.prototype.isMesh = !0; function EI(n, e, t, i, r, s, o, a) { let c; if (e.side === qt ? c = i.intersectTriangle(o, s, r, !0, a) : c = i.intersectTriangle(r, s, o, e.side !== Yr, a), c === null) return null; rc.copy(a), rc.applyMatrix4(n.matrixWorld); const l = t.ray.origin.distanceTo(rc); return l < t.near || l > t.far ? null : { distance: l, point: rc.clone(), object: n }; } function sc(n, e, t, i, r, s, o, a, c, l, d, h) { Ar.fromBufferAttribute(r, l), Cr.fromBufferAttribute(r, d), Lr.fromBufferAttribute(r, h); const p = n.morphTargetInfluences; if (e.morphTargets && s && p) { Kl.set(0, 0, 0), Ql.set(0, 0, 0), ec.set(0, 0, 0); for (let f = 0, u = s.length; f < u; f++) { const y = p[f], v = s[f]; y !== 0 && (Sh.fromBufferAttribute(v, l), _h.fromBufferAttribute(v, d), Th.fromBufferAttribute(v, h), o ? (Kl.addScaledVector(Sh, y), Ql.addScaledVector(_h, y), ec.addScaledVector(Th, y)) : (Kl.addScaledVector(Sh.sub(Ar), y), Ql.addScaledVector(_h.sub(Cr), y), ec.addScaledVector(Th.sub(Lr), y))); } Ar.add(Kl), Cr.add(Ql), Lr.add(ec); } n.isSkinnedMesh && (n.boneTransform(l, Ar), n.boneTransform(d, Cr), n.boneTransform(h, Lr)); const g = EI(n, e, t, i, Ar, Cr, Lr, Eh); if (g) { a && (tc.fromBufferAttribute(a, l), nc.fromBufferAttribute(a, d), ic.fromBufferAttribute(a, h), g.uv = Qt.getUV(Eh, Ar, Cr, Lr, tc, nc, ic, new Pe())), c && (tc.fromBufferAttribute(c, l), nc.fromBufferAttribute(c, d), ic.fromBufferAttribute(c, h), g.uv2 = Qt.getUV(Eh, Ar, Cr, Lr, tc, nc, ic, new Pe())); const f = { a: l, b: d, c: h, normal: new X(), materialIndex: 0 }; Qt.getNormal(Ar, Cr, Lr, f.normal), g.face = f; } return g; } class hr extends Je { constructor(e = 1, t = 1, i = 1, r = 1, s = 1, o = 1) { super(), this.type = "BoxGeometry", this.parameters = { width: e, height: t, depth: i, widthSegments: r, heightSegments: s, depthSegments: o }; const a = this; r = Math.floor(r), s = Math.floor(s), o = Math.floor(o); const c = [], l = [], d = [], h = []; let p = 0, g = 0; f("z", "y", "x", -1, -1, i, t, e, o, s, 0), f("z", "y", "x", 1, -1, i, t, -e, o, s, 1), f("x", "z", "y", 1, 1, e, i, t, r, o, 2), f("x", "z", "y", 1, -1, e, i, -t, r, o, 3), f("x", "y", "z", 1, -1, e, t, i, r, s, 4), f("x", "y", "z", -1, -1, e, t, -i, r, s, 5), this.setIndex(c), this.setAttribute("position", new We(l, 3)), this.setAttribute("normal", new We(d, 3)), this.setAttribute("uv", new We(h, 2)); function f(u, y, v, m, w, S, T, M, x, _, E) { const L = S / x, R = T / _, C = S / 2, A = T / 2, P = M / 2, I = x + 1, b = _ + 1; let O = 0, N = 0; const D = new X(); for (let B = 0; B < b; B++) { const U = B * R - A; for (let k = 0; k < I; k++) { const K = k * L - C; D[u] = K * m, D[y] = U * w, D[v] = P, l.push(D.x, D.y, D.z), D[u] = 0, D[y] = 0, D[v] = M > 0 ? 1 : -1, d.push(D.x, D.y, D.z), h.push(k / x), h.push(1 - B / _), O += 1; } } for (let B = 0; B < _; B++) for (let U = 0; U < x; U++) { const k = p + U + I * B, K = p + U + I * (B + 1), ie = p + (U + 1) + I * (B + 1), j = p + (U + 1) + I * B; c.push(k, K, j), c.push(K, ie, j), N += 6; } a.addGroup(g, N, E), g += N, p += O; } } static fromJSON(e) { return new hr(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments); } } function Vo(n) { const e = {}; for (const t in n) { e[t] = {}; for (const i in n[t]) { const r = n[t][i]; r && (r.isColor || r.isMatrix3 || r.isMatrix4 || r.isVector2 || r.isVector3 || r.isVector4 || r.isTexture || r.isQuaternion) ? e[t][i] = r.clone() : Array.isArray(r) ? e[t][i] = r.slice() : e[t][i] = r; } } return e; } function En(n) { const e = {}; for (let t = 0; t < n.length; t++) { const i = Vo(n[t]); for (const r in i) e[r] = i[r]; } return e; } const _x = { clone: Vo, merge: En }; var AI = `void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`, CI = `void main() { gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); }`; class dr extends sn { constructor(e) { super(), this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.vertexShader = AI, this.fragmentShader = CI, this.linewidth = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.lights = !1, this.clipping = !1, this.morphTargets = !1, this.morphNormals = !1, this.extensions = { derivatives: !1, // set to use derivatives fragDepth: !1, // set to use fragment depth values drawBuffers: !1, // set to use draw buffers shaderTextureLOD: !1 // set to use shader texture LOD }, this.defaultAttributeValues = { color: [1, 1, 1], uv: [0, 0], uv2: [0, 0] }, this.index0AttributeName = void 0, this.uniformsNeedUpdate = !1, this.glslVersion = null, e !== void 0 && (e.attributes !== void 0 && console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."), this.setValues(e)); } copy(e) { return super.copy(e), this.fragmentShader = e.fragmentShader, this.vertexShader = e.vertexShader, this.uniforms = Vo(e.uniforms), this.defines = Object.assign({}, e.defines), this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.lights = e.lights, this.clipping = e.clipping, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.extensions = Object.assign({}, e.extensions), this.glslVersion = e.glslVersion, this; } toJSON(e) { const t = super.toJSON(e); t.glslVersion = this.glslVersion, t.uniforms = {}; for (const r in this.uniforms) { const o = this.uniforms[r].value; o && o.isTexture ? t.uniforms[r] = { type: "t", value: o.toJSON(e).uuid } : o && o.isColor ? t.uniforms[r] = { type: "c", value: o.getHex() } : o && o.isVector2 ? t.uniforms[r] = { type: "v2", value: o.toArray() } : o && o.isVector3 ? t.uniforms[r] = { type: "v3", value: o.toArray() } : o && o.isVector4 ? t.uniforms[r] = { type: "v4", value: o.toArray() } : o && o.isMatrix3 ? t.uniforms[r] = { type: "m3", value: o.toArray() } : o && o.isMatrix4 ? t.uniforms[r] = { type: "m4", value: o.toArray() } : t.uniforms[r] = { value: o }; } Object.keys(this.defines).length > 0 && (t.defines = this.defines), t.vertexShader = this.vertexShader, t.fragmentShader = this.fragmentShader; const i = {}; for (const r in this.extensions) this.extensions[r] === !0 && (i[r] = !0); return Object.keys(i).length > 0 && (t.extensions = i), t; } } dr.prototype.isShaderMaterial = !0; class wl extends ot { constructor() { super(), this.type = "Camera", this.matrixWorldInverse = new $e(), this.projectionMatrix = new $e(), this.projectionMatrixInverse = new $e(); } copy(e, t) { return super.copy(e, t), this.matrixWorldInverse.copy(e.matrixWorldInverse), this.projectionMatrix.copy(e.projectionMatrix), this.projectionMatrixInverse.copy(e.projectionMatrixInverse), this; } getWorldDirection(e) { this.updateWorldMatrix(!0, !1); const t = this.matrixWorld.elements; return e.set(-t[8], -t[9], -t[10]).normalize(); } updateMatrixWorld(e) { super.updateMatrixWorld(e), this.matrixWorldInverse.copy(this.matrixWorld).invert(); } updateWorldMatrix(e, t) { super.updateWorldMatrix(e, t), this.matrixWorldInverse.copy(this.matrixWorld).invert(); } clone() { return new this.constructor().copy(this); } } wl.prototype.isCamera = !0; class an extends wl { constructor(e = 50, t = 1, i = 0.1, r = 2e3) { super(), this.type = "PerspectiveCamera", this.fov = e, this.zoom = 1, this.near = i, this.far = r, this.focus = 10, this.aspect = t, this.view = null, this.filmGauge = 35, this.filmOffset = 0, this.updateProjectionMatrix(); } copy(e, t) { return super.copy(e, t), this.fov = e.fov, this.zoom = e.zoom, this.near = e.near, this.far = e.far, this.focus = e.focus, this.aspect = e.aspect, this.view = e.view === null ? null : Object.assign({}, e.view), this.filmGauge = e.filmGauge, this.filmOffset = e.filmOffset, this; } /** * Sets the FOV by focal length in respect to the current .filmGauge. * * The default film gauge is 35, so that the focal length can be specified for * a 35mm (full frame) camera. * * Values for focal length and film gauge must have the same unit. */ setFocalLength(e) { const t = 0.5 * this.getFilmHeight() / e; this.fov = nl * 2 * Math.atan(t), this.updateProjectionMatrix(); } /** * Calculates the focal length from the current .fov and .filmGauge. */ getFocalLength() { const e = Math.tan(As * 0.5 * this.fov); return 0.5 * this.getFilmHeight() / e; } getEffectiveFOV() { return nl * 2 * Math.atan( Math.tan(As * 0.5 * this.fov) / this.zoom ); } getFilmWidth() { return this.filmGauge * Math.min(this.aspect, 1); } getFilmHeight() { return this.filmGauge / Math.max(this.aspect, 1); } /** * Sets an offset in a larger frustum. This is useful for multi-window or * multi-monitor/multi-machine setups. * * For example, if you have 3x2 monitors and each monitor is 1920x1080 and * the monitors are in grid like this * * +---+---+---+ * | A | B | C | * +---+---+---+ * | D | E | F | * +---+---+---+ * * then for each monitor you would call it like this * * const w = 1920; * const h = 1080; * const fullWidth = w * 3; * const fullHeight = h * 2; * * --A-- * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); * --B-- * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); * --C-- * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); * --D-- * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); * --E-- * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); * --F-- * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); * * Note there is no reason monitors have to be the same size or in a grid. */ setViewOffset(e, t, i, r, s, o) { this.aspect = e / t, this.view === null && (this.view = { enabled: !0, fullWidth: 1, fullHeight: 1, offsetX: 0, offsetY: 0, width: 1, height: 1 }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = i, this.view.offsetY = r, this.view.width = s, this.view.height = o, this.updateProjectionMatrix(); } clearViewOffset() { this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix(); } updateProjectionMatrix() { const e = this.near; let t = e * Math.tan(As * 0.5 * this.fov) / this.zoom, i = 2 * t, r = this.aspect * i, s = -0.5 * r; const o = this.view; if (this.view !== null && this.view.enabled) { const c = o.fullWidth, l = o.fullHeight; s += o.offsetX * r / c, t -= o.offsetY * i / l, r *= o.width / c, i *= o.height / l; } const a = this.filmOffset; a !== 0 && (s += e * a / this.getFilmWidth()), this.projectionMatrix.makePerspective(s, s + r, t, t - i, e, this.far), this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); } toJSON(e) { const t = super.toJSON(e); return t.object.fov = this.fov, t.object.zoom = this.zoom, t.object.near = this.near, t.object.far = this.far, t.object.focus = this.focus, t.object.aspect = this.aspect, this.view !== null && (t.object.view = Object.assign({}, this.view)), t.object.filmGauge = this.filmGauge, t.object.filmOffset = this.filmOffset, t; } } an.prototype.isPerspectiveCamera = !0; const ao = 90, lo = 1; class Pu extends ot { constructor(e, t, i) { if (super(), this.type = "CubeCamera", i.isWebGLCubeRenderTarget !== !0) { console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter."); return; } this.renderTarget = i; const r = new an(ao, lo, e, t); r.layers = this.layers, r.up.set(0, -1, 0), r.lookAt(new X(1, 0, 0)), this.add(r); const s = new an(ao, lo, e, t); s.layers = this.layers, s.up.set(0, -1, 0), s.lookAt(new X(-1, 0, 0)), this.add(s); const o = new an(ao, lo, e, t); o.layers = this.layers, o.up.set(0, 0, 1), o.lookAt(new X(0, 1, 0)), this.add(o); const a = new an(ao, lo, e, t); a.layers = this.layers, a.up.set(0, 0, -1), a.lookAt(new X(0, -1, 0)), this.add(a); const c = new an(ao, lo, e, t); c.layers = this.layers, c.up.set(0, -1, 0), c.lookAt(new X(0, 0, 1)), this.add(c); const l = new an(ao, lo, e, t); l.layers = this.layers, l.up.set(0, -1, 0), l.lookAt(new X(0, 0, -1)), this.add(l); } update(e, t) { this.parent === null && this.updateMatrixWorld(); const i = this.renderTarget, [r, s, o, a, c, l] = this.children, d = e.xr.enabled, h = e.getRenderTarget(); e.xr.enabled = !1; const p = i.texture.generateMipmaps; i.texture.generateMipmaps = !1, e.setRenderTarget(i, 0), e.render(t, r), e.setRenderTarget(i, 1), e.render(t, s), e.setRenderTarget(i, 2), e.render(t, o), e.setRenderTarget(i, 3), e.render(t, a), e.setRenderTarget(i, 4), e.render(t, c), i.texture.generateMipmaps = p, e.setRenderTarget(i, 5), e.render(t, l), e.setRenderTarget(h), e.xr.enabled = d; } } class ca extends nn { constructor(e, t, i, r, s, o, a, c, l, d) { e = e !== void 0 ? e : [], t = t !== void 0 ? t : yl, a = a !== void 0 ? a : ar, super(e, t, i, r, s, o, a, c, l, d), this._needsFlipEnvMap = !0, this.flipY = !1; } get images() { return this.image; } set images(e) { this.image = e; } } ca.prototype.isCubeTexture = !0; class Iu extends bi { constructor(e, t, i) { Number.isInteger(t) && (console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"), t = i), super(e, e, t), t = t || {}, this.texture = new ca(void 0, t.mapping, t.wrapS, t.wrapT, t.magFilter, t.minFilter, t.format, t.type, t.anisotropy, t.encoding), this.texture.generateMipmaps = t.generateMipmaps !== void 0 ? t.generateMipmaps : !1, this.texture.minFilter = t.minFilter !== void 0 ? t.minFilter : jt, this.texture._needsFlipEnvMap = !1; } fromEquirectangularTexture(e, t) { this.texture.type = t.type, this.texture.format = Yn, this.texture.encoding = t.encoding, this.texture.generateMipmaps = t.generateMipmaps, this.texture.minFilter = t.minFilter, this.texture.magFilter = t.magFilter; const i = { uniforms: { tEquirect: { value: null } }, vertexShader: ( /* glsl */ ` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } ` ), fragmentShader: ( /* glsl */ ` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } ` ) }, r = new hr(5, 5, 5), s = new dr({ name: "CubemapFromEquirect", uniforms: Vo(i.uniforms), vertexShader: i.vertexShader, fragmentShader: i.fragmentShader, side: qt, blending: or }); s.uniforms.tEquirect.value = t; const o = new tn(r, s), a = t.minFilter; return t.minFilter === br && (t.minFilter = jt), new Pu(1, 10, this).update(e, o), t.minFilter = a, o.geometry.dispose(), o.material.dispose(), this; } clear(e, t, i, r) { const s = e.getRenderTarget(); for (let o = 0; o < 6; o++) e.setRenderTarget(this, o), e.clear(t, i, r); e.setRenderTarget(s); } } Iu.prototype.isWebGLCubeRenderTarget = !0; const Ah = /* @__PURE__ */ new X(), LI = /* @__PURE__ */ new X(), RI = /* @__PURE__ */ new ln(); class Li { constructor(e = new X(1, 0, 0), t = 0) { this.normal = e, this.constant = t; } set(e, t) { return this.normal.copy(e), this.constant = t, this; } setComponents(e, t, i, r) { return this.normal.set(e, t, i), this.constant = r, this; } setFromNormalAndCoplanarPoint(e, t) { return this.normal.copy(e), this.constant = -t.dot(this.normal), this; } setFromCoplanarPoints(e, t, i) { const r = Ah.subVectors(i, t).cross(LI.subVectors(e, t)).normalize(); return this.setFromNormalAndCoplanarPoint(r, e), this; } copy(e) { return this.normal.copy(e.normal), this.constant = e.constant, this; } normalize() { const e = 1 / this.normal.length(); return this.normal.multiplyScalar(e), this.constant *= e, this; } negate() { return this.constant *= -1, this.normal.negate(), this; } distanceToPoint(e) { return this.normal.dot(e) + this.constant; } distanceToSphere(e) { return this.distanceToPoint(e.center) - e.radius; } projectPoint(e, t) { return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e); } intersectLine(e, t) { const i = e.delta(Ah), r = this.normal.dot(i); if (r === 0) return this.distanceToPoint(e.start) === 0 ? t.copy(e.start) : null; const s = -(e.start.dot(this.normal) + this.constant) / r; return s < 0 || s > 1 ? null : t.copy(i).multiplyScalar(s).add(e.start); } intersectsLine(e) { const t = this.distanceToPoint(e.start), i = this.distanceToPoint(e.end); return t < 0 && i > 0 || i < 0 && t > 0; } intersectsBox(e) { return e.intersectsPlane(this); } intersectsSphere(e) { return e.intersectsPlane(this); } coplanarPoint(e) { return e.copy(this.normal).multiplyScalar(-this.constant); } applyMatrix4(e, t) { const i = t || RI.getNormalMatrix(e), r = this.coplanarPoint(Ah).applyMatrix4(e), s = this.normal.applyMatrix3(i).normalize(); return this.constant = -r.dot(s), this; } translate(e) { return this.constant -= e.dot(this.normal), this; } equals(e) { return e.normal.equals(this.normal) && e.constant === this.constant; } clone() { return new this.constructor().copy(this); } } Li.prototype.isPlane = !0; const co = /* @__PURE__ */ new xr(), oc = /* @__PURE__ */ new X(); class Ml { constructor(e = new Li(), t = new Li(), i = new Li(), r = new Li(), s = new Li(), o = new Li()) { this.planes = [e, t, i, r, s, o]; } set(e, t, i, r, s, o) { const a = this.planes; return a[0].copy(e), a[1].copy(t), a[2].copy(i), a[3].copy(r), a[4].copy(s), a[5].copy(o), this; } copy(e) { const t = this.planes; for (let i = 0; i < 6; i++) t[i].copy(e.planes[i]); return this; } setFromProjectionMatrix(e) { const t = this.planes, i = e.elements, r = i[0], s = i[1], o = i[2], a = i[3], c = i[4], l = i[5], d = i[6], h = i[7], p = i[8], g = i[9], f = i[10], u = i[11], y = i[12], v = i[13], m = i[14], w = i[15]; return t[0].setComponents(a - r, h - c, u - p, w - y).normalize(), t[1].setComponents(a + r, h + c, u + p, w + y).normalize(), t[2].setComponents(a + s, h + l, u + g, w + v).normalize(), t[3].setComponents(a - s, h - l, u - g, w - v).normalize(), t[4].setComponents(a - o, h - d, u - f, w - m).normalize(), t[5].setComponents(a + o, h + d, u + f, w + m).normalize(), this; } intersectsObject(e) { const t = e.geometry; return t.boundingSphere === null && t.computeBoundingSphere(), co.copy(t.boundingSphere).applyMatrix4(e.matrixWorld), this.intersectsSphere(co); } intersectsSprite(e) { return co.center.set(0, 0, 0), co.radius = 0.7071067811865476, co.applyMatrix4(e.matrixWorld), this.intersectsSphere(co); } intersectsSphere(e) { const t = this.planes, i = e.center, r = -e.radius; for (let s = 0; s < 6; s++) if (t[s].distanceToPoint(i) < r) return !1; return !0; } intersectsBox(e) { const t = this.planes; for (let i = 0; i < 6; i++) { const r = t[i]; if (oc.x = r.normal.x > 0 ? e.max.x : e.min.x, oc.y = r.normal.y > 0 ? e.max.y : e.min.y, oc.z = r.normal.z > 0 ? e.max.z : e.min.z, r.distanceToPoint(oc) < 0) return !1; } return !0; } containsPoint(e) { const t = this.planes; for (let i = 0; i < 6; i++) if (t[i].distanceToPoint(e) < 0) return !1; return !0; } clone() { return new this.constructor().copy(this); } } function Tx() { let n = null, e = !1, t = null, i = null; function r(s, o) { t(s, o), i = n.requestAnimationFrame(r); } return { start: function() { e !== !0 && t !== null && (i = n.requestAnimationFrame(r), e = !0); }, stop: function() { n.cancelAnimationFrame(i), e = !1; }, setAnimationLoop: function(s) { t = s; }, setContext: function(s) { n = s; } }; } function PI(n, e) { const t = e.isWebGL2, i = /* @__PURE__ */ new WeakMap(); function r(l, d) { const h = l.array, p = l.usage, g = n.createBuffer(); n.bindBuffer(d, g), n.bufferData(d, h, p), l.onUploadCallback(); let f = 5126; return h instanceof Float32Array ? f = 5126 : h instanceof Float64Array ? console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.") : h instanceof Uint16Array ? l.isFloat16BufferAttribute ? t ? f = 5131 : console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.") : f = 5123 : h instanceof Int16Array ? f = 5122 : h instanceof Uint32Array ? f = 5125 : h instanceof Int32Array ? f = 5124 : h instanceof Int8Array ? f = 5120 : (h instanceof Uint8Array || h instanceof Uint8ClampedArray) && (f = 5121), { buffer: g, type: f, bytesPerElement: h.BYTES_PER_ELEMENT, version: l.version }; } function s(l, d, h) { const p = d.array, g = d.updateRange; n.bindBuffer(h, l), g.count === -1 ? n.bufferSubData(h, 0, p) : (t ? n.bufferSubData( h, g.offset * p.BYTES_PER_ELEMENT, p, g.offset, g.count ) : n.bufferSubData( h, g.offset * p.BYTES_PER_ELEMENT, p.subarray(g.offset, g.offset + g.count) ), g.count = -1); } function o(l) { return l.isInterleavedBufferAttribute && (l = l.data), i.get(l); } function a(l) { l.isInterleavedBufferAttribute && (l = l.data); const d = i.get(l); d && (n.deleteBuffer(d.buffer), i.delete(l)); } function c(l, d) { if (l.isGLBufferAttribute) { const p = i.get(l); (!p || p.version < l.version) && i.set(l, { buffer: l.buffer, type: l.type, bytesPerElement: l.elementSize, version: l.version }); return; } l.isInterleavedBufferAttribute && (l = l.data); const h = i.get(l); h === void 0 ? i.set(l, r(l, d)) : h.version < l.version && (s(h.buffer, l, d), h.version = l.version); } return { get: o, remove: a, update: c }; } class Ds extends Je { constructor(e = 1, t = 1, i = 1, r = 1) { super(), this.type = "PlaneGeometry", this.parameters = { width: e, height: t, widthSegments: i, heightSegments: r }; const s = e / 2, o = t / 2, a = Math.floor(i), c = Math.floor(r), l = a + 1, d = c + 1, h = e / a, p = t / c, g = [], f = [], u = [], y = []; for (let v = 0; v < d; v++) { const m = v * p - o; for (let w = 0; w < l; w++) { const S = w * h - s; f.push(S, -m, 0), u.push(0, 0, 1), y.push(w / a), y.push(1 - v / c); } } for (let v = 0; v < c; v++) for (let m = 0; m < a; m++) { const w = m + l * v, S = m + l * (v + 1), T = m + 1 + l * (v + 1), M = m + 1 + l * v; g.push(w, S, M), g.push(S, T, M); } this.setIndex(g), this.setAttribute("position", new We(f, 3)), this.setAttribute("normal", new We(u, 3)), this.setAttribute("uv", new We(y, 2)); } static fromJSON(e) { return new Ds(e.width, e.height, e.widthSegments, e.heightSegments); } } var II = `#ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, vUv ).g; #endif`, OI = `#ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`, DI = `#ifdef ALPHATEST if ( diffuseColor.a < ALPHATEST ) discard; #endif`, NI = `#ifdef USE_AOMAP float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0; reflectedLight.indirectDiffuse *= ambientOcclusion; #if defined( USE_ENVMAP ) && defined( STANDARD ) float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness ); #endif #endif`, FI = `#ifdef USE_AOMAP uniform sampler2D aoMap; uniform float aoMapIntensity; #endif`, BI = "vec3 transformed = vec3( position );", zI = `vec3 objectNormal = vec3( normal ); #ifdef USE_TANGENT vec3 objectTangent = vec3( tangent.xyz ); #endif`, UI = `vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) { const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); vec4 r = roughness * c0 + c1; float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; return vec2( -1.04, 1.04 ) * a004 + r.zw; } float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { #if defined ( PHYSICALLY_CORRECT_LIGHTS ) float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; #else if( cutoffDistance > 0.0 && decayExponent > 0.0 ) { return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent ); } return 1.0; #endif } vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 specularColor, const in float dotVH ) { float fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH ); return ( 1.0 - specularColor ) * fresnel + specularColor; } vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) { float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV ); vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0; return Fr * fresnel + F0; } float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); return 1.0 / ( gl * gv ); } float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) { float alpha = pow2( roughness ); vec3 halfDir = normalize( incidentLight.direction + viewDir ); float dotNL = saturate( dot( normal, incidentLight.direction ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotLH = saturate( dot( incidentLight.direction, halfDir ) ); vec3 F = F_Schlick( specularColor, dotLH ); float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( G * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); vec2 brdf = integrateSpecularBRDF( dotNV, roughness ); return specularColor * brdf.x + brdf.y; } void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness ); vec2 brdf = integrateSpecularBRDF( dotNV, roughness ); vec3 FssEss = F * brdf.x + brdf.y; float Ess = brdf.x + brdf.y; float Ems = 1.0 - Ess; vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } float G_BlinnPhong_Implicit( ) { return 0.25; } float D_BlinnPhong( const in float shininess, const in float dotNH ) { return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); } vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) { vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir ); float dotNH = saturate( dot( geometry.normal, halfDir ) ); float dotLH = saturate( dot( incidentLight.direction, halfDir ) ); vec3 F = F_Schlick( specularColor, dotLH ); float G = G_BlinnPhong_Implicit( ); float D = D_BlinnPhong( shininess, dotNH ); return F * ( G * D ); } float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) { return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 ); } float BlinnExponentToGGXRoughness( const in float blinnExponent ) { return sqrt( 2.0 / ( blinnExponent + 2.0 ) ); } #if defined( USE_SHEEN ) float D_Charlie(float roughness, float NoH) { float invAlpha = 1.0 / roughness; float cos2h = NoH * NoH; float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI); } float V_Neubelt(float NoV, float NoL) { return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV))); } vec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) { vec3 N = geometry.normal; vec3 V = geometry.viewDir; vec3 H = normalize( V + L ); float dotNH = saturate( dot( N, H ) ); return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) ); } #endif`, VI = `#ifdef USE_BUMPMAP uniform sampler2D bumpMap; uniform float bumpScale; vec2 dHdxy_fwd() { vec2 dSTdx = dFdx( vUv ); vec2 dSTdy = dFdy( vUv ); float Hll = bumpScale * texture2D( bumpMap, vUv ).x; float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; return vec2( dBx, dBy ); } vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) ); vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) ); vec3 vN = surf_norm; vec3 R1 = cross( vSigmaY, vN ); vec3 R2 = cross( vN, vSigmaX ); float fDet = dot( vSigmaX, R1 ) * faceDirection; vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); return normalize( abs( fDet ) * surf_norm - vGrad ); } #endif`, kI = `#if NUM_CLIPPING_PLANES > 0 vec4 plane; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif`, GI = `#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`, HI = `#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`, WI = `#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`, jI = `#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`, $I = `#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`, ZI = `#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`, XI = `#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif`, YI = `#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate(a) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement(a) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract(sin(sn) * c); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); } float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; struct GeometricContext { vec3 position; vec3 normal; vec3 viewDir; #ifdef CLEARCOAT vec3 clearcoatNormal; #endif }; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) { float distance = dot( planeNormal, point - pointOnPlane ); return - distance * planeNormal + point; } float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) { return sign( dot( point - pointOnPlane, planeNormal ) ); } vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) { return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine; } mat3 transposeMat3( const in mat3 m ) { mat3 tmp; tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); return tmp; } float linearToRelativeLuminance( const in vec3 color ) { vec3 weights = vec3( 0.2126, 0.7152, 0.0722 ); return dot( weights, color.rgb ); } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); }`, JI = `#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_maxMipLevel 8.0 #define cubeUV_minMipLevel 4.0 #define cubeUV_maxTileSize 256.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); float texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize ); vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ); vec2 f = fract( uv ); uv += 0.5 - f; if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; if ( mipInt < cubeUV_maxMipLevel ) { uv.y += 2.0 * cubeUV_maxTileSize; } uv.y += filterInt * 2.0 * cubeUV_minTileSize; uv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize ); uv *= texelSize; vec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb; uv.x += texelSize; vec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb; uv.y += texelSize; vec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb; uv.x -= texelSize; vec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb; vec3 tm = mix( tl, tr, f.x ); vec3 bm = mix( bl, br, f.x ); return mix( tm, bm, f.y ); } #define r0 1.0 #define v0 0.339 #define m0 - 2.0 #define r1 0.8 #define v1 0.276 #define m1 - 1.0 #define r4 0.4 #define v4 0.046 #define m4 2.0 #define r5 0.305 #define v5 0.016 #define m5 3.0 #define r6 0.21 #define v6 0.0038 #define m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= r1 ) { mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0; } else if ( roughness >= r4 ) { mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1; } else if ( roughness >= r5 ) { mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4; } else if ( roughness >= r6 ) { mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif`, qI = `vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING mat3 m = mat3( instanceMatrix ); transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); transformedNormal = m * transformedNormal; #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`, KI = `#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`, QI = `#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); #endif`, eO = `#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vUv ); emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb; totalEmissiveRadiance *= emissiveColor.rgb; #endif`, tO = `#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`, nO = "gl_FragColor = linearToOutputTexel( gl_FragColor );", iO = ` vec4 LinearToLinear( in vec4 value ) { return value; } vec4 GammaToLinear( in vec4 value, in float gammaFactor ) { return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a ); } vec4 LinearToGamma( in vec4 value, in float gammaFactor ) { return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a ); } vec4 sRGBToLinear( in vec4 value ) { return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); } vec4 LinearTosRGB( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); } vec4 RGBEToLinear( in vec4 value ) { return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 ); } vec4 LinearToRGBE( in vec4 value ) { float maxComponent = max( max( value.r, value.g ), value.b ); float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 ); return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 ); } vec4 RGBMToLinear( in vec4 value, in float maxRange ) { return vec4( value.rgb * value.a * maxRange, 1.0 ); } vec4 LinearToRGBM( in vec4 value, in float maxRange ) { float maxRGB = max( value.r, max( value.g, value.b ) ); float M = clamp( maxRGB / maxRange, 0.0, 1.0 ); M = ceil( M * 255.0 ) / 255.0; return vec4( value.rgb / ( M * maxRange ), M ); } vec4 RGBDToLinear( in vec4 value, in float maxRange ) { return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 ); } vec4 LinearToRGBD( in vec4 value, in float maxRange ) { float maxRGB = max( value.r, max( value.g, value.b ) ); float D = max( maxRange / maxRGB, 1.0 ); D = clamp( floor( D ) / 255.0, 0.0, 1.0 ); return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D ); } const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 ); vec4 LinearToLogLuv( in vec4 value ) { vec3 Xp_Y_XYZp = cLogLuvM * value.rgb; Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) ); vec4 vResult; vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z; float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0; vResult.w = fract( Le ); vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0; return vResult; } const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 ); vec4 LogLuvToLinear( in vec4 value ) { float Le = value.z * 255.0 + value.w; vec3 Xp_Y_XYZp; Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 ); Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y; Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z; vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb; return vec4( max( vRGB, 0.0 ), 1.0 ); }`, rO = `#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 ); #else vec4 envColor = vec4( 0.0 ); #endif #ifndef ENVMAP_TYPE_CUBE_UV envColor = envMapTexelToLinear( envColor ); #endif #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif`, sO = `#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform int maxMipLevel; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`, oO = `#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`, aO = `#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`, lO = `#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif`, cO = `#ifdef USE_FOG fogDepth = - mvPosition.z; #endif`, uO = `#ifdef USE_FOG varying float fogDepth; #endif`, hO = `#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, fogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`, dO = `#ifdef USE_FOG uniform vec3 fogColor; varying float fogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`, fO = `#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return texture2D( gradientMap, coord ).rgb; #else return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 ); #endif }`, pO = `#ifdef USE_LIGHTMAP vec4 lightMapTexel= texture2D( lightMap, vUv2 ); reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; #endif`, mO = `#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`, gO = `vec3 diffuse = vec3( 1.0 ); GeometricContext geometry; geometry.position = mvPosition.xyz; geometry.normal = normalize( transformedNormal ); geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz ); GeometricContext backGeometry; backGeometry.position = geometry.position; backGeometry.normal = -geometry.normal; backGeometry.viewDir = geometry.viewDir; vLightFront = vec3( 0.0 ); vIndirectFront = vec3( 0.0 ); #ifdef DOUBLE_SIDED vLightBack = vec3( 0.0 ); vIndirectBack = vec3( 0.0 ); #endif IncidentLight directLight; float dotNL; vec3 directLightColor_Diffuse; vIndirectFront += getAmbientLightIrradiance( ambientLightColor ); vIndirectFront += getLightProbeIrradiance( lightProbe, geometry ); #ifdef DOUBLE_SIDED vIndirectBack += getAmbientLightIrradiance( ambientLightColor ); vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry ); #endif #if NUM_POINT_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = PI * directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; #endif } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = PI * directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; #endif } #pragma unroll_loop_end #endif #if NUM_DIR_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = PI * directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; #endif } #pragma unroll_loop_end #endif #if NUM_HEMI_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry ); #ifdef DOUBLE_SIDED vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry ); #endif } #pragma unroll_loop_end #endif`, vO = `uniform bool receiveShadow; uniform vec3 ambientLightColor; uniform vec3 lightProbe[ 9 ]; vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) { vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif return irradiance; } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) { directLight.color = directionalLight.color; directLight.direction = directionalLight.direction; directLight.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) { vec3 lVector = pointLight.position - geometry.position; directLight.direction = normalize( lVector ); float lightDistance = length( lVector ); directLight.color = pointLight.color; directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay ); directLight.visible = ( directLight.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) { vec3 lVector = spotLight.position - geometry.position; directLight.direction = normalize( lVector ); float lightDistance = length( lVector ); float angleCos = dot( directLight.direction, spotLight.direction ); if ( angleCos > spotLight.coneCos ) { float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos ); directLight.color = spotLight.color; directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay ); directLight.visible = true; } else { directLight.color = vec3( 0.0 ); directLight.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) { float dotNL = dot( geometry.normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif return irradiance; } #endif`, yO = `#if defined( USE_ENVMAP ) #ifdef ENVMAP_MODE_REFRACTION uniform float refractionRatio; #endif vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) { vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix ); #ifdef ENVMAP_TYPE_CUBE vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz ); #ifdef TEXTURE_LOD_EXT vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) ); #else vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) ); #endif envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); #else vec4 envMapColor = vec4( 0.0 ); #endif return PI * envMapColor.rgb * envMapIntensity; } float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) { float maxMIPLevelScalar = float( maxMIPLevel ); float sigma = PI * roughness * roughness / ( 1.0 + roughness ); float desiredMIPLevel = maxMIPLevelScalar + log2( sigma ); return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar ); } vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) { #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( -viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); #else vec3 reflectVec = refract( -viewDir, normal, refractionRatio ); #endif reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel ); #ifdef ENVMAP_TYPE_CUBE vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz ); #ifdef TEXTURE_LOD_EXT vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel ); #else vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel ); #endif envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); #endif return envMapColor.rgb * envMapIntensity; } #endif`, bO = `ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`, xO = `varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon #define Material_LightProbeLOD( material ) (0)`, wO = `BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`, MO = `varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong #define Material_LightProbeLOD( material ) (0)`, SO = `PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness; material.specularRoughness = min( material.specularRoughness, 1.0 ); #ifdef REFLECTIVITY material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor ); #endif #ifdef CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_SHEEN material.sheenColor = sheen; #endif`, _O = `struct PhysicalMaterial { vec3 diffuseColor; float specularRoughness; vec3 specularColor; #ifdef CLEARCOAT float clearcoat; float clearcoatRoughness; #endif #ifdef USE_SHEEN vec3 sheenColor; #endif }; #define MAXIMUM_SPECULAR_COEFFICIENT 0.16 #define DEFAULT_SPECULAR_COEFFICIENT 0.04 float clearcoatDHRApprox( const in float roughness, const in float dotNL ) { return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) ); } #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 normal = geometry.normal; vec3 viewDir = geometry.viewDir; vec3 position = geometry.position; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.specularRoughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif #ifdef CLEARCOAT float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = ccDotNL * directLight.color; #ifndef PHYSICALLY_CORRECT_LIGHTS ccIrradiance *= PI; #endif float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL ); reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness ); #else float clearcoatDHR = 0.0; #endif #ifdef USE_SHEEN reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen( material.specularRoughness, directLight.direction, geometry, material.sheenColor ); #else reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness); #endif reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef CLEARCOAT float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness ); float ccDotNL = ccDotNV; float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL ); #else float clearcoatDHR = 0.0; #endif float clearcoatInv = 1.0 - clearcoatDHR; vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering ); vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) ); reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`, TO = ` GeometricContext geometry; geometry.position = - vViewPosition; geometry.normal = normal; geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); #ifdef CLEARCOAT geometry.clearcoatNormal = clearcoatNormal; #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointDirectLightIrradiance( pointLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotDirectLightIrradiance( spotLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); irradiance += getLightProbeIrradiance( lightProbe, geometry ); #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`, EO = `#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel= texture2D( lightMap, vUv2 ); vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; #ifndef PHYSICALLY_CORRECT_LIGHTS lightMapIrradiance *= PI; #endif irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel ); #ifdef CLEARCOAT clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel ); #endif #endif`, AO = `#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); #endif`, CO = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`, LO = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`, RO = `#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`, PO = `#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #else if ( isPerspectiveMatrix( projectionMatrix ) ) { gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; gl_Position.z *= gl_Position.w; } #endif #endif`, IO = `#ifdef USE_MAP vec4 texelColor = texture2D( map, vUv ); texelColor = mapTexelToLinear( texelColor ); diffuseColor *= texelColor; #endif`, OO = `#ifdef USE_MAP uniform sampler2D map; #endif`, DO = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #ifdef USE_MAP vec4 mapTexel = texture2D( map, uv ); diffuseColor *= mapTexelToLinear( mapTexel ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`, NO = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`, FO = `float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vUv ); metalnessFactor *= texelMetalness.b; #endif`, BO = `#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`, zO = `#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif`, UO = `#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifndef USE_MORPHNORMALS uniform float morphTargetInfluences[ 8 ]; #else uniform float morphTargetInfluences[ 4 ]; #endif #endif`, VO = `#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; transformed += morphTarget0 * morphTargetInfluences[ 0 ]; transformed += morphTarget1 * morphTargetInfluences[ 1 ]; transformed += morphTarget2 * morphTargetInfluences[ 2 ]; transformed += morphTarget3 * morphTargetInfluences[ 3 ]; #ifndef USE_MORPHNORMALS transformed += morphTarget4 * morphTargetInfluences[ 4 ]; transformed += morphTarget5 * morphTargetInfluences[ 5 ]; transformed += morphTarget6 * morphTargetInfluences[ 6 ]; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif`, kO = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) ); vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif #ifdef USE_TANGENT vec3 tangent = normalize( vTangent ); vec3 bitangent = normalize( vBitangent ); #ifdef DOUBLE_SIDED tangent = tangent * faceDirection; bitangent = bitangent * faceDirection; #endif #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) mat3 vTBN = mat3( tangent, bitangent, normal ); #endif #endif #endif vec3 geometryNormal = normal;`, GO = `#ifdef OBJECTSPACE_NORMALMAP normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( TANGENTSPACE_NORMALMAP ) vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; #ifdef USE_TANGENT normal = normalize( vTBN * mapN ); #else normal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection ); #endif #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`, HO = `#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef OBJECTSPACE_NORMALMAP uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) ); vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) ); vec2 st0 = dFdx( vUv.st ); vec2 st1 = dFdy( vUv.st ); vec3 N = surf_norm; vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); } #endif`, WO = `#ifdef CLEARCOAT vec3 clearcoatNormal = geometryNormal; #endif`, jO = `#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; #ifdef USE_TANGENT clearcoatNormal = normalize( vTBN * clearcoatMapN ); #else clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); #endif #endif`, $O = `#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif`, ZO = `vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); const float ShiftRight8 = 1. / 256.; vec4 packDepthToRGBA( const in float v ) { vec4 r = vec4( fract( v * PackFactors ), v ); r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors ); } vec4 pack2HalfToRGBA( vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 )); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w); } vec2 unpackRGBATo2Half( vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { return linearClipZ * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return (( near + viewZ ) * far ) / (( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * invClipZ - far ); }`, XO = `#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`, YO = `vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`, JO = `#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`, qO = `#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } #endif`, KO = `float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vUv ); roughnessFactor *= texelRoughness.g; #endif`, QO = `#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`, e3 = `#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); } return occlusion; } float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); bool inFrustum = all( inFrustumVec ); bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); bool frustumTest = all( frustumTestVec ); if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; float dx2 = dx0 / 2.0; float dy2 = dy0 / 2.0; float dx3 = dx1 / 2.0; float dy3 = dy1 / 2.0; shadow = ( texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 17.0 ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #else shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return shadow; } vec2 cubeToUV( vec3 v, float texelSizeY ) { vec3 absV = abs( v ); float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); vec3 lightToPosition = shadowCoord.xyz; float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; vec3 bd3D = normalize( lightToPosition ); #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; return ( texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) ) * ( 1.0 / 9.0 ); #else return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } #endif`, t3 = `#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ]; varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`, n3 = `#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 ); vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #endif`, i3 = `float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`, r3 = `#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`, s3 = `#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; #ifdef BONE_TEXTURE uniform highp sampler2D boneTexture; uniform int boneTextureSize; mat4 getBoneMatrix( const in float i ) { float j = i * 4.0; float x = mod( j, float( boneTextureSize ) ); float y = floor( j / float( boneTextureSize ) ); float dx = 1.0 / float( boneTextureSize ); float dy = 1.0 / float( boneTextureSize ); y = dy * ( y + 0.5 ); vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); mat4 bone = mat4( v1, v2, v3, v4 ); return bone; } #else uniform mat4 boneMatrices[ MAX_BONES ]; mat4 getBoneMatrix( const in float i ) { mat4 bone = boneMatrices[ int(i) ]; return bone; } #endif #endif`, o3 = `#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif`, a3 = `#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif`, l3 = `float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`, c3 = `#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`, u3 = `#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`, h3 = `#ifndef saturate #define saturate(a) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return toneMappingExposure * color; } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } vec3 OptimizedCineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; color = RRTAndODTFit( color ); color = ACESOutputMat * color; return saturate( color ); } vec3 CustomToneMapping( vec3 color ) { return color; }`, d3 = `#ifdef USE_TRANSMISSION float transmissionFactor = transmission; float thicknessFactor = thickness; #ifdef USE_TRANSMISSIONMAP transmissionFactor *= texture2D( transmissionMap, vUv ).r; #endif #ifdef USE_THICKNESSNMAP thicknessFactor *= texture2D( thicknessMap, vUv ).g; #endif vec3 pos = vWorldPosition.xyz / vWorldPosition.w; vec3 v = normalize( cameraPosition - pos ); float ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity ); vec3 transmission = transmissionFactor * getIBLVolumeRefraction( normal, v, roughnessFactor, material.diffuseColor, totalSpecular, pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor, attenuationColor, attenuationDistance ); totalDiffuse = mix( totalDiffuse, transmission, transmissionFactor ); #endif`, f3 = `#ifdef USE_TRANSMISSION #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec4 vWorldPosition; vec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix) { vec3 refractionVector = refract(-v, normalize(n), 1.0 / ior); vec3 modelScale; modelScale.x = length(vec3(modelMatrix[0].xyz)); modelScale.y = length(vec3(modelMatrix[1].xyz)); modelScale.z = length(vec3(modelMatrix[2].xyz)); return normalize(refractionVector) * thickness * modelScale; } float applyIorToRoughness(float roughness, float ior) { return roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0); } vec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) { float framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior); return texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb; } vec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) { if (attenuationDistance == 0.0) { return radiance; } else { vec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance; vec3 transmittance = exp(-attenuationCoefficient * transmissionDistance); return transmittance * radiance; } } vec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor, vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness, vec3 attenuationColor, float attenuationDistance) { vec3 transmissionRay = getVolumeTransmissionRay(n, v, thickness, ior, modelMatrix); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4(refractedRayExit, 1.0); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; vec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior); vec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance); return (1.0 - specularColor) * attenuatedColor * baseColor; } #endif`, p3 = `#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) varying vec2 vUv; #endif`, m3 = `#ifdef USE_UV #ifdef UVS_VERTEX_ONLY vec2 vUv; #else varying vec2 vUv; #endif uniform mat3 uvTransform; #endif`, g3 = `#ifdef USE_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif`, v3 = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) varying vec2 vUv2; #endif`, y3 = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) attribute vec2 uv2; varying vec2 vUv2; uniform mat3 uv2Transform; #endif`, b3 = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; #endif`, x3 = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`, w3 = `uniform sampler2D t2D; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); gl_FragColor = mapTexelToLinear( texColor ); #include #include }`, M3 = `varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`, S3 = `#include uniform float opacity; varying vec3 vWorldDirection; #include void main() { vec3 vReflect = vWorldDirection; #include gl_FragColor = envColor; gl_FragColor.a *= opacity; #include #include }`, _3 = `varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`, T3 = `#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include vec4 diffuseColor = vec4( 1.0 ); #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif }`, E3 = `#include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`, A3 = `#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include void main () { #include vec4 diffuseColor = vec4( 1.0 ); #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`, C3 = `#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`, L3 = `uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); vec4 texColor = texture2D( tEquirect, sampleUV ); gl_FragColor = mapTexelToLinear( texColor ); #include #include }`, R3 = `varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`, P3 = `uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include void main() { #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include outgoingLight = diffuseColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include }`, I3 = `uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include }`, O3 = `uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel= texture2D( lightMap, vUv2 ); reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`, D3 = `#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_ENVMAP #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`, N3 = `uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; varying vec3 vLightFront; varying vec3 vIndirectFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; varying vec3 vIndirectBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #ifdef DOUBLE_SIDED reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; #else reflectedLight.indirectDiffuse += vIndirectFront; #endif #include reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ); #ifdef DOUBLE_SIDED reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; #else reflectedLight.directDiffuse = vLightFront; #endif reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask(); #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`, F3 = `#define LAMBERT varying vec3 vLightFront; varying vec3 vIndirectFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; varying vec3 vIndirectBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`, B3 = `#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); matcapColor = matcapTexelToLinear( matcapColor ); #else vec4 matcapColor = vec4( 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`, z3 = `#define MATCAP varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`, U3 = `#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`, V3 = `#define TOON varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`, k3 = `#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`, G3 = `#define PHONG varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`, H3 = `#define STANDARD #ifdef PHYSICAL #define REFLECTIVITY #define CLEARCOAT #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform vec3 attenuationColor; uniform float attenuationDistance; #endif #ifdef REFLECTIVITY uniform float reflectivity; #endif #ifdef CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_SHEEN uniform vec3 sheen; #endif varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`, W3 = `#define STANDARD varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif #ifdef USE_TRANSMISSION varying vec4 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition; #endif }`, j3 = `#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) varying vec3 vViewPosition; #endif #ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif #include #include #include #include #include #include void main() { #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); }`, $3 = `#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) varying vec3 vViewPosition; #endif #ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) vViewPosition = - mvPosition.xyz; #endif }`, Z3 = `uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include }`, X3 = `uniform float size; uniform float scale; #include #include #include #include #include #include void main() { #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`, Y3 = `uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include void main() { gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`, J3 = `#include #include #include void main() { #include #include #include #include #include #include #include #include #include #include }`, q3 = `uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include }`, K3 = `uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); vec2 scale; scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include }`; const ct = { alphamap_fragment: II, alphamap_pars_fragment: OI, alphatest_fragment: DI, aomap_fragment: NI, aomap_pars_fragment: FI, begin_vertex: BI, beginnormal_vertex: zI, bsdfs: UI, bumpmap_pars_fragment: VI, clipping_planes_fragment: kI, clipping_planes_pars_fragment: GI, clipping_planes_pars_vertex: HI, clipping_planes_vertex: WI, color_fragment: jI, color_pars_fragment: $I, color_pars_vertex: ZI, color_vertex: XI, common: YI, cube_uv_reflection_fragment: JI, defaultnormal_vertex: qI, displacementmap_pars_vertex: KI, displacementmap_vertex: QI, emissivemap_fragment: eO, emissivemap_pars_fragment: tO, encodings_fragment: nO, encodings_pars_fragment: iO, envmap_fragment: rO, envmap_common_pars_fragment: sO, envmap_pars_fragment: oO, envmap_pars_vertex: aO, envmap_physical_pars_fragment: yO, envmap_vertex: lO, fog_vertex: cO, fog_pars_vertex: uO, fog_fragment: hO, fog_pars_fragment: dO, gradientmap_pars_fragment: fO, lightmap_fragment: pO, lightmap_pars_fragment: mO, lights_lambert_vertex: gO, lights_pars_begin: vO, lights_toon_fragment: bO, lights_toon_pars_fragment: xO, lights_phong_fragment: wO, lights_phong_pars_fragment: MO, lights_physical_fragment: SO, lights_physical_pars_fragment: _O, lights_fragment_begin: TO, lights_fragment_maps: EO, lights_fragment_end: AO, logdepthbuf_fragment: CO, logdepthbuf_pars_fragment: LO, logdepthbuf_pars_vertex: RO, logdepthbuf_vertex: PO, map_fragment: IO, map_pars_fragment: OO, map_particle_fragment: DO, map_particle_pars_fragment: NO, metalnessmap_fragment: FO, metalnessmap_pars_fragment: BO, morphnormal_vertex: zO, morphtarget_pars_vertex: UO, morphtarget_vertex: VO, normal_fragment_begin: kO, normal_fragment_maps: GO, normalmap_pars_fragment: HO, clearcoat_normal_fragment_begin: WO, clearcoat_normal_fragment_maps: jO, clearcoat_pars_fragment: $O, packing: ZO, premultiplied_alpha_fragment: XO, project_vertex: YO, dithering_fragment: JO, dithering_pars_fragment: qO, roughnessmap_fragment: KO, roughnessmap_pars_fragment: QO, shadowmap_pars_fragment: e3, shadowmap_pars_vertex: t3, shadowmap_vertex: n3, shadowmask_pars_fragment: i3, skinbase_vertex: r3, skinning_pars_vertex: s3, skinning_vertex: o3, skinnormal_vertex: a3, specularmap_fragment: l3, specularmap_pars_fragment: c3, tonemapping_fragment: u3, tonemapping_pars_fragment: h3, transmission_fragment: d3, transmission_pars_fragment: f3, uv_pars_fragment: p3, uv_pars_vertex: m3, uv_vertex: g3, uv2_pars_fragment: v3, uv2_pars_vertex: y3, uv2_vertex: b3, worldpos_vertex: x3, background_frag: w3, background_vert: M3, cube_frag: S3, cube_vert: _3, depth_frag: T3, depth_vert: E3, distanceRGBA_frag: A3, distanceRGBA_vert: C3, equirect_frag: L3, equirect_vert: R3, linedashed_frag: P3, linedashed_vert: I3, meshbasic_frag: O3, meshbasic_vert: D3, meshlambert_frag: N3, meshlambert_vert: F3, meshmatcap_frag: B3, meshmatcap_vert: z3, meshtoon_frag: U3, meshtoon_vert: V3, meshphong_frag: k3, meshphong_vert: G3, meshphysical_frag: H3, meshphysical_vert: W3, normal_frag: j3, normal_vert: $3, points_frag: Z3, points_vert: X3, shadow_frag: Y3, shadow_vert: J3, sprite_frag: q3, sprite_vert: K3 }, ze = { common: { diffuse: { value: new Fe(16777215) }, opacity: { value: 1 }, map: { value: null }, uvTransform: { value: new ln() }, uv2Transform: { value: new ln() }, alphaMap: { value: null } }, specularmap: { specularMap: { value: null } }, envmap: { envMap: { value: null }, flipEnvMap: { value: -1 }, reflectivity: { value: 1 }, refractionRatio: { value: 0.98 }, maxMipLevel: { value: 0 } }, aomap: { aoMap: { value: null }, aoMapIntensity: { value: 1 } }, lightmap: { lightMap: { value: null }, lightMapIntensity: { value: 1 } }, emissivemap: { emissiveMap: { value: null } }, bumpmap: { bumpMap: { value: null }, bumpScale: { value: 1 } }, normalmap: { normalMap: { value: null }, normalScale: { value: new Pe(1, 1) } }, displacementmap: { displacementMap: { value: null }, displacementScale: { value: 1 }, displacementBias: { value: 0 } }, roughnessmap: { roughnessMap: { value: null } }, metalnessmap: { metalnessMap: { value: null } }, gradientmap: { gradientMap: { value: null } }, fog: { fogDensity: { value: 25e-5 }, fogNear: { value: 1 }, fogFar: { value: 2e3 }, fogColor: { value: new Fe(16777215) } }, lights: { ambientLightColor: { value: [] }, lightProbe: { value: [] }, directionalLights: { value: [], properties: { direction: {}, color: {} } }, directionalLightShadows: { value: [], properties: { shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {} } }, directionalShadowMap: { value: [] }, directionalShadowMatrix: { value: [] }, spotLights: { value: [], properties: { color: {}, position: {}, direction: {}, distance: {}, coneCos: {}, penumbraCos: {}, decay: {} } }, spotLightShadows: { value: [], properties: { shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {} } }, spotShadowMap: { value: [] }, spotShadowMatrix: { value: [] }, pointLights: { value: [], properties: { color: {}, position: {}, decay: {}, distance: {} } }, pointLightShadows: { value: [], properties: { shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {}, shadowCameraNear: {}, shadowCameraFar: {} } }, pointShadowMap: { value: [] }, pointShadowMatrix: { value: [] }, hemisphereLights: { value: [], properties: { direction: {}, skyColor: {}, groundColor: {} } }, // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src rectAreaLights: { value: [], properties: { color: {}, position: {}, width: {}, height: {} } }, ltc_1: { value: null }, ltc_2: { value: null } }, points: { diffuse: { value: new Fe(16777215) }, opacity: { value: 1 }, size: { value: 1 }, scale: { value: 1 }, map: { value: null }, alphaMap: { value: null }, uvTransform: { value: new ln() } }, sprite: { diffuse: { value: new Fe(16777215) }, opacity: { value: 1 }, center: { value: new Pe(0.5, 0.5) }, rotation: { value: 0 }, map: { value: null }, alphaMap: { value: null }, uvTransform: { value: new ln() } } }, gi = { basic: { uniforms: En([ ze.common, ze.specularmap, ze.envmap, ze.aomap, ze.lightmap, ze.fog ]), vertexShader: ct.meshbasic_vert, fragmentShader: ct.meshbasic_frag }, lambert: { uniforms: En([ ze.common, ze.specularmap, ze.envmap, ze.aomap, ze.lightmap, ze.emissivemap, ze.fog, ze.lights, { emissive: { value: new Fe(0) } } ]), vertexShader: ct.meshlambert_vert, fragmentShader: ct.meshlambert_frag }, phong: { uniforms: En([ ze.common, ze.specularmap, ze.envmap, ze.aomap, ze.lightmap, ze.emissivemap, ze.bumpmap, ze.normalmap, ze.displacementmap, ze.fog, ze.lights, { emissive: { value: new Fe(0) }, specular: { value: new Fe(1118481) }, shininess: { value: 30 } } ]), vertexShader: ct.meshphong_vert, fragmentShader: ct.meshphong_frag }, standard: { uniforms: En([ ze.common, ze.envmap, ze.aomap, ze.lightmap, ze.emissivemap, ze.bumpmap, ze.normalmap, ze.displacementmap, ze.roughnessmap, ze.metalnessmap, ze.fog, ze.lights, { emissive: { value: new Fe(0) }, roughness: { value: 1 }, metalness: { value: 0 }, envMapIntensity: { value: 1 } // temporary } ]), vertexShader: ct.meshphysical_vert, fragmentShader: ct.meshphysical_frag }, toon: { uniforms: En([ ze.common, ze.aomap, ze.lightmap, ze.emissivemap, ze.bumpmap, ze.normalmap, ze.displacementmap, ze.gradientmap, ze.fog, ze.lights, { emissive: { value: new Fe(0) } } ]), vertexShader: ct.meshtoon_vert, fragmentShader: ct.meshtoon_frag }, matcap: { uniforms: En([ ze.common, ze.bumpmap, ze.normalmap, ze.displacementmap, ze.fog, { matcap: { value: null } } ]), vertexShader: ct.meshmatcap_vert, fragmentShader: ct.meshmatcap_frag }, points: { uniforms: En([ ze.points, ze.fog ]), vertexShader: ct.points_vert, fragmentShader: ct.points_frag }, dashed: { uniforms: En([ ze.common, ze.fog, { scale: { value: 1 }, dashSize: { value: 1 }, totalSize: { value: 2 } } ]), vertexShader: ct.linedashed_vert, fragmentShader: ct.linedashed_frag }, depth: { uniforms: En([ ze.common, ze.displacementmap ]), vertexShader: ct.depth_vert, fragmentShader: ct.depth_frag }, normal: { uniforms: En([ ze.common, ze.bumpmap, ze.normalmap, ze.displacementmap, { opacity: { value: 1 } } ]), vertexShader: ct.normal_vert, fragmentShader: ct.normal_frag }, sprite: { uniforms: En([ ze.sprite, ze.fog ]), vertexShader: ct.sprite_vert, fragmentShader: ct.sprite_frag }, background: { uniforms: { uvTransform: { value: new ln() }, t2D: { value: null } }, vertexShader: ct.background_vert, fragmentShader: ct.background_frag }, /* ------------------------------------------------------------------------- // Cube map shader ------------------------------------------------------------------------- */ cube: { uniforms: En([ ze.envmap, { opacity: { value: 1 } } ]), vertexShader: ct.cube_vert, fragmentShader: ct.cube_frag }, equirect: { uniforms: { tEquirect: { value: null } }, vertexShader: ct.equirect_vert, fragmentShader: ct.equirect_frag }, distanceRGBA: { uniforms: En([ ze.common, ze.displacementmap, { referencePosition: { value: new X() }, nearDistance: { value: 1 }, farDistance: { value: 1e3 } } ]), vertexShader: ct.distanceRGBA_vert, fragmentShader: ct.distanceRGBA_frag }, shadow: { uniforms: En([ ze.lights, ze.fog, { color: { value: new Fe(0) }, opacity: { value: 1 } } ]), vertexShader: ct.shadow_vert, fragmentShader: ct.shadow_frag } }; gi.physical = { uniforms: En([ gi.standard.uniforms, { clearcoat: { value: 0 }, clearcoatMap: { value: null }, clearcoatRoughness: { value: 0 }, clearcoatRoughnessMap: { value: null }, clearcoatNormalScale: { value: new Pe(1, 1) }, clearcoatNormalMap: { value: null }, sheen: { value: new Fe(0) }, transmission: { value: 0 }, transmissionMap: { value: null }, transmissionSamplerSize: { value: new Pe() }, transmissionSamplerMap: { value: null }, thickness: { value: 0 }, thicknessMap: { value: null }, attenuationDistance: { value: 0 }, attenuationColor: { value: new Fe(0) } } ]), vertexShader: ct.meshphysical_vert, fragmentShader: ct.meshphysical_frag }; function Q3(n, e, t, i, r) { const s = new Fe(0); let o = 0, a, c, l = null, d = 0, h = null; function p(f, u) { let y = !1, v = u.isScene === !0 ? u.background : null; v && v.isTexture && (v = e.get(v)); const m = n.xr, w = m.getSession && m.getSession(); w && w.environmentBlendMode === "additive" && (v = null), v === null ? g(s, o) : v && v.isColor && (g(v, 1), y = !0), (n.autoClear || y) && n.clear(n.autoClearColor, n.autoClearDepth, n.autoClearStencil), v && (v.isCubeTexture || v.mapping === la) ? (c === void 0 && (c = new tn( new hr(1, 1, 1), new dr({ name: "BackgroundCubeMaterial", uniforms: Vo(gi.cube.uniforms), vertexShader: gi.cube.vertexShader, fragmentShader: gi.cube.fragmentShader, side: qt, depthTest: !1, depthWrite: !1, fog: !1 }) ), c.geometry.deleteAttribute("normal"), c.geometry.deleteAttribute("uv"), c.onBeforeRender = function(S, T, M) { this.matrixWorld.copyPosition(M.matrixWorld); }, Object.defineProperty(c.material, "envMap", { get: function() { return this.uniforms.envMap.value; } }), i.update(c)), c.material.uniforms.envMap.value = v, c.material.uniforms.flipEnvMap.value = v.isCubeTexture && v._needsFlipEnvMap ? -1 : 1, (l !== v || d !== v.version || h !== n.toneMapping) && (c.material.needsUpdate = !0, l = v, d = v.version, h = n.toneMapping), f.unshift(c, c.geometry, c.material, 0, 0, null)) : v && v.isTexture && (a === void 0 && (a = new tn( new Ds(2, 2), new dr({ name: "BackgroundMaterial", uniforms: Vo(gi.background.uniforms), vertexShader: gi.background.vertexShader, fragmentShader: gi.background.fragmentShader, side: Xr, depthTest: !1, depthWrite: !1, fog: !1 }) ), a.geometry.deleteAttribute("normal"), Object.defineProperty(a.material, "map", { get: function() { return this.uniforms.t2D.value; } }), i.update(a)), a.material.uniforms.t2D.value = v, v.matrixAutoUpdate === !0 && v.updateMatrix(), a.material.uniforms.uvTransform.value.copy(v.matrix), (l !== v || d !== v.version || h !== n.toneMapping) && (a.material.needsUpdate = !0, l = v, d = v.version, h = n.toneMapping), f.unshift(a, a.geometry, a.material, 0, 0, null)); } function g(f, u) { t.buffers.color.setClear(f.r, f.g, f.b, u, r); } return { getClearColor: function() { return s; }, setClearColor: function(f, u = 1) { s.set(f), o = u, g(s, o); }, getClearAlpha: function() { return o; }, setClearAlpha: function(f) { o = f, g(s, o); }, render: p }; } function eD(n, e, t, i) { const r = n.getParameter(34921), s = i.isWebGL2 ? null : e.get("OES_vertex_array_object"), o = i.isWebGL2 || s !== null, a = {}, c = u(null); let l = c; function d(A, P, I, b, O) { let N = !1; if (o) { const D = f(b, I, P); l !== D && (l = D, p(l.object)), N = y(b, O), N && v(b, O); } else { const D = P.wireframe === !0; (l.geometry !== b.id || l.program !== I.id || l.wireframe !== D) && (l.geometry = b.id, l.program = I.id, l.wireframe = D, N = !0); } A.isInstancedMesh === !0 && (N = !0), O !== null && t.update(O, 34963), N && (x(A, P, I, b), O !== null && n.bindBuffer(34963, t.get(O).buffer)); } function h() { return i.isWebGL2 ? n.createVertexArray() : s.createVertexArrayOES(); } function p(A) { return i.isWebGL2 ? n.bindVertexArray(A) : s.bindVertexArrayOES(A); } function g(A) { return i.isWebGL2 ? n.deleteVertexArray(A) : s.deleteVertexArrayOES(A); } function f(A, P, I) { const b = I.wireframe === !0; let O = a[A.id]; O === void 0 && (O = {}, a[A.id] = O); let N = O[P.id]; N === void 0 && (N = {}, O[P.id] = N); let D = N[b]; return D === void 0 && (D = u(h()), N[b] = D), D; } function u(A) { const P = [], I = [], b = []; for (let O = 0; O < r; O++) P[O] = 0, I[O] = 0, b[O] = 0; return { // for backward compatibility on non-VAO support browser geometry: null, program: null, wireframe: !1, newAttributes: P, enabledAttributes: I, attributeDivisors: b, object: A, attributes: {}, index: null }; } function y(A, P) { const I = l.attributes, b = A.attributes; let O = 0; for (const N in b) { const D = I[N], B = b[N]; if (D === void 0 || D.attribute !== B || D.data !== B.data) return !0; O++; } return l.attributesNum !== O || l.index !== P; } function v(A, P) { const I = {}, b = A.attributes; let O = 0; for (const N in b) { const D = b[N], B = {}; B.attribute = D, D.data && (B.data = D.data), I[N] = B, O++; } l.attributes = I, l.attributesNum = O, l.index = P; } function m() { const A = l.newAttributes; for (let P = 0, I = A.length; P < I; P++) A[P] = 0; } function w(A) { S(A, 0); } function S(A, P) { const I = l.newAttributes, b = l.enabledAttributes, O = l.attributeDivisors; I[A] = 1, b[A] === 0 && (n.enableVertexAttribArray(A), b[A] = 1), O[A] !== P && ((i.isWebGL2 ? n : e.get("ANGLE_instanced_arrays"))[i.isWebGL2 ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE"](A, P), O[A] = P); } function T() { const A = l.newAttributes, P = l.enabledAttributes; for (let I = 0, b = P.length; I < b; I++) P[I] !== A[I] && (n.disableVertexAttribArray(I), P[I] = 0); } function M(A, P, I, b, O, N) { i.isWebGL2 === !0 && (I === 5124 || I === 5125) ? n.vertexAttribIPointer(A, P, I, O, N) : n.vertexAttribPointer(A, P, I, b, O, N); } function x(A, P, I, b) { if (i.isWebGL2 === !1 && (A.isInstancedMesh || b.isInstancedBufferGeometry) && e.get("ANGLE_instanced_arrays") === null) return; m(); const O = b.attributes, N = I.getAttributes(), D = P.defaultAttributeValues; for (const B in N) { const U = N[B]; if (U >= 0) { const k = O[B]; if (k !== void 0) { const K = k.normalized, ie = k.itemSize, j = t.get(k); if (j === void 0) continue; const G = j.buffer, W = j.type, q = j.bytesPerElement; if (k.isInterleavedBufferAttribute) { const Q = k.data, ee = Q.stride, ne = k.offset; Q && Q.isInstancedInterleavedBuffer ? (S(U, Q.meshPerAttribute), b._maxInstanceCount === void 0 && (b._maxInstanceCount = Q.meshPerAttribute * Q.count)) : w(U), n.bindBuffer(34962, G), M(U, ie, W, K, ee * q, ne * q); } else k.isInstancedBufferAttribute ? (S(U, k.meshPerAttribute), b._maxInstanceCount === void 0 && (b._maxInstanceCount = k.meshPerAttribute * k.count)) : w(U), n.bindBuffer(34962, G), M(U, ie, W, K, 0, 0); } else if (B === "instanceMatrix") { const K = t.get(A.instanceMatrix); if (K === void 0) continue; const ie = K.buffer, j = K.type; S(U + 0, 1), S(U + 1, 1), S(U + 2, 1), S(U + 3, 1), n.bindBuffer(34962, ie), n.vertexAttribPointer(U + 0, 4, j, !1, 64, 0), n.vertexAttribPointer(U + 1, 4, j, !1, 64, 16), n.vertexAttribPointer(U + 2, 4, j, !1, 64, 32), n.vertexAttribPointer(U + 3, 4, j, !1, 64, 48); } else if (B === "instanceColor") { const K = t.get(A.instanceColor); if (K === void 0) continue; const ie = K.buffer, j = K.type; S(U, 1), n.bindBuffer(34962, ie), n.vertexAttribPointer(U, 3, j, !1, 12, 0); } else if (D !== void 0) { const K = D[B]; if (K !== void 0) switch (K.length) { case 2: n.vertexAttrib2fv(U, K); break; case 3: n.vertexAttrib3fv(U, K); break; case 4: n.vertexAttrib4fv(U, K); break; default: n.vertexAttrib1fv(U, K); } } } } T(); } function _() { R(); for (const A in a) { const P = a[A]; for (const I in P) { const b = P[I]; for (const O in b) g(b[O].object), delete b[O]; delete P[I]; } delete a[A]; } } function E(A) { if (a[A.id] === void 0) return; const P = a[A.id]; for (const I in P) { const b = P[I]; for (const O in b) g(b[O].object), delete b[O]; delete P[I]; } delete a[A.id]; } function L(A) { for (const P in a) { const I = a[P]; if (I[A.id] === void 0) continue; const b = I[A.id]; for (const O in b) g(b[O].object), delete b[O]; delete I[A.id]; } } function R() { C(), l !== c && (l = c, p(l.object)); } function C() { c.geometry = null, c.program = null, c.wireframe = !1; } return { setup: d, reset: R, resetDefaultState: C, dispose: _, releaseStatesOfGeometry: E, releaseStatesOfProgram: L, initAttributes: m, enableAttribute: w, disableUnusedAttributes: T }; } function tD(n, e, t, i) { const r = i.isWebGL2; let s; function o(l) { s = l; } function a(l, d) { n.drawArrays(s, l, d), t.update(d, s, 1); } function c(l, d, h) { if (h === 0) return; let p, g; if (r) p = n, g = "drawArraysInstanced"; else if (p = e.get("ANGLE_instanced_arrays"), g = "drawArraysInstancedANGLE", p === null) { console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); return; } p[g](s, l, d, h), t.update(d, s, h); } this.setMode = o, this.render = a, this.renderInstances = c; } function nD(n, e, t) { let i; function r() { if (i !== void 0) return i; if (e.has("EXT_texture_filter_anisotropic") === !0) { const x = e.get("EXT_texture_filter_anisotropic"); i = n.getParameter(x.MAX_TEXTURE_MAX_ANISOTROPY_EXT); } else i = 0; return i; } function s(x) { if (x === "highp") { if (n.getShaderPrecisionFormat(35633, 36338).precision > 0 && n.getShaderPrecisionFormat(35632, 36338).precision > 0) return "highp"; x = "mediump"; } return x === "mediump" && n.getShaderPrecisionFormat(35633, 36337).precision > 0 && n.getShaderPrecisionFormat(35632, 36337).precision > 0 ? "mediump" : "lowp"; } const o = typeof WebGL2RenderingContext < "u" && n instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext < "u" && n instanceof WebGL2ComputeRenderingContext; let a = t.precision !== void 0 ? t.precision : "highp"; const c = s(a); c !== a && (console.warn("THREE.WebGLRenderer:", a, "not supported, using", c, "instead."), a = c); const l = o || e.has("WEBGL_draw_buffers"), d = t.logarithmicDepthBuffer === !0, h = n.getParameter(34930), p = n.getParameter(35660), g = n.getParameter(3379), f = n.getParameter(34076), u = n.getParameter(34921), y = n.getParameter(36347), v = n.getParameter(36348), m = n.getParameter(36349), w = p > 0, S = o || e.has("OES_texture_float"), T = w && S, M = o ? n.getParameter(36183) : 0; return { isWebGL2: o, drawBuffers: l, getMaxAnisotropy: r, getMaxPrecision: s, precision: a, logarithmicDepthBuffer: d, maxTextures: h, maxVertexTextures: p, maxTextureSize: g, maxCubemapSize: f, maxAttributes: u, maxVertexUniforms: y, maxVaryings: v, maxFragmentUniforms: m, vertexTextures: w, floatFragmentTextures: S, floatVertexTextures: T, maxSamples: M }; } function iD(n) { const e = this; let t = null, i = 0, r = !1, s = !1; const o = new Li(), a = new ln(), c = { value: null, needsUpdate: !1 }; this.uniform = c, this.numPlanes = 0, this.numIntersection = 0, this.init = function(h, p, g) { const f = h.length !== 0 || p || // enable state of previous frame - the clipping code has to // run another frame in order to reset the state: i !== 0 || r; return r = p, t = d(h, g, 0), i = h.length, f; }, this.beginShadows = function() { s = !0, d(null); }, this.endShadows = function() { s = !1, l(); }, this.setState = function(h, p, g) { const f = h.clippingPlanes, u = h.clipIntersection, y = h.clipShadows, v = n.get(h); if (!r || f === null || f.length === 0 || s && !y) s ? d(null) : l(); else { const m = s ? 0 : i, w = m * 4; let S = v.clippingState || null; c.value = S, S = d(f, p, w, g); for (let T = 0; T !== w; ++T) S[T] = t[T]; v.clippingState = S, this.numIntersection = u ? this.numPlanes : 0, this.numPlanes += m; } }; function l() { c.value !== t && (c.value = t, c.needsUpdate = i > 0), e.numPlanes = i, e.numIntersection = 0; } function d(h, p, g, f) { const u = h !== null ? h.length : 0; let y = null; if (u !== 0) { if (y = c.value, f !== !0 || y === null) { const v = g + u * 4, m = p.matrixWorldInverse; a.getNormalMatrix(m), (y === null || y.length < v) && (y = new Float32Array(v)); for (let w = 0, S = g; w !== u; ++w, S += 4) o.copy(h[w]).applyMatrix4(m, a), o.normal.toArray(y, S), y[S + 3] = o.constant; } c.value = y, c.needsUpdate = !0; } return e.numPlanes = u, e.numIntersection = 0, y; } } function rD(n) { let e = /* @__PURE__ */ new WeakMap(); function t(o, a) { return a === Qc ? o.mapping = yl : a === eu && (o.mapping = bl), o; } function i(o) { if (o && o.isTexture) { const a = o.mapping; if (a === Qc || a === eu) if (e.has(o)) { const c = e.get(o).texture; return t(c, o.mapping); } else { const c = o.image; if (c && c.height > 0) { const l = n.getRenderTarget(), d = new Iu(c.height / 2); return d.fromEquirectangularTexture(n, o), e.set(o, d), n.setRenderTarget(l), o.addEventListener("dispose", r), t(d.texture, o.mapping); } else return null; } } return o; } function r(o) { const a = o.target; a.removeEventListener("dispose", r); const c = e.get(a); c !== void 0 && (e.delete(a), c.dispose()); } function s() { e = /* @__PURE__ */ new WeakMap(); } return { get: i, dispose: s }; } function sD(n) { const e = {}; function t(i) { if (e[i] !== void 0) return e[i]; let r; switch (i) { case "WEBGL_depth_texture": r = n.getExtension("WEBGL_depth_texture") || n.getExtension("MOZ_WEBGL_depth_texture") || n.getExtension("WEBKIT_WEBGL_depth_texture"); break; case "EXT_texture_filter_anisotropic": r = n.getExtension("EXT_texture_filter_anisotropic") || n.getExtension("MOZ_EXT_texture_filter_anisotropic") || n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); break; case "WEBGL_compressed_texture_s3tc": r = n.getExtension("WEBGL_compressed_texture_s3tc") || n.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); break; case "WEBGL_compressed_texture_pvrtc": r = n.getExtension("WEBGL_compressed_texture_pvrtc") || n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"); break; default: r = n.getExtension(i); } return e[i] = r, r; } return { has: function(i) { return t(i) !== null; }, init: function(i) { i.isWebGL2 ? t("EXT_color_buffer_float") : (t("WEBGL_depth_texture"), t("OES_texture_float"), t("OES_texture_half_float"), t("OES_texture_half_float_linear"), t("OES_standard_derivatives"), t("OES_element_index_uint"), t("OES_vertex_array_object"), t("ANGLE_instanced_arrays")), t("OES_texture_float_linear"), t("EXT_color_buffer_half_float"); }, get: function(i) { const r = t(i); return r === null && console.warn("THREE.WebGLRenderer: " + i + " extension not supported."), r; } }; } function oD(n, e, t, i) { const r = {}, s = /* @__PURE__ */ new WeakMap(); function o(h) { const p = h.target; p.index !== null && e.remove(p.index); for (const f in p.attributes) e.remove(p.attributes[f]); p.removeEventListener("dispose", o), delete r[p.id]; const g = s.get(p); g && (e.remove(g), s.delete(p)), i.releaseStatesOfGeometry(p), p.isInstancedBufferGeometry === !0 && delete p._maxInstanceCount, t.memory.geometries--; } function a(h, p) { return r[p.id] === !0 || (p.addEventListener("dispose", o), r[p.id] = !0, t.memory.geometries++), p; } function c(h) { const p = h.attributes; for (const f in p) e.update(p[f], 34962); const g = h.morphAttributes; for (const f in g) { const u = g[f]; for (let y = 0, v = u.length; y < v; y++) e.update(u[y], 34962); } } function l(h) { const p = [], g = h.index, f = h.attributes.position; let u = 0; if (g !== null) { const m = g.array; u = g.version; for (let w = 0, S = m.length; w < S; w += 3) { const T = m[w + 0], M = m[w + 1], x = m[w + 2]; p.push(T, M, M, x, x, T); } } else { const m = f.array; u = f.version; for (let w = 0, S = m.length / 3 - 1; w < S; w += 3) { const T = w + 0, M = w + 1, x = w + 2; p.push(T, M, M, x, x, T); } } const y = new (Sx(p) > 65535 ? Ru : Lu)(p, 1); y.version = u; const v = s.get(h); v && e.remove(v), s.set(h, y); } function d(h) { const p = s.get(h); if (p) { const g = h.index; g !== null && p.version < g.version && l(h); } else l(h); return s.get(h); } return { get: a, update: c, getWireframeAttribute: d }; } function aD(n, e, t, i) { const r = i.isWebGL2; let s; function o(p) { s = p; } let a, c; function l(p) { a = p.type, c = p.bytesPerElement; } function d(p, g) { n.drawElements(s, g, a, p * c), t.update(g, s, 1); } function h(p, g, f) { if (f === 0) return; let u, y; if (r) u = n, y = "drawElementsInstanced"; else if (u = e.get("ANGLE_instanced_arrays"), y = "drawElementsInstancedANGLE", u === null) { console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); return; } u[y](s, g, a, p * c, f), t.update(g, s, f); } this.setMode = o, this.setIndex = l, this.render = d, this.renderInstances = h; } function lD(n) { const e = { geometries: 0, textures: 0 }, t = { frame: 0, calls: 0, triangles: 0, points: 0, lines: 0 }; function i(s, o, a) { switch (t.calls++, o) { case 4: t.triangles += a * (s / 3); break; case 1: t.lines += a * (s / 2); break; case 3: t.lines += a * (s - 1); break; case 2: t.lines += a * s; break; case 0: t.points += a * s; break; default: console.error("THREE.WebGLInfo: Unknown draw mode:", o); break; } } function r() { t.frame++, t.calls = 0, t.triangles = 0, t.points = 0, t.lines = 0; } return { memory: e, render: t, programs: null, autoReset: !0, reset: r, update: i }; } function cD(n, e) { return n[0] - e[0]; } function uD(n, e) { return Math.abs(e[1]) - Math.abs(n[1]); } function hD(n) { const e = {}, t = new Float32Array(8), i = []; for (let s = 0; s < 8; s++) i[s] = [s, 0]; function r(s, o, a, c) { const l = s.morphTargetInfluences, d = l === void 0 ? 0 : l.length; let h = e[o.id]; if (h === void 0 || h.length !== d) { h = []; for (let y = 0; y < d; y++) h[y] = [y, 0]; e[o.id] = h; } for (let y = 0; y < d; y++) { const v = h[y]; v[0] = y, v[1] = l[y]; } h.sort(uD); for (let y = 0; y < 8; y++) y < d && h[y][1] ? (i[y][0] = h[y][0], i[y][1] = h[y][1]) : (i[y][0] = Number.MAX_SAFE_INTEGER, i[y][1] = 0); i.sort(cD); const p = a.morphTargets && o.morphAttributes.position, g = a.morphNormals && o.morphAttributes.normal; let f = 0; for (let y = 0; y < 8; y++) { const v = i[y], m = v[0], w = v[1]; m !== Number.MAX_SAFE_INTEGER && w ? (p && o.getAttribute("morphTarget" + y) !== p[m] && o.setAttribute("morphTarget" + y, p[m]), g && o.getAttribute("morphNormal" + y) !== g[m] && o.setAttribute("morphNormal" + y, g[m]), t[y] = w, f += w) : (p && o.hasAttribute("morphTarget" + y) === !0 && o.deleteAttribute("morphTarget" + y), g && o.hasAttribute("morphNormal" + y) === !0 && o.deleteAttribute("morphNormal" + y), t[y] = 0); } const u = o.morphTargetsRelative ? 1 : 1 - f; c.getUniforms().setValue(n, "morphTargetBaseInfluence", u), c.getUniforms().setValue(n, "morphTargetInfluences", t); } return { update: r }; } function dD(n, e, t, i) { let r = /* @__PURE__ */ new WeakMap(); function s(c) { const l = i.render.frame, d = c.geometry, h = e.get(c, d); return r.get(h) !== l && (e.update(h), r.set(h, l)), c.isInstancedMesh && (c.hasEventListener("dispose", a) === !1 && c.addEventListener("dispose", a), t.update(c.instanceMatrix, 34962), c.instanceColor !== null && t.update(c.instanceColor, 34962)), h; } function o() { r = /* @__PURE__ */ new WeakMap(); } function a(c) { const l = c.target; l.removeEventListener("dispose", a), t.remove(l.instanceMatrix), l.instanceColor !== null && t.remove(l.instanceColor); } return { update: s, dispose: o }; } class Kf extends nn { constructor(e = null, t = 1, i = 1, r = 1) { super(null), this.image = { data: e, width: t, height: i, depth: r }, this.magFilter = Kt, this.minFilter = Kt, this.wrapR = mn, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0; } } Kf.prototype.isDataTexture2DArray = !0; class Qf extends nn { constructor(e = null, t = 1, i = 1, r = 1) { super(null), this.image = { data: e, width: t, height: i, depth: r }, this.magFilter = Kt, this.minFilter = Kt, this.wrapR = mn, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0; } } Qf.prototype.isDataTexture3D = !0; const Ex = new nn(), fD = new Kf(), pD = new Qf(), Ax = new ca(), Tg = [], Eg = [], Ag = new Float32Array(16), Cg = new Float32Array(9), Lg = new Float32Array(4); function ua(n, e, t) { const i = n[0]; if (i <= 0 || i > 0) return n; const r = e * t; let s = Tg[r]; if (s === void 0 && (s = new Float32Array(r), Tg[r] = s), e !== 0) { i.toArray(s, 0); for (let o = 1, a = 0; o !== e; ++o) a += t, n[o].toArray(s, a); } return s; } function Nn(n, e) { if (n.length !== e.length) return !1; for (let t = 0, i = n.length; t < i; t++) if (n[t] !== e[t]) return !1; return !0; } function Rn(n, e) { for (let t = 0, i = e.length; t < i; t++) n[t] = e[t]; } function Cx(n, e) { let t = Eg[e]; t === void 0 && (t = new Int32Array(e), Eg[e] = t); for (let i = 0; i !== e; ++i) t[i] = n.allocateTextureUnit(); return t; } function mD(n, e) { const t = this.cache; t[0] !== e && (n.uniform1f(this.addr, e), t[0] = e); } function gD(n, e) { const t = this.cache; if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y) && (n.uniform2f(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y); else { if (Nn(t, e)) return; n.uniform2fv(this.addr, e), Rn(t, e); } } function vD(n, e) { const t = this.cache; if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (n.uniform3f(this.addr, e.x, e.y, e.z), t[0] = e.x, t[1] = e.y, t[2] = e.z); else if (e.r !== void 0) (t[0] !== e.r || t[1] !== e.g || t[2] !== e.b) && (n.uniform3f(this.addr, e.r, e.g, e.b), t[0] = e.r, t[1] = e.g, t[2] = e.b); else { if (Nn(t, e)) return; n.uniform3fv(this.addr, e), Rn(t, e); } } function yD(n, e) { const t = this.cache; if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (n.uniform4f(this.addr, e.x, e.y, e.z, e.w), t[0] = e.x, t[1] = e.y, t[2] = e.z, t[3] = e.w); else { if (Nn(t, e)) return; n.uniform4fv(this.addr, e), Rn(t, e); } } function bD(n, e) { const t = this.cache, i = e.elements; if (i === void 0) { if (Nn(t, e)) return; n.uniformMatrix2fv(this.addr, !1, e), Rn(t, e); } else { if (Nn(t, i)) return; Lg.set(i), n.uniformMatrix2fv(this.addr, !1, Lg), Rn(t, i); } } function xD(n, e) { const t = this.cache, i = e.elements; if (i === void 0) { if (Nn(t, e)) return; n.uniformMatrix3fv(this.addr, !1, e), Rn(t, e); } else { if (Nn(t, i)) return; Cg.set(i), n.uniformMatrix3fv(this.addr, !1, Cg), Rn(t, i); } } function wD(n, e) { const t = this.cache, i = e.elements; if (i === void 0) { if (Nn(t, e)) return; n.uniformMatrix4fv(this.addr, !1, e), Rn(t, e); } else { if (Nn(t, i)) return; Ag.set(i), n.uniformMatrix4fv(this.addr, !1, Ag), Rn(t, i); } } function MD(n, e) { const t = this.cache; t[0] !== e && (n.uniform1i(this.addr, e), t[0] = e); } function SD(n, e) { const t = this.cache; Nn(t, e) || (n.uniform2iv(this.addr, e), Rn(t, e)); } function _D(n, e) { const t = this.cache; Nn(t, e) || (n.uniform3iv(this.addr, e), Rn(t, e)); } function TD(n, e) { const t = this.cache; Nn(t, e) || (n.uniform4iv(this.addr, e), Rn(t, e)); } function ED(n, e) { const t = this.cache; t[0] !== e && (n.uniform1ui(this.addr, e), t[0] = e); } function AD(n, e) { const t = this.cache; Nn(t, e) || (n.uniform2uiv(this.addr, e), Rn(t, e)); } function CD(n, e) { const t = this.cache; Nn(t, e) || (n.uniform3uiv(this.addr, e), Rn(t, e)); } function LD(n, e) { const t = this.cache; Nn(t, e) || (n.uniform4uiv(this.addr, e), Rn(t, e)); } function RD(n, e, t) { const i = this.cache, r = t.allocateTextureUnit(); i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.safeSetTexture2D(e || Ex, r); } function PD(n, e, t) { const i = this.cache, r = t.allocateTextureUnit(); i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.setTexture3D(e || pD, r); } function ID(n, e, t) { const i = this.cache, r = t.allocateTextureUnit(); i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.safeSetTextureCube(e || Ax, r); } function OD(n, e, t) { const i = this.cache, r = t.allocateTextureUnit(); i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.setTexture2DArray(e || fD, r); } function DD(n) { switch (n) { case 5126: return mD; case 35664: return gD; case 35665: return vD; case 35666: return yD; case 35674: return bD; case 35675: return xD; case 35676: return wD; case 5124: case 35670: return MD; case 35667: case 35671: return SD; case 35668: case 35672: return _D; case 35669: case 35673: return TD; case 5125: return ED; case 36294: return AD; case 36295: return CD; case 36296: return LD; case 35678: case 36198: case 36298: case 36306: case 35682: return RD; case 35679: case 36299: case 36307: return PD; case 35680: case 36300: case 36308: case 36293: return ID; case 36289: case 36303: case 36311: case 36292: return OD; } } function ND(n, e) { n.uniform1fv(this.addr, e); } function FD(n, e) { const t = ua(e, this.size, 2); n.uniform2fv(this.addr, t); } function BD(n, e) { const t = ua(e, this.size, 3); n.uniform3fv(this.addr, t); } function zD(n, e) { const t = ua(e, this.size, 4); n.uniform4fv(this.addr, t); } function UD(n, e) { const t = ua(e, this.size, 4); n.uniformMatrix2fv(this.addr, !1, t); } function VD(n, e) { const t = ua(e, this.size, 9); n.uniformMatrix3fv(this.addr, !1, t); } function kD(n, e) { const t = ua(e, this.size, 16); n.uniformMatrix4fv(this.addr, !1, t); } function GD(n, e) { n.uniform1iv(this.addr, e); } function HD(n, e) { n.uniform2iv(this.addr, e); } function WD(n, e) { n.uniform3iv(this.addr, e); } function jD(n, e) { n.uniform4iv(this.addr, e); } function $D(n, e) { n.uniform1uiv(this.addr, e); } function ZD(n, e) { n.uniform2uiv(this.addr, e); } function XD(n, e) { n.uniform3uiv(this.addr, e); } function YD(n, e) { n.uniform4uiv(this.addr, e); } function JD(n, e, t) { const i = e.length, r = Cx(t, i); n.uniform1iv(this.addr, r); for (let s = 0; s !== i; ++s) t.safeSetTexture2D(e[s] || Ex, r[s]); } function qD(n, e, t) { const i = e.length, r = Cx(t, i); n.uniform1iv(this.addr, r); for (let s = 0; s !== i; ++s) t.safeSetTextureCube(e[s] || Ax, r[s]); } function KD(n) { switch (n) { case 5126: return ND; case 35664: return FD; case 35665: return BD; case 35666: return zD; case 35674: return UD; case 35675: return VD; case 35676: return kD; case 5124: case 35670: return GD; case 35667: case 35671: return HD; case 35668: case 35672: return WD; case 35669: case 35673: return jD; case 5125: return $D; case 36294: return ZD; case 36295: return XD; case 36296: return YD; case 35678: case 36198: case 36298: case 36306: case 35682: return JD; case 35680: case 36300: case 36308: case 36293: return qD; } } function QD(n, e, t) { this.id = n, this.addr = t, this.cache = [], this.setValue = DD(e.type); } function Lx(n, e, t) { this.id = n, this.addr = t, this.cache = [], this.size = e.size, this.setValue = KD(e.type); } Lx.prototype.updateCache = function(n) { const e = this.cache; n instanceof Float32Array && e.length !== n.length && (this.cache = new Float32Array(n.length)), Rn(e, n); }; function Rx(n) { this.id = n, this.seq = [], this.map = {}; } Rx.prototype.setValue = function(n, e, t) { const i = this.seq; for (let r = 0, s = i.length; r !== s; ++r) { const o = i[r]; o.setValue(n, e[o.id], t); } }; const Ch = /(\w+)(\])?(\[|\.)?/g; function Rg(n, e) { n.seq.push(e), n.map[e.id] = e; } function eN(n, e, t) { const i = n.name, r = i.length; for (Ch.lastIndex = 0; ; ) { const s = Ch.exec(i), o = Ch.lastIndex; let a = s[1]; const c = s[2] === "]", l = s[3]; if (c && (a = a | 0), l === void 0 || l === "[" && o + 2 === r) { Rg(t, l === void 0 ? new QD(a, n, e) : new Lx(a, n, e)); break; } else { let h = t.map[a]; h === void 0 && (h = new Rx(a), Rg(t, h)), t = h; } } } function kr(n, e) { this.seq = [], this.map = {}; const t = n.getProgramParameter(e, 35718); for (let i = 0; i < t; ++i) { const r = n.getActiveUniform(e, i), s = n.getUniformLocation(e, r.name); eN(r, s, this); } } kr.prototype.setValue = function(n, e, t, i) { const r = this.map[e]; r !== void 0 && r.setValue(n, t, i); }; kr.prototype.setOptional = function(n, e, t) { const i = e[t]; i !== void 0 && this.setValue(n, t, i); }; kr.upload = function(n, e, t, i) { for (let r = 0, s = e.length; r !== s; ++r) { const o = e[r], a = t[o.id]; a.needsUpdate !== !1 && o.setValue(n, a.value, i); } }; kr.seqWithValue = function(n, e) { const t = []; for (let i = 0, r = n.length; i !== r; ++i) { const s = n[i]; s.id in e && t.push(s); } return t; }; function Pg(n, e, t) { const i = n.createShader(e); return n.shaderSource(i, t), n.compileShader(i), i; } let tN = 0; function nN(n) { const e = n.split(` `); for (let t = 0; t < e.length; t++) e[t] = t + 1 + ": " + e[t]; return e.join(` `); } function Px(n) { switch (n) { case Dn: return ["Linear", "( value )"]; case Os: return ["sRGB", "( value )"]; case Cu: return ["RGBE", "( value )"]; case $f: return ["RGBM", "( value, 7.0 )"]; case Zf: return ["RGBM", "( value, 16.0 )"]; case Xf: return ["RGBD", "( value, 256.0 )"]; case Au: return ["Gamma", "( value, float( GAMMA_FACTOR ) )"]; case ax: return ["LogLuv", "( value )"]; default: return console.warn("THREE.WebGLProgram: Unsupported encoding:", n), ["Linear", "( value )"]; } } function Ig(n, e, t) { const i = n.getShaderParameter(e, 35713), r = n.getShaderInfoLog(e).trim(); if (i && r === "") return ""; const s = n.getShaderSource(e); return "THREE.WebGLShader: gl.getShaderInfoLog() " + t + ` ` + r + nN(s); } function Sa(n, e) { const t = Px(e); return "vec4 " + n + "( vec4 value ) { return " + t[0] + "ToLinear" + t[1] + "; }"; } function iN(n, e) { const t = Px(e); return "vec4 " + n + "( vec4 value ) { return LinearTo" + t[0] + t[1] + "; }"; } function rN(n, e) { let t; switch (e) { case sb: t = "Linear"; break; case ob: t = "Reinhard"; break; case ab: t = "OptimizedCineon"; break; case lb: t = "ACESFilmic"; break; case cb: t = "Custom"; break; default: console.warn("THREE.WebGLProgram: Unsupported toneMapping:", e), t = "Linear"; } return "vec3 " + n + "( vec3 color ) { return " + t + "ToneMapping( color ); }"; } function sN(n) { return [ n.extensionDerivatives || n.envMapCubeUV || n.bumpMap || n.tangentSpaceNormalMap || n.clearcoatNormalMap || n.flatShading || n.shaderID === "physical" ? "#extension GL_OES_standard_derivatives : enable" : "", (n.extensionFragDepth || n.logarithmicDepthBuffer) && n.rendererExtensionFragDepth ? "#extension GL_EXT_frag_depth : enable" : "", n.extensionDrawBuffers && n.rendererExtensionDrawBuffers ? "#extension GL_EXT_draw_buffers : require" : "", (n.extensionShaderTextureLOD || n.envMap || n.transmission > 0) && n.rendererExtensionShaderTextureLod ? "#extension GL_EXT_shader_texture_lod : enable" : "" ].filter(Da).join(` `); } function oN(n) { const e = []; for (const t in n) { const i = n[t]; i !== !1 && e.push("#define " + t + " " + i); } return e.join(` `); } function aN(n, e) { const t = {}, i = n.getProgramParameter(e, 35721); for (let r = 0; r < i; r++) { const o = n.getActiveAttrib(e, r).name; t[o] = n.getAttribLocation(e, o); } return t; } function Da(n) { return n !== ""; } function Og(n, e) { return n.replace(/NUM_DIR_LIGHTS/g, e.numDirLights).replace(/NUM_SPOT_LIGHTS/g, e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, e.numPointLights).replace(/NUM_HEMI_LIGHTS/g, e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, e.numPointLightShadows); } function Dg(n, e) { return n.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection); } const lN = /^[ \t]*#include +<([\w\d./]+)>/gm; function Bd(n) { return n.replace(lN, cN); } function cN(n, e) { const t = ct[e]; if (t === void 0) throw new Error("Can not resolve #include <" + e + ">"); return Bd(t); } const uN = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g, hN = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g; function Ng(n) { return n.replace(hN, Ix).replace(uN, dN); } function dN(n, e, t, i) { return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."), Ix(n, e, t, i); } function Ix(n, e, t, i) { let r = ""; for (let s = parseInt(e); s < parseInt(t); s++) r += i.replace(/\[\s*i\s*\]/g, "[ " + s + " ]").replace(/UNROLLED_LOOP_INDEX/g, s); return r; } function Fg(n) { let e = "precision " + n.precision + ` float; precision ` + n.precision + " int;"; return n.precision === "highp" ? e += ` #define HIGH_PRECISION` : n.precision === "mediump" ? e += ` #define MEDIUM_PRECISION` : n.precision === "lowp" && (e += ` #define LOW_PRECISION`), e; } function fN(n) { let e = "SHADOWMAP_TYPE_BASIC"; return n.shadowMapType === Vf ? e = "SHADOWMAP_TYPE_PCF" : n.shadowMapType === By ? e = "SHADOWMAP_TYPE_PCF_SOFT" : n.shadowMapType === wo && (e = "SHADOWMAP_TYPE_VSM"), e; } function pN(n) { let e = "ENVMAP_TYPE_CUBE"; if (n.envMap) switch (n.envMapMode) { case yl: case bl: e = "ENVMAP_TYPE_CUBE"; break; case la: case xl: e = "ENVMAP_TYPE_CUBE_UV"; break; } return e; } function mN(n) { let e = "ENVMAP_MODE_REFLECTION"; if (n.envMap) switch (n.envMapMode) { case bl: case xl: e = "ENVMAP_MODE_REFRACTION"; break; } return e; } function gN(n) { let e = "ENVMAP_BLENDING_NONE"; if (n.envMap) switch (n.combine) { case vl: e = "ENVMAP_BLENDING_MULTIPLY"; break; case ib: e = "ENVMAP_BLENDING_MIX"; break; case rb: e = "ENVMAP_BLENDING_ADD"; break; } return e; } function vN(n, e, t, i) { const r = n.getContext(), s = t.defines; let o = t.vertexShader, a = t.fragmentShader; const c = fN(t), l = pN(t), d = mN(t), h = gN(t), p = n.gammaFactor > 0 ? n.gammaFactor : 1, g = t.isWebGL2 ? "" : sN(t), f = oN(s), u = r.createProgram(); let y, v, m = t.glslVersion ? "#version " + t.glslVersion + ` ` : ""; t.isRawShaderMaterial ? (y = [ f ].filter(Da).join(` `), y.length > 0 && (y += ` `), v = [ g, f ].filter(Da).join(` `), v.length > 0 && (v += ` `)) : (y = [ Fg(t), "#define SHADER_NAME " + t.shaderName, f, t.instancing ? "#define USE_INSTANCING" : "", t.instancingColor ? "#define USE_INSTANCING_COLOR" : "", t.supportsVertexTextures ? "#define VERTEX_TEXTURES" : "", "#define GAMMA_FACTOR " + p, "#define MAX_BONES " + t.maxBones, t.useFog && t.fog ? "#define USE_FOG" : "", t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", t.map ? "#define USE_MAP" : "", t.envMap ? "#define USE_ENVMAP" : "", t.envMap ? "#define " + d : "", t.lightMap ? "#define USE_LIGHTMAP" : "", t.aoMap ? "#define USE_AOMAP" : "", t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", t.bumpMap ? "#define USE_BUMPMAP" : "", t.normalMap ? "#define USE_NORMALMAP" : "", t.normalMap && t.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", t.normalMap && t.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", t.displacementMap && t.supportsVertexTextures ? "#define USE_DISPLACEMENTMAP" : "", t.specularMap ? "#define USE_SPECULARMAP" : "", t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", t.metalnessMap ? "#define USE_METALNESSMAP" : "", t.alphaMap ? "#define USE_ALPHAMAP" : "", t.transmission ? "#define USE_TRANSMISSION" : "", t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", t.thicknessMap ? "#define USE_THICKNESSMAP" : "", t.vertexTangents ? "#define USE_TANGENT" : "", t.vertexColors ? "#define USE_COLOR" : "", t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", t.vertexUvs ? "#define USE_UV" : "", t.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", t.flatShading ? "#define FLAT_SHADED" : "", t.skinning ? "#define USE_SKINNING" : "", t.useVertexTexture ? "#define BONE_TEXTURE" : "", t.morphTargets ? "#define USE_MORPHTARGETS" : "", t.morphNormals && t.flatShading === !1 ? "#define USE_MORPHNORMALS" : "", t.doubleSided ? "#define DOUBLE_SIDED" : "", t.flipSided ? "#define FLIP_SIDED" : "", t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", t.shadowMapEnabled ? "#define " + c : "", t.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", t.logarithmicDepthBuffer && t.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", "uniform mat4 modelMatrix;", "uniform mat4 modelViewMatrix;", "uniform mat4 projectionMatrix;", "uniform mat4 viewMatrix;", "uniform mat3 normalMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", "#ifdef USE_INSTANCING", " attribute mat4 instanceMatrix;", "#endif", "#ifdef USE_INSTANCING_COLOR", " attribute vec3 instanceColor;", "#endif", "attribute vec3 position;", "attribute vec3 normal;", "attribute vec2 uv;", "#ifdef USE_TANGENT", " attribute vec4 tangent;", "#endif", "#if defined( USE_COLOR_ALPHA )", " attribute vec4 color;", "#elif defined( USE_COLOR )", " attribute vec3 color;", "#endif", "#ifdef USE_MORPHTARGETS", " attribute vec3 morphTarget0;", " attribute vec3 morphTarget1;", " attribute vec3 morphTarget2;", " attribute vec3 morphTarget3;", " #ifdef USE_MORPHNORMALS", " attribute vec3 morphNormal0;", " attribute vec3 morphNormal1;", " attribute vec3 morphNormal2;", " attribute vec3 morphNormal3;", " #else", " attribute vec3 morphTarget4;", " attribute vec3 morphTarget5;", " attribute vec3 morphTarget6;", " attribute vec3 morphTarget7;", " #endif", "#endif", "#ifdef USE_SKINNING", " attribute vec4 skinIndex;", " attribute vec4 skinWeight;", "#endif", ` ` ].filter(Da).join(` `), v = [ g, Fg(t), "#define SHADER_NAME " + t.shaderName, f, t.alphaTest ? "#define ALPHATEST " + t.alphaTest + (t.alphaTest % 1 ? "" : ".0") : "", // add '.0' if integer "#define GAMMA_FACTOR " + p, t.useFog && t.fog ? "#define USE_FOG" : "", t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", t.map ? "#define USE_MAP" : "", t.matcap ? "#define USE_MATCAP" : "", t.envMap ? "#define USE_ENVMAP" : "", t.envMap ? "#define " + l : "", t.envMap ? "#define " + d : "", t.envMap ? "#define " + h : "", t.lightMap ? "#define USE_LIGHTMAP" : "", t.aoMap ? "#define USE_AOMAP" : "", t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", t.bumpMap ? "#define USE_BUMPMAP" : "", t.normalMap ? "#define USE_NORMALMAP" : "", t.normalMap && t.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", t.normalMap && t.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", t.specularMap ? "#define USE_SPECULARMAP" : "", t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", t.metalnessMap ? "#define USE_METALNESSMAP" : "", t.alphaMap ? "#define USE_ALPHAMAP" : "", t.sheen ? "#define USE_SHEEN" : "", t.transmission ? "#define USE_TRANSMISSION" : "", t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", t.thicknessMap ? "#define USE_THICKNESSMAP" : "", t.vertexTangents ? "#define USE_TANGENT" : "", t.vertexColors || t.instancingColor ? "#define USE_COLOR" : "", t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", t.vertexUvs ? "#define USE_UV" : "", t.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", t.gradientMap ? "#define USE_GRADIENTMAP" : "", t.flatShading ? "#define FLAT_SHADED" : "", t.doubleSided ? "#define DOUBLE_SIDED" : "", t.flipSided ? "#define FLIP_SIDED" : "", t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", t.shadowMapEnabled ? "#define " + c : "", t.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", t.physicallyCorrectLights ? "#define PHYSICALLY_CORRECT_LIGHTS" : "", t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", t.logarithmicDepthBuffer && t.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", (t.extensionShaderTextureLOD || t.envMap) && t.rendererExtensionShaderTextureLod ? "#define TEXTURE_LOD_EXT" : "", "uniform mat4 viewMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", t.toneMapping !== Vr ? "#define TONE_MAPPING" : "", t.toneMapping !== Vr ? ct.tonemapping_pars_fragment : "", // this code is required here because it is used by the toneMapping() function defined below t.toneMapping !== Vr ? rN("toneMapping", t.toneMapping) : "", t.dithering ? "#define DITHERING" : "", ct.encodings_pars_fragment, // this code is required here because it is used by the various encoding/decoding function defined below t.map ? Sa("mapTexelToLinear", t.mapEncoding) : "", t.matcap ? Sa("matcapTexelToLinear", t.matcapEncoding) : "", t.envMap ? Sa("envMapTexelToLinear", t.envMapEncoding) : "", t.emissiveMap ? Sa("emissiveMapTexelToLinear", t.emissiveMapEncoding) : "", t.lightMap ? Sa("lightMapTexelToLinear", t.lightMapEncoding) : "", iN("linearToOutputTexel", t.outputEncoding), t.depthPacking ? "#define DEPTH_PACKING " + t.depthPacking : "", ` ` ].filter(Da).join(` `)), o = Bd(o), o = Og(o, t), o = Dg(o, t), a = Bd(a), a = Og(a, t), a = Dg(a, t), o = Ng(o), a = Ng(a), t.isWebGL2 && t.isRawShaderMaterial !== !0 && (m = `#version 300 es `, y = [ "#define attribute in", "#define varying out", "#define texture2D texture" ].join(` `) + ` ` + y, v = [ "#define varying in", t.glslVersion === Dd ? "" : "out highp vec4 pc_fragColor;", t.glslVersion === Dd ? "" : "#define gl_FragColor pc_fragColor", "#define gl_FragDepthEXT gl_FragDepth", "#define texture2D texture", "#define textureCube texture", "#define texture2DProj textureProj", "#define texture2DLodEXT textureLod", "#define texture2DProjLodEXT textureProjLod", "#define textureCubeLodEXT textureLod", "#define texture2DGradEXT textureGrad", "#define texture2DProjGradEXT textureProjGrad", "#define textureCubeGradEXT textureGrad" ].join(` `) + ` ` + v); const w = m + y + o, S = m + v + a, T = Pg(r, 35633, w), M = Pg(r, 35632, S); if (r.attachShader(u, T), r.attachShader(u, M), t.index0AttributeName !== void 0 ? r.bindAttribLocation(u, 0, t.index0AttributeName) : t.morphTargets === !0 && r.bindAttribLocation(u, 0, "position"), r.linkProgram(u), n.debug.checkShaderErrors) { const E = r.getProgramInfoLog(u).trim(), L = r.getShaderInfoLog(T).trim(), R = r.getShaderInfoLog(M).trim(); let C = !0, A = !0; if (r.getProgramParameter(u, 35714) === !1) { C = !1; const P = Ig(r, T, "vertex"), I = Ig(r, M, "fragment"); console.error("THREE.WebGLProgram: shader error: ", r.getError(), "35715", r.getProgramParameter(u, 35715), "gl.getProgramInfoLog", E, P, I); } else E !== "" ? console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", E) : (L === "" || R === "") && (A = !1); A && (this.diagnostics = { runnable: C, programLog: E, vertexShader: { log: L, prefix: y }, fragmentShader: { log: R, prefix: v } }); } r.deleteShader(T), r.deleteShader(M); let x; this.getUniforms = function() { return x === void 0 && (x = new kr(r, u)), x; }; let _; return this.getAttributes = function() { return _ === void 0 && (_ = aN(r, u)), _; }, this.destroy = function() { i.releaseStatesOfProgram(this), r.deleteProgram(u), this.program = void 0; }, this.name = t.shaderName, this.id = tN++, this.cacheKey = e, this.usedTimes = 1, this.program = u, this.vertexShader = T, this.fragmentShader = M, this; } function yN(n, e, t, i, r, s) { const o = [], a = i.isWebGL2, c = i.logarithmicDepthBuffer, l = i.floatVertexTextures, d = i.maxVertexUniforms, h = i.vertexTextures; let p = i.precision; const g = { MeshDepthMaterial: "depth", MeshDistanceMaterial: "distanceRGBA", MeshNormalMaterial: "normal", MeshBasicMaterial: "basic", MeshLambertMaterial: "lambert", MeshPhongMaterial: "phong", MeshToonMaterial: "toon", MeshStandardMaterial: "physical", MeshPhysicalMaterial: "physical", MeshMatcapMaterial: "matcap", LineBasicMaterial: "basic", LineDashedMaterial: "dashed", PointsMaterial: "points", ShadowMaterial: "shadow", SpriteMaterial: "sprite" }, f = [ "precision", "isWebGL2", "supportsVertexTextures", "outputEncoding", "instancing", "instancingColor", "map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", "envMapCubeUV", "lightMap", "lightMapEncoding", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "tangentSpaceNormalMap", "clearcoatMap", "clearcoatRoughnessMap", "clearcoatNormalMap", "displacementMap", "specularMap", "roughnessMap", "metalnessMap", "gradientMap", "alphaMap", "combine", "vertexColors", "vertexAlphas", "vertexTangents", "vertexUvs", "uvsVertexOnly", "fog", "useFog", "fogExp2", "flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning", "maxBones", "useVertexTexture", "morphTargets", "morphNormals", "premultipliedAlpha", "numDirLights", "numPointLights", "numSpotLights", "numHemiLights", "numRectAreaLights", "numDirLightShadows", "numPointLightShadows", "numSpotLightShadows", "shadowMapEnabled", "shadowMapType", "toneMapping", "physicallyCorrectLights", "alphaTest", "doubleSided", "flipSided", "numClippingPlanes", "numClipIntersection", "depthPacking", "dithering", "sheen", "transmission", "transmissionMap", "thicknessMap" ]; function u(M) { const _ = M.skeleton.bones; if (l) return 1024; { const L = Math.floor((d - 20) / 4), R = Math.min(L, _.length); return R < _.length ? (console.warn("THREE.WebGLRenderer: Skeleton has " + _.length + " bones. This GPU supports " + R + "."), 0) : R; } } function y(M) { let x; return M && M.isTexture ? x = M.encoding : M && M.isWebGLRenderTarget ? (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."), x = M.texture.encoding) : x = Dn, x; } function v(M, x, _, E, L) { const R = E.fog, C = M.isMeshStandardMaterial ? E.environment : null, A = e.get(M.envMap || C), P = g[M.type], I = L.isSkinnedMesh ? u(L) : 0; M.precision !== null && (p = i.getMaxPrecision(M.precision), p !== M.precision && console.warn("THREE.WebGLProgram.getParameters:", M.precision, "not supported, using", p, "instead.")); let b, O; if (P) { const B = gi[P]; b = B.vertexShader, O = B.fragmentShader; } else b = M.vertexShader, O = M.fragmentShader; const N = n.getRenderTarget(); return { isWebGL2: a, shaderID: P, shaderName: M.type, vertexShader: b, fragmentShader: O, defines: M.defines, isRawShaderMaterial: M.isRawShaderMaterial === !0, glslVersion: M.glslVersion, precision: p, instancing: L.isInstancedMesh === !0, instancingColor: L.isInstancedMesh === !0 && L.instanceColor !== null, supportsVertexTextures: h, outputEncoding: N !== null ? y(N.texture) : n.outputEncoding, map: !!M.map, mapEncoding: y(M.map), matcap: !!M.matcap, matcapEncoding: y(M.matcap), envMap: !!A, envMapMode: A && A.mapping, envMapEncoding: y(A), envMapCubeUV: !!A && (A.mapping === la || A.mapping === xl), lightMap: !!M.lightMap, lightMapEncoding: y(M.lightMap), aoMap: !!M.aoMap, emissiveMap: !!M.emissiveMap, emissiveMapEncoding: y(M.emissiveMap), bumpMap: !!M.bumpMap, normalMap: !!M.normalMap, objectSpaceNormalMap: M.normalMapType === ux, tangentSpaceNormalMap: M.normalMapType === ts, clearcoatMap: !!M.clearcoatMap, clearcoatRoughnessMap: !!M.clearcoatRoughnessMap, clearcoatNormalMap: !!M.clearcoatNormalMap, displacementMap: !!M.displacementMap, roughnessMap: !!M.roughnessMap, metalnessMap: !!M.metalnessMap, specularMap: !!M.specularMap, alphaMap: !!M.alphaMap, gradientMap: !!M.gradientMap, sheen: !!M.sheen, transmission: !!M.transmission, transmissionMap: !!M.transmissionMap, thicknessMap: !!M.thicknessMap, combine: M.combine, vertexTangents: M.normalMap && M.vertexTangents, vertexColors: M.vertexColors, vertexAlphas: M.vertexColors === !0 && L.geometry && L.geometry.attributes.color && L.geometry.attributes.color.itemSize === 4, vertexUvs: !!M.map || !!M.bumpMap || !!M.normalMap || !!M.specularMap || !!M.alphaMap || !!M.emissiveMap || !!M.roughnessMap || !!M.metalnessMap || !!M.clearcoatMap || !!M.clearcoatRoughnessMap || !!M.clearcoatNormalMap || !!M.displacementMap || !!M.transmissionMap || !!M.thicknessMap, uvsVertexOnly: !(M.map || M.bumpMap || M.normalMap || M.specularMap || M.alphaMap || M.emissiveMap || M.roughnessMap || M.metalnessMap || M.clearcoatNormalMap || M.transmission || M.transmissionMap || M.thicknessMap) && !!M.displacementMap, fog: !!R, useFog: M.fog, fogExp2: R && R.isFogExp2, flatShading: !!M.flatShading, sizeAttenuation: M.sizeAttenuation, logarithmicDepthBuffer: c, skinning: L.isSkinnedMesh === !0 && I > 0, maxBones: I, useVertexTexture: l, morphTargets: M.morphTargets, morphNormals: M.morphNormals, numDirLights: x.directional.length, numPointLights: x.point.length, numSpotLights: x.spot.length, numRectAreaLights: x.rectArea.length, numHemiLights: x.hemi.length, numDirLightShadows: x.directionalShadowMap.length, numPointLightShadows: x.pointShadowMap.length, numSpotLightShadows: x.spotShadowMap.length, numClippingPlanes: s.numPlanes, numClipIntersection: s.numIntersection, dithering: M.dithering, shadowMapEnabled: n.shadowMap.enabled && _.length > 0, shadowMapType: n.shadowMap.type, toneMapping: M.toneMapped ? n.toneMapping : Vr, physicallyCorrectLights: n.physicallyCorrectLights, premultipliedAlpha: M.premultipliedAlpha, alphaTest: M.alphaTest, doubleSided: M.side === Yr, flipSided: M.side === qt, depthPacking: M.depthPacking !== void 0 ? M.depthPacking : !1, index0AttributeName: M.index0AttributeName, extensionDerivatives: M.extensions && M.extensions.derivatives, extensionFragDepth: M.extensions && M.extensions.fragDepth, extensionDrawBuffers: M.extensions && M.extensions.drawBuffers, extensionShaderTextureLOD: M.extensions && M.extensions.shaderTextureLOD, rendererExtensionFragDepth: a || t.has("EXT_frag_depth"), rendererExtensionDrawBuffers: a || t.has("WEBGL_draw_buffers"), rendererExtensionShaderTextureLod: a || t.has("EXT_shader_texture_lod"), customProgramCacheKey: M.customProgramCacheKey() }; } function m(M) { const x = []; if (M.shaderID ? x.push(M.shaderID) : (x.push(M.fragmentShader), x.push(M.vertexShader)), M.defines !== void 0) for (const _ in M.defines) x.push(_), x.push(M.defines[_]); if (M.isRawShaderMaterial === !1) { for (let _ = 0; _ < f.length; _++) x.push(M[f[_]]); x.push(n.outputEncoding), x.push(n.gammaFactor); } return x.push(M.customProgramCacheKey), x.join(); } function w(M) { const x = g[M.type]; let _; if (x) { const E = gi[x]; _ = _x.clone(E.uniforms); } else _ = M.uniforms; return _; } function S(M, x) { let _; for (let E = 0, L = o.length; E < L; E++) { const R = o[E]; if (R.cacheKey === x) { _ = R, ++_.usedTimes; break; } } return _ === void 0 && (_ = new vN(n, x, M, r), o.push(_)), _; } function T(M) { if (--M.usedTimes === 0) { const x = o.indexOf(M); o[x] = o[o.length - 1], o.pop(), M.destroy(); } } return { getParameters: v, getProgramCacheKey: m, getUniforms: w, acquireProgram: S, releaseProgram: T, // Exposed for resource monitoring & error feedback via renderer.info: programs: o }; } function bN() { let n = /* @__PURE__ */ new WeakMap(); function e(s) { let o = n.get(s); return o === void 0 && (o = {}, n.set(s, o)), o; } function t(s) { n.delete(s); } function i(s, o, a) { n.get(s)[o] = a; } function r() { n = /* @__PURE__ */ new WeakMap(); } return { get: e, remove: t, update: i, dispose: r }; } function xN(n, e) { return n.groupOrder !== e.groupOrder ? n.groupOrder - e.groupOrder : n.renderOrder !== e.renderOrder ? n.renderOrder - e.renderOrder : n.program !== e.program ? n.program.id - e.program.id : n.material.id !== e.material.id ? n.material.id - e.material.id : n.z !== e.z ? n.z - e.z : n.id - e.id; } function Bg(n, e) { return n.groupOrder !== e.groupOrder ? n.groupOrder - e.groupOrder : n.renderOrder !== e.renderOrder ? n.renderOrder - e.renderOrder : n.z !== e.z ? e.z - n.z : n.id - e.id; } function zg(n) { const e = []; let t = 0; const i = [], r = [], s = [], o = { id: -1 }; function a() { t = 0, i.length = 0, r.length = 0, s.length = 0; } function c(g, f, u, y, v, m) { let w = e[t]; const S = n.get(u); return w === void 0 ? (w = { id: g.id, object: g, geometry: f, material: u, program: S.program || o, groupOrder: y, renderOrder: g.renderOrder, z: v, group: m }, e[t] = w) : (w.id = g.id, w.object = g, w.geometry = f, w.material = u, w.program = S.program || o, w.groupOrder = y, w.renderOrder = g.renderOrder, w.z = v, w.group = m), t++, w; } function l(g, f, u, y, v, m) { const w = c(g, f, u, y, v, m); u.transmission > 0 ? r.push(w) : u.transparent === !0 ? s.push(w) : i.push(w); } function d(g, f, u, y, v, m) { const w = c(g, f, u, y, v, m); u.transmission > 0 ? r.unshift(w) : u.transparent === !0 ? s.unshift(w) : i.unshift(w); } function h(g, f) { i.length > 1 && i.sort(g || xN), r.length > 1 && r.sort(f || Bg), s.length > 1 && s.sort(f || Bg); } function p() { for (let g = t, f = e.length; g < f; g++) { const u = e[g]; if (u.id === null) break; u.id = null, u.object = null, u.geometry = null, u.material = null, u.program = null, u.group = null; } } return { opaque: i, transmissive: r, transparent: s, init: a, push: l, unshift: d, finish: p, sort: h }; } function wN(n) { let e = /* @__PURE__ */ new WeakMap(); function t(r, s) { let o; return e.has(r) === !1 ? (o = new zg(n), e.set(r, [o])) : s >= e.get(r).length ? (o = new zg(n), e.get(r).push(o)) : o = e.get(r)[s], o; } function i() { e = /* @__PURE__ */ new WeakMap(); } return { get: t, dispose: i }; } function MN() { const n = {}; return { get: function(e) { if (n[e.id] !== void 0) return n[e.id]; let t; switch (e.type) { case "DirectionalLight": t = { direction: new X(), color: new Fe() }; break; case "SpotLight": t = { position: new X(), direction: new X(), color: new Fe(), distance: 0, coneCos: 0, penumbraCos: 0, decay: 0 }; break; case "PointLight": t = { position: new X(), color: new Fe(), distance: 0, decay: 0 }; break; case "HemisphereLight": t = { direction: new X(), skyColor: new Fe(), groundColor: new Fe() }; break; case "RectAreaLight": t = { color: new Fe(), position: new X(), halfWidth: new X(), halfHeight: new X() }; break; } return n[e.id] = t, t; } }; } function SN() { const n = {}; return { get: function(e) { if (n[e.id] !== void 0) return n[e.id]; let t; switch (e.type) { case "DirectionalLight": t = { shadowBias: 0, shadowNormalBias: 0, shadowRadius: 1, shadowMapSize: new Pe() }; break; case "SpotLight": t = { shadowBias: 0, shadowNormalBias: 0, shadowRadius: 1, shadowMapSize: new Pe() }; break; case "PointLight": t = { shadowBias: 0, shadowNormalBias: 0, shadowRadius: 1, shadowMapSize: new Pe(), shadowCameraNear: 1, shadowCameraFar: 1e3 }; break; } return n[e.id] = t, t; } }; } let _N = 0; function TN(n, e) { return (e.castShadow ? 1 : 0) - (n.castShadow ? 1 : 0); } function EN(n, e) { const t = new MN(), i = SN(), r = { version: 0, hash: { directionalLength: -1, pointLength: -1, spotLength: -1, rectAreaLength: -1, hemiLength: -1, numDirectionalShadows: -1, numPointShadows: -1, numSpotShadows: -1 }, ambient: [0, 0, 0], probe: [], directional: [], directionalShadow: [], directionalShadowMap: [], directionalShadowMatrix: [], spot: [], spotShadow: [], spotShadowMap: [], spotShadowMatrix: [], rectArea: [], rectAreaLTC1: null, rectAreaLTC2: null, point: [], pointShadow: [], pointShadowMap: [], pointShadowMatrix: [], hemi: [] }; for (let d = 0; d < 9; d++) r.probe.push(new X()); const s = new X(), o = new $e(), a = new $e(); function c(d) { let h = 0, p = 0, g = 0; for (let x = 0; x < 9; x++) r.probe[x].set(0, 0, 0); let f = 0, u = 0, y = 0, v = 0, m = 0, w = 0, S = 0, T = 0; d.sort(TN); for (let x = 0, _ = d.length; x < _; x++) { const E = d[x], L = E.color, R = E.intensity, C = E.distance, A = E.shadow && E.shadow.map ? E.shadow.map.texture : null; if (E.isAmbientLight) h += L.r * R, p += L.g * R, g += L.b * R; else if (E.isLightProbe) for (let P = 0; P < 9; P++) r.probe[P].addScaledVector(E.sh.coefficients[P], R); else if (E.isDirectionalLight) { const P = t.get(E); if (P.color.copy(E.color).multiplyScalar(E.intensity), E.castShadow) { const I = E.shadow, b = i.get(E); b.shadowBias = I.bias, b.shadowNormalBias = I.normalBias, b.shadowRadius = I.radius, b.shadowMapSize = I.mapSize, r.directionalShadow[f] = b, r.directionalShadowMap[f] = A, r.directionalShadowMatrix[f] = E.shadow.matrix, w++; } r.directional[f] = P, f++; } else if (E.isSpotLight) { const P = t.get(E); if (P.position.setFromMatrixPosition(E.matrixWorld), P.color.copy(L).multiplyScalar(R), P.distance = C, P.coneCos = Math.cos(E.angle), P.penumbraCos = Math.cos(E.angle * (1 - E.penumbra)), P.decay = E.decay, E.castShadow) { const I = E.shadow, b = i.get(E); b.shadowBias = I.bias, b.shadowNormalBias = I.normalBias, b.shadowRadius = I.radius, b.shadowMapSize = I.mapSize, r.spotShadow[y] = b, r.spotShadowMap[y] = A, r.spotShadowMatrix[y] = E.shadow.matrix, T++; } r.spot[y] = P, y++; } else if (E.isRectAreaLight) { const P = t.get(E); P.color.copy(L).multiplyScalar(R), P.halfWidth.set(E.width * 0.5, 0, 0), P.halfHeight.set(0, E.height * 0.5, 0), r.rectArea[v] = P, v++; } else if (E.isPointLight) { const P = t.get(E); if (P.color.copy(E.color).multiplyScalar(E.intensity), P.distance = E.distance, P.decay = E.decay, E.castShadow) { const I = E.shadow, b = i.get(E); b.shadowBias = I.bias, b.shadowNormalBias = I.normalBias, b.shadowRadius = I.radius, b.shadowMapSize = I.mapSize, b.shadowCameraNear = I.camera.near, b.shadowCameraFar = I.camera.far, r.pointShadow[u] = b, r.pointShadowMap[u] = A, r.pointShadowMatrix[u] = E.shadow.matrix, S++; } r.point[u] = P, u++; } else if (E.isHemisphereLight) { const P = t.get(E); P.skyColor.copy(E.color).multiplyScalar(R), P.groundColor.copy(E.groundColor).multiplyScalar(R), r.hemi[m] = P, m++; } } v > 0 && (e.isWebGL2 || n.has("OES_texture_float_linear") === !0 ? (r.rectAreaLTC1 = ze.LTC_FLOAT_1, r.rectAreaLTC2 = ze.LTC_FLOAT_2) : n.has("OES_texture_half_float_linear") === !0 ? (r.rectAreaLTC1 = ze.LTC_HALF_1, r.rectAreaLTC2 = ze.LTC_HALF_2) : console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")), r.ambient[0] = h, r.ambient[1] = p, r.ambient[2] = g; const M = r.hash; (M.directionalLength !== f || M.pointLength !== u || M.spotLength !== y || M.rectAreaLength !== v || M.hemiLength !== m || M.numDirectionalShadows !== w || M.numPointShadows !== S || M.numSpotShadows !== T) && (r.directional.length = f, r.spot.length = y, r.rectArea.length = v, r.point.length = u, r.hemi.length = m, r.directionalShadow.length = w, r.directionalShadowMap.length = w, r.pointShadow.length = S, r.pointShadowMap.length = S, r.spotShadow.length = T, r.spotShadowMap.length = T, r.directionalShadowMatrix.length = w, r.pointShadowMatrix.length = S, r.spotShadowMatrix.length = T, M.directionalLength = f, M.pointLength = u, M.spotLength = y, M.rectAreaLength = v, M.hemiLength = m, M.numDirectionalShadows = w, M.numPointShadows = S, M.numSpotShadows = T, r.version = _N++); } function l(d, h) { let p = 0, g = 0, f = 0, u = 0, y = 0; const v = h.matrixWorldInverse; for (let m = 0, w = d.length; m < w; m++) { const S = d[m]; if (S.isDirectionalLight) { const T = r.directional[p]; T.direction.setFromMatrixPosition(S.matrixWorld), s.setFromMatrixPosition(S.target.matrixWorld), T.direction.sub(s), T.direction.transformDirection(v), p++; } else if (S.isSpotLight) { const T = r.spot[f]; T.position.setFromMatrixPosition(S.matrixWorld), T.position.applyMatrix4(v), T.direction.setFromMatrixPosition(S.matrixWorld), s.setFromMatrixPosition(S.target.matrixWorld), T.direction.sub(s), T.direction.transformDirection(v), f++; } else if (S.isRectAreaLight) { const T = r.rectArea[u]; T.position.setFromMatrixPosition(S.matrixWorld), T.position.applyMatrix4(v), a.identity(), o.copy(S.matrixWorld), o.premultiply(v), a.extractRotation(o), T.halfWidth.set(S.width * 0.5, 0, 0), T.halfHeight.set(0, S.height * 0.5, 0), T.halfWidth.applyMatrix4(a), T.halfHeight.applyMatrix4(a), u++; } else if (S.isPointLight) { const T = r.point[g]; T.position.setFromMatrixPosition(S.matrixWorld), T.position.applyMatrix4(v), g++; } else if (S.isHemisphereLight) { const T = r.hemi[y]; T.direction.setFromMatrixPosition(S.matrixWorld), T.direction.transformDirection(v), T.direction.normalize(), y++; } } } return { setup: c, setupView: l, state: r }; } function Ug(n, e) { const t = new EN(n, e), i = [], r = []; function s() { i.length = 0, r.length = 0; } function o(h) { i.push(h); } function a(h) { r.push(h); } function c() { t.setup(i); } function l(h) { t.setupView(i, h); } return { init: s, state: { lightsArray: i, shadowsArray: r, lights: t }, setupLights: c, setupLightsView: l, pushLight: o, pushShadow: a }; } function AN(n, e) { let t = /* @__PURE__ */ new WeakMap(); function i(s, o = 0) { let a; return t.has(s) === !1 ? (a = new Ug(n, e), t.set(s, [a])) : o >= t.get(s).length ? (a = new Ug(n, e), t.get(s).push(a)) : a = t.get(s)[o], a; } function r() { t = /* @__PURE__ */ new WeakMap(); } return { get: i, dispose: r }; } class Ou extends sn { constructor(e) { super(), this.type = "MeshDepthMaterial", this.depthPacking = lx, this.morphTargets = !1, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.setValues(e); } copy(e) { return super.copy(e), this.depthPacking = e.depthPacking, this.morphTargets = e.morphTargets, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this; } } Ou.prototype.isMeshDepthMaterial = !0; class Du extends sn { constructor(e) { super(), this.type = "MeshDistanceMaterial", this.referencePosition = new X(), this.nearDistance = 1, this.farDistance = 1e3, this.morphTargets = !1, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.fog = !1, this.setValues(e); } copy(e) { return super.copy(e), this.referencePosition.copy(e.referencePosition), this.nearDistance = e.nearDistance, this.farDistance = e.farDistance, this.morphTargets = e.morphTargets, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this; } } Du.prototype.isMeshDistanceMaterial = !0; var CN = `uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include void main() { float mean = 0.0; float squared_mean = 0.0; float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) ); for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) { #ifdef HORIZONTAL_PASS vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) ); mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) ); mean += depth; squared_mean += depth * depth; #endif } mean = mean * HALF_SAMPLE_RATE; squared_mean = squared_mean * HALF_SAMPLE_RATE; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`, LN = `void main() { gl_Position = vec4( position, 1.0 ); }`; function Ox(n, e, t) { let i = new Ml(); const r = new Pe(), s = new Pe(), o = new _t(), a = [], c = [], l = {}, d = t.maxTextureSize, h = { 0: qt, 1: Xr, 2: Yr }, p = new dr({ defines: { SAMPLE_RATE: 2 / 8, HALF_SAMPLE_RATE: 1 / 8 }, uniforms: { shadow_pass: { value: null }, resolution: { value: new Pe() }, radius: { value: 4 } }, vertexShader: LN, fragmentShader: CN }), g = p.clone(); g.defines.HORIZONTAL_PASS = 1; const f = new Je(); f.setAttribute( "position", new nt( new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]), 3 ) ); const u = new tn(f, p), y = this; this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = Vf, this.render = function(M, x, _) { if (y.enabled === !1 || y.autoUpdate === !1 && y.needsUpdate === !1 || M.length === 0) return; const E = n.getRenderTarget(), L = n.getActiveCubeFace(), R = n.getActiveMipmapLevel(), C = n.state; C.setBlending(or), C.buffers.color.setClear(1, 1, 1, 1), C.buffers.depth.setTest(!0), C.setScissorTest(!1); for (let A = 0, P = M.length; A < P; A++) { const I = M[A], b = I.shadow; if (b === void 0) { console.warn("THREE.WebGLShadowMap:", I, "has no shadow."); continue; } if (b.autoUpdate === !1 && b.needsUpdate === !1) continue; r.copy(b.mapSize); const O = b.getFrameExtents(); if (r.multiply(O), s.copy(b.mapSize), (r.x > d || r.y > d) && (r.x > d && (s.x = Math.floor(d / O.x), r.x = s.x * O.x, b.mapSize.x = s.x), r.y > d && (s.y = Math.floor(d / O.y), r.y = s.y * O.y, b.mapSize.y = s.y)), b.map === null && !b.isPointLightShadow && this.type === wo) { const D = { minFilter: jt, magFilter: jt, format: Yn }; b.map = new bi(r.x, r.y, D), b.map.texture.name = I.name + ".shadowMap", b.mapPass = new bi(r.x, r.y, D), b.camera.updateProjectionMatrix(); } if (b.map === null) { const D = { minFilter: Kt, magFilter: Kt, format: Yn }; b.map = new bi(r.x, r.y, D), b.map.texture.name = I.name + ".shadowMap", b.camera.updateProjectionMatrix(); } n.setRenderTarget(b.map), n.clear(); const N = b.getViewportCount(); for (let D = 0; D < N; D++) { const B = b.getViewport(D); o.set( s.x * B.x, s.y * B.y, s.x * B.z, s.y * B.w ), C.viewport(o), b.updateMatrices(I, D), i = b.getFrustum(), T(x, _, b.camera, I, this.type); } !b.isPointLightShadow && this.type === wo && v(b, _), b.needsUpdate = !1; } y.needsUpdate = !1, n.setRenderTarget(E, L, R); }; function v(M, x) { const _ = e.update(u); p.uniforms.shadow_pass.value = M.map.texture, p.uniforms.resolution.value = M.mapSize, p.uniforms.radius.value = M.radius, n.setRenderTarget(M.mapPass), n.clear(), n.renderBufferDirect(x, null, _, p, u, null), g.uniforms.shadow_pass.value = M.mapPass.texture, g.uniforms.resolution.value = M.mapSize, g.uniforms.radius.value = M.radius, n.setRenderTarget(M.map), n.clear(), n.renderBufferDirect(x, null, _, g, u, null); } function m(M) { const x = M << 0; let _ = a[x]; return _ === void 0 && (_ = new Ou({ depthPacking: cx, morphTargets: M }), a[x] = _), _; } function w(M) { const x = M << 0; let _ = c[x]; return _ === void 0 && (_ = new Du({ morphTargets: M }), c[x] = _), _; } function S(M, x, _, E, L, R, C) { let A = null, P = m, I = M.customDepthMaterial; if (E.isPointLight === !0 && (P = w, I = M.customDistanceMaterial), I === void 0) { let b = !1; _.morphTargets === !0 && (b = x.morphAttributes && x.morphAttributes.position && x.morphAttributes.position.length > 0), A = P(b); } else A = I; if (n.localClippingEnabled && _.clipShadows === !0 && _.clippingPlanes.length !== 0) { const b = A.uuid, O = _.uuid; let N = l[b]; N === void 0 && (N = {}, l[b] = N); let D = N[O]; D === void 0 && (D = A.clone(), N[O] = D), A = D; } return A.visible = _.visible, A.wireframe = _.wireframe, C === wo ? A.side = _.shadowSide !== null ? _.shadowSide : _.side : A.side = _.shadowSide !== null ? _.shadowSide : h[_.side], A.clipShadows = _.clipShadows, A.clippingPlanes = _.clippingPlanes, A.clipIntersection = _.clipIntersection, A.wireframeLinewidth = _.wireframeLinewidth, A.linewidth = _.linewidth, E.isPointLight === !0 && A.isMeshDistanceMaterial === !0 && (A.referencePosition.setFromMatrixPosition(E.matrixWorld), A.nearDistance = L, A.farDistance = R), A; } function T(M, x, _, E, L) { if (M.visible === !1) return; if (M.layers.test(x.layers) && (M.isMesh || M.isLine || M.isPoints) && (M.castShadow || M.receiveShadow && L === wo) && (!M.frustumCulled || i.intersectsObject(M))) { M.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse, M.matrixWorld); const A = e.update(M), P = M.material; if (Array.isArray(P)) { const I = A.groups; for (let b = 0, O = I.length; b < O; b++) { const N = I[b], D = P[N.materialIndex]; if (D && D.visible) { const B = S(M, A, D, E, _.near, _.far, L); n.renderBufferDirect(_, null, A, B, M, N); } } } else if (P.visible) { const I = S(M, A, P, E, _.near, _.far, L); n.renderBufferDirect(_, null, A, I, M, null); } } const C = M.children; for (let A = 0, P = C.length; A < P; A++) T(C[A], x, _, E, L); } } function RN(n, e, t) { const i = t.isWebGL2; function r() { let se = !1; const Se = new _t(); let ge = null; const be = new _t(0, 0, 0, 0); return { setMask: function(Ie) { ge !== Ie && !se && (n.colorMask(Ie, Ie, Ie, Ie), ge = Ie); }, setLocked: function(Ie) { se = Ie; }, setClear: function(Ie, et, mt, Ue, bt) { bt === !0 && (Ie *= Ue, et *= Ue, mt *= Ue), Se.set(Ie, et, mt, Ue), be.equals(Se) === !1 && (n.clearColor(Ie, et, mt, Ue), be.copy(Se)); }, reset: function() { se = !1, ge = null, be.set(-1, 0, 0, 0); } }; } function s() { let se = !1, Se = null, ge = null, be = null; return { setTest: function(Ie) { Ie ? ie(2929) : j(2929); }, setMask: function(Ie) { Se !== Ie && !se && (n.depthMask(Ie), Se = Ie); }, setFunc: function(Ie) { if (ge !== Ie) { if (Ie) switch (Ie) { case Jy: n.depthFunc(512); break; case qy: n.depthFunc(519); break; case Ky: n.depthFunc(513); break; case Kc: n.depthFunc(515); break; case Qy: n.depthFunc(514); break; case eb: n.depthFunc(518); break; case tb: n.depthFunc(516); break; case nb: n.depthFunc(517); break; default: n.depthFunc(515); } else n.depthFunc(515); ge = Ie; } }, setLocked: function(Ie) { se = Ie; }, setClear: function(Ie) { be !== Ie && (n.clearDepth(Ie), be = Ie); }, reset: function() { se = !1, Se = null, ge = null, be = null; } }; } function o() { let se = !1, Se = null, ge = null, be = null, Ie = null, et = null, mt = null, Ue = null, bt = null; return { setTest: function(Ve) { se || (Ve ? ie(2960) : j(2960)); }, setMask: function(Ve) { Se !== Ve && !se && (n.stencilMask(Ve), Se = Ve); }, setFunc: function(Ve, lt, tt) { (ge !== Ve || be !== lt || Ie !== tt) && (n.stencilFunc(Ve, lt, tt), ge = Ve, be = lt, Ie = tt); }, setOp: function(Ve, lt, tt) { (et !== Ve || mt !== lt || Ue !== tt) && (n.stencilOp(Ve, lt, tt), et = Ve, mt = lt, Ue = tt); }, setLocked: function(Ve) { se = Ve; }, setClear: function(Ve) { bt !== Ve && (n.clearStencil(Ve), bt = Ve); }, reset: function() { se = !1, Se = null, ge = null, be = null, Ie = null, et = null, mt = null, Ue = null, bt = null; } }; } const a = new r(), c = new s(), l = new o(); let d = {}, h = null, p = {}, g = null, f = !1, u = null, y = null, v = null, m = null, w = null, S = null, T = null, M = !1, x = null, _ = null, E = null, L = null, R = null; const C = n.getParameter(35661); let A = !1, P = 0; const I = n.getParameter(7938); I.indexOf("WebGL") !== -1 ? (P = parseFloat(/^WebGL (\d)/.exec(I)[1]), A = P >= 1) : I.indexOf("OpenGL ES") !== -1 && (P = parseFloat(/^OpenGL ES (\d)/.exec(I)[1]), A = P >= 2); let b = null, O = {}; const N = n.getParameter(3088), D = n.getParameter(2978), B = new _t().fromArray(N), U = new _t().fromArray(D); function k(se, Se, ge) { const be = new Uint8Array(4), Ie = n.createTexture(); n.bindTexture(se, Ie), n.texParameteri(se, 10241, 9728), n.texParameteri(se, 10240, 9728); for (let et = 0; et < ge; et++) n.texImage2D(Se + et, 0, 6408, 1, 1, 0, 6408, 5121, be); return Ie; } const K = {}; K[3553] = k(3553, 3553, 1), K[34067] = k(34067, 34069, 6), a.setClear(0, 0, 0, 1), c.setClear(1), l.setClear(0), ie(2929), c.setFunc(Kc), te(!1), F(yd), ie(2884), ne(or); function ie(se) { d[se] !== !0 && (n.enable(se), d[se] = !0); } function j(se) { d[se] !== !1 && (n.disable(se), d[se] = !1); } function G(se) { se !== h && (n.bindFramebuffer(36160, se), h = se); } function W(se, Se) { return Se === null && h !== null && (Se = h), p[se] !== Se ? (n.bindFramebuffer(se, Se), p[se] = Se, i && (se === 36009 && (p[36160] = Se), se === 36160 && (p[36009] = Se)), !0) : !1; } function q(se) { return g !== se ? (n.useProgram(se), g = se, !0) : !1; } const Q = { [ys]: 32774, [Uy]: 32778, [Vy]: 32779 }; if (i) Q[Md] = 32775, Q[Sd] = 32776; else { const se = e.get("EXT_blend_minmax"); se !== null && (Q[Md] = se.MIN_EXT, Q[Sd] = se.MAX_EXT); } const ee = { [ky]: 0, [Gy]: 1, [Hy]: 768, [Gf]: 770, [Yy]: 776, [Zy]: 774, [jy]: 772, [Wy]: 769, [Hf]: 771, [Xy]: 775, [$y]: 773 }; function ne(se, Se, ge, be, Ie, et, mt, Ue) { if (se === or) { f === !0 && (j(3042), f = !1); return; } if (f === !1 && (ie(3042), f = !0), se !== zy) { if (se !== u || Ue !== M) { if ((y !== ys || w !== ys) && (n.blendEquation(32774), y = ys, w = ys), Ue) switch (se) { case _o: n.blendFuncSeparate(1, 771, 1, 771); break; case bd: n.blendFunc(1, 1); break; case xd: n.blendFuncSeparate(0, 0, 769, 771); break; case wd: n.blendFuncSeparate(0, 768, 0, 770); break; default: console.error("THREE.WebGLState: Invalid blending: ", se); break; } else switch (se) { case _o: n.blendFuncSeparate(770, 771, 1, 771); break; case bd: n.blendFunc(770, 1); break; case xd: n.blendFunc(0, 769); break; case wd: n.blendFunc(0, 768); break; default: console.error("THREE.WebGLState: Invalid blending: ", se); break; } v = null, m = null, S = null, T = null, u = se, M = Ue; } return; } Ie = Ie || Se, et = et || ge, mt = mt || be, (Se !== y || Ie !== w) && (n.blendEquationSeparate(Q[Se], Q[Ie]), y = Se, w = Ie), (ge !== v || be !== m || et !== S || mt !== T) && (n.blendFuncSeparate(ee[ge], ee[be], ee[et], ee[mt]), v = ge, m = be, S = et, T = mt), u = se, M = null; } function Y(se, Se) { se.side === Yr ? j(2884) : ie(2884); let ge = se.side === qt; Se && (ge = !ge), te(ge), se.blending === _o && se.transparent === !1 ? ne(or) : ne(se.blending, se.blendEquation, se.blendSrc, se.blendDst, se.blendEquationAlpha, se.blendSrcAlpha, se.blendDstAlpha, se.premultipliedAlpha), c.setFunc(se.depthFunc), c.setTest(se.depthTest), c.setMask(se.depthWrite), a.setMask(se.colorWrite); const be = se.stencilWrite; l.setTest(be), be && (l.setMask(se.stencilWriteMask), l.setFunc(se.stencilFunc, se.stencilRef, se.stencilFuncMask), l.setOp(se.stencilFail, se.stencilZFail, se.stencilZPass)), J(se.polygonOffset, se.polygonOffsetFactor, se.polygonOffsetUnits), se.alphaToCoverage === !0 ? ie(32926) : j(32926); } function te(se) { x !== se && (se ? n.frontFace(2304) : n.frontFace(2305), x = se); } function F(se) { se !== Ny ? (ie(2884), se !== _ && (se === yd ? n.cullFace(1029) : se === Fy ? n.cullFace(1028) : n.cullFace(1032))) : j(2884), _ = se; } function $(se) { se !== E && (A && n.lineWidth(se), E = se); } function J(se, Se, ge) { se ? (ie(32823), (L !== Se || R !== ge) && (n.polygonOffset(Se, ge), L = Se, R = ge)) : j(32823); } function z(se) { se ? ie(3089) : j(3089); } function V(se) { se === void 0 && (se = 33984 + C - 1), b !== se && (n.activeTexture(se), b = se); } function oe(se, Se) { b === null && V(); let ge = O[b]; ge === void 0 && (ge = { type: void 0, texture: void 0 }, O[b] = ge), (ge.type !== se || ge.texture !== Se) && (n.bindTexture(se, Se || K[se]), ge.type = se, ge.texture = Se); } function ue() { const se = O[b]; se !== void 0 && se.type !== void 0 && (n.bindTexture(se.type, null), se.type = void 0, se.texture = void 0); } function le() { try { n.compressedTexImage2D.apply(n, arguments); } catch (se) { console.error("THREE.WebGLState:", se); } } function ve() { try { n.texImage2D.apply(n, arguments); } catch (se) { console.error("THREE.WebGLState:", se); } } function xe() { try { n.texImage3D.apply(n, arguments); } catch (se) { console.error("THREE.WebGLState:", se); } } function Te(se) { B.equals(se) === !1 && (n.scissor(se.x, se.y, se.z, se.w), B.copy(se)); } function de(se) { U.equals(se) === !1 && (n.viewport(se.x, se.y, se.z, se.w), U.copy(se)); } function we() { n.disable(3042), n.disable(2884), n.disable(2929), n.disable(32823), n.disable(3089), n.disable(2960), n.disable(32926), n.blendEquation(32774), n.blendFunc(1, 0), n.blendFuncSeparate(1, 0, 1, 0), n.colorMask(!0, !0, !0, !0), n.clearColor(0, 0, 0, 0), n.depthMask(!0), n.depthFunc(513), n.clearDepth(1), n.stencilMask(4294967295), n.stencilFunc(519, 0, 4294967295), n.stencilOp(7680, 7680, 7680), n.clearStencil(0), n.cullFace(1029), n.frontFace(2305), n.polygonOffset(0, 0), n.activeTexture(33984), n.bindFramebuffer(36160, null), i === !0 && (n.bindFramebuffer(36009, null), n.bindFramebuffer(36008, null)), n.useProgram(null), n.lineWidth(1), n.scissor(0, 0, n.canvas.width, n.canvas.height), n.viewport(0, 0, n.canvas.width, n.canvas.height), d = {}, b = null, O = {}, h = null, p = {}, g = null, f = !1, u = null, y = null, v = null, m = null, w = null, S = null, T = null, M = !1, x = null, _ = null, E = null, L = null, R = null, B.set(0, 0, n.canvas.width, n.canvas.height), U.set(0, 0, n.canvas.width, n.canvas.height), a.reset(), c.reset(), l.reset(); } return { buffers: { color: a, depth: c, stencil: l }, enable: ie, disable: j, bindFramebuffer: W, bindXRFramebuffer: G, useProgram: q, setBlending: ne, setMaterial: Y, setFlipSided: te, setCullFace: F, setLineWidth: $, setPolygonOffset: J, setScissorTest: z, activeTexture: V, bindTexture: oe, unbindTexture: ue, compressedTexImage2D: le, texImage2D: ve, texImage3D: xe, scissor: Te, viewport: de, reset: we }; } function PN(n, e, t, i, r, s, o) { const a = r.isWebGL2, c = r.maxTextures, l = r.maxCubemapSize, d = r.maxTextureSize, h = r.maxSamples, p = /* @__PURE__ */ new WeakMap(); let g, f = !1; try { f = typeof OffscreenCanvas < "u" && new OffscreenCanvas(1, 1).getContext("2d") !== null; } catch { } function u(z, V) { return f ? new OffscreenCanvas(z, V) : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); } function y(z, V, oe, ue) { let le = 1; if ((z.width > ue || z.height > ue) && (le = ue / Math.max(z.width, z.height)), le < 1 || V === !0) if (typeof HTMLImageElement < "u" && z instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && z instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && z instanceof ImageBitmap) { const ve = V ? fx : Math.floor, xe = ve(le * z.width), Te = ve(le * z.height); g === void 0 && (g = u(xe, Te)); const de = oe ? u(xe, Te) : g; return de.width = xe, de.height = Te, de.getContext("2d").drawImage(z, 0, 0, xe, Te), console.warn("THREE.WebGLRenderer: Texture has been resized from (" + z.width + "x" + z.height + ") to (" + xe + "x" + Te + ")."), de; } else return "data" in z && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + z.width + "x" + z.height + ")."), z; return z; } function v(z) { return Nd(z.width) && Nd(z.height); } function m(z) { return a ? !1 : z.wrapS !== mn || z.wrapT !== mn || z.minFilter !== Kt && z.minFilter !== jt; } function w(z, V) { return z.generateMipmaps && V && z.minFilter !== Kt && z.minFilter !== jt; } function S(z, V, oe, ue, le = 1) { n.generateMipmap(z); const ve = i.get(V); ve.__maxMipLevel = Math.log2(Math.max(oe, ue, le)); } function T(z, V, oe) { if (a === !1) return V; if (z !== null) { if (n[z] !== void 0) return n[z]; console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + z + "'"); } let ue = V; return V === 6403 && (oe === 5126 && (ue = 33326), oe === 5131 && (ue = 33325), oe === 5121 && (ue = 33321)), V === 6407 && (oe === 5126 && (ue = 34837), oe === 5131 && (ue = 34843), oe === 5121 && (ue = 32849)), V === 6408 && (oe === 5126 && (ue = 34836), oe === 5131 && (ue = 34842), oe === 5121 && (ue = 32856)), (ue === 33325 || ue === 33326 || ue === 34842 || ue === 34836) && e.get("EXT_color_buffer_float"), ue; } function M(z) { return z === Kt || z === Ka || z === Qa ? 9728 : 9729; } function x(z) { const V = z.target; V.removeEventListener("dispose", x), E(V), V.isVideoTexture && p.delete(V), o.memory.textures--; } function _(z) { const V = z.target; V.removeEventListener("dispose", _), L(V); } function E(z) { const V = i.get(z); V.__webglInit !== void 0 && (n.deleteTexture(V.__webglTexture), i.remove(z)); } function L(z) { const V = z.texture, oe = i.get(z), ue = i.get(V); if (z) { if (ue.__webglTexture !== void 0 && (n.deleteTexture(ue.__webglTexture), o.memory.textures--), z.depthTexture && z.depthTexture.dispose(), z.isWebGLCubeRenderTarget) for (let le = 0; le < 6; le++) n.deleteFramebuffer(oe.__webglFramebuffer[le]), oe.__webglDepthbuffer && n.deleteRenderbuffer(oe.__webglDepthbuffer[le]); else n.deleteFramebuffer(oe.__webglFramebuffer), oe.__webglDepthbuffer && n.deleteRenderbuffer(oe.__webglDepthbuffer), oe.__webglMultisampledFramebuffer && n.deleteFramebuffer(oe.__webglMultisampledFramebuffer), oe.__webglColorRenderbuffer && n.deleteRenderbuffer(oe.__webglColorRenderbuffer), oe.__webglDepthRenderbuffer && n.deleteRenderbuffer(oe.__webglDepthRenderbuffer); if (z.isWebGLMultipleRenderTargets) for (let le = 0, ve = V.length; le < ve; le++) { const xe = i.get(V[le]); xe.__webglTexture && (n.deleteTexture(xe.__webglTexture), o.memory.textures--), i.remove(V[le]); } i.remove(V), i.remove(z); } } let R = 0; function C() { R = 0; } function A() { const z = R; return z >= c && console.warn("THREE.WebGLTextures: Trying to use " + z + " texture units while this GPU supports only " + c), R += 1, z; } function P(z, V) { const oe = i.get(z); if (z.isVideoTexture && Y(z), z.version > 0 && oe.__version !== z.version) { const ue = z.image; if (ue === void 0) console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined"); else if (ue.complete === !1) console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete"); else { k(oe, z, V); return; } } t.activeTexture(33984 + V), t.bindTexture(3553, oe.__webglTexture); } function I(z, V) { const oe = i.get(z); if (z.version > 0 && oe.__version !== z.version) { k(oe, z, V); return; } t.activeTexture(33984 + V), t.bindTexture(35866, oe.__webglTexture); } function b(z, V) { const oe = i.get(z); if (z.version > 0 && oe.__version !== z.version) { k(oe, z, V); return; } t.activeTexture(33984 + V), t.bindTexture(32879, oe.__webglTexture); } function O(z, V) { const oe = i.get(z); if (z.version > 0 && oe.__version !== z.version) { K(oe, z, V); return; } t.activeTexture(33984 + V), t.bindTexture(34067, oe.__webglTexture); } const N = { [Jr]: 10497, [mn]: 33071, [No]: 33648 }, D = { [Kt]: 9728, [Ka]: 9984, [Qa]: 9986, [jt]: 9729, [Tu]: 9985, [br]: 9987 }; function B(z, V, oe) { if (oe ? (n.texParameteri(z, 10242, N[V.wrapS]), n.texParameteri(z, 10243, N[V.wrapT]), (z === 32879 || z === 35866) && n.texParameteri(z, 32882, N[V.wrapR]), n.texParameteri(z, 10240, D[V.magFilter]), n.texParameteri(z, 10241, D[V.minFilter])) : (n.texParameteri(z, 10242, 33071), n.texParameteri(z, 10243, 33071), (z === 32879 || z === 35866) && n.texParameteri(z, 32882, 33071), (V.wrapS !== mn || V.wrapT !== mn) && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."), n.texParameteri(z, 10240, M(V.magFilter)), n.texParameteri(z, 10241, M(V.minFilter)), V.minFilter !== Kt && V.minFilter !== jt && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")), e.has("EXT_texture_filter_anisotropic") === !0) { const ue = e.get("EXT_texture_filter_anisotropic"); if (V.type === nr && e.has("OES_texture_float_linear") === !1 || a === !1 && V.type === Ts && e.has("OES_texture_half_float_linear") === !1) return; (V.anisotropy > 1 || i.get(V).__currentAnisotropy) && (n.texParameterf(z, ue.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(V.anisotropy, r.getMaxAnisotropy())), i.get(V).__currentAnisotropy = V.anisotropy); } } function U(z, V) { z.__webglInit === void 0 && (z.__webglInit = !0, V.addEventListener("dispose", x), z.__webglTexture = n.createTexture(), o.memory.textures++); } function k(z, V, oe) { let ue = 3553; V.isDataTexture2DArray && (ue = 35866), V.isDataTexture3D && (ue = 32879), U(z, V), t.activeTexture(33984 + oe), t.bindTexture(ue, z.__webglTexture), n.pixelStorei(37440, V.flipY), n.pixelStorei(37441, V.premultiplyAlpha), n.pixelStorei(3317, V.unpackAlignment), n.pixelStorei(37443, 0); const le = m(V) && v(V.image) === !1, ve = y(V.image, le, !1, d), xe = v(ve) || a, Te = s.convert(V.format); let de = s.convert(V.type), we = T(V.internalFormat, Te, de); B(ue, V, xe); let se; const Se = V.mipmaps; if (V.isDepthTexture) we = 6402, a ? V.type === nr ? we = 36012 : V.type === Va ? we = 33190 : V.type === To ? we = 35056 : we = 33189 : V.type === nr && console.error("WebGLRenderer: Floating point depth texture requires WebGL2."), V.format === Es && we === 6402 && V.type !== el && V.type !== Va && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."), V.type = el, de = s.convert(V.type)), V.format === Fo && we === 6402 && (we = 34041, V.type !== To && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."), V.type = To, de = s.convert(V.type))), t.texImage2D(3553, 0, we, ve.width, ve.height, 0, Te, de, null); else if (V.isDataTexture) if (Se.length > 0 && xe) { for (let ge = 0, be = Se.length; ge < be; ge++) se = Se[ge], t.texImage2D(3553, ge, we, se.width, se.height, 0, Te, de, se.data); V.generateMipmaps = !1, z.__maxMipLevel = Se.length - 1; } else t.texImage2D(3553, 0, we, ve.width, ve.height, 0, Te, de, ve.data), z.__maxMipLevel = 0; else if (V.isCompressedTexture) { for (let ge = 0, be = Se.length; ge < be; ge++) se = Se[ge], V.format !== Yn && V.format !== ar ? Te !== null ? t.compressedTexImage2D(3553, ge, we, se.width, se.height, 0, se.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : t.texImage2D(3553, ge, we, se.width, se.height, 0, Te, de, se.data); z.__maxMipLevel = Se.length - 1; } else if (V.isDataTexture2DArray) t.texImage3D(35866, 0, we, ve.width, ve.height, ve.depth, 0, Te, de, ve.data), z.__maxMipLevel = 0; else if (V.isDataTexture3D) t.texImage3D(32879, 0, we, ve.width, ve.height, ve.depth, 0, Te, de, ve.data), z.__maxMipLevel = 0; else if (Se.length > 0 && xe) { for (let ge = 0, be = Se.length; ge < be; ge++) se = Se[ge], t.texImage2D(3553, ge, we, Te, de, se); V.generateMipmaps = !1, z.__maxMipLevel = Se.length - 1; } else t.texImage2D(3553, 0, we, Te, de, ve), z.__maxMipLevel = 0; w(V, xe) && S(ue, V, ve.width, ve.height), z.__version = V.version, V.onUpdate && V.onUpdate(V); } function K(z, V, oe) { if (V.image.length !== 6) return; U(z, V), t.activeTexture(33984 + oe), t.bindTexture(34067, z.__webglTexture), n.pixelStorei(37440, V.flipY), n.pixelStorei(37441, V.premultiplyAlpha), n.pixelStorei(3317, V.unpackAlignment), n.pixelStorei(37443, 0); const ue = V && (V.isCompressedTexture || V.image[0].isCompressedTexture), le = V.image[0] && V.image[0].isDataTexture, ve = []; for (let ge = 0; ge < 6; ge++) !ue && !le ? ve[ge] = y(V.image[ge], !1, !0, l) : ve[ge] = le ? V.image[ge].image : V.image[ge]; const xe = ve[0], Te = v(xe) || a, de = s.convert(V.format), we = s.convert(V.type), se = T(V.internalFormat, de, we); B(34067, V, Te); let Se; if (ue) { for (let ge = 0; ge < 6; ge++) { Se = ve[ge].mipmaps; for (let be = 0; be < Se.length; be++) { const Ie = Se[be]; V.format !== Yn && V.format !== ar ? de !== null ? t.compressedTexImage2D(34069 + ge, be, se, Ie.width, Ie.height, 0, Ie.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : t.texImage2D(34069 + ge, be, se, Ie.width, Ie.height, 0, de, we, Ie.data); } } z.__maxMipLevel = Se.length - 1; } else { Se = V.mipmaps; for (let ge = 0; ge < 6; ge++) if (le) { t.texImage2D(34069 + ge, 0, se, ve[ge].width, ve[ge].height, 0, de, we, ve[ge].data); for (let be = 0; be < Se.length; be++) { const et = Se[be].image[ge].image; t.texImage2D(34069 + ge, be + 1, se, et.width, et.height, 0, de, we, et.data); } } else { t.texImage2D(34069 + ge, 0, se, de, we, ve[ge]); for (let be = 0; be < Se.length; be++) { const Ie = Se[be]; t.texImage2D(34069 + ge, be + 1, se, de, we, Ie.image[ge]); } } z.__maxMipLevel = Se.length; } w(V, Te) && S(34067, V, xe.width, xe.height), z.__version = V.version, V.onUpdate && V.onUpdate(V); } function ie(z, V, oe, ue, le) { const ve = s.convert(oe.format), xe = s.convert(oe.type), Te = T(oe.internalFormat, ve, xe); le === 32879 || le === 35866 ? t.texImage3D(le, 0, Te, V.width, V.height, V.depth, 0, ve, xe, null) : t.texImage2D(le, 0, Te, V.width, V.height, 0, ve, xe, null), t.bindFramebuffer(36160, z), n.framebufferTexture2D(36160, ue, le, i.get(oe).__webglTexture, 0), t.bindFramebuffer(36160, null); } function j(z, V, oe) { if (n.bindRenderbuffer(36161, z), V.depthBuffer && !V.stencilBuffer) { let ue = 33189; if (oe) { const le = V.depthTexture; le && le.isDepthTexture && (le.type === nr ? ue = 36012 : le.type === Va && (ue = 33190)); const ve = ne(V); n.renderbufferStorageMultisample(36161, ve, ue, V.width, V.height); } else n.renderbufferStorage(36161, ue, V.width, V.height); n.framebufferRenderbuffer(36160, 36096, 36161, z); } else if (V.depthBuffer && V.stencilBuffer) { if (oe) { const ue = ne(V); n.renderbufferStorageMultisample(36161, ue, 35056, V.width, V.height); } else n.renderbufferStorage(36161, 34041, V.width, V.height); n.framebufferRenderbuffer(36160, 33306, 36161, z); } else { const ue = V.isWebGLMultipleRenderTargets === !0 ? V.texture[0] : V.texture, le = s.convert(ue.format), ve = s.convert(ue.type), xe = T(ue.internalFormat, le, ve); if (oe) { const Te = ne(V); n.renderbufferStorageMultisample(36161, Te, xe, V.width, V.height); } else n.renderbufferStorage(36161, xe, V.width, V.height); } n.bindRenderbuffer(36161, null); } function G(z, V) { if (V && V.isWebGLCubeRenderTarget) throw new Error("Depth Texture with cube render targets is not supported"); if (t.bindFramebuffer(36160, z), !(V.depthTexture && V.depthTexture.isDepthTexture)) throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture"); (!i.get(V.depthTexture).__webglTexture || V.depthTexture.image.width !== V.width || V.depthTexture.image.height !== V.height) && (V.depthTexture.image.width = V.width, V.depthTexture.image.height = V.height, V.depthTexture.needsUpdate = !0), P(V.depthTexture, 0); const ue = i.get(V.depthTexture).__webglTexture; if (V.depthTexture.format === Es) n.framebufferTexture2D(36160, 36096, 3553, ue, 0); else if (V.depthTexture.format === Fo) n.framebufferTexture2D(36160, 33306, 3553, ue, 0); else throw new Error("Unknown depthTexture format"); } function W(z) { const V = i.get(z), oe = z.isWebGLCubeRenderTarget === !0; if (z.depthTexture) { if (oe) throw new Error("target.depthTexture not supported in Cube render targets"); G(V.__webglFramebuffer, z); } else if (oe) { V.__webglDepthbuffer = []; for (let ue = 0; ue < 6; ue++) t.bindFramebuffer(36160, V.__webglFramebuffer[ue]), V.__webglDepthbuffer[ue] = n.createRenderbuffer(), j(V.__webglDepthbuffer[ue], z, !1); } else t.bindFramebuffer(36160, V.__webglFramebuffer), V.__webglDepthbuffer = n.createRenderbuffer(), j(V.__webglDepthbuffer, z, !1); t.bindFramebuffer(36160, null); } function q(z) { const V = z.texture, oe = i.get(z), ue = i.get(V); z.addEventListener("dispose", _), z.isWebGLMultipleRenderTargets !== !0 && (ue.__webglTexture = n.createTexture(), ue.__version = V.version, o.memory.textures++); const le = z.isWebGLCubeRenderTarget === !0, ve = z.isWebGLMultipleRenderTargets === !0, xe = z.isWebGLMultisampleRenderTarget === !0, Te = V.isDataTexture3D || V.isDataTexture2DArray, de = v(z) || a; if (a && V.format === ar && (V.type === nr || V.type === Ts) && (V.format = Yn, console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")), le) { oe.__webglFramebuffer = []; for (let we = 0; we < 6; we++) oe.__webglFramebuffer[we] = n.createFramebuffer(); } else if (oe.__webglFramebuffer = n.createFramebuffer(), ve) if (r.drawBuffers) { const we = z.texture; for (let se = 0, Se = we.length; se < Se; se++) { const ge = i.get(we[se]); ge.__webglTexture === void 0 && (ge.__webglTexture = n.createTexture(), o.memory.textures++); } } else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension."); else if (xe) if (a) { oe.__webglMultisampledFramebuffer = n.createFramebuffer(), oe.__webglColorRenderbuffer = n.createRenderbuffer(), n.bindRenderbuffer(36161, oe.__webglColorRenderbuffer); const we = s.convert(V.format), se = s.convert(V.type), Se = T(V.internalFormat, we, se), ge = ne(z); n.renderbufferStorageMultisample(36161, ge, Se, z.width, z.height), t.bindFramebuffer(36160, oe.__webglMultisampledFramebuffer), n.framebufferRenderbuffer(36160, 36064, 36161, oe.__webglColorRenderbuffer), n.bindRenderbuffer(36161, null), z.depthBuffer && (oe.__webglDepthRenderbuffer = n.createRenderbuffer(), j(oe.__webglDepthRenderbuffer, z, !0)), t.bindFramebuffer(36160, null); } else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."); if (le) { t.bindTexture(34067, ue.__webglTexture), B(34067, V, de); for (let we = 0; we < 6; we++) ie(oe.__webglFramebuffer[we], z, V, 36064, 34069 + we); w(V, de) && S(34067, V, z.width, z.height), t.bindTexture(34067, null); } else if (ve) { const we = z.texture; for (let se = 0, Se = we.length; se < Se; se++) { const ge = we[se], be = i.get(ge); t.bindTexture(3553, be.__webglTexture), B(3553, ge, de), ie(oe.__webglFramebuffer, z, ge, 36064 + se, 3553), w(ge, de) && S(3553, ge, z.width, z.height); } t.bindTexture(3553, null); } else { let we = 3553; Te && (a ? we = V.isDataTexture3D ? 32879 : 35866 : console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")), t.bindTexture(we, ue.__webglTexture), B(we, V, de), ie(oe.__webglFramebuffer, z, V, 36064, we), w(V, de) && S(we, V, z.width, z.height, z.depth), t.bindTexture(we, null); } z.depthBuffer && W(z); } function Q(z) { const V = v(z) || a, oe = z.isWebGLMultipleRenderTargets === !0 ? z.texture : [z.texture]; for (let ue = 0, le = oe.length; ue < le; ue++) { const ve = oe[ue]; if (w(ve, V)) { const xe = z.isWebGLCubeRenderTarget ? 34067 : 3553, Te = i.get(ve).__webglTexture; t.bindTexture(xe, Te), S(xe, ve, z.width, z.height), t.bindTexture(xe, null); } } } function ee(z) { if (z.isWebGLMultisampleRenderTarget) if (a) { const V = z.width, oe = z.height; let ue = 16384; z.depthBuffer && (ue |= 256), z.stencilBuffer && (ue |= 1024); const le = i.get(z); t.bindFramebuffer(36008, le.__webglMultisampledFramebuffer), t.bindFramebuffer(36009, le.__webglFramebuffer), n.blitFramebuffer(0, 0, V, oe, 0, 0, V, oe, ue, 9728), t.bindFramebuffer(36008, null), t.bindFramebuffer(36009, le.__webglMultisampledFramebuffer); } else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."); } function ne(z) { return a && z.isWebGLMultisampleRenderTarget ? Math.min(h, z.samples) : 0; } function Y(z) { const V = o.render.frame; p.get(z) !== V && (p.set(z, V), z.update()); } let te = !1, F = !1; function $(z, V) { z && z.isWebGLRenderTarget && (te === !1 && (console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."), te = !0), z = z.texture), P(z, V); } function J(z, V) { z && z.isWebGLCubeRenderTarget && (F === !1 && (console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), F = !0), z = z.texture), O(z, V); } this.allocateTextureUnit = A, this.resetTextureUnits = C, this.setTexture2D = P, this.setTexture2DArray = I, this.setTexture3D = b, this.setTextureCube = O, this.setupRenderTarget = q, this.updateRenderTargetMipmap = Q, this.updateMultisampleRenderTarget = ee, this.safeSetTexture2D = $, this.safeSetTextureCube = J; } function Dx(n, e, t) { const i = t.isWebGL2; function r(s) { let o; if (s === Ps) return 5121; if (s === fb) return 32819; if (s === pb) return 32820; if (s === mb) return 33635; if (s === ub) return 5120; if (s === hb) return 5122; if (s === el) return 5123; if (s === db) return 5124; if (s === Va) return 5125; if (s === nr) return 5126; if (s === Ts) return i ? 5131 : (o = e.get("OES_texture_half_float"), o !== null ? o.HALF_FLOAT_OES : null); if (s === gb) return 6406; if (s === ar) return 6407; if (s === Yn) return 6408; if (s === vb) return 6409; if (s === yb) return 6410; if (s === Es) return 6402; if (s === Fo) return 34041; if (s === xb) return 6403; if (s === wb) return 36244; if (s === Mb) return 33319; if (s === Sb) return 33320; if (s === _b) return 36248; if (s === Tb) return 36249; if (s === _d || s === Td || s === Ed || s === Ad) if (o = e.get("WEBGL_compressed_texture_s3tc"), o !== null) { if (s === _d) return o.COMPRESSED_RGB_S3TC_DXT1_EXT; if (s === Td) return o.COMPRESSED_RGBA_S3TC_DXT1_EXT; if (s === Ed) return o.COMPRESSED_RGBA_S3TC_DXT3_EXT; if (s === Ad) return o.COMPRESSED_RGBA_S3TC_DXT5_EXT; } else return null; if (s === Cd || s === Ld || s === Rd || s === Pd) if (o = e.get("WEBGL_compressed_texture_pvrtc"), o !== null) { if (s === Cd) return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; if (s === Ld) return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; if (s === Rd) return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; if (s === Pd) return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; } else return null; if (s === Eb) return o = e.get("WEBGL_compressed_texture_etc1"), o !== null ? o.COMPRESSED_RGB_ETC1_WEBGL : null; if ((s === Id || s === Od) && (o = e.get("WEBGL_compressed_texture_etc"), o !== null)) { if (s === Id) return o.COMPRESSED_RGB8_ETC2; if (s === Od) return o.COMPRESSED_RGBA8_ETC2_EAC; } if (s === Ab || s === Cb || s === Lb || s === Rb || s === Pb || s === Ib || s === Ob || s === Db || s === Nb || s === Fb || s === Bb || s === zb || s === Ub || s === Vb || s === Gb || s === Hb || s === Wb || s === jb || s === $b || s === Zb || s === Xb || s === Yb || s === Jb || s === qb || s === Kb || s === Qb || s === ex || s === tx) return o = e.get("WEBGL_compressed_texture_astc"), o !== null ? s : null; if (s === kb) return o = e.get("EXT_texture_compression_bptc"), o !== null ? s : null; if (s === To) return i ? 34042 : (o = e.get("WEBGL_depth_texture"), o !== null ? o.UNSIGNED_INT_24_8_WEBGL : null); } return { convert: r }; } class ep extends an { constructor(e = []) { super(), this.cameras = e; } } ep.prototype.isArrayCamera = !0; class Pi extends ot { constructor() { super(), this.type = "Group"; } } Pi.prototype.isGroup = !0; const IN = { type: "move" }; class Lh { constructor() { this._targetRay = null, this._grip = null, this._hand = null; } getHandSpace() { return this._hand === null && (this._hand = new Pi(), this._hand.matrixAutoUpdate = !1, this._hand.visible = !1, this._hand.joints = {}, this._hand.inputState = { pinching: !1 }), this._hand; } getTargetRaySpace() { return this._targetRay === null && (this._targetRay = new Pi(), this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new X(), this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new X()), this._targetRay; } getGripSpace() { return this._grip === null && (this._grip = new Pi(), this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new X(), this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new X()), this._grip; } dispatchEvent(e) { return this._targetRay !== null && this._targetRay.dispatchEvent(e), this._grip !== null && this._grip.dispatchEvent(e), this._hand !== null && this._hand.dispatchEvent(e), this; } disconnect(e) { return this.dispatchEvent({ type: "disconnected", data: e }), this._targetRay !== null && (this._targetRay.visible = !1), this._grip !== null && (this._grip.visible = !1), this._hand !== null && (this._hand.visible = !1), this; } update(e, t, i) { let r = null, s = null, o = null; const a = this._targetRay, c = this._grip, l = this._hand; if (e && t.session.visibilityState !== "visible-blurred") if (a !== null && (r = t.getPose(e.targetRaySpace, i), r !== null && (a.matrix.fromArray(r.transform.matrix), a.matrix.decompose(a.position, a.rotation, a.scale), r.linearVelocity ? (a.hasLinearVelocity = !0, a.linearVelocity.copy(r.linearVelocity)) : a.hasLinearVelocity = !1, r.angularVelocity ? (a.hasAngularVelocity = !0, a.angularVelocity.copy(r.angularVelocity)) : a.hasAngularVelocity = !1, this.dispatchEvent(IN))), l && e.hand) { o = !0; for (const u of e.hand.values()) { const y = t.getJointPose(u, i); if (l.joints[u.jointName] === void 0) { const m = new Pi(); m.matrixAutoUpdate = !1, m.visible = !1, l.joints[u.jointName] = m, l.add(m); } const v = l.joints[u.jointName]; y !== null && (v.matrix.fromArray(y.transform.matrix), v.matrix.decompose(v.position, v.rotation, v.scale), v.jointRadius = y.radius), v.visible = y !== null; } const d = l.joints["index-finger-tip"], h = l.joints["thumb-tip"], p = d.position.distanceTo(h.position), g = 0.02, f = 5e-3; l.inputState.pinching && p > g + f ? (l.inputState.pinching = !1, this.dispatchEvent({ type: "pinchend", handedness: e.handedness, target: this })) : !l.inputState.pinching && p <= g - f && (l.inputState.pinching = !0, this.dispatchEvent({ type: "pinchstart", handedness: e.handedness, target: this })); } else c !== null && e.gripSpace && (s = t.getPose(e.gripSpace, i), s !== null && (c.matrix.fromArray(s.transform.matrix), c.matrix.decompose(c.position, c.rotation, c.scale), s.linearVelocity ? (c.hasLinearVelocity = !0, c.linearVelocity.copy(s.linearVelocity)) : c.hasLinearVelocity = !1, s.angularVelocity ? (c.hasAngularVelocity = !0, c.angularVelocity.copy(s.angularVelocity)) : c.hasAngularVelocity = !1)); return a !== null && (a.visible = r !== null), c !== null && (c.visible = s !== null), l !== null && (l.visible = o !== null), this; } } class ON extends ns { constructor(e, t) { super(); const i = this, r = e.state; let s = null, o = 1, a = null, c = "local-floor", l = null, d = null, h = null, p = null; const g = [], f = /* @__PURE__ */ new Map(), u = new an(); u.layers.enable(1), u.viewport = new _t(); const y = new an(); y.layers.enable(2), y.viewport = new _t(); const v = [u, y], m = new ep(); m.layers.enable(1), m.layers.enable(2); let w = null, S = null; this.cameraAutoUpdate = !0, this.enabled = !1, this.isPresenting = !1, this.getController = function(I) { let b = g[I]; return b === void 0 && (b = new Lh(), g[I] = b), b.getTargetRaySpace(); }, this.getControllerGrip = function(I) { let b = g[I]; return b === void 0 && (b = new Lh(), g[I] = b), b.getGripSpace(); }, this.getHand = function(I) { let b = g[I]; return b === void 0 && (b = new Lh(), g[I] = b), b.getHandSpace(); }; function T(I) { const b = f.get(I.inputSource); b && b.dispatchEvent({ type: I.type, data: I.inputSource }); } function M() { f.forEach(function(I, b) { I.disconnect(b); }), f.clear(), w = null, S = null, r.bindXRFramebuffer(null), e.setRenderTarget(e.getRenderTarget()), P.stop(), i.isPresenting = !1, i.dispatchEvent({ type: "sessionend" }); } this.setFramebufferScaleFactor = function(I) { o = I, i.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting."); }, this.setReferenceSpaceType = function(I) { c = I, i.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change reference space type while presenting."); }, this.getReferenceSpace = function() { return a; }, this.getSession = function() { return s; }, this.setSession = async function(I) { if (s = I, s !== null) { s.addEventListener("select", T), s.addEventListener("selectstart", T), s.addEventListener("selectend", T), s.addEventListener("squeeze", T), s.addEventListener("squeezestart", T), s.addEventListener("squeezeend", T), s.addEventListener("end", M), s.addEventListener("inputsourceschange", x); const b = t.getContextAttributes(); if (b.xrCompatible !== !0 && await t.makeXRCompatible(), s.renderState.layers === void 0) { const O = { antialias: b.antialias, alpha: b.alpha, depth: b.depth, stencil: b.stencil, framebufferScaleFactor: o }, N = new XRWebGLLayer(s, t, O); s.updateRenderState({ baseLayer: N }); } else { let O = 0; b.depth && (O = b.stencil ? 34041 : 6402); const N = { colorFormat: b.alpha ? 6408 : 6407, depthFormat: O, scaleFactor: o }; d = new XRWebGLBinding(s, t), p = d.createProjectionLayer(N), h = t.createFramebuffer(), s.updateRenderState({ layers: [p] }); } a = await s.requestReferenceSpace(c), P.setContext(s), P.start(), i.isPresenting = !0, i.dispatchEvent({ type: "sessionstart" }); } }; function x(I) { const b = s.inputSources; for (let O = 0; O < g.length; O++) f.set(b[O], g[O]); for (let O = 0; O < I.removed.length; O++) { const N = I.removed[O], D = f.get(N); D && (D.dispatchEvent({ type: "disconnected", data: N }), f.delete(N)); } for (let O = 0; O < I.added.length; O++) { const N = I.added[O], D = f.get(N); D && D.dispatchEvent({ type: "connected", data: N }); } } const _ = new X(), E = new X(); function L(I, b, O) { _.setFromMatrixPosition(b.matrixWorld), E.setFromMatrixPosition(O.matrixWorld); const N = _.distanceTo(E), D = b.projectionMatrix.elements, B = O.projectionMatrix.elements, U = D[14] / (D[10] - 1), k = D[14] / (D[10] + 1), K = (D[9] + 1) / D[5], ie = (D[9] - 1) / D[5], j = (D[8] - 1) / D[0], G = (B[8] + 1) / B[0], W = U * j, q = U * G, Q = N / (-j + G), ee = Q * -j; b.matrixWorld.decompose(I.position, I.quaternion, I.scale), I.translateX(ee), I.translateZ(Q), I.matrixWorld.compose(I.position, I.quaternion, I.scale), I.matrixWorldInverse.copy(I.matrixWorld).invert(); const ne = U + Q, Y = k + Q, te = W - ee, F = q + (N - ee), $ = K * k / Y * ne, J = ie * k / Y * ne; I.projectionMatrix.makePerspective(te, F, $, J, ne, Y); } function R(I, b) { b === null ? I.matrixWorld.copy(I.matrix) : I.matrixWorld.multiplyMatrices(b.matrixWorld, I.matrix), I.matrixWorldInverse.copy(I.matrixWorld).invert(); } this.updateCamera = function(I) { if (s === null) return; m.near = y.near = u.near = I.near, m.far = y.far = u.far = I.far, (w !== m.near || S !== m.far) && (s.updateRenderState({ depthNear: m.near, depthFar: m.far }), w = m.near, S = m.far); const b = I.parent, O = m.cameras; R(m, b); for (let D = 0; D < O.length; D++) R(O[D], b); m.matrixWorld.decompose(m.position, m.quaternion, m.scale), I.position.copy(m.position), I.quaternion.copy(m.quaternion), I.scale.copy(m.scale), I.matrix.copy(m.matrix), I.matrixWorld.copy(m.matrixWorld); const N = I.children; for (let D = 0, B = N.length; D < B; D++) N[D].updateMatrixWorld(!0); O.length === 2 ? L(m, u, y) : m.projectionMatrix.copy(u.projectionMatrix); }, this.getCamera = function() { return m; }; let C = null; function A(I, b) { if (l = b.getViewerPose(a), l !== null) { const N = l.views, D = s.renderState.baseLayer; s.renderState.layers === void 0 && r.bindXRFramebuffer(D.framebuffer); let B = !1; N.length !== m.cameras.length && (m.cameras.length = 0, B = !0); for (let U = 0; U < N.length; U++) { const k = N[U]; let K = null; if (s.renderState.layers === void 0) K = D.getViewport(k); else { const j = d.getViewSubImage(p, k); r.bindXRFramebuffer(h), t.framebufferTexture2D(36160, 36064, 3553, j.colorTexture, 0), j.depthStencilTexture !== void 0 && t.framebufferTexture2D(36160, 36096, 3553, j.depthStencilTexture, 0), K = j.viewport; } const ie = v[U]; ie.matrix.fromArray(k.transform.matrix), ie.projectionMatrix.fromArray(k.projectionMatrix), ie.viewport.set(K.x, K.y, K.width, K.height), U === 0 && m.matrix.copy(ie.matrix), B === !0 && m.cameras.push(ie); } } const O = s.inputSources; for (let N = 0; N < g.length; N++) { const D = g[N], B = O[N]; D.update(B, b, a); } C && C(I, b); } const P = new Tx(); P.setAnimationLoop(A), this.setAnimationLoop = function(I) { C = I; }, this.dispose = function() { }; } } function DN(n) { function e(v, m) { v.fogColor.value.copy(m.color), m.isFog ? (v.fogNear.value = m.near, v.fogFar.value = m.far) : m.isFogExp2 && (v.fogDensity.value = m.density); } function t(v, m, w, S, T) { m.isMeshBasicMaterial ? i(v, m) : m.isMeshLambertMaterial ? (i(v, m), c(v, m)) : m.isMeshToonMaterial ? (i(v, m), d(v, m)) : m.isMeshPhongMaterial ? (i(v, m), l(v, m)) : m.isMeshStandardMaterial ? (i(v, m), m.isMeshPhysicalMaterial ? p(v, m, T) : h(v, m)) : m.isMeshMatcapMaterial ? (i(v, m), g(v, m)) : m.isMeshDepthMaterial ? (i(v, m), f(v, m)) : m.isMeshDistanceMaterial ? (i(v, m), u(v, m)) : m.isMeshNormalMaterial ? (i(v, m), y(v, m)) : m.isLineBasicMaterial ? (r(v, m), m.isLineDashedMaterial && s(v, m)) : m.isPointsMaterial ? o(v, m, w, S) : m.isSpriteMaterial ? a(v, m) : m.isShadowMaterial ? (v.color.value.copy(m.color), v.opacity.value = m.opacity) : m.isShaderMaterial && (m.uniformsNeedUpdate = !1); } function i(v, m) { v.opacity.value = m.opacity, m.color && v.diffuse.value.copy(m.color), m.emissive && v.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity), m.map && (v.map.value = m.map), m.alphaMap && (v.alphaMap.value = m.alphaMap), m.specularMap && (v.specularMap.value = m.specularMap); const w = n.get(m).envMap; if (w) { v.envMap.value = w, v.flipEnvMap.value = w.isCubeTexture && w._needsFlipEnvMap ? -1 : 1, v.reflectivity.value = m.reflectivity, v.refractionRatio.value = m.refractionRatio; const M = n.get(w).__maxMipLevel; M !== void 0 && (v.maxMipLevel.value = M); } m.lightMap && (v.lightMap.value = m.lightMap, v.lightMapIntensity.value = m.lightMapIntensity), m.aoMap && (v.aoMap.value = m.aoMap, v.aoMapIntensity.value = m.aoMapIntensity); let S; m.map ? S = m.map : m.specularMap ? S = m.specularMap : m.displacementMap ? S = m.displacementMap : m.normalMap ? S = m.normalMap : m.bumpMap ? S = m.bumpMap : m.roughnessMap ? S = m.roughnessMap : m.metalnessMap ? S = m.metalnessMap : m.alphaMap ? S = m.alphaMap : m.emissiveMap ? S = m.emissiveMap : m.clearcoatMap ? S = m.clearcoatMap : m.clearcoatNormalMap ? S = m.clearcoatNormalMap : m.clearcoatRoughnessMap && (S = m.clearcoatRoughnessMap), S !== void 0 && (S.isWebGLRenderTarget && (S = S.texture), S.matrixAutoUpdate === !0 && S.updateMatrix(), v.uvTransform.value.copy(S.matrix)); let T; m.aoMap ? T = m.aoMap : m.lightMap && (T = m.lightMap), T !== void 0 && (T.isWebGLRenderTarget && (T = T.texture), T.matrixAutoUpdate === !0 && T.updateMatrix(), v.uv2Transform.value.copy(T.matrix)); } function r(v, m) { v.diffuse.value.copy(m.color), v.opacity.value = m.opacity; } function s(v, m) { v.dashSize.value = m.dashSize, v.totalSize.value = m.dashSize + m.gapSize, v.scale.value = m.scale; } function o(v, m, w, S) { v.diffuse.value.copy(m.color), v.opacity.value = m.opacity, v.size.value = m.size * w, v.scale.value = S * 0.5, m.map && (v.map.value = m.map), m.alphaMap && (v.alphaMap.value = m.alphaMap); let T; m.map ? T = m.map : m.alphaMap && (T = m.alphaMap), T !== void 0 && (T.matrixAutoUpdate === !0 && T.updateMatrix(), v.uvTransform.value.copy(T.matrix)); } function a(v, m) { v.diffuse.value.copy(m.color), v.opacity.value = m.opacity, v.rotation.value = m.rotation, m.map && (v.map.value = m.map), m.alphaMap && (v.alphaMap.value = m.alphaMap); let w; m.map ? w = m.map : m.alphaMap && (w = m.alphaMap), w !== void 0 && (w.matrixAutoUpdate === !0 && w.updateMatrix(), v.uvTransform.value.copy(w.matrix)); } function c(v, m) { m.emissiveMap && (v.emissiveMap.value = m.emissiveMap); } function l(v, m) { v.specular.value.copy(m.specular), v.shininess.value = Math.max(m.shininess, 1e-4), m.emissiveMap && (v.emissiveMap.value = m.emissiveMap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === qt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === qt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias); } function d(v, m) { m.gradientMap && (v.gradientMap.value = m.gradientMap), m.emissiveMap && (v.emissiveMap.value = m.emissiveMap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === qt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === qt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias); } function h(v, m) { v.roughness.value = m.roughness, v.metalness.value = m.metalness, m.roughnessMap && (v.roughnessMap.value = m.roughnessMap), m.metalnessMap && (v.metalnessMap.value = m.metalnessMap), m.emissiveMap && (v.emissiveMap.value = m.emissiveMap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === qt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === qt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias), n.get(m).envMap && (v.envMapIntensity.value = m.envMapIntensity); } function p(v, m, w) { h(v, m), v.reflectivity.value = m.reflectivity, v.clearcoat.value = m.clearcoat, v.clearcoatRoughness.value = m.clearcoatRoughness, m.sheen && v.sheen.value.copy(m.sheen), m.clearcoatMap && (v.clearcoatMap.value = m.clearcoatMap), m.clearcoatRoughnessMap && (v.clearcoatRoughnessMap.value = m.clearcoatRoughnessMap), m.clearcoatNormalMap && (v.clearcoatNormalScale.value.copy(m.clearcoatNormalScale), v.clearcoatNormalMap.value = m.clearcoatNormalMap, m.side === qt && v.clearcoatNormalScale.value.negate()), v.transmission.value = m.transmission, m.transmissionMap && (v.transmissionMap.value = m.transmissionMap), m.transmission > 0 && (v.transmissionSamplerMap.value = w.texture, v.transmissionSamplerSize.value.set(w.width, w.height)), v.thickness.value = m.thickness, m.thicknessMap && (v.thicknessMap.value = m.thicknessMap), v.attenuationDistance.value = m.attenuationDistance, v.attenuationColor.value.copy(m.attenuationColor); } function g(v, m) { m.matcap && (v.matcap.value = m.matcap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === qt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === qt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias); } function f(v, m) { m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias); } function u(v, m) { m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias), v.referencePosition.value.copy(m.referencePosition), v.nearDistance.value = m.nearDistance, v.farDistance.value = m.farDistance; } function y(v, m) { m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === qt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === qt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias); } return { refreshFogUniforms: e, refreshMaterialUniforms: t }; } function NN() { const n = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); return n.style.display = "block", n; } function Et(n = {}) { const e = n.canvas !== void 0 ? n.canvas : NN(), t = n.context !== void 0 ? n.context : null, i = n.alpha !== void 0 ? n.alpha : !1, r = n.depth !== void 0 ? n.depth : !0, s = n.stencil !== void 0 ? n.stencil : !0, o = n.antialias !== void 0 ? n.antialias : !1, a = n.premultipliedAlpha !== void 0 ? n.premultipliedAlpha : !0, c = n.preserveDrawingBuffer !== void 0 ? n.preserveDrawingBuffer : !1, l = n.powerPreference !== void 0 ? n.powerPreference : "default", d = n.failIfMajorPerformanceCaveat !== void 0 ? n.failIfMajorPerformanceCaveat : !1; let h = null, p = null; const g = [], f = []; this.domElement = e, this.debug = { /** * Enables error checking and reporting when shader programs are being compiled * @type {boolean} */ checkShaderErrors: !0 }, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this.gammaFactor = 2, this.outputEncoding = Dn, this.physicallyCorrectLights = !1, this.toneMapping = Vr, this.toneMappingExposure = 1; const u = this; let y = !1, v = 0, m = 0, w = null, S = -1, T = null; const M = new _t(), x = new _t(); let _ = null, E = e.width, L = e.height, R = 1, C = null, A = null; const P = new _t(0, 0, E, L), I = new _t(0, 0, E, L); let b = !1; const O = [], N = new Ml(); let D = !1, B = !1, U = null; const k = new $e(), K = new X(), ie = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: !0 }; function j() { return w === null ? R : 1; } let G = t; function W(Z, ye) { for (let me = 0; me < Z.length; me++) { const Me = Z[me], Oe = e.getContext(Me, ye); if (Oe !== null) return Oe; } return null; } try { const Z = { alpha: i, depth: r, stencil: s, antialias: o, premultipliedAlpha: a, preserveDrawingBuffer: c, powerPreference: l, failIfMajorPerformanceCaveat: d }; if (e.addEventListener("webglcontextlost", et, !1), e.addEventListener("webglcontextrestored", mt, !1), G === null) { const ye = ["webgl2", "webgl", "experimental-webgl"]; if (u.isWebGL1Renderer === !0 && ye.shift(), G = W(ye, Z), G === null) throw W(ye) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context."); } G.getShaderPrecisionFormat === void 0 && (G.getShaderPrecisionFormat = function() { return { rangeMin: 1, rangeMax: 1, precision: 1 }; }); } catch (Z) { throw console.error("THREE.WebGLRenderer: " + Z.message), Z; } let q, Q, ee, ne, Y, te, F, $, J, z, V, oe, ue, le, ve, xe, Te, de, we, se, Se, ge; function be() { q = new sD(G), Q = new nD(G, q, n), q.init(Q), Se = new Dx(G, q, Q), ee = new RN(G, q, Q), O[0] = 1029, ne = new lD(), Y = new bN(), te = new PN(G, q, ee, Y, Q, Se, ne), F = new rD(u), $ = new PI(G, Q), ge = new eD(G, q, $, Q), J = new oD(G, $, ne, ge), z = new dD(G, J, $, ne), de = new hD(G), ve = new iD(Y), V = new yN(u, F, q, Q, ge, ve), oe = new DN(Y), ue = new wN(Y), le = new AN(q, Q), Te = new Q3(u, F, ee, z, a), xe = new Ox(u, z, Q), we = new tD(G, q, ne, Q), se = new aD(G, q, ne, Q), ne.programs = V.programs, u.capabilities = Q, u.extensions = q, u.properties = Y, u.renderLists = ue, u.shadowMap = xe, u.state = ee, u.info = ne; } be(); const Ie = new ON(u, G); this.xr = Ie, this.getContext = function() { return G; }, this.getContextAttributes = function() { return G.getContextAttributes(); }, this.forceContextLoss = function() { const Z = q.get("WEBGL_lose_context"); Z && Z.loseContext(); }, this.forceContextRestore = function() { const Z = q.get("WEBGL_lose_context"); Z && Z.restoreContext(); }, this.getPixelRatio = function() { return R; }, this.setPixelRatio = function(Z) { Z !== void 0 && (R = Z, this.setSize(E, L, !1)); }, this.getSize = function(Z) { return Z.set(E, L); }, this.setSize = function(Z, ye, me) { if (Ie.isPresenting) { console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."); return; } E = Z, L = ye, e.width = Math.floor(Z * R), e.height = Math.floor(ye * R), me !== !1 && (e.style.width = Z + "px", e.style.height = ye + "px"), this.setViewport(0, 0, Z, ye); }, this.getDrawingBufferSize = function(Z) { return Z.set(E * R, L * R).floor(); }, this.setDrawingBufferSize = function(Z, ye, me) { E = Z, L = ye, R = me, e.width = Math.floor(Z * me), e.height = Math.floor(ye * me), this.setViewport(0, 0, Z, ye); }, this.getCurrentViewport = function(Z) { return Z.copy(M); }, this.getViewport = function(Z) { return Z.copy(P); }, this.setViewport = function(Z, ye, me, Me) { Z.isVector4 ? P.set(Z.x, Z.y, Z.z, Z.w) : P.set(Z, ye, me, Me), ee.viewport(M.copy(P).multiplyScalar(R).floor()); }, this.getScissor = function(Z) { return Z.copy(I); }, this.setScissor = function(Z, ye, me, Me) { Z.isVector4 ? I.set(Z.x, Z.y, Z.z, Z.w) : I.set(Z, ye, me, Me), ee.scissor(x.copy(I).multiplyScalar(R).floor()); }, this.getScissorTest = function() { return b; }, this.setScissorTest = function(Z) { ee.setScissorTest(b = Z); }, this.setOpaqueSort = function(Z) { C = Z; }, this.setTransparentSort = function(Z) { A = Z; }, this.getClearColor = function(Z) { return Z.copy(Te.getClearColor()); }, this.setClearColor = function() { Te.setClearColor.apply(Te, arguments); }, this.getClearAlpha = function() { return Te.getClearAlpha(); }, this.setClearAlpha = function() { Te.setClearAlpha.apply(Te, arguments); }, this.clear = function(Z, ye, me) { let Me = 0; (Z === void 0 || Z) && (Me |= 16384), (ye === void 0 || ye) && (Me |= 256), (me === void 0 || me) && (Me |= 1024), G.clear(Me); }, this.clearColor = function() { this.clear(!0, !1, !1); }, this.clearDepth = function() { this.clear(!1, !0, !1); }, this.clearStencil = function() { this.clear(!1, !1, !0); }, this.dispose = function() { e.removeEventListener("webglcontextlost", et, !1), e.removeEventListener("webglcontextrestored", mt, !1), ue.dispose(), le.dispose(), Y.dispose(), F.dispose(), z.dispose(), ge.dispose(), Ie.dispose(), Ie.removeEventListener("sessionstart", pt), Ie.removeEventListener("sessionend", Vt), U && (U.dispose(), U = null), Nt.stop(); }; function et(Z) { Z.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), y = !0; } function mt() { console.log("THREE.WebGLRenderer: Context Restored."), y = !1; const Z = ne.autoReset, ye = xe.enabled, me = xe.autoUpdate, Me = xe.needsUpdate, Oe = xe.type; be(), ne.autoReset = Z, xe.enabled = ye, xe.autoUpdate = me, xe.needsUpdate = Me, xe.type = Oe; } function Ue(Z) { const ye = Z.target; ye.removeEventListener("dispose", Ue), bt(ye); } function bt(Z) { Ve(Z), Y.remove(Z); } function Ve(Z) { const ye = Y.get(Z).programs; ye !== void 0 && ye.forEach(function(me) { V.releaseProgram(me); }); } function lt(Z, ye) { Z.render(function(me) { u.renderBufferImmediate(me, ye); }); } this.renderBufferImmediate = function(Z, ye) { ge.initAttributes(); const me = Y.get(Z); Z.hasPositions && !me.position && (me.position = G.createBuffer()), Z.hasNormals && !me.normal && (me.normal = G.createBuffer()), Z.hasUvs && !me.uv && (me.uv = G.createBuffer()), Z.hasColors && !me.color && (me.color = G.createBuffer()); const Me = ye.getAttributes(); Z.hasPositions && (G.bindBuffer(34962, me.position), G.bufferData(34962, Z.positionArray, 35048), ge.enableAttribute(Me.position), G.vertexAttribPointer(Me.position, 3, 5126, !1, 0, 0)), Z.hasNormals && (G.bindBuffer(34962, me.normal), G.bufferData(34962, Z.normalArray, 35048), ge.enableAttribute(Me.normal), G.vertexAttribPointer(Me.normal, 3, 5126, !1, 0, 0)), Z.hasUvs && (G.bindBuffer(34962, me.uv), G.bufferData(34962, Z.uvArray, 35048), ge.enableAttribute(Me.uv), G.vertexAttribPointer(Me.uv, 2, 5126, !1, 0, 0)), Z.hasColors && (G.bindBuffer(34962, me.color), G.bufferData(34962, Z.colorArray, 35048), ge.enableAttribute(Me.color), G.vertexAttribPointer(Me.color, 3, 5126, !1, 0, 0)), ge.disableUnusedAttributes(), G.drawArrays(4, 0, Z.count), Z.count = 0; }, this.renderBufferDirect = function(Z, ye, me, Me, Oe, he) { ye === null && (ye = ie); const _e = Oe.isMesh && Oe.matrixWorld.determinant() < 0, Ce = Tt(Z, ye, Me, Oe); ee.setMaterial(Me, _e); let ke = me.index; const Ze = me.attributes.position; if (ke === null) { if (Ze === void 0 || Ze.count === 0) return; } else if (ke.count === 0) return; let Qe = 1; Me.wireframe === !0 && (ke = J.getWireframeAttribute(me), Qe = 2), (Me.morphTargets || Me.morphNormals) && de.update(Oe, me, Me, Ce), ge.setup(Oe, Me, Ce, me, ke); let qe, ut = we; ke !== null && (qe = $.get(ke), ut = se, ut.setIndex(qe)); const Zt = ke !== null ? ke.count : Ze.count, hn = me.drawRange.start * Qe, os = me.drawRange.count * Qe, Rt = he !== null ? he.start * Qe : 0, as = he !== null ? he.count * Qe : 1 / 0, Tn = Math.max(hn, Rt), qw = Math.min(Zt, hn + os, Rt + as) - 1, Dl = Math.max(0, qw - Tn + 1); if (Dl !== 0) { if (Oe.isMesh) Me.wireframe === !0 ? (ee.setLineWidth(Me.wireframeLinewidth * j()), ut.setMode(1)) : ut.setMode(4); else if (Oe.isLine) { let ma = Me.linewidth; ma === void 0 && (ma = 1), ee.setLineWidth(ma * j()), Oe.isLineSegments ? ut.setMode(1) : Oe.isLineLoop ? ut.setMode(2) : ut.setMode(3); } else Oe.isPoints ? ut.setMode(0) : Oe.isSprite && ut.setMode(4); if (Oe.isInstancedMesh) ut.renderInstances(Tn, Dl, Oe.count); else if (me.isInstancedBufferGeometry) { const ma = Math.min(me.instanceCount, me._maxInstanceCount); ut.renderInstances(Tn, Dl, ma); } else ut.render(Tn, Dl); } }, this.compile = function(Z, ye) { p = le.get(Z), p.init(), Z.traverseVisible(function(me) { me.isLight && me.layers.test(ye.layers) && (p.pushLight(me), me.castShadow && p.pushShadow(me)); }), p.setupLights(), Z.traverse(function(me) { const Me = me.material; if (Me) if (Array.isArray(Me)) for (let Oe = 0; Oe < Me.length; Oe++) { const he = Me[Oe]; rt(he, Z, me); } else rt(Me, Z, me); }); }; let tt = null; function xt(Z) { tt && tt(Z); } function pt() { Nt.stop(); } function Vt() { Nt.start(); } const Nt = new Tx(); Nt.setAnimationLoop(xt), typeof window < "u" && Nt.setContext(window), this.setAnimationLoop = function(Z) { tt = Z, Ie.setAnimationLoop(Z), Z === null ? Nt.stop() : Nt.start(); }, Ie.addEventListener("sessionstart", pt), Ie.addEventListener("sessionend", Vt), this.render = function(Z, ye) { if (ye !== void 0 && ye.isCamera !== !0) { console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera."); return; } if (y === !0) return; Z.autoUpdate === !0 && Z.updateMatrixWorld(), ye.parent === null && ye.updateMatrixWorld(), Ie.enabled === !0 && Ie.isPresenting === !0 && (Ie.cameraAutoUpdate === !0 && Ie.updateCamera(ye), ye = Ie.getCamera()), Z.isScene === !0 && Z.onBeforeRender(u, Z, ye, w), p = le.get(Z, f.length), p.init(), f.push(p), k.multiplyMatrices(ye.projectionMatrix, ye.matrixWorldInverse), N.setFromProjectionMatrix(k), B = this.localClippingEnabled, D = ve.init(this.clippingPlanes, B, ye), h = ue.get(Z, g.length), h.init(), g.push(h), re(Z, ye, 0, u.sortObjects), h.finish(), u.sortObjects === !0 && h.sort(C, A), D === !0 && ve.beginShadows(); const me = p.state.shadowsArray; xe.render(me, Z, ye), p.setupLights(), p.setupLightsView(ye), D === !0 && ve.endShadows(), this.info.autoReset === !0 && this.info.reset(), Te.render(h, Z); const Me = h.opaque, Oe = h.transmissive, he = h.transparent; Me.length > 0 && Ne(Me, Z, ye), Oe.length > 0 && Ee(Me, Oe, Z, ye), he.length > 0 && Ne(he, Z, ye), w !== null && (te.updateMultisampleRenderTarget(w), te.updateRenderTargetMipmap(w)), Z.isScene === !0 && Z.onAfterRender(u, Z, ye), ee.buffers.depth.setTest(!0), ee.buffers.depth.setMask(!0), ee.buffers.color.setMask(!0), ee.setPolygonOffset(!1), ge.resetDefaultState(), S = -1, T = null, f.pop(), f.length > 0 ? p = f[f.length - 1] : p = null, g.pop(), g.length > 0 ? h = g[g.length - 1] : h = null; }; function re(Z, ye, me, Me) { if (Z.visible === !1) return; if (Z.layers.test(ye.layers)) { if (Z.isGroup) me = Z.renderOrder; else if (Z.isLOD) Z.autoUpdate === !0 && Z.update(ye); else if (Z.isLight) p.pushLight(Z), Z.castShadow && p.pushShadow(Z); else if (Z.isSprite) { if (!Z.frustumCulled || N.intersectsSprite(Z)) { Me && K.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(k); const _e = z.update(Z), Ce = Z.material; Ce.visible && h.push(Z, _e, Ce, me, K.z, null); } } else if (Z.isImmediateRenderObject) Me && K.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(k), h.push(Z, null, Z.material, me, K.z, null); else if ((Z.isMesh || Z.isLine || Z.isPoints) && (Z.isSkinnedMesh && Z.skeleton.frame !== ne.render.frame && (Z.skeleton.update(), Z.skeleton.frame = ne.render.frame), !Z.frustumCulled || N.intersectsObject(Z))) { Me && K.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(k); const _e = z.update(Z), Ce = Z.material; if (Array.isArray(Ce)) { const ke = _e.groups; for (let Ze = 0, Qe = ke.length; Ze < Qe; Ze++) { const qe = ke[Ze], ut = Ce[qe.materialIndex]; ut && ut.visible && h.push(Z, _e, ut, me, K.z, qe); } } else Ce.visible && h.push(Z, _e, Ce, me, K.z, null); } } const he = Z.children; for (let _e = 0, Ce = he.length; _e < Ce; _e++) re(he[_e], ye, me, Me); } function Ee(Z, ye, me, Me) { if (U === null) { const Ce = o === !0 && Q.isWebGL2 === !0 ? Jf : bi; U = new Ce(1024, 1024, { generateMipmaps: !0, type: Se.convert(Ts) !== null ? Ts : Ps, minFilter: br, magFilter: Kt, wrapS: mn, wrapT: mn }); } const Oe = u.getRenderTarget(); u.setRenderTarget(U), u.clear(); const he = u.toneMapping; u.toneMapping = Vr, Ne(Z, me, Me), u.toneMapping = he, te.updateMultisampleRenderTarget(U), te.updateRenderTargetMipmap(U), u.setRenderTarget(Oe), Ne(ye, me, Me); } function Ne(Z, ye, me) { const Me = ye.isScene === !0 ? ye.overrideMaterial : null; for (let Oe = 0, he = Z.length; Oe < he; Oe++) { const _e = Z[Oe], Ce = _e.object, ke = _e.geometry, Ze = Me === null ? _e.material : Me, Qe = _e.group; if (me.isArrayCamera) { const qe = me.cameras; for (let ut = 0, Zt = qe.length; ut < Zt; ut++) { const hn = qe[ut]; Ce.layers.test(hn.layers) && (ee.viewport(M.copy(hn.viewport)), p.setupLightsView(hn), je(Ce, ye, hn, ke, Ze, Qe)); } } else je(Ce, ye, me, ke, Ze, Qe); } } function je(Z, ye, me, Me, Oe, he) { if (Z.onBeforeRender(u, ye, me, Me, Oe, he), Z.modelViewMatrix.multiplyMatrices(me.matrixWorldInverse, Z.matrixWorld), Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix), Z.isImmediateRenderObject) { const _e = Tt(me, ye, Oe, Z); ee.setMaterial(Oe), ge.reset(), lt(Z, _e); } else Oe.transparent === !0 && Oe.side === Yr ? (Oe.side = qt, Oe.needsUpdate = !0, u.renderBufferDirect(me, ye, Me, Oe, Z, he), Oe.side = Xr, Oe.needsUpdate = !0, u.renderBufferDirect(me, ye, Me, Oe, Z, he), Oe.side = Yr) : u.renderBufferDirect(me, ye, Me, Oe, Z, he); Z.onAfterRender(u, ye, me, Me, Oe, he); } function rt(Z, ye, me) { ye.isScene !== !0 && (ye = ie); const Me = Y.get(Z), Oe = p.state.lights, he = p.state.shadowsArray, _e = Oe.state.version, Ce = V.getParameters(Z, Oe.state, he, ye, me), ke = V.getProgramCacheKey(Ce); let Ze = Me.programs; Me.environment = Z.isMeshStandardMaterial ? ye.environment : null, Me.fog = ye.fog, Me.envMap = F.get(Z.envMap || Me.environment), Ze === void 0 && (Z.addEventListener("dispose", Ue), Ze = /* @__PURE__ */ new Map(), Me.programs = Ze); let Qe = Ze.get(ke); if (Qe !== void 0) { if (Me.currentProgram === Qe && Me.lightsStateVersion === _e) return gt(Z, Ce), Qe; } else Ce.uniforms = V.getUniforms(Z), Z.onBuild(Ce, u), Z.onBeforeCompile(Ce, u), Qe = V.acquireProgram(Ce, ke), Ze.set(ke, Qe), Me.uniforms = Ce.uniforms; const qe = Me.uniforms; (!Z.isShaderMaterial && !Z.isRawShaderMaterial || Z.clipping === !0) && (qe.clippingPlanes = ve.uniform), gt(Z, Ce), Me.needsLights = kt(Z), Me.lightsStateVersion = _e, Me.needsLights && (qe.ambientLightColor.value = Oe.state.ambient, qe.lightProbe.value = Oe.state.probe, qe.directionalLights.value = Oe.state.directional, qe.directionalLightShadows.value = Oe.state.directionalShadow, qe.spotLights.value = Oe.state.spot, qe.spotLightShadows.value = Oe.state.spotShadow, qe.rectAreaLights.value = Oe.state.rectArea, qe.ltc_1.value = Oe.state.rectAreaLTC1, qe.ltc_2.value = Oe.state.rectAreaLTC2, qe.pointLights.value = Oe.state.point, qe.pointLightShadows.value = Oe.state.pointShadow, qe.hemisphereLights.value = Oe.state.hemi, qe.directionalShadowMap.value = Oe.state.directionalShadowMap, qe.directionalShadowMatrix.value = Oe.state.directionalShadowMatrix, qe.spotShadowMap.value = Oe.state.spotShadowMap, qe.spotShadowMatrix.value = Oe.state.spotShadowMatrix, qe.pointShadowMap.value = Oe.state.pointShadowMap, qe.pointShadowMatrix.value = Oe.state.pointShadowMatrix); const ut = Qe.getUniforms(), Zt = kr.seqWithValue(ut.seq, qe); return Me.currentProgram = Qe, Me.uniformsList = Zt, Qe; } function gt(Z, ye) { const me = Y.get(Z); me.outputEncoding = ye.outputEncoding, me.instancing = ye.instancing, me.skinning = ye.skinning, me.numClippingPlanes = ye.numClippingPlanes, me.numIntersection = ye.numClipIntersection, me.vertexAlphas = ye.vertexAlphas; } function Tt(Z, ye, me, Me) { ye.isScene !== !0 && (ye = ie), te.resetTextureUnits(); const Oe = ye.fog, he = me.isMeshStandardMaterial ? ye.environment : null, _e = w === null ? u.outputEncoding : w.texture.encoding, Ce = F.get(me.envMap || he), ke = me.vertexColors === !0 && Me.geometry && Me.geometry.attributes.color && Me.geometry.attributes.color.itemSize === 4, Ze = Y.get(me), Qe = p.state.lights; if (D === !0 && (B === !0 || Z !== T)) { const Tn = Z === T && me.id === S; ve.setState(me, Z, Tn); } let qe = !1; me.version === Ze.__version ? (Ze.needsLights && Ze.lightsStateVersion !== Qe.state.version || Ze.outputEncoding !== _e || Me.isInstancedMesh && Ze.instancing === !1 || !Me.isInstancedMesh && Ze.instancing === !0 || Me.isSkinnedMesh && Ze.skinning === !1 || !Me.isSkinnedMesh && Ze.skinning === !0 || Ze.envMap !== Ce || me.fog && Ze.fog !== Oe || Ze.numClippingPlanes !== void 0 && (Ze.numClippingPlanes !== ve.numPlanes || Ze.numIntersection !== ve.numIntersection) || Ze.vertexAlphas !== ke) && (qe = !0) : (qe = !0, Ze.__version = me.version); let ut = Ze.currentProgram; qe === !0 && (ut = rt(me, ye, Me)); let Zt = !1, hn = !1, os = !1; const Rt = ut.getUniforms(), as = Ze.uniforms; if (ee.useProgram(ut.program) && (Zt = !0, hn = !0, os = !0), me.id !== S && (S = me.id, hn = !0), Zt || T !== Z) { if (Rt.setValue(G, "projectionMatrix", Z.projectionMatrix), Q.logarithmicDepthBuffer && Rt.setValue( G, "logDepthBufFC", 2 / (Math.log(Z.far + 1) / Math.LN2) ), T !== Z && (T = Z, hn = !0, os = !0), me.isShaderMaterial || me.isMeshPhongMaterial || me.isMeshToonMaterial || me.isMeshStandardMaterial || me.envMap) { const Tn = Rt.map.cameraPosition; Tn !== void 0 && Tn.setValue( G, K.setFromMatrixPosition(Z.matrixWorld) ); } (me.isMeshPhongMaterial || me.isMeshToonMaterial || me.isMeshLambertMaterial || me.isMeshBasicMaterial || me.isMeshStandardMaterial || me.isShaderMaterial) && Rt.setValue(G, "isOrthographic", Z.isOrthographicCamera === !0), (me.isMeshPhongMaterial || me.isMeshToonMaterial || me.isMeshLambertMaterial || me.isMeshBasicMaterial || me.isMeshStandardMaterial || me.isShaderMaterial || me.isShadowMaterial || Me.isSkinnedMesh) && Rt.setValue(G, "viewMatrix", Z.matrixWorldInverse); } if (Me.isSkinnedMesh) { Rt.setOptional(G, Me, "bindMatrix"), Rt.setOptional(G, Me, "bindMatrixInverse"); const Tn = Me.skeleton; Tn && (Q.floatVertexTextures ? (Tn.boneTexture === null && Tn.computeBoneTexture(), Rt.setValue(G, "boneTexture", Tn.boneTexture, te), Rt.setValue(G, "boneTextureSize", Tn.boneTextureSize)) : Rt.setOptional(G, Tn, "boneMatrices")); } return (hn || Ze.receiveShadow !== Me.receiveShadow) && (Ze.receiveShadow = Me.receiveShadow, Rt.setValue(G, "receiveShadow", Me.receiveShadow)), hn && (Rt.setValue(G, "toneMappingExposure", u.toneMappingExposure), Ze.needsLights && Lt(as, os), Oe && me.fog && oe.refreshFogUniforms(as, Oe), oe.refreshMaterialUniforms(as, me, R, L, U), kr.upload(G, Ze.uniformsList, as, te)), me.isShaderMaterial && me.uniformsNeedUpdate === !0 && (kr.upload(G, Ze.uniformsList, as, te), me.uniformsNeedUpdate = !1), me.isSpriteMaterial && Rt.setValue(G, "center", Me.center), Rt.setValue(G, "modelViewMatrix", Me.modelViewMatrix), Rt.setValue(G, "normalMatrix", Me.normalMatrix), Rt.setValue(G, "modelMatrix", Me.matrixWorld), ut; } function Lt(Z, ye) { Z.ambientLightColor.needsUpdate = ye, Z.lightProbe.needsUpdate = ye, Z.directionalLights.needsUpdate = ye, Z.directionalLightShadows.needsUpdate = ye, Z.pointLights.needsUpdate = ye, Z.pointLightShadows.needsUpdate = ye, Z.spotLights.needsUpdate = ye, Z.spotLightShadows.needsUpdate = ye, Z.rectAreaLights.needsUpdate = ye, Z.hemisphereLights.needsUpdate = ye; } function kt(Z) { return Z.isMeshLambertMaterial || Z.isMeshToonMaterial || Z.isMeshPhongMaterial || Z.isMeshStandardMaterial || Z.isShadowMaterial || Z.isShaderMaterial && Z.lights === !0; } this.getActiveCubeFace = function() { return v; }, this.getActiveMipmapLevel = function() { return m; }, this.getRenderTarget = function() { return w; }, this.setRenderTarget = function(Z, ye = 0, me = 0) { w = Z, v = ye, m = me, Z && Y.get(Z).__webglFramebuffer === void 0 && te.setupRenderTarget(Z); let Me = null, Oe = !1, he = !1; if (Z) { const Ce = Z.texture; (Ce.isDataTexture3D || Ce.isDataTexture2DArray) && (he = !0); const ke = Y.get(Z).__webglFramebuffer; Z.isWebGLCubeRenderTarget ? (Me = ke[ye], Oe = !0) : Z.isWebGLMultisampleRenderTarget ? Me = Y.get(Z).__webglMultisampledFramebuffer : Me = ke, M.copy(Z.viewport), x.copy(Z.scissor), _ = Z.scissorTest; } else M.copy(P).multiplyScalar(R).floor(), x.copy(I).multiplyScalar(R).floor(), _ = b; if (ee.bindFramebuffer(36160, Me) && Q.drawBuffers) { let Ce = !1; if (Z) if (Z.isWebGLMultipleRenderTargets) { const ke = Z.texture; if (O.length !== ke.length || O[0] !== 36064) { for (let Ze = 0, Qe = ke.length; Ze < Qe; Ze++) O[Ze] = 36064 + Ze; O.length = ke.length, Ce = !0; } } else (O.length !== 1 || O[0] !== 36064) && (O[0] = 36064, O.length = 1, Ce = !0); else (O.length !== 1 || O[0] !== 1029) && (O[0] = 1029, O.length = 1, Ce = !0); Ce && (Q.isWebGL2 ? G.drawBuffers(O) : q.get("WEBGL_draw_buffers").drawBuffersWEBGL(O)); } if (ee.viewport(M), ee.scissor(x), ee.setScissorTest(_), Oe) { const Ce = Y.get(Z.texture); G.framebufferTexture2D(36160, 36064, 34069 + ye, Ce.__webglTexture, me); } else if (he) { const Ce = Y.get(Z.texture), ke = ye || 0; G.framebufferTextureLayer(36160, 36064, Ce.__webglTexture, me || 0, ke); } }, this.readRenderTargetPixels = function(Z, ye, me, Me, Oe, he, _e) { if (!(Z && Z.isWebGLRenderTarget)) { console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); return; } let Ce = Y.get(Z).__webglFramebuffer; if (Z.isWebGLCubeRenderTarget && _e !== void 0 && (Ce = Ce[_e]), Ce) { ee.bindFramebuffer(36160, Ce); try { const ke = Z.texture, Ze = ke.format, Qe = ke.type; if (Ze !== Yn && Se.convert(Ze) !== G.getParameter(35739)) { console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."); return; } const qe = Qe === Ts && (q.has("EXT_color_buffer_half_float") || Q.isWebGL2 && q.has("EXT_color_buffer_float")); if (Qe !== Ps && Se.convert(Qe) !== G.getParameter(35738) && // Edge and Chrome Mac < 52 (#9513) !(Qe === nr && (Q.isWebGL2 || q.has("OES_texture_float") || q.has("WEBGL_color_buffer_float"))) && // Chrome Mac >= 52 and Firefox !qe) { console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type."); return; } G.checkFramebufferStatus(36160) === 36053 ? ye >= 0 && ye <= Z.width - Me && me >= 0 && me <= Z.height - Oe && G.readPixels(ye, me, Me, Oe, Se.convert(Ze), Se.convert(Qe), he) : console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."); } finally { const ke = w !== null ? Y.get(w).__webglFramebuffer : null; ee.bindFramebuffer(36160, ke); } } }, this.copyFramebufferToTexture = function(Z, ye, me = 0) { const Me = Math.pow(2, -me), Oe = Math.floor(ye.image.width * Me), he = Math.floor(ye.image.height * Me); let _e = Se.convert(ye.format); Q.isWebGL2 && (_e === 6407 && (_e = 32849), _e === 6408 && (_e = 32856)), te.setTexture2D(ye, 0), G.copyTexImage2D(3553, me, _e, Z.x, Z.y, Oe, he, 0), ee.unbindTexture(); }, this.copyTextureToTexture = function(Z, ye, me, Me = 0) { const Oe = ye.image.width, he = ye.image.height, _e = Se.convert(me.format), Ce = Se.convert(me.type); te.setTexture2D(me, 0), G.pixelStorei(37440, me.flipY), G.pixelStorei(37441, me.premultiplyAlpha), G.pixelStorei(3317, me.unpackAlignment), ye.isDataTexture ? G.texSubImage2D(3553, Me, Z.x, Z.y, Oe, he, _e, Ce, ye.image.data) : ye.isCompressedTexture ? G.compressedTexSubImage2D(3553, Me, Z.x, Z.y, ye.mipmaps[0].width, ye.mipmaps[0].height, _e, ye.mipmaps[0].data) : G.texSubImage2D(3553, Me, Z.x, Z.y, _e, Ce, ye.image), Me === 0 && me.generateMipmaps && G.generateMipmap(3553), ee.unbindTexture(); }, this.copyTextureToTexture3D = function(Z, ye, me, Me, Oe = 0) { if (u.isWebGL1Renderer) { console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2."); return; } const he = Z.max.x - Z.min.x + 1, _e = Z.max.y - Z.min.y + 1, Ce = Z.max.z - Z.min.z + 1, ke = Se.convert(Me.format), Ze = Se.convert(Me.type); let Qe; if (Me.isDataTexture3D) te.setTexture3D(Me, 0), Qe = 32879; else if (Me.isDataTexture2DArray) te.setTexture2DArray(Me, 0), Qe = 35866; else { console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray."); return; } G.pixelStorei(37440, Me.flipY), G.pixelStorei(37441, Me.premultiplyAlpha), G.pixelStorei(3317, Me.unpackAlignment); const qe = G.getParameter(3314), ut = G.getParameter(32878), Zt = G.getParameter(3316), hn = G.getParameter(3315), os = G.getParameter(32877), Rt = me.isCompressedTexture ? me.mipmaps[0] : me.image; G.pixelStorei(3314, Rt.width), G.pixelStorei(32878, Rt.height), G.pixelStorei(3316, Z.min.x), G.pixelStorei(3315, Z.min.y), G.pixelStorei(32877, Z.min.z), me.isDataTexture || me.isDataTexture3D ? G.texSubImage3D(Qe, Oe, ye.x, ye.y, ye.z, he, _e, Ce, ke, Ze, Rt.data) : me.isCompressedTexture ? (console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."), G.compressedTexSubImage3D(Qe, Oe, ye.x, ye.y, ye.z, he, _e, Ce, ke, Rt.data)) : G.texSubImage3D(Qe, Oe, ye.x, ye.y, ye.z, he, _e, Ce, ke, Ze, Rt), G.pixelStorei(3314, qe), G.pixelStorei(32878, ut), G.pixelStorei(3316, Zt), G.pixelStorei(3315, hn), G.pixelStorei(32877, os), Oe === 0 && Me.generateMipmaps && G.generateMipmap(Qe), ee.unbindTexture(); }, this.initTexture = function(Z) { te.setTexture2D(Z, 0), ee.unbindTexture(); }, this.resetState = function() { v = 0, m = 0, w = null, ee.reset(), ge.reset(); }, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this })); } class Nx extends Et { } Nx.prototype.isWebGL1Renderer = !0; class Sl { constructor(e, t = 25e-5) { this.name = "", this.color = new Fe(e), this.density = t; } clone() { return new Sl(this.color, this.density); } toJSON() { return { type: "FogExp2", color: this.color.getHex(), density: this.density }; } } Sl.prototype.isFogExp2 = !0; class _l { constructor(e, t = 1, i = 1e3) { this.name = "", this.color = new Fe(e), this.near = t, this.far = i; } clone() { return new _l(this.color, this.near, this.far); } toJSON() { return { type: "Fog", color: this.color.getHex(), near: this.near, far: this.far }; } } _l.prototype.isFog = !0; class Nu extends ot { constructor() { super(), this.type = "Scene", this.background = null, this.environment = null, this.fog = null, this.overrideMaterial = null, this.autoUpdate = !0, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this })); } copy(e, t) { return super.copy(e, t), e.background !== null && (this.background = e.background.clone()), e.environment !== null && (this.environment = e.environment.clone()), e.fog !== null && (this.fog = e.fog.clone()), e.overrideMaterial !== null && (this.overrideMaterial = e.overrideMaterial.clone()), this.autoUpdate = e.autoUpdate, this.matrixAutoUpdate = e.matrixAutoUpdate, this; } toJSON(e) { const t = super.toJSON(e); return this.fog !== null && (t.object.fog = this.fog.toJSON()), t; } } Nu.prototype.isScene = !0; class rs { constructor(e, t) { this.array = e, this.stride = t, this.count = e !== void 0 ? e.length / t : 0, this.usage = zo, this.updateRange = { offset: 0, count: -1 }, this.version = 0, this.uuid = Jn(); } onUploadCallback() { } set needsUpdate(e) { e === !0 && this.version++; } setUsage(e) { return this.usage = e, this; } copy(e) { return this.array = new e.array.constructor(e.array), this.count = e.count, this.stride = e.stride, this.usage = e.usage, this; } copyAt(e, t, i) { e *= this.stride, i *= t.stride; for (let r = 0, s = this.stride; r < s; r++) this.array[e + r] = t.array[i + r]; return this; } set(e, t = 0) { return this.array.set(e, t), this; } clone(e) { e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = Jn()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer); const t = new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]), i = new this.constructor(t, this.stride); return i.setUsage(this.usage), i; } onUpload(e) { return this.onUploadCallback = e, this; } toJSON(e) { return e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = Jn()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = Array.prototype.slice.call(new Uint32Array(this.array.buffer))), { uuid: this.uuid, buffer: this.array.buffer._uuid, type: this.array.constructor.name, stride: this.stride }; } } rs.prototype.isInterleavedBuffer = !0; const Xt = /* @__PURE__ */ new X(); class fr { constructor(e, t, i, r = !1) { this.name = "", this.data = e, this.itemSize = t, this.offset = i, this.normalized = r === !0; } get count() { return this.data.count; } get array() { return this.data.array; } set needsUpdate(e) { this.data.needsUpdate = e; } applyMatrix4(e) { for (let t = 0, i = this.data.count; t < i; t++) Xt.x = this.getX(t), Xt.y = this.getY(t), Xt.z = this.getZ(t), Xt.applyMatrix4(e), this.setXYZ(t, Xt.x, Xt.y, Xt.z); return this; } applyNormalMatrix(e) { for (let t = 0, i = this.count; t < i; t++) Xt.x = this.getX(t), Xt.y = this.getY(t), Xt.z = this.getZ(t), Xt.applyNormalMatrix(e), this.setXYZ(t, Xt.x, Xt.y, Xt.z); return this; } transformDirection(e) { for (let t = 0, i = this.count; t < i; t++) Xt.x = this.getX(t), Xt.y = this.getY(t), Xt.z = this.getZ(t), Xt.transformDirection(e), this.setXYZ(t, Xt.x, Xt.y, Xt.z); return this; } setX(e, t) { return this.data.array[e * this.data.stride + this.offset] = t, this; } setY(e, t) { return this.data.array[e * this.data.stride + this.offset + 1] = t, this; } setZ(e, t) { return this.data.array[e * this.data.stride + this.offset + 2] = t, this; } setW(e, t) { return this.data.array[e * this.data.stride + this.offset + 3] = t, this; } getX(e) { return this.data.array[e * this.data.stride + this.offset]; } getY(e) { return this.data.array[e * this.data.stride + this.offset + 1]; } getZ(e) { return this.data.array[e * this.data.stride + this.offset + 2]; } getW(e) { return this.data.array[e * this.data.stride + this.offset + 3]; } setXY(e, t, i) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = i, this; } setXYZ(e, t, i, r) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = i, this.data.array[e + 2] = r, this; } setXYZW(e, t, i, r, s) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = i, this.data.array[e + 2] = r, this.data.array[e + 3] = s, this; } clone(e) { if (e === void 0) { console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data."); const t = []; for (let i = 0; i < this.count; i++) { const r = i * this.data.stride + this.offset; for (let s = 0; s < this.itemSize; s++) t.push(this.data.array[r + s]); } return new nt(new this.array.constructor(t), this.itemSize, this.normalized); } else return e.interleavedBuffers === void 0 && (e.interleavedBuffers = {}), e.interleavedBuffers[this.data.uuid] === void 0 && (e.interleavedBuffers[this.data.uuid] = this.data.clone(e)), new fr(e.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized); } toJSON(e) { if (e === void 0) { console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data."); const t = []; for (let i = 0; i < this.count; i++) { const r = i * this.data.stride + this.offset; for (let s = 0; s < this.itemSize; s++) t.push(this.data.array[r + s]); } return { itemSize: this.itemSize, type: this.array.constructor.name, array: t, normalized: this.normalized }; } else return e.interleavedBuffers === void 0 && (e.interleavedBuffers = {}), e.interleavedBuffers[this.data.uuid] === void 0 && (e.interleavedBuffers[this.data.uuid] = this.data.toJSON(e)), { isInterleavedBufferAttribute: !0, itemSize: this.itemSize, data: this.data.uuid, offset: this.offset, normalized: this.normalized }; } } fr.prototype.isInterleavedBufferAttribute = !0; class Tl extends sn { constructor(e) { super(), this.type = "SpriteMaterial", this.color = new Fe(16777215), this.map = null, this.alphaMap = null, this.rotation = 0, this.sizeAttenuation = !0, this.transparent = !0, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.rotation = e.rotation, this.sizeAttenuation = e.sizeAttenuation, this; } } Tl.prototype.isSpriteMaterial = !0; let uo; const _a = /* @__PURE__ */ new X(), ho = /* @__PURE__ */ new X(), fo = /* @__PURE__ */ new X(), po = /* @__PURE__ */ new Pe(), Ta = /* @__PURE__ */ new Pe(), Fx = /* @__PURE__ */ new $e(), ac = /* @__PURE__ */ new X(), Ea = /* @__PURE__ */ new X(), lc = /* @__PURE__ */ new X(), Vg = /* @__PURE__ */ new Pe(), Rh = /* @__PURE__ */ new Pe(), kg = /* @__PURE__ */ new Pe(); class El extends ot { constructor(e) { if (super(), this.type = "Sprite", uo === void 0) { uo = new Je(); const t = new Float32Array([ -0.5, -0.5, 0, 0, 0, 0.5, -0.5, 0, 1, 0, 0.5, 0.5, 0, 1, 1, -0.5, 0.5, 0, 0, 1 ]), i = new rs(t, 5); uo.setIndex([0, 1, 2, 0, 2, 3]), uo.setAttribute("position", new fr(i, 3, 0, !1)), uo.setAttribute("uv", new fr(i, 2, 3, !1)); } this.geometry = uo, this.material = e !== void 0 ? e : new Tl(), this.center = new Pe(0.5, 0.5); } raycast(e, t) { e.camera === null && console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'), ho.setFromMatrixScale(this.matrixWorld), Fx.copy(e.camera.matrixWorld), this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse, this.matrixWorld), fo.setFromMatrixPosition(this.modelViewMatrix), e.camera.isPerspectiveCamera && this.material.sizeAttenuation === !1 && ho.multiplyScalar(-fo.z); const i = this.material.rotation; let r, s; i !== 0 && (s = Math.cos(i), r = Math.sin(i)); const o = this.center; cc(ac.set(-0.5, -0.5, 0), fo, o, ho, r, s), cc(Ea.set(0.5, -0.5, 0), fo, o, ho, r, s), cc(lc.set(0.5, 0.5, 0), fo, o, ho, r, s), Vg.set(0, 0), Rh.set(1, 0), kg.set(1, 1); let a = e.ray.intersectTriangle(ac, Ea, lc, !1, _a); if (a === null && (cc(Ea.set(-0.5, 0.5, 0), fo, o, ho, r, s), Rh.set(0, 1), a = e.ray.intersectTriangle(ac, lc, Ea, !1, _a), a === null)) return; const c = e.ray.origin.distanceTo(_a); c < e.near || c > e.far || t.push({ distance: c, point: _a.clone(), uv: Qt.getUV(_a, ac, Ea, lc, Vg, Rh, kg, new Pe()), face: null, object: this }); } copy(e) { return super.copy(e), e.center !== void 0 && this.center.copy(e.center), this.material = e.material, this; } } El.prototype.isSprite = !0; function cc(n, e, t, i, r, s) { po.subVectors(n, t).addScalar(0.5).multiply(i), r !== void 0 ? (Ta.x = s * po.x - r * po.y, Ta.y = r * po.x + s * po.y) : Ta.copy(po), n.copy(e), n.x += Ta.x, n.y += Ta.y, n.applyMatrix4(Fx); } const uc = /* @__PURE__ */ new X(), Gg = /* @__PURE__ */ new X(); class Bx extends ot { constructor() { super(), this._currentLevel = 0, this.type = "LOD", Object.defineProperties(this, { levels: { enumerable: !0, value: [] }, isLOD: { value: !0 } }), this.autoUpdate = !0; } copy(e) { super.copy(e, !1); const t = e.levels; for (let i = 0, r = t.length; i < r; i++) { const s = t[i]; this.addLevel(s.object.clone(), s.distance); } return this.autoUpdate = e.autoUpdate, this; } addLevel(e, t = 0) { t = Math.abs(t); const i = this.levels; let r; for (r = 0; r < i.length && !(t < i[r].distance); r++) ; return i.splice(r, 0, { distance: t, object: e }), this.add(e), this; } getCurrentLevel() { return this._currentLevel; } getObjectForDistance(e) { const t = this.levels; if (t.length > 0) { let i, r; for (i = 1, r = t.length; i < r && !(e < t[i].distance); i++) ; return t[i - 1].object; } return null; } raycast(e, t) { if (this.levels.length > 0) { uc.setFromMatrixPosition(this.matrixWorld); const r = e.ray.origin.distanceTo(uc); this.getObjectForDistance(r).raycast(e, t); } } update(e) { const t = this.levels; if (t.length > 1) { uc.setFromMatrixPosition(e.matrixWorld), Gg.setFromMatrixPosition(this.matrixWorld); const i = uc.distanceTo(Gg) / e.zoom; t[0].object.visible = !0; let r, s; for (r = 1, s = t.length; r < s && i >= t[r].distance; r++) t[r - 1].object.visible = !1, t[r].object.visible = !0; for (this._currentLevel = r - 1; r < s; r++) t[r].object.visible = !1; } } toJSON(e) { const t = super.toJSON(e); this.autoUpdate === !1 && (t.object.autoUpdate = !1), t.object.levels = []; const i = this.levels; for (let r = 0, s = i.length; r < s; r++) { const o = i[r]; t.object.levels.push({ object: o.object.uuid, distance: o.distance }); } return t; } } const Hg = /* @__PURE__ */ new X(), Wg = /* @__PURE__ */ new _t(), jg = /* @__PURE__ */ new _t(), FN = /* @__PURE__ */ new X(), $g = /* @__PURE__ */ new $e(); class Al extends tn { constructor(e, t) { super(e, t), this.type = "SkinnedMesh", this.bindMode = "attached", this.bindMatrix = new $e(), this.bindMatrixInverse = new $e(); } copy(e) { return super.copy(e), this.bindMode = e.bindMode, this.bindMatrix.copy(e.bindMatrix), this.bindMatrixInverse.copy(e.bindMatrixInverse), this.skeleton = e.skeleton, this; } bind(e, t) { this.skeleton = e, t === void 0 && (this.updateMatrixWorld(!0), this.skeleton.calculateInverses(), t = this.matrixWorld), this.bindMatrix.copy(t), this.bindMatrixInverse.copy(t).invert(); } pose() { this.skeleton.pose(); } normalizeSkinWeights() { const e = new _t(), t = this.geometry.attributes.skinWeight; for (let i = 0, r = t.count; i < r; i++) { e.x = t.getX(i), e.y = t.getY(i), e.z = t.getZ(i), e.w = t.getW(i); const s = 1 / e.manhattanLength(); s !== 1 / 0 ? e.multiplyScalar(s) : e.set(1, 0, 0, 0), t.setXYZW(i, e.x, e.y, e.z, e.w); } } updateMatrixWorld(e) { super.updateMatrixWorld(e), this.bindMode === "attached" ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : this.bindMode === "detached" ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode); } boneTransform(e, t) { const i = this.skeleton, r = this.geometry; Wg.fromBufferAttribute(r.attributes.skinIndex, e), jg.fromBufferAttribute(r.attributes.skinWeight, e), Hg.fromBufferAttribute(r.attributes.position, e).applyMatrix4(this.bindMatrix), t.set(0, 0, 0); for (let s = 0; s < 4; s++) { const o = jg.getComponent(s); if (o !== 0) { const a = Wg.getComponent(s); $g.multiplyMatrices(i.bones[a].matrixWorld, i.boneInverses[a]), t.addScaledVector(FN.copy(Hg).applyMatrix4($g), o); } } return t.applyMatrix4(this.bindMatrixInverse); } } Al.prototype.isSkinnedMesh = !0; class Cl extends ot { constructor() { super(), this.type = "Bone"; } } Cl.prototype.isBone = !0; class Cs extends nn { constructor(e = null, t = 1, i = 1, r, s, o, a, c, l = Kt, d = Kt, h, p) { super(null, o, a, c, l, d, r, s, h, p), this.image = { data: e, width: t, height: i }, this.magFilter = l, this.minFilter = d, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0; } } Cs.prototype.isDataTexture = !0; const Zg = /* @__PURE__ */ new $e(), BN = /* @__PURE__ */ new $e(); class Ll { constructor(e = [], t = []) { this.uuid = Jn(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.boneTextureSize = 0, this.frame = -1, this.init(); } init() { const e = this.bones, t = this.boneInverses; if (this.boneMatrices = new Float32Array(e.length * 16), t.length === 0) this.calculateInverses(); else if (e.length !== t.length) { console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."), this.boneInverses = []; for (let i = 0, r = this.bones.length; i < r; i++) this.boneInverses.push(new $e()); } } calculateInverses() { this.boneInverses.length = 0; for (let e = 0, t = this.bones.length; e < t; e++) { const i = new $e(); this.bones[e] && i.copy(this.bones[e].matrixWorld).invert(), this.boneInverses.push(i); } } pose() { for (let e = 0, t = this.bones.length; e < t; e++) { const i = this.bones[e]; i && i.matrixWorld.copy(this.boneInverses[e]).invert(); } for (let e = 0, t = this.bones.length; e < t; e++) { const i = this.bones[e]; i && (i.parent && i.parent.isBone ? (i.matrix.copy(i.parent.matrixWorld).invert(), i.matrix.multiply(i.matrixWorld)) : i.matrix.copy(i.matrixWorld), i.matrix.decompose(i.position, i.quaternion, i.scale)); } } update() { const e = this.bones, t = this.boneInverses, i = this.boneMatrices, r = this.boneTexture; for (let s = 0, o = e.length; s < o; s++) { const a = e[s] ? e[s].matrixWorld : BN; Zg.multiplyMatrices(a, t[s]), Zg.toArray(i, s * 16); } r !== null && (r.needsUpdate = !0); } clone() { return new Ll(this.bones, this.boneInverses); } computeBoneTexture() { let e = Math.sqrt(this.bones.length * 4); e = dx(e), e = Math.max(e, 4); const t = new Float32Array(e * e * 4); t.set(this.boneMatrices); const i = new Cs(t, e, e, Yn, nr); return this.boneMatrices = t, this.boneTexture = i, this.boneTextureSize = e, this; } getBoneByName(e) { for (let t = 0, i = this.bones.length; t < i; t++) { const r = this.bones[t]; if (r.name === e) return r; } } dispose() { this.boneTexture !== null && (this.boneTexture.dispose(), this.boneTexture = null); } fromJSON(e, t) { this.uuid = e.uuid; for (let i = 0, r = e.bones.length; i < r; i++) { const s = e.bones[i]; let o = t[s]; o === void 0 && (console.warn("THREE.Skeleton: No bone found with UUID:", s), o = new Cl()), this.bones.push(o), this.boneInverses.push(new $e().fromArray(e.boneInverses[i])); } return this.init(), this; } toJSON() { const e = { metadata: { version: 4.5, type: "Skeleton", generator: "Skeleton.toJSON" }, bones: [], boneInverses: [] }; e.uuid = this.uuid; const t = this.bones, i = this.boneInverses; for (let r = 0, s = t.length; r < s; r++) { const o = t[r]; e.bones.push(o.uuid); const a = i[r]; e.boneInverses.push(a.toArray()); } return e; } } const Xg = /* @__PURE__ */ new $e(), Yg = /* @__PURE__ */ new $e(), hc = [], Aa = /* @__PURE__ */ new tn(); class tp extends tn { constructor(e, t, i) { super(e, t), this.instanceMatrix = new nt(new Float32Array(i * 16), 16), this.instanceColor = null, this.count = i, this.frustumCulled = !1; } copy(e) { return super.copy(e), this.instanceMatrix.copy(e.instanceMatrix), e.instanceColor !== null && (this.instanceColor = e.instanceColor.clone()), this.count = e.count, this; } getColorAt(e, t) { t.fromArray(this.instanceColor.array, e * 3); } getMatrixAt(e, t) { t.fromArray(this.instanceMatrix.array, e * 16); } raycast(e, t) { const i = this.matrixWorld, r = this.count; if (Aa.geometry = this.geometry, Aa.material = this.material, Aa.material !== void 0) for (let s = 0; s < r; s++) { this.getMatrixAt(s, Xg), Yg.multiplyMatrices(i, Xg), Aa.matrixWorld = Yg, Aa.raycast(e, hc); for (let o = 0, a = hc.length; o < a; o++) { const c = hc[o]; c.instanceId = s, c.object = this, t.push(c); } hc.length = 0; } } setColorAt(e, t) { this.instanceColor === null && (this.instanceColor = new nt(new Float32Array(this.count * 3), 3)), t.toArray(this.instanceColor.array, e * 3); } setMatrixAt(e, t) { t.toArray(this.instanceMatrix.array, e * 16); } updateMorphTargets() { } dispose() { this.dispatchEvent({ type: "dispose" }); } } tp.prototype.isInstancedMesh = !0; class un extends sn { constructor(e) { super(), this.type = "LineBasicMaterial", this.color = new Fe(16777215), this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.morphTargets = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.linewidth = e.linewidth, this.linecap = e.linecap, this.linejoin = e.linejoin, this.morphTargets = e.morphTargets, this; } } un.prototype.isLineBasicMaterial = !0; const Jg = /* @__PURE__ */ new X(), qg = /* @__PURE__ */ new X(), Kg = /* @__PURE__ */ new $e(), Ph = /* @__PURE__ */ new is(), dc = /* @__PURE__ */ new xr(); class Ui extends ot { constructor(e = new Je(), t = new un()) { super(), this.type = "Line", this.geometry = e, this.material = t, this.updateMorphTargets(); } copy(e) { return super.copy(e), this.material = e.material, this.geometry = e.geometry, this; } computeLineDistances() { const e = this.geometry; if (e.isBufferGeometry) if (e.index === null) { const t = e.attributes.position, i = [0]; for (let r = 1, s = t.count; r < s; r++) Jg.fromBufferAttribute(t, r - 1), qg.fromBufferAttribute(t, r), i[r] = i[r - 1], i[r] += Jg.distanceTo(qg); e.setAttribute("lineDistance", new We(i, 1)); } else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); else e.isGeometry && console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); return this; } raycast(e, t) { const i = this.geometry, r = this.matrixWorld, s = e.params.Line.threshold, o = i.drawRange; if (i.boundingSphere === null && i.computeBoundingSphere(), dc.copy(i.boundingSphere), dc.applyMatrix4(r), dc.radius += s, e.ray.intersectsSphere(dc) === !1) return; Kg.copy(r).invert(), Ph.copy(e.ray).applyMatrix4(Kg); const a = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = a * a, l = new X(), d = new X(), h = new X(), p = new X(), g = this.isLineSegments ? 2 : 1; if (i.isBufferGeometry) { const f = i.index, y = i.attributes.position; if (f !== null) { const v = Math.max(0, o.start), m = Math.min(f.count, o.start + o.count); for (let w = v, S = m - 1; w < S; w += g) { const T = f.getX(w), M = f.getX(w + 1); if (l.fromBufferAttribute(y, T), d.fromBufferAttribute(y, M), Ph.distanceSqToSegment(l, d, p, h) > c) continue; p.applyMatrix4(this.matrixWorld); const _ = e.ray.origin.distanceTo(p); _ < e.near || _ > e.far || t.push({ distance: _, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: h.clone().applyMatrix4(this.matrixWorld), index: w, face: null, faceIndex: null, object: this }); } } else { const v = Math.max(0, o.start), m = Math.min(y.count, o.start + o.count); for (let w = v, S = m - 1; w < S; w += g) { if (l.fromBufferAttribute(y, w), d.fromBufferAttribute(y, w + 1), Ph.distanceSqToSegment(l, d, p, h) > c) continue; p.applyMatrix4(this.matrixWorld); const M = e.ray.origin.distanceTo(p); M < e.near || M > e.far || t.push({ distance: M, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: h.clone().applyMatrix4(this.matrixWorld), index: w, face: null, faceIndex: null, object: this }); } } } else i.isGeometry && console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } updateMorphTargets() { const e = this.geometry; if (e.isBufferGeometry) { const t = e.morphAttributes, i = Object.keys(t); if (i.length > 0) { const r = t[i[0]]; if (r !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (let s = 0, o = r.length; s < o; s++) { const a = r[s].name || String(s); this.morphTargetInfluences.push(0), this.morphTargetDictionary[a] = s; } } } } else { const t = e.morphTargets; t !== void 0 && t.length > 0 && console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead."); } } } Ui.prototype.isLine = !0; const Qg = /* @__PURE__ */ new X(), ev = /* @__PURE__ */ new X(); class Fn extends Ui { constructor(e, t) { super(e, t), this.type = "LineSegments"; } computeLineDistances() { const e = this.geometry; if (e.isBufferGeometry) if (e.index === null) { const t = e.attributes.position, i = []; for (let r = 0, s = t.count; r < s; r += 2) Qg.fromBufferAttribute(t, r), ev.fromBufferAttribute(t, r + 1), i[r] = r === 0 ? 0 : i[r - 1], i[r + 1] = i[r] + Qg.distanceTo(ev); e.setAttribute("lineDistance", new We(i, 1)); } else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); else e.isGeometry && console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); return this; } } Fn.prototype.isLineSegments = !0; class Fu extends Ui { constructor(e, t) { super(e, t), this.type = "LineLoop"; } } Fu.prototype.isLineLoop = !0; class ss extends sn { constructor(e) { super(), this.type = "PointsMaterial", this.color = new Fe(16777215), this.map = null, this.alphaMap = null, this.size = 1, this.sizeAttenuation = !0, this.morphTargets = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.size = e.size, this.sizeAttenuation = e.sizeAttenuation, this.morphTargets = e.morphTargets, this; } } ss.prototype.isPointsMaterial = !0; const tv = /* @__PURE__ */ new $e(), zd = /* @__PURE__ */ new is(), fc = /* @__PURE__ */ new xr(), pc = /* @__PURE__ */ new X(); class ha extends ot { constructor(e = new Je(), t = new ss()) { super(), this.type = "Points", this.geometry = e, this.material = t, this.updateMorphTargets(); } copy(e) { return super.copy(e), this.material = e.material, this.geometry = e.geometry, this; } raycast(e, t) { const i = this.geometry, r = this.matrixWorld, s = e.params.Points.threshold, o = i.drawRange; if (i.boundingSphere === null && i.computeBoundingSphere(), fc.copy(i.boundingSphere), fc.applyMatrix4(r), fc.radius += s, e.ray.intersectsSphere(fc) === !1) return; tv.copy(r).invert(), zd.copy(e.ray).applyMatrix4(tv); const a = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = a * a; if (i.isBufferGeometry) { const l = i.index, h = i.attributes.position; if (l !== null) { const p = Math.max(0, o.start), g = Math.min(l.count, o.start + o.count); for (let f = p, u = g; f < u; f++) { const y = l.getX(f); pc.fromBufferAttribute(h, y), nv(pc, y, c, r, e, t, this); } } else { const p = Math.max(0, o.start), g = Math.min(h.count, o.start + o.count); for (let f = p, u = g; f < u; f++) pc.fromBufferAttribute(h, f), nv(pc, f, c, r, e, t, this); } } else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } updateMorphTargets() { const e = this.geometry; if (e.isBufferGeometry) { const t = e.morphAttributes, i = Object.keys(t); if (i.length > 0) { const r = t[i[0]]; if (r !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (let s = 0, o = r.length; s < o; s++) { const a = r[s].name || String(s); this.morphTargetInfluences.push(0), this.morphTargetDictionary[a] = s; } } } } else { const t = e.morphTargets; t !== void 0 && t.length > 0 && console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead."); } } } ha.prototype.isPoints = !0; function nv(n, e, t, i, r, s, o) { const a = zd.distanceSqToPoint(n); if (a < t) { const c = new X(); zd.closestPointToPoint(n, c), c.applyMatrix4(i); const l = r.ray.origin.distanceTo(c); if (l < r.near || l > r.far) return; s.push({ distance: l, distanceToRay: Math.sqrt(a), point: c, index: e, face: null, object: o }); } } class zx extends nn { constructor(e, t, i, r, s, o, a, c, l) { super(e, t, i, r, s, o, a, c, l), this.format = a !== void 0 ? a : ar, this.minFilter = o !== void 0 ? o : jt, this.magFilter = s !== void 0 ? s : jt, this.generateMipmaps = !1; const d = this; function h() { d.needsUpdate = !0, e.requestVideoFrameCallback(h); } "requestVideoFrameCallback" in e && e.requestVideoFrameCallback(h); } clone() { return new this.constructor(this.image).copy(this); } update() { const e = this.image; "requestVideoFrameCallback" in e === !1 && e.readyState >= e.HAVE_CURRENT_DATA && (this.needsUpdate = !0); } } zx.prototype.isVideoTexture = !0; class np extends nn { constructor(e, t, i, r, s, o, a, c, l, d, h, p) { super(null, o, a, c, l, d, r, s, h, p), this.image = { width: t, height: i }, this.mipmaps = e, this.flipY = !1, this.generateMipmaps = !1; } } np.prototype.isCompressedTexture = !0; class Ux extends nn { constructor(e, t, i, r, s, o, a, c, l) { super(e, t, i, r, s, o, a, c, l), this.needsUpdate = !0; } } Ux.prototype.isCanvasTexture = !0; class Vx extends nn { constructor(e, t, i, r, s, o, a, c, l, d) { if (d = d !== void 0 ? d : Es, d !== Es && d !== Fo) throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat"); i === void 0 && d === Es && (i = el), i === void 0 && d === Fo && (i = To), super(null, r, s, o, a, c, d, i, l), this.image = { width: e, height: t }, this.magFilter = a !== void 0 ? a : Kt, this.minFilter = c !== void 0 ? c : Kt, this.flipY = !1, this.generateMipmaps = !1; } } Vx.prototype.isDepthTexture = !0; class ko extends Je { constructor(e = 1, t = 8, i = 0, r = Math.PI * 2) { super(), this.type = "CircleGeometry", this.parameters = { radius: e, segments: t, thetaStart: i, thetaLength: r }, t = Math.max(3, t); const s = [], o = [], a = [], c = [], l = new X(), d = new Pe(); o.push(0, 0, 0), a.push(0, 0, 1), c.push(0.5, 0.5); for (let h = 0, p = 3; h <= t; h++, p += 3) { const g = i + h / t * r; l.x = e * Math.cos(g), l.y = e * Math.sin(g), o.push(l.x, l.y, l.z), a.push(0, 0, 1), d.x = (o[p] / e + 1) / 2, d.y = (o[p + 1] / e + 1) / 2, c.push(d.x, d.y); } for (let h = 1; h <= t; h++) s.push(h, h + 1, 0); this.setIndex(s), this.setAttribute("position", new We(o, 3)), this.setAttribute("normal", new We(a, 3)), this.setAttribute("uv", new We(c, 2)); } static fromJSON(e) { return new ko(e.radius, e.segments, e.thetaStart, e.thetaLength); } } class qr extends Je { constructor(e = 1, t = 1, i = 1, r = 8, s = 1, o = !1, a = 0, c = Math.PI * 2) { super(), this.type = "CylinderGeometry", this.parameters = { radiusTop: e, radiusBottom: t, height: i, radialSegments: r, heightSegments: s, openEnded: o, thetaStart: a, thetaLength: c }; const l = this; r = Math.floor(r), s = Math.floor(s); const d = [], h = [], p = [], g = []; let f = 0; const u = [], y = i / 2; let v = 0; m(), o === !1 && (e > 0 && w(!0), t > 0 && w(!1)), this.setIndex(d), this.setAttribute("position", new We(h, 3)), this.setAttribute("normal", new We(p, 3)), this.setAttribute("uv", new We(g, 2)); function m() { const S = new X(), T = new X(); let M = 0; const x = (t - e) / i; for (let _ = 0; _ <= s; _++) { const E = [], L = _ / s, R = L * (t - e) + e; for (let C = 0; C <= r; C++) { const A = C / r, P = A * c + a, I = Math.sin(P), b = Math.cos(P); T.x = R * I, T.y = -L * i + y, T.z = R * b, h.push(T.x, T.y, T.z), S.set(I, x, b).normalize(), p.push(S.x, S.y, S.z), g.push(A, 1 - L), E.push(f++); } u.push(E); } for (let _ = 0; _ < r; _++) for (let E = 0; E < s; E++) { const L = u[E][_], R = u[E + 1][_], C = u[E + 1][_ + 1], A = u[E][_ + 1]; d.push(L, R, A), d.push(R, C, A), M += 6; } l.addGroup(v, M, 0), v += M; } function w(S) { const T = f, M = new Pe(), x = new X(); let _ = 0; const E = S === !0 ? e : t, L = S === !0 ? 1 : -1; for (let C = 1; C <= r; C++) h.push(0, y * L, 0), p.push(0, L, 0), g.push(0.5, 0.5), f++; const R = f; for (let C = 0; C <= r; C++) { const P = C / r * c + a, I = Math.cos(P), b = Math.sin(P); x.x = E * b, x.y = y * L, x.z = E * I, h.push(x.x, x.y, x.z), p.push(0, L, 0), M.x = I * 0.5 + 0.5, M.y = b * 0.5 * L + 0.5, g.push(M.x, M.y), f++; } for (let C = 0; C < r; C++) { const A = T + C, P = R + C; S === !0 ? d.push(P, P + 1, A) : d.push(P + 1, P, A), _ += 3; } l.addGroup(v, _, S === !0 ? 1 : 2), v += _; } } static fromJSON(e) { return new qr(e.radiusTop, e.radiusBottom, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength); } } class Go extends qr { constructor(e = 1, t = 1, i = 8, r = 1, s = !1, o = 0, a = Math.PI * 2) { super(0, e, t, i, r, s, o, a), this.type = "ConeGeometry", this.parameters = { radius: e, height: t, radialSegments: i, heightSegments: r, openEnded: s, thetaStart: o, thetaLength: a }; } static fromJSON(e) { return new Go(e.radius, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength); } } class Vi extends Je { constructor(e, t, i = 1, r = 0) { super(), this.type = "PolyhedronGeometry", this.parameters = { vertices: e, indices: t, radius: i, detail: r }; const s = [], o = []; a(r), l(i), d(), this.setAttribute("position", new We(s, 3)), this.setAttribute("normal", new We(s.slice(), 3)), this.setAttribute("uv", new We(o, 2)), r === 0 ? this.computeVertexNormals() : this.normalizeNormals(); function a(m) { const w = new X(), S = new X(), T = new X(); for (let M = 0; M < t.length; M += 3) g(t[M + 0], w), g(t[M + 1], S), g(t[M + 2], T), c(w, S, T, m); } function c(m, w, S, T) { const M = T + 1, x = []; for (let _ = 0; _ <= M; _++) { x[_] = []; const E = m.clone().lerp(S, _ / M), L = w.clone().lerp(S, _ / M), R = M - _; for (let C = 0; C <= R; C++) C === 0 && _ === M ? x[_][C] = E : x[_][C] = E.clone().lerp(L, C / R); } for (let _ = 0; _ < M; _++) for (let E = 0; E < 2 * (M - _) - 1; E++) { const L = Math.floor(E / 2); E % 2 === 0 ? (p(x[_][L + 1]), p(x[_ + 1][L]), p(x[_][L])) : (p(x[_][L + 1]), p(x[_ + 1][L + 1]), p(x[_ + 1][L])); } } function l(m) { const w = new X(); for (let S = 0; S < s.length; S += 3) w.x = s[S + 0], w.y = s[S + 1], w.z = s[S + 2], w.normalize().multiplyScalar(m), s[S + 0] = w.x, s[S + 1] = w.y, s[S + 2] = w.z; } function d() { const m = new X(); for (let w = 0; w < s.length; w += 3) { m.x = s[w + 0], m.y = s[w + 1], m.z = s[w + 2]; const S = y(m) / 2 / Math.PI + 0.5, T = v(m) / Math.PI + 0.5; o.push(S, 1 - T); } f(), h(); } function h() { for (let m = 0; m < o.length; m += 6) { const w = o[m + 0], S = o[m + 2], T = o[m + 4], M = Math.max(w, S, T), x = Math.min(w, S, T); M > 0.9 && x < 0.1 && (w < 0.2 && (o[m + 0] += 1), S < 0.2 && (o[m + 2] += 1), T < 0.2 && (o[m + 4] += 1)); } } function p(m) { s.push(m.x, m.y, m.z); } function g(m, w) { const S = m * 3; w.x = e[S + 0], w.y = e[S + 1], w.z = e[S + 2]; } function f() { const m = new X(), w = new X(), S = new X(), T = new X(), M = new Pe(), x = new Pe(), _ = new Pe(); for (let E = 0, L = 0; E < s.length; E += 9, L += 6) { m.set(s[E + 0], s[E + 1], s[E + 2]), w.set(s[E + 3], s[E + 4], s[E + 5]), S.set(s[E + 6], s[E + 7], s[E + 8]), M.set(o[L + 0], o[L + 1]), x.set(o[L + 2], o[L + 3]), _.set(o[L + 4], o[L + 5]), T.copy(m).add(w).add(S).divideScalar(3); const R = y(T); u(M, L + 0, m, R), u(x, L + 2, w, R), u(_, L + 4, S, R); } } function u(m, w, S, T) { T < 0 && m.x === 1 && (o[w] = m.x - 1), S.x === 0 && S.z === 0 && (o[w] = T / 2 / Math.PI + 0.5); } function y(m) { return Math.atan2(m.z, -m.x); } function v(m) { return Math.atan2(-m.y, Math.sqrt(m.x * m.x + m.z * m.z)); } } static fromJSON(e) { return new Vi(e.vertices, e.indices, e.radius, e.details); } } class Ho extends Vi { constructor(e = 1, t = 0) { const i = (1 + Math.sqrt(5)) / 2, r = 1 / i, s = [ // (±1, ±1, ±1) -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, // (0, ±1/φ, ±φ) 0, -r, -i, 0, -r, i, 0, r, -i, 0, r, i, // (±1/φ, ±φ, 0) -r, -i, 0, -r, i, 0, r, -i, 0, r, i, 0, // (±φ, 0, ±1/φ) -i, 0, -r, i, 0, -r, -i, 0, r, i, 0, r ], o = [ 3, 11, 7, 3, 7, 15, 3, 15, 13, 7, 19, 17, 7, 17, 6, 7, 6, 15, 17, 4, 8, 17, 8, 10, 17, 10, 6, 8, 0, 16, 8, 16, 2, 8, 2, 10, 0, 12, 1, 0, 1, 18, 0, 18, 16, 6, 10, 2, 6, 2, 13, 6, 13, 15, 2, 16, 18, 2, 18, 3, 2, 3, 13, 18, 1, 9, 18, 9, 11, 18, 11, 3, 4, 14, 12, 4, 12, 0, 4, 0, 8, 11, 9, 5, 11, 5, 19, 11, 19, 7, 19, 5, 14, 19, 14, 4, 19, 4, 17, 1, 12, 14, 1, 14, 5, 1, 5, 9 ]; super(s, o, e, t), this.type = "DodecahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new Ho(e.radius, e.detail); } } const mc = new X(), gc = new X(), Ih = new X(), vc = new Qt(); class ip extends Je { constructor(e, t) { if (super(), this.type = "EdgesGeometry", this.parameters = { thresholdAngle: t }, t = t !== void 0 ? t : 1, e.isGeometry === !0) { console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); return; } const r = Math.pow(10, 4), s = Math.cos(As * t), o = e.getIndex(), a = e.getAttribute("position"), c = o ? o.count : a.count, l = [0, 0, 0], d = ["a", "b", "c"], h = new Array(3), p = {}, g = []; for (let f = 0; f < c; f += 3) { o ? (l[0] = o.getX(f), l[1] = o.getX(f + 1), l[2] = o.getX(f + 2)) : (l[0] = f, l[1] = f + 1, l[2] = f + 2); const { a: u, b: y, c: v } = vc; if (u.fromBufferAttribute(a, l[0]), y.fromBufferAttribute(a, l[1]), v.fromBufferAttribute(a, l[2]), vc.getNormal(Ih), h[0] = `${Math.round(u.x * r)},${Math.round(u.y * r)},${Math.round(u.z * r)}`, h[1] = `${Math.round(y.x * r)},${Math.round(y.y * r)},${Math.round(y.z * r)}`, h[2] = `${Math.round(v.x * r)},${Math.round(v.y * r)},${Math.round(v.z * r)}`, !(h[0] === h[1] || h[1] === h[2] || h[2] === h[0])) for (let m = 0; m < 3; m++) { const w = (m + 1) % 3, S = h[m], T = h[w], M = vc[d[m]], x = vc[d[w]], _ = `${S}_${T}`, E = `${T}_${S}`; E in p && p[E] ? (Ih.dot(p[E].normal) <= s && (g.push(M.x, M.y, M.z), g.push(x.x, x.y, x.z)), p[E] = null) : _ in p || (p[_] = { index0: l[m], index1: l[w], normal: Ih.clone() }); } } for (const f in p) if (p[f]) { const { index0: u, index1: y } = p[f]; mc.fromBufferAttribute(a, u), gc.fromBufferAttribute(a, y), g.push(mc.x, mc.y, mc.z), g.push(gc.x, gc.y, gc.z); } this.setAttribute("position", new We(g, 3)); } } class Kn { constructor() { this.type = "Curve", this.arcLengthDivisions = 200; } // Virtual base class method to overwrite and implement in subclasses // - t [0 .. 1] getPoint() { return console.warn("THREE.Curve: .getPoint() not implemented."), null; } // Get point at relative position in curve according to arc length // - u [0 .. 1] getPointAt(e, t) { const i = this.getUtoTmapping(e); return this.getPoint(i, t); } // Get sequence of points using getPoint( t ) getPoints(e = 5) { const t = []; for (let i = 0; i <= e; i++) t.push(this.getPoint(i / e)); return t; } // Get sequence of points using getPointAt( u ) getSpacedPoints(e = 5) { const t = []; for (let i = 0; i <= e; i++) t.push(this.getPointAt(i / e)); return t; } // Get total curve arc length getLength() { const e = this.getLengths(); return e[e.length - 1]; } // Get list of cumulative segment lengths getLengths(e = this.arcLengthDivisions) { if (this.cacheArcLengths && this.cacheArcLengths.length === e + 1 && !this.needsUpdate) return this.cacheArcLengths; this.needsUpdate = !1; const t = []; let i, r = this.getPoint(0), s = 0; t.push(0); for (let o = 1; o <= e; o++) i = this.getPoint(o / e), s += i.distanceTo(r), t.push(s), r = i; return this.cacheArcLengths = t, t; } updateArcLengths() { this.needsUpdate = !0, this.getLengths(); } // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant getUtoTmapping(e, t) { const i = this.getLengths(); let r = 0; const s = i.length; let o; t ? o = t : o = e * i[s - 1]; let a = 0, c = s - 1, l; for (; a <= c; ) if (r = Math.floor(a + (c - a) / 2), l = i[r] - o, l < 0) a = r + 1; else if (l > 0) c = r - 1; else { c = r; break; } if (r = c, i[r] === o) return r / (s - 1); const d = i[r], p = i[r + 1] - d, g = (o - d) / p; return (r + g) / (s - 1); } // Returns a unit vector tangent at t // In case any sub curve does not implement its tangent derivation, // 2 points a small delta apart will be used to find its gradient // which seems to give a reasonable approximation getTangent(e, t) { let r = e - 1e-4, s = e + 1e-4; r < 0 && (r = 0), s > 1 && (s = 1); const o = this.getPoint(r), a = this.getPoint(s), c = t || (o.isVector2 ? new Pe() : new X()); return c.copy(a).sub(o).normalize(), c; } getTangentAt(e, t) { const i = this.getUtoTmapping(e); return this.getTangent(i, t); } computeFrenetFrames(e, t) { const i = new X(), r = [], s = [], o = [], a = new X(), c = new $e(); for (let g = 0; g <= e; g++) { const f = g / e; r[g] = this.getTangentAt(f, new X()), r[g].normalize(); } s[0] = new X(), o[0] = new X(); let l = Number.MAX_VALUE; const d = Math.abs(r[0].x), h = Math.abs(r[0].y), p = Math.abs(r[0].z); d <= l && (l = d, i.set(1, 0, 0)), h <= l && (l = h, i.set(0, 1, 0)), p <= l && i.set(0, 0, 1), a.crossVectors(r[0], i).normalize(), s[0].crossVectors(r[0], a), o[0].crossVectors(r[0], s[0]); for (let g = 1; g <= e; g++) { if (s[g] = s[g - 1].clone(), o[g] = o[g - 1].clone(), a.crossVectors(r[g - 1], r[g]), a.length() > Number.EPSILON) { a.normalize(); const f = Math.acos(wn(r[g - 1].dot(r[g]), -1, 1)); s[g].applyMatrix4(c.makeRotationAxis(a, f)); } o[g].crossVectors(r[g], s[g]); } if (t === !0) { let g = Math.acos(wn(s[0].dot(s[e]), -1, 1)); g /= e, r[0].dot(a.crossVectors(s[0], s[e])) > 0 && (g = -g); for (let f = 1; f <= e; f++) s[f].applyMatrix4(c.makeRotationAxis(r[f], g * f)), o[f].crossVectors(r[f], s[f]); } return { tangents: r, normals: s, binormals: o }; } clone() { return new this.constructor().copy(this); } copy(e) { return this.arcLengthDivisions = e.arcLengthDivisions, this; } toJSON() { const e = { metadata: { version: 4.5, type: "Curve", generator: "Curve.toJSON" } }; return e.arcLengthDivisions = this.arcLengthDivisions, e.type = this.type, e; } fromJSON(e) { return this.arcLengthDivisions = e.arcLengthDivisions, this; } } class Rl extends Kn { constructor(e = 0, t = 0, i = 1, r = 1, s = 0, o = Math.PI * 2, a = !1, c = 0) { super(), this.type = "EllipseCurve", this.aX = e, this.aY = t, this.xRadius = i, this.yRadius = r, this.aStartAngle = s, this.aEndAngle = o, this.aClockwise = a, this.aRotation = c; } getPoint(e, t) { const i = t || new Pe(), r = Math.PI * 2; let s = this.aEndAngle - this.aStartAngle; const o = Math.abs(s) < Number.EPSILON; for (; s < 0; ) s += r; for (; s > r; ) s -= r; s < Number.EPSILON && (o ? s = 0 : s = r), this.aClockwise === !0 && !o && (s === r ? s = -r : s = s - r); const a = this.aStartAngle + e * s; let c = this.aX + this.xRadius * Math.cos(a), l = this.aY + this.yRadius * Math.sin(a); if (this.aRotation !== 0) { const d = Math.cos(this.aRotation), h = Math.sin(this.aRotation), p = c - this.aX, g = l - this.aY; c = p * d - g * h + this.aX, l = p * h + g * d + this.aY; } return i.set(c, l); } copy(e) { return super.copy(e), this.aX = e.aX, this.aY = e.aY, this.xRadius = e.xRadius, this.yRadius = e.yRadius, this.aStartAngle = e.aStartAngle, this.aEndAngle = e.aEndAngle, this.aClockwise = e.aClockwise, this.aRotation = e.aRotation, this; } toJSON() { const e = super.toJSON(); return e.aX = this.aX, e.aY = this.aY, e.xRadius = this.xRadius, e.yRadius = this.yRadius, e.aStartAngle = this.aStartAngle, e.aEndAngle = this.aEndAngle, e.aClockwise = this.aClockwise, e.aRotation = this.aRotation, e; } fromJSON(e) { return super.fromJSON(e), this.aX = e.aX, this.aY = e.aY, this.xRadius = e.xRadius, this.yRadius = e.yRadius, this.aStartAngle = e.aStartAngle, this.aEndAngle = e.aEndAngle, this.aClockwise = e.aClockwise, this.aRotation = e.aRotation, this; } } Rl.prototype.isEllipseCurve = !0; class rp extends Rl { constructor(e, t, i, r, s, o) { super(e, t, i, i, r, s, o), this.type = "ArcCurve"; } } rp.prototype.isArcCurve = !0; function sp() { let n = 0, e = 0, t = 0, i = 0; function r(s, o, a, c) { n = s, e = a, t = -3 * s + 3 * o - 2 * a - c, i = 2 * s - 2 * o + a + c; } return { initCatmullRom: function(s, o, a, c, l) { r(o, a, l * (a - s), l * (c - o)); }, initNonuniformCatmullRom: function(s, o, a, c, l, d, h) { let p = (o - s) / l - (a - s) / (l + d) + (a - o) / d, g = (a - o) / d - (c - o) / (d + h) + (c - a) / h; p *= d, g *= d, r(o, a, p, g); }, calc: function(s) { const o = s * s, a = o * s; return n + e * s + t * o + i * a; } }; } const yc = new X(), Oh = new sp(), Dh = new sp(), Nh = new sp(); class op extends Kn { constructor(e = [], t = !1, i = "centripetal", r = 0.5) { super(), this.type = "CatmullRomCurve3", this.points = e, this.closed = t, this.curveType = i, this.tension = r; } getPoint(e, t = new X()) { const i = t, r = this.points, s = r.length, o = (s - (this.closed ? 0 : 1)) * e; let a = Math.floor(o), c = o - a; this.closed ? a += a > 0 ? 0 : (Math.floor(Math.abs(a) / s) + 1) * s : c === 0 && a === s - 1 && (a = s - 2, c = 1); let l, d; this.closed || a > 0 ? l = r[(a - 1) % s] : (yc.subVectors(r[0], r[1]).add(r[0]), l = yc); const h = r[a % s], p = r[(a + 1) % s]; if (this.closed || a + 2 < s ? d = r[(a + 2) % s] : (yc.subVectors(r[s - 1], r[s - 2]).add(r[s - 1]), d = yc), this.curveType === "centripetal" || this.curveType === "chordal") { const g = this.curveType === "chordal" ? 0.5 : 0.25; let f = Math.pow(l.distanceToSquared(h), g), u = Math.pow(h.distanceToSquared(p), g), y = Math.pow(p.distanceToSquared(d), g); u < 1e-4 && (u = 1), f < 1e-4 && (f = u), y < 1e-4 && (y = u), Oh.initNonuniformCatmullRom(l.x, h.x, p.x, d.x, f, u, y), Dh.initNonuniformCatmullRom(l.y, h.y, p.y, d.y, f, u, y), Nh.initNonuniformCatmullRom(l.z, h.z, p.z, d.z, f, u, y); } else this.curveType === "catmullrom" && (Oh.initCatmullRom(l.x, h.x, p.x, d.x, this.tension), Dh.initCatmullRom(l.y, h.y, p.y, d.y, this.tension), Nh.initCatmullRom(l.z, h.z, p.z, d.z, this.tension)); return i.set( Oh.calc(c), Dh.calc(c), Nh.calc(c) ), i; } copy(e) { super.copy(e), this.points = []; for (let t = 0, i = e.points.length; t < i; t++) { const r = e.points[t]; this.points.push(r.clone()); } return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this; } toJSON() { const e = super.toJSON(); e.points = []; for (let t = 0, i = this.points.length; t < i; t++) { const r = this.points[t]; e.points.push(r.toArray()); } return e.closed = this.closed, e.curveType = this.curveType, e.tension = this.tension, e; } fromJSON(e) { super.fromJSON(e), this.points = []; for (let t = 0, i = e.points.length; t < i; t++) { const r = e.points[t]; this.points.push(new X().fromArray(r)); } return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this; } } op.prototype.isCatmullRomCurve3 = !0; function iv(n, e, t, i, r) { const s = (i - e) * 0.5, o = (r - t) * 0.5, a = n * n, c = n * a; return (2 * t - 2 * i + s + o) * c + (-3 * t + 3 * i - 2 * s - o) * a + s * n + t; } function zN(n, e) { const t = 1 - n; return t * t * e; } function UN(n, e) { return 2 * (1 - n) * n * e; } function VN(n, e) { return n * n * e; } function Ga(n, e, t, i) { return zN(n, e) + UN(n, t) + VN(n, i); } function kN(n, e) { const t = 1 - n; return t * t * t * e; } function GN(n, e) { const t = 1 - n; return 3 * t * t * n * e; } function HN(n, e) { return 3 * (1 - n) * n * n * e; } function WN(n, e) { return n * n * n * e; } function Ha(n, e, t, i, r) { return kN(n, e) + GN(n, t) + HN(n, i) + WN(n, r); } class Bu extends Kn { constructor(e = new Pe(), t = new Pe(), i = new Pe(), r = new Pe()) { super(), this.type = "CubicBezierCurve", this.v0 = e, this.v1 = t, this.v2 = i, this.v3 = r; } getPoint(e, t = new Pe()) { const i = t, r = this.v0, s = this.v1, o = this.v2, a = this.v3; return i.set( Ha(e, r.x, s.x, o.x, a.x), Ha(e, r.y, s.y, o.y, a.y) ), i; } copy(e) { return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this.v3.copy(e.v3), this; } toJSON() { const e = super.toJSON(); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e.v3 = this.v3.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this.v3.fromArray(e.v3), this; } } Bu.prototype.isCubicBezierCurve = !0; class ap extends Kn { constructor(e = new X(), t = new X(), i = new X(), r = new X()) { super(), this.type = "CubicBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = i, this.v3 = r; } getPoint(e, t = new X()) { const i = t, r = this.v0, s = this.v1, o = this.v2, a = this.v3; return i.set( Ha(e, r.x, s.x, o.x, a.x), Ha(e, r.y, s.y, o.y, a.y), Ha(e, r.z, s.z, o.z, a.z) ), i; } copy(e) { return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this.v3.copy(e.v3), this; } toJSON() { const e = super.toJSON(); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e.v3 = this.v3.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this.v3.fromArray(e.v3), this; } } ap.prototype.isCubicBezierCurve3 = !0; class Pl extends Kn { constructor(e = new Pe(), t = new Pe()) { super(), this.type = "LineCurve", this.v1 = e, this.v2 = t; } getPoint(e, t = new Pe()) { const i = t; return e === 1 ? i.copy(this.v2) : (i.copy(this.v2).sub(this.v1), i.multiplyScalar(e).add(this.v1)), i; } // Line curve is linear, so we can overwrite default getPointAt getPointAt(e, t) { return this.getPoint(e, t); } getTangent(e, t) { const i = t || new Pe(); return i.copy(this.v2).sub(this.v1).normalize(), i; } copy(e) { return super.copy(e), this.v1.copy(e.v1), this.v2.copy(e.v2), this; } toJSON() { const e = super.toJSON(); return e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; } } Pl.prototype.isLineCurve = !0; class kx extends Kn { constructor(e = new X(), t = new X()) { super(), this.type = "LineCurve3", this.isLineCurve3 = !0, this.v1 = e, this.v2 = t; } getPoint(e, t = new X()) { const i = t; return e === 1 ? i.copy(this.v2) : (i.copy(this.v2).sub(this.v1), i.multiplyScalar(e).add(this.v1)), i; } // Line curve is linear, so we can overwrite default getPointAt getPointAt(e, t) { return this.getPoint(e, t); } copy(e) { return super.copy(e), this.v1.copy(e.v1), this.v2.copy(e.v2), this; } toJSON() { const e = super.toJSON(); return e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; } } class zu extends Kn { constructor(e = new Pe(), t = new Pe(), i = new Pe()) { super(), this.type = "QuadraticBezierCurve", this.v0 = e, this.v1 = t, this.v2 = i; } getPoint(e, t = new Pe()) { const i = t, r = this.v0, s = this.v1, o = this.v2; return i.set( Ga(e, r.x, s.x, o.x), Ga(e, r.y, s.y, o.y) ), i; } copy(e) { return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this; } toJSON() { const e = super.toJSON(); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; } } zu.prototype.isQuadraticBezierCurve = !0; class lp extends Kn { constructor(e = new X(), t = new X(), i = new X()) { super(), this.type = "QuadraticBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = i; } getPoint(e, t = new X()) { const i = t, r = this.v0, s = this.v1, o = this.v2; return i.set( Ga(e, r.x, s.x, o.x), Ga(e, r.y, s.y, o.y), Ga(e, r.z, s.z, o.z) ), i; } copy(e) { return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this; } toJSON() { const e = super.toJSON(); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; } } lp.prototype.isQuadraticBezierCurve3 = !0; class Uu extends Kn { constructor(e = []) { super(), this.type = "SplineCurve", this.points = e; } getPoint(e, t = new Pe()) { const i = t, r = this.points, s = (r.length - 1) * e, o = Math.floor(s), a = s - o, c = r[o === 0 ? o : o - 1], l = r[o], d = r[o > r.length - 2 ? r.length - 1 : o + 1], h = r[o > r.length - 3 ? r.length - 1 : o + 2]; return i.set( iv(a, c.x, l.x, d.x, h.x), iv(a, c.y, l.y, d.y, h.y) ), i; } copy(e) { super.copy(e), this.points = []; for (let t = 0, i = e.points.length; t < i; t++) { const r = e.points[t]; this.points.push(r.clone()); } return this; } toJSON() { const e = super.toJSON(); e.points = []; for (let t = 0, i = this.points.length; t < i; t++) { const r = this.points[t]; e.points.push(r.toArray()); } return e; } fromJSON(e) { super.fromJSON(e), this.points = []; for (let t = 0, i = e.points.length; t < i; t++) { const r = e.points[t]; this.points.push(new Pe().fromArray(r)); } return this; } } Uu.prototype.isSplineCurve = !0; var cp = /* @__PURE__ */ Object.freeze({ __proto__: null, ArcCurve: rp, CatmullRomCurve3: op, CubicBezierCurve: Bu, CubicBezierCurve3: ap, EllipseCurve: Rl, LineCurve: Pl, LineCurve3: kx, QuadraticBezierCurve: zu, QuadraticBezierCurve3: lp, SplineCurve: Uu }); const jN = { triangulate: function(n, e, t = 2) { const i = e && e.length, r = i ? e[0] * t : n.length; let s = Gx(n, 0, r, t, !0); const o = []; if (!s || s.next === s.prev) return o; let a, c, l, d, h, p, g; if (i && (s = JN(n, e, s, t)), n.length > 80 * t) { a = l = n[0], c = d = n[1]; for (let f = t; f < r; f += t) h = n[f], p = n[f + 1], h < a && (a = h), p < c && (c = p), h > l && (l = h), p > d && (d = p); g = Math.max(l - a, d - c), g = g !== 0 ? 1 / g : 0; } return il(s, o, t, a, c, g), o; } }; function Gx(n, e, t, i, r) { let s, o; if (r === aF(n, e, t, i) > 0) for (s = e; s < t; s += i) o = rv(s, n[s], n[s + 1], o); else for (s = t - i; s >= e; s -= i) o = rv(s, n[s], n[s + 1], o); return o && Vu(o, o.next) && (sl(o), o = o.next), o; } function Kr(n, e) { if (!n) return n; e || (e = n); let t = n, i; do if (i = !1, !t.steiner && (Vu(t, t.next) || zt(t.prev, t, t.next) === 0)) { if (sl(t), t = e = t.prev, t === t.next) break; i = !0; } else t = t.next; while (i || t !== e); return e; } function il(n, e, t, i, r, s, o) { if (!n) return; !o && s && tF(n, i, r, s); let a = n, c, l; for (; n.prev !== n.next; ) { if (c = n.prev, l = n.next, s ? ZN(n, i, r, s) : $N(n)) { e.push(c.i / t), e.push(n.i / t), e.push(l.i / t), sl(n), n = l.next, a = l.next; continue; } if (n = l, n === a) { o ? o === 1 ? (n = XN(Kr(n), e, t), il(n, e, t, i, r, s, 2)) : o === 2 && YN(n, e, t, i, r, s) : il(Kr(n), e, t, i, r, s, 1); break; } } } function $N(n) { const e = n.prev, t = n, i = n.next; if (zt(e, t, i) >= 0) return !1; let r = n.next.next; for (; r !== n.prev; ) { if (So(e.x, e.y, t.x, t.y, i.x, i.y, r.x, r.y) && zt(r.prev, r, r.next) >= 0) return !1; r = r.next; } return !0; } function ZN(n, e, t, i) { const r = n.prev, s = n, o = n.next; if (zt(r, s, o) >= 0) return !1; const a = r.x < s.x ? r.x < o.x ? r.x : o.x : s.x < o.x ? s.x : o.x, c = r.y < s.y ? r.y < o.y ? r.y : o.y : s.y < o.y ? s.y : o.y, l = r.x > s.x ? r.x > o.x ? r.x : o.x : s.x > o.x ? s.x : o.x, d = r.y > s.y ? r.y > o.y ? r.y : o.y : s.y > o.y ? s.y : o.y, h = Ud(a, c, e, t, i), p = Ud(l, d, e, t, i); let g = n.prevZ, f = n.nextZ; for (; g && g.z >= h && f && f.z <= p; ) { if (g !== n.prev && g !== n.next && So(r.x, r.y, s.x, s.y, o.x, o.y, g.x, g.y) && zt(g.prev, g, g.next) >= 0 || (g = g.prevZ, f !== n.prev && f !== n.next && So(r.x, r.y, s.x, s.y, o.x, o.y, f.x, f.y) && zt(f.prev, f, f.next) >= 0)) return !1; f = f.nextZ; } for (; g && g.z >= h; ) { if (g !== n.prev && g !== n.next && So(r.x, r.y, s.x, s.y, o.x, o.y, g.x, g.y) && zt(g.prev, g, g.next) >= 0) return !1; g = g.prevZ; } for (; f && f.z <= p; ) { if (f !== n.prev && f !== n.next && So(r.x, r.y, s.x, s.y, o.x, o.y, f.x, f.y) && zt(f.prev, f, f.next) >= 0) return !1; f = f.nextZ; } return !0; } function XN(n, e, t) { let i = n; do { const r = i.prev, s = i.next.next; !Vu(r, s) && Hx(r, i, i.next, s) && rl(r, s) && rl(s, r) && (e.push(r.i / t), e.push(i.i / t), e.push(s.i / t), sl(i), sl(i.next), i = n = s), i = i.next; } while (i !== n); return Kr(i); } function YN(n, e, t, i, r, s) { let o = n; do { let a = o.next.next; for (; a !== o.prev; ) { if (o.i !== a.i && rF(o, a)) { let c = Wx(o, a); o = Kr(o, o.next), c = Kr(c, c.next), il(o, e, t, i, r, s), il(c, e, t, i, r, s); return; } a = a.next; } o = o.next; } while (o !== n); } function JN(n, e, t, i) { const r = []; let s, o, a, c, l; for (s = 0, o = e.length; s < o; s++) a = e[s] * i, c = s < o - 1 ? e[s + 1] * i : n.length, l = Gx(n, a, c, i, !1), l === l.next && (l.steiner = !0), r.push(iF(l)); for (r.sort(qN), s = 0; s < r.length; s++) KN(r[s], t), t = Kr(t, t.next); return t; } function qN(n, e) { return n.x - e.x; } function KN(n, e) { if (e = QN(n, e), e) { const t = Wx(e, n); Kr(e, e.next), Kr(t, t.next); } } function QN(n, e) { let t = e; const i = n.x, r = n.y; let s = -1 / 0, o; do { if (r <= t.y && r >= t.next.y && t.next.y !== t.y) { const p = t.x + (r - t.y) * (t.next.x - t.x) / (t.next.y - t.y); if (p <= i && p > s) { if (s = p, p === i) { if (r === t.y) return t; if (r === t.next.y) return t.next; } o = t.x < t.next.x ? t : t.next; } } t = t.next; } while (t !== e); if (!o) return null; if (i === s) return o; const a = o, c = o.x, l = o.y; let d = 1 / 0, h; t = o; do i >= t.x && t.x >= c && i !== t.x && So(r < l ? i : s, r, c, l, r < l ? s : i, r, t.x, t.y) && (h = Math.abs(r - t.y) / (i - t.x), rl(t, n) && (h < d || h === d && (t.x > o.x || t.x === o.x && eF(o, t))) && (o = t, d = h)), t = t.next; while (t !== a); return o; } function eF(n, e) { return zt(n.prev, n, e.prev) < 0 && zt(e.next, n, n.next) < 0; } function tF(n, e, t, i) { let r = n; do r.z === null && (r.z = Ud(r.x, r.y, e, t, i)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next; while (r !== n); r.prevZ.nextZ = null, r.prevZ = null, nF(r); } function nF(n) { let e, t, i, r, s, o, a, c, l = 1; do { for (t = n, n = null, s = null, o = 0; t; ) { for (o++, i = t, a = 0, e = 0; e < l && (a++, i = i.nextZ, !!i); e++) ; for (c = l; a > 0 || c > 0 && i; ) a !== 0 && (c === 0 || !i || t.z <= i.z) ? (r = t, t = t.nextZ, a--) : (r = i, i = i.nextZ, c--), s ? s.nextZ = r : n = r, r.prevZ = s, s = r; t = i; } s.nextZ = null, l *= 2; } while (o > 1); return n; } function Ud(n, e, t, i, r) { return n = 32767 * (n - t) * r, e = 32767 * (e - i) * r, n = (n | n << 8) & 16711935, n = (n | n << 4) & 252645135, n = (n | n << 2) & 858993459, n = (n | n << 1) & 1431655765, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, n | e << 1; } function iF(n) { let e = n, t = n; do (e.x < t.x || e.x === t.x && e.y < t.y) && (t = e), e = e.next; while (e !== n); return t; } function So(n, e, t, i, r, s, o, a) { return (r - o) * (e - a) - (n - o) * (s - a) >= 0 && (n - o) * (i - a) - (t - o) * (e - a) >= 0 && (t - o) * (s - a) - (r - o) * (i - a) >= 0; } function rF(n, e) { return n.next.i !== e.i && n.prev.i !== e.i && !sF(n, e) && // dones't intersect other edges (rl(n, e) && rl(e, n) && oF(n, e) && // locally visible (zt(n.prev, n, e.prev) || zt(n, e.prev, e)) || // does not create opposite-facing sectors Vu(n, e) && zt(n.prev, n, n.next) > 0 && zt(e.prev, e, e.next) > 0); } function zt(n, e, t) { return (e.y - n.y) * (t.x - e.x) - (e.x - n.x) * (t.y - e.y); } function Vu(n, e) { return n.x === e.x && n.y === e.y; } function Hx(n, e, t, i) { const r = xc(zt(n, e, t)), s = xc(zt(n, e, i)), o = xc(zt(t, i, n)), a = xc(zt(t, i, e)); return !!(r !== s && o !== a || r === 0 && bc(n, t, e) || s === 0 && bc(n, i, e) || o === 0 && bc(t, n, i) || a === 0 && bc(t, e, i)); } function bc(n, e, t) { return e.x <= Math.max(n.x, t.x) && e.x >= Math.min(n.x, t.x) && e.y <= Math.max(n.y, t.y) && e.y >= Math.min(n.y, t.y); } function xc(n) { return n > 0 ? 1 : n < 0 ? -1 : 0; } function sF(n, e) { let t = n; do { if (t.i !== n.i && t.next.i !== n.i && t.i !== e.i && t.next.i !== e.i && Hx(t, t.next, n, e)) return !0; t = t.next; } while (t !== n); return !1; } function rl(n, e) { return zt(n.prev, n, n.next) < 0 ? zt(n, e, n.next) >= 0 && zt(n, n.prev, e) >= 0 : zt(n, e, n.prev) < 0 || zt(n, n.next, e) < 0; } function oF(n, e) { let t = n, i = !1; const r = (n.x + e.x) / 2, s = (n.y + e.y) / 2; do t.y > s != t.next.y > s && t.next.y !== t.y && r < (t.next.x - t.x) * (s - t.y) / (t.next.y - t.y) + t.x && (i = !i), t = t.next; while (t !== n); return i; } function Wx(n, e) { const t = new Vd(n.i, n.x, n.y), i = new Vd(e.i, e.x, e.y), r = n.next, s = e.prev; return n.next = e, e.prev = n, t.next = r, r.prev = t, i.next = t, t.prev = i, s.next = i, i.prev = s, i; } function rv(n, e, t, i) { const r = new Vd(n, e, t); return i ? (r.next = i.next, r.prev = i, i.next.prev = r, i.next = r) : (r.prev = r, r.next = r), r; } function sl(n) { n.next.prev = n.prev, n.prev.next = n.next, n.prevZ && (n.prevZ.nextZ = n.nextZ), n.nextZ && (n.nextZ.prevZ = n.prevZ); } function Vd(n, e, t) { this.i = n, this.x = e, this.y = t, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1; } function aF(n, e, t, i) { let r = 0; for (let s = e, o = t - i; s < t; s += i) r += (n[o] - n[s]) * (n[s + 1] + n[o + 1]), o = s; return r; } class Fi { // calculate area of the contour polygon static area(e) { const t = e.length; let i = 0; for (let r = t - 1, s = 0; s < t; r = s++) i += e[r].x * e[s].y - e[s].x * e[r].y; return i * 0.5; } static isClockWise(e) { return Fi.area(e) < 0; } static triangulateShape(e, t) { const i = [], r = [], s = []; sv(e), ov(i, e); let o = e.length; t.forEach(sv); for (let c = 0; c < t.length; c++) r.push(o), o += t[c].length, ov(i, t[c]); const a = jN.triangulate(i, r); for (let c = 0; c < a.length; c += 3) s.push(a.slice(c, c + 3)); return s; } } function sv(n) { const e = n.length; e > 2 && n[e - 1].equals(n[0]) && n.pop(); } function ov(n, e) { for (let t = 0; t < e.length; t++) n.push(e[t].x), n.push(e[t].y); } class wi extends Je { constructor(e, t) { super(), this.type = "ExtrudeGeometry", this.parameters = { shapes: e, options: t }, e = Array.isArray(e) ? e : [e]; const i = this, r = [], s = []; for (let a = 0, c = e.length; a < c; a++) { const l = e[a]; o(l); } this.setAttribute("position", new We(r, 3)), this.setAttribute("uv", new We(s, 2)), this.computeVertexNormals(); function o(a) { const c = [], l = t.curveSegments !== void 0 ? t.curveSegments : 12, d = t.steps !== void 0 ? t.steps : 1; let h = t.depth !== void 0 ? t.depth : 100, p = t.bevelEnabled !== void 0 ? t.bevelEnabled : !0, g = t.bevelThickness !== void 0 ? t.bevelThickness : 6, f = t.bevelSize !== void 0 ? t.bevelSize : g - 2, u = t.bevelOffset !== void 0 ? t.bevelOffset : 0, y = t.bevelSegments !== void 0 ? t.bevelSegments : 3; const v = t.extrudePath, m = t.UVGenerator !== void 0 ? t.UVGenerator : lF; t.amount !== void 0 && (console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."), h = t.amount); let w, S = !1, T, M, x, _; v && (w = v.getSpacedPoints(d), S = !0, p = !1, T = v.computeFrenetFrames(d, !1), M = new X(), x = new X(), _ = new X()), p || (y = 0, g = 0, f = 0, u = 0); const E = a.extractPoints(l); let L = E.shape; const R = E.holes; if (!Fi.isClockWise(L)) { L = L.reverse(); for (let Y = 0, te = R.length; Y < te; Y++) { const F = R[Y]; Fi.isClockWise(F) && (R[Y] = F.reverse()); } } const A = Fi.triangulateShape(L, R), P = L; for (let Y = 0, te = R.length; Y < te; Y++) { const F = R[Y]; L = L.concat(F); } function I(Y, te, F) { return te || console.error("THREE.ExtrudeGeometry: vec does not exist"), te.clone().multiplyScalar(F).add(Y); } const b = L.length, O = A.length; function N(Y, te, F) { let $, J, z; const V = Y.x - te.x, oe = Y.y - te.y, ue = F.x - Y.x, le = F.y - Y.y, ve = V * V + oe * oe, xe = V * le - oe * ue; if (Math.abs(xe) > Number.EPSILON) { const Te = Math.sqrt(ve), de = Math.sqrt(ue * ue + le * le), we = te.x - oe / Te, se = te.y + V / Te, Se = F.x - le / de, ge = F.y + ue / de, be = ((Se - we) * le - (ge - se) * ue) / (V * le - oe * ue); $ = we + V * be - Y.x, J = se + oe * be - Y.y; const Ie = $ * $ + J * J; if (Ie <= 2) return new Pe($, J); z = Math.sqrt(Ie / 2); } else { let Te = !1; V > Number.EPSILON ? ue > Number.EPSILON && (Te = !0) : V < -Number.EPSILON ? ue < -Number.EPSILON && (Te = !0) : Math.sign(oe) === Math.sign(le) && (Te = !0), Te ? ($ = -oe, J = V, z = Math.sqrt(ve)) : ($ = V, J = oe, z = Math.sqrt(ve / 2)); } return new Pe($ / z, J / z); } const D = []; for (let Y = 0, te = P.length, F = te - 1, $ = Y + 1; Y < te; Y++, F++, $++) F === te && (F = 0), $ === te && ($ = 0), D[Y] = N(P[Y], P[F], P[$]); const B = []; let U, k = D.concat(); for (let Y = 0, te = R.length; Y < te; Y++) { const F = R[Y]; U = []; for (let $ = 0, J = F.length, z = J - 1, V = $ + 1; $ < J; $++, z++, V++) z === J && (z = 0), V === J && (V = 0), U[$] = N(F[$], F[z], F[V]); B.push(U), k = k.concat(U); } for (let Y = 0; Y < y; Y++) { const te = Y / y, F = g * Math.cos(te * Math.PI / 2), $ = f * Math.sin(te * Math.PI / 2) + u; for (let J = 0, z = P.length; J < z; J++) { const V = I(P[J], D[J], $); W(V.x, V.y, -F); } for (let J = 0, z = R.length; J < z; J++) { const V = R[J]; U = B[J]; for (let oe = 0, ue = V.length; oe < ue; oe++) { const le = I(V[oe], U[oe], $); W(le.x, le.y, -F); } } } const K = f + u; for (let Y = 0; Y < b; Y++) { const te = p ? I(L[Y], k[Y], K) : L[Y]; S ? (x.copy(T.normals[0]).multiplyScalar(te.x), M.copy(T.binormals[0]).multiplyScalar(te.y), _.copy(w[0]).add(x).add(M), W(_.x, _.y, _.z)) : W(te.x, te.y, 0); } for (let Y = 1; Y <= d; Y++) for (let te = 0; te < b; te++) { const F = p ? I(L[te], k[te], K) : L[te]; S ? (x.copy(T.normals[Y]).multiplyScalar(F.x), M.copy(T.binormals[Y]).multiplyScalar(F.y), _.copy(w[Y]).add(x).add(M), W(_.x, _.y, _.z)) : W(F.x, F.y, h / d * Y); } for (let Y = y - 1; Y >= 0; Y--) { const te = Y / y, F = g * Math.cos(te * Math.PI / 2), $ = f * Math.sin(te * Math.PI / 2) + u; for (let J = 0, z = P.length; J < z; J++) { const V = I(P[J], D[J], $); W(V.x, V.y, h + F); } for (let J = 0, z = R.length; J < z; J++) { const V = R[J]; U = B[J]; for (let oe = 0, ue = V.length; oe < ue; oe++) { const le = I(V[oe], U[oe], $); S ? W(le.x, le.y + w[d - 1].y, w[d - 1].x + F) : W(le.x, le.y, h + F); } } } ie(), j(); function ie() { const Y = r.length / 3; if (p) { let te = 0, F = b * te; for (let $ = 0; $ < O; $++) { const J = A[$]; q(J[2] + F, J[1] + F, J[0] + F); } te = d + y * 2, F = b * te; for (let $ = 0; $ < O; $++) { const J = A[$]; q(J[0] + F, J[1] + F, J[2] + F); } } else { for (let te = 0; te < O; te++) { const F = A[te]; q(F[2], F[1], F[0]); } for (let te = 0; te < O; te++) { const F = A[te]; q(F[0] + b * d, F[1] + b * d, F[2] + b * d); } } i.addGroup(Y, r.length / 3 - Y, 0); } function j() { const Y = r.length / 3; let te = 0; G(P, te), te += P.length; for (let F = 0, $ = R.length; F < $; F++) { const J = R[F]; G(J, te), te += J.length; } i.addGroup(Y, r.length / 3 - Y, 1); } function G(Y, te) { let F = Y.length; for (; --F >= 0; ) { const $ = F; let J = F - 1; J < 0 && (J = Y.length - 1); for (let z = 0, V = d + y * 2; z < V; z++) { const oe = b * z, ue = b * (z + 1), le = te + $ + oe, ve = te + J + oe, xe = te + J + ue, Te = te + $ + ue; Q(le, ve, xe, Te); } } } function W(Y, te, F) { c.push(Y), c.push(te), c.push(F); } function q(Y, te, F) { ee(Y), ee(te), ee(F); const $ = r.length / 3, J = m.generateTopUV(i, r, $ - 3, $ - 2, $ - 1); ne(J[0]), ne(J[1]), ne(J[2]); } function Q(Y, te, F, $) { ee(Y), ee(te), ee($), ee(te), ee(F), ee($); const J = r.length / 3, z = m.generateSideWallUV(i, r, J - 6, J - 3, J - 2, J - 1); ne(z[0]), ne(z[1]), ne(z[3]), ne(z[1]), ne(z[2]), ne(z[3]); } function ee(Y) { r.push(c[Y * 3 + 0]), r.push(c[Y * 3 + 1]), r.push(c[Y * 3 + 2]); } function ne(Y) { s.push(Y.x), s.push(Y.y); } } } toJSON() { const e = super.toJSON(), t = this.parameters.shapes, i = this.parameters.options; return cF(t, i, e); } static fromJSON(e, t) { const i = []; for (let s = 0, o = e.shapes.length; s < o; s++) { const a = t[e.shapes[s]]; i.push(a); } const r = e.options.extrudePath; return r !== void 0 && (e.options.extrudePath = new cp[r.type]().fromJSON(r)), new wi(i, e.options); } } const lF = { generateTopUV: function(n, e, t, i, r) { const s = e[t * 3], o = e[t * 3 + 1], a = e[i * 3], c = e[i * 3 + 1], l = e[r * 3], d = e[r * 3 + 1]; return [ new Pe(s, o), new Pe(a, c), new Pe(l, d) ]; }, generateSideWallUV: function(n, e, t, i, r, s) { const o = e[t * 3], a = e[t * 3 + 1], c = e[t * 3 + 2], l = e[i * 3], d = e[i * 3 + 1], h = e[i * 3 + 2], p = e[r * 3], g = e[r * 3 + 1], f = e[r * 3 + 2], u = e[s * 3], y = e[s * 3 + 1], v = e[s * 3 + 2]; return Math.abs(a - d) < Math.abs(o - l) ? [ new Pe(o, 1 - c), new Pe(l, 1 - h), new Pe(p, 1 - f), new Pe(u, 1 - v) ] : [ new Pe(a, 1 - c), new Pe(d, 1 - h), new Pe(g, 1 - f), new Pe(y, 1 - v) ]; } }; function cF(n, e, t) { if (t.shapes = [], Array.isArray(n)) for (let i = 0, r = n.length; i < r; i++) { const s = n[i]; t.shapes.push(s.uuid); } else t.shapes.push(n.uuid); return e.extrudePath !== void 0 && (t.options.extrudePath = e.extrudePath.toJSON()), t; } class Wo extends Vi { constructor(e = 1, t = 0) { const i = (1 + Math.sqrt(5)) / 2, r = [ -1, i, 0, 1, i, 0, -1, -i, 0, 1, -i, 0, 0, -1, i, 0, 1, i, 0, -1, -i, 0, 1, -i, i, 0, -1, i, 0, 1, -i, 0, -1, -i, 0, 1 ], s = [ 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1 ]; super(r, s, e, t), this.type = "IcosahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new Wo(e.radius, e.detail); } } class jo extends Je { constructor(e, t = 12, i = 0, r = Math.PI * 2) { super(), this.type = "LatheGeometry", this.parameters = { points: e, segments: t, phiStart: i, phiLength: r }, t = Math.floor(t), r = wn(r, 0, Math.PI * 2); const s = [], o = [], a = [], c = 1 / t, l = new X(), d = new Pe(); for (let h = 0; h <= t; h++) { const p = i + h * c * r, g = Math.sin(p), f = Math.cos(p); for (let u = 0; u <= e.length - 1; u++) l.x = e[u].x * g, l.y = e[u].y, l.z = e[u].x * f, o.push(l.x, l.y, l.z), d.x = h / t, d.y = u / (e.length - 1), a.push(d.x, d.y); } for (let h = 0; h < t; h++) for (let p = 0; p < e.length - 1; p++) { const g = p + h * e.length, f = g, u = g + e.length, y = g + e.length + 1, v = g + 1; s.push(f, u, v), s.push(u, y, v); } if (this.setIndex(s), this.setAttribute("position", new We(o, 3)), this.setAttribute("uv", new We(a, 2)), this.computeVertexNormals(), r === Math.PI * 2) { const h = this.attributes.normal.array, p = new X(), g = new X(), f = new X(), u = t * e.length * 3; for (let y = 0, v = 0; y < e.length; y++, v += 3) p.x = h[v + 0], p.y = h[v + 1], p.z = h[v + 2], g.x = h[u + v + 0], g.y = h[u + v + 1], g.z = h[u + v + 2], f.addVectors(p, g).normalize(), h[v + 0] = h[u + v + 0] = f.x, h[v + 1] = h[u + v + 1] = f.y, h[v + 2] = h[u + v + 2] = f.z; } } static fromJSON(e) { return new jo(e.points, e.segments, e.phiStart, e.phiLength); } } class Ns extends Vi { constructor(e = 1, t = 0) { const i = [ 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1 ], r = [ 0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2 ]; super(i, r, e, t), this.type = "OctahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new Ns(e.radius, e.detail); } } class tu extends Je { constructor(e, t, i) { super(), this.type = "ParametricGeometry", this.parameters = { func: e, slices: t, stacks: i }; const r = [], s = [], o = [], a = [], c = 1e-5, l = new X(), d = new X(), h = new X(), p = new X(), g = new X(); e.length < 3 && console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter."); const f = t + 1; for (let u = 0; u <= i; u++) { const y = u / i; for (let v = 0; v <= t; v++) { const m = v / t; e(m, y, d), s.push(d.x, d.y, d.z), m - c >= 0 ? (e(m - c, y, h), p.subVectors(d, h)) : (e(m + c, y, h), p.subVectors(h, d)), y - c >= 0 ? (e(m, y - c, h), g.subVectors(d, h)) : (e(m, y + c, h), g.subVectors(h, d)), l.crossVectors(p, g).normalize(), o.push(l.x, l.y, l.z), a.push(m, y); } } for (let u = 0; u < i; u++) for (let y = 0; y < t; y++) { const v = u * f + y, m = u * f + y + 1, w = (u + 1) * f + y + 1, S = (u + 1) * f + y; r.push(v, m, S), r.push(m, w, S); } this.setIndex(r), this.setAttribute("position", new We(s, 3)), this.setAttribute("normal", new We(o, 3)), this.setAttribute("uv", new We(a, 2)); } } class $o extends Je { constructor(e = 0.5, t = 1, i = 8, r = 1, s = 0, o = Math.PI * 2) { super(), this.type = "RingGeometry", this.parameters = { innerRadius: e, outerRadius: t, thetaSegments: i, phiSegments: r, thetaStart: s, thetaLength: o }, i = Math.max(3, i), r = Math.max(1, r); const a = [], c = [], l = [], d = []; let h = e; const p = (t - e) / r, g = new X(), f = new Pe(); for (let u = 0; u <= r; u++) { for (let y = 0; y <= i; y++) { const v = s + y / i * o; g.x = h * Math.cos(v), g.y = h * Math.sin(v), c.push(g.x, g.y, g.z), l.push(0, 0, 1), f.x = (g.x / t + 1) / 2, f.y = (g.y / t + 1) / 2, d.push(f.x, f.y); } h += p; } for (let u = 0; u < r; u++) { const y = u * (i + 1); for (let v = 0; v < i; v++) { const m = v + y, w = m, S = m + i + 1, T = m + i + 2, M = m + 1; a.push(w, S, M), a.push(S, T, M); } } this.setIndex(a), this.setAttribute("position", new We(c, 3)), this.setAttribute("normal", new We(l, 3)), this.setAttribute("uv", new We(d, 2)); } static fromJSON(e) { return new $o(e.innerRadius, e.outerRadius, e.thetaSegments, e.phiSegments, e.thetaStart, e.thetaLength); } } class Fs extends Je { constructor(e, t = 12) { super(), this.type = "ShapeGeometry", this.parameters = { shapes: e, curveSegments: t }; const i = [], r = [], s = [], o = []; let a = 0, c = 0; if (Array.isArray(e) === !1) l(e); else for (let d = 0; d < e.length; d++) l(e[d]), this.addGroup(a, c, d), a += c, c = 0; this.setIndex(i), this.setAttribute("position", new We(r, 3)), this.setAttribute("normal", new We(s, 3)), this.setAttribute("uv", new We(o, 2)); function l(d) { const h = r.length / 3, p = d.extractPoints(t); let g = p.shape; const f = p.holes; Fi.isClockWise(g) === !1 && (g = g.reverse()); for (let y = 0, v = f.length; y < v; y++) { const m = f[y]; Fi.isClockWise(m) === !0 && (f[y] = m.reverse()); } const u = Fi.triangulateShape(g, f); for (let y = 0, v = f.length; y < v; y++) { const m = f[y]; g = g.concat(m); } for (let y = 0, v = g.length; y < v; y++) { const m = g[y]; r.push(m.x, m.y, 0), s.push(0, 0, 1), o.push(m.x, m.y); } for (let y = 0, v = u.length; y < v; y++) { const m = u[y], w = m[0] + h, S = m[1] + h, T = m[2] + h; i.push(w, S, T), c += 3; } } } toJSON() { const e = super.toJSON(), t = this.parameters.shapes; return uF(t, e); } static fromJSON(e, t) { const i = []; for (let r = 0, s = e.shapes.length; r < s; r++) { const o = t[e.shapes[r]]; i.push(o); } return new Fs(i, e.curveSegments); } } function uF(n, e) { if (e.shapes = [], Array.isArray(n)) for (let t = 0, i = n.length; t < i; t++) { const r = n[t]; e.shapes.push(r.uuid); } else e.shapes.push(n.uuid); return e; } class Bs extends Je { constructor(e = 1, t = 8, i = 6, r = 0, s = Math.PI * 2, o = 0, a = Math.PI) { super(), this.type = "SphereGeometry", this.parameters = { radius: e, widthSegments: t, heightSegments: i, phiStart: r, phiLength: s, thetaStart: o, thetaLength: a }, t = Math.max(3, Math.floor(t)), i = Math.max(2, Math.floor(i)); const c = Math.min(o + a, Math.PI); let l = 0; const d = [], h = new X(), p = new X(), g = [], f = [], u = [], y = []; for (let v = 0; v <= i; v++) { const m = [], w = v / i; let S = 0; v == 0 && o == 0 ? S = 0.5 / t : v == i && c == Math.PI && (S = -0.5 / t); for (let T = 0; T <= t; T++) { const M = T / t; h.x = -e * Math.cos(r + M * s) * Math.sin(o + w * a), h.y = e * Math.cos(o + w * a), h.z = e * Math.sin(r + M * s) * Math.sin(o + w * a), f.push(h.x, h.y, h.z), p.copy(h).normalize(), u.push(p.x, p.y, p.z), y.push(M + S, 1 - w), m.push(l++); } d.push(m); } for (let v = 0; v < i; v++) for (let m = 0; m < t; m++) { const w = d[v][m + 1], S = d[v][m], T = d[v + 1][m], M = d[v + 1][m + 1]; (v !== 0 || o > 0) && g.push(w, S, M), (v !== i - 1 || c < Math.PI) && g.push(S, T, M); } this.setIndex(g), this.setAttribute("position", new We(f, 3)), this.setAttribute("normal", new We(u, 3)), this.setAttribute("uv", new We(y, 2)); } static fromJSON(e) { return new Bs(e.radius, e.widthSegments, e.heightSegments, e.phiStart, e.phiLength, e.thetaStart, e.thetaLength); } } class Zo extends Vi { constructor(e = 1, t = 0) { const i = [ 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1 ], r = [ 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1 ]; super(i, r, e, t), this.type = "TetrahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new Zo(e.radius, e.detail); } } class nu extends wi { constructor(e, t = {}) { const i = t.font; if (!(i && i.isFont)) return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."), new Je(); const r = i.generateShapes(e, t.size); t.depth = t.height !== void 0 ? t.height : 50, t.bevelThickness === void 0 && (t.bevelThickness = 10), t.bevelSize === void 0 && (t.bevelSize = 8), t.bevelEnabled === void 0 && (t.bevelEnabled = !1), super(r, t), this.type = "TextGeometry"; } } class Xo extends Je { constructor(e = 1, t = 0.4, i = 8, r = 6, s = Math.PI * 2) { super(), this.type = "TorusGeometry", this.parameters = { radius: e, tube: t, radialSegments: i, tubularSegments: r, arc: s }, i = Math.floor(i), r = Math.floor(r); const o = [], a = [], c = [], l = [], d = new X(), h = new X(), p = new X(); for (let g = 0; g <= i; g++) for (let f = 0; f <= r; f++) { const u = f / r * s, y = g / i * Math.PI * 2; h.x = (e + t * Math.cos(y)) * Math.cos(u), h.y = (e + t * Math.cos(y)) * Math.sin(u), h.z = t * Math.sin(y), a.push(h.x, h.y, h.z), d.x = e * Math.cos(u), d.y = e * Math.sin(u), p.subVectors(h, d).normalize(), c.push(p.x, p.y, p.z), l.push(f / r), l.push(g / i); } for (let g = 1; g <= i; g++) for (let f = 1; f <= r; f++) { const u = (r + 1) * g + f - 1, y = (r + 1) * (g - 1) + f - 1, v = (r + 1) * (g - 1) + f, m = (r + 1) * g + f; o.push(u, y, m), o.push(y, v, m); } this.setIndex(o), this.setAttribute("position", new We(a, 3)), this.setAttribute("normal", new We(c, 3)), this.setAttribute("uv", new We(l, 2)); } static fromJSON(e) { return new Xo(e.radius, e.tube, e.radialSegments, e.tubularSegments, e.arc); } } class Yo extends Je { constructor(e = 1, t = 0.4, i = 64, r = 8, s = 2, o = 3) { super(), this.type = "TorusKnotGeometry", this.parameters = { radius: e, tube: t, tubularSegments: i, radialSegments: r, p: s, q: o }, i = Math.floor(i), r = Math.floor(r); const a = [], c = [], l = [], d = [], h = new X(), p = new X(), g = new X(), f = new X(), u = new X(), y = new X(), v = new X(); for (let w = 0; w <= i; ++w) { const S = w / i * s * Math.PI * 2; m(S, s, o, e, g), m(S + 0.01, s, o, e, f), y.subVectors(f, g), v.addVectors(f, g), u.crossVectors(y, v), v.crossVectors(u, y), u.normalize(), v.normalize(); for (let T = 0; T <= r; ++T) { const M = T / r * Math.PI * 2, x = -t * Math.cos(M), _ = t * Math.sin(M); h.x = g.x + (x * v.x + _ * u.x), h.y = g.y + (x * v.y + _ * u.y), h.z = g.z + (x * v.z + _ * u.z), c.push(h.x, h.y, h.z), p.subVectors(h, g).normalize(), l.push(p.x, p.y, p.z), d.push(w / i), d.push(T / r); } } for (let w = 1; w <= i; w++) for (let S = 1; S <= r; S++) { const T = (r + 1) * (w - 1) + (S - 1), M = (r + 1) * w + (S - 1), x = (r + 1) * w + S, _ = (r + 1) * (w - 1) + S; a.push(T, M, _), a.push(M, x, _); } this.setIndex(a), this.setAttribute("position", new We(c, 3)), this.setAttribute("normal", new We(l, 3)), this.setAttribute("uv", new We(d, 2)); function m(w, S, T, M, x) { const _ = Math.cos(w), E = Math.sin(w), L = T / S * w, R = Math.cos(L); x.x = M * (2 + R) * 0.5 * _, x.y = M * (2 + R) * E * 0.5, x.z = M * Math.sin(L) * 0.5; } } static fromJSON(e) { return new Yo(e.radius, e.tube, e.tubularSegments, e.radialSegments, e.p, e.q); } } class Jo extends Je { constructor(e, t = 64, i = 1, r = 8, s = !1) { super(), this.type = "TubeGeometry", this.parameters = { path: e, tubularSegments: t, radius: i, radialSegments: r, closed: s }; const o = e.computeFrenetFrames(t, s); this.tangents = o.tangents, this.normals = o.normals, this.binormals = o.binormals; const a = new X(), c = new X(), l = new Pe(); let d = new X(); const h = [], p = [], g = [], f = []; u(), this.setIndex(f), this.setAttribute("position", new We(h, 3)), this.setAttribute("normal", new We(p, 3)), this.setAttribute("uv", new We(g, 2)); function u() { for (let w = 0; w < t; w++) y(w); y(s === !1 ? t : 0), m(), v(); } function y(w) { d = e.getPointAt(w / t, d); const S = o.normals[w], T = o.binormals[w]; for (let M = 0; M <= r; M++) { const x = M / r * Math.PI * 2, _ = Math.sin(x), E = -Math.cos(x); c.x = E * S.x + _ * T.x, c.y = E * S.y + _ * T.y, c.z = E * S.z + _ * T.z, c.normalize(), p.push(c.x, c.y, c.z), a.x = d.x + i * c.x, a.y = d.y + i * c.y, a.z = d.z + i * c.z, h.push(a.x, a.y, a.z); } } function v() { for (let w = 1; w <= t; w++) for (let S = 1; S <= r; S++) { const T = (r + 1) * (w - 1) + (S - 1), M = (r + 1) * w + (S - 1), x = (r + 1) * w + S, _ = (r + 1) * (w - 1) + S; f.push(T, M, _), f.push(M, x, _); } } function m() { for (let w = 0; w <= t; w++) for (let S = 0; S <= r; S++) l.x = w / t, l.y = S / r, g.push(l.x, l.y); } } toJSON() { const e = super.toJSON(); return e.path = this.parameters.path.toJSON(), e; } static fromJSON(e) { return new Jo( new cp[e.path.type]().fromJSON(e.path), e.tubularSegments, e.radius, e.radialSegments, e.closed ); } } class up extends Je { constructor(e) { if (super(), this.type = "WireframeGeometry", e.isGeometry === !0) { console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); return; } const t = [], i = [0, 0], r = {}, s = new X(); if (e.index !== null) { const o = e.attributes.position, a = e.index; let c = e.groups; c.length === 0 && (c = [{ start: 0, count: a.count, materialIndex: 0 }]); for (let l = 0, d = c.length; l < d; ++l) { const h = c[l], p = h.start, g = h.count; for (let f = p, u = p + g; f < u; f += 3) for (let y = 0; y < 3; y++) { const v = a.getX(f + y), m = a.getX(f + (y + 1) % 3); i[0] = Math.min(v, m), i[1] = Math.max(v, m); const w = i[0] + "," + i[1]; r[w] === void 0 && (r[w] = { index1: i[0], index2: i[1] }); } } for (const l in r) { const d = r[l]; s.fromBufferAttribute(o, d.index1), t.push(s.x, s.y, s.z), s.fromBufferAttribute(o, d.index2), t.push(s.x, s.y, s.z); } } else { const o = e.attributes.position; for (let a = 0, c = o.count / 3; a < c; a++) for (let l = 0; l < 3; l++) { const d = 3 * a + l; s.fromBufferAttribute(o, d), t.push(s.x, s.y, s.z); const h = 3 * a + (l + 1) % 3; s.fromBufferAttribute(o, h), t.push(s.x, s.y, s.z); } } this.setAttribute("position", new We(t, 3)); } } var av = /* @__PURE__ */ Object.freeze({ __proto__: null, BoxGeometry: hr, BoxBufferGeometry: hr, CircleGeometry: ko, CircleBufferGeometry: ko, ConeGeometry: Go, ConeBufferGeometry: Go, CylinderGeometry: qr, CylinderBufferGeometry: qr, DodecahedronGeometry: Ho, DodecahedronBufferGeometry: Ho, EdgesGeometry: ip, ExtrudeGeometry: wi, ExtrudeBufferGeometry: wi, IcosahedronGeometry: Wo, IcosahedronBufferGeometry: Wo, LatheGeometry: jo, LatheBufferGeometry: jo, OctahedronGeometry: Ns, OctahedronBufferGeometry: Ns, ParametricGeometry: tu, ParametricBufferGeometry: tu, PlaneGeometry: Ds, PlaneBufferGeometry: Ds, PolyhedronGeometry: Vi, PolyhedronBufferGeometry: Vi, RingGeometry: $o, RingBufferGeometry: $o, ShapeGeometry: Fs, ShapeBufferGeometry: Fs, SphereGeometry: Bs, SphereBufferGeometry: Bs, TetrahedronGeometry: Zo, TetrahedronBufferGeometry: Zo, TextGeometry: nu, TextBufferGeometry: nu, TorusGeometry: Xo, TorusBufferGeometry: Xo, TorusKnotGeometry: Yo, TorusKnotBufferGeometry: Yo, TubeGeometry: Jo, TubeBufferGeometry: Jo, WireframeGeometry: up }); class hp extends sn { constructor(e) { super(), this.type = "ShadowMaterial", this.color = new Fe(0), this.transparent = !0, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this; } } hp.prototype.isShadowMaterial = !0; class da extends dr { constructor(e) { super(e), this.type = "RawShaderMaterial"; } } da.prototype.isRawShaderMaterial = !0; class js extends sn { constructor(e) { super(), this.defines = { STANDARD: "" }, this.type = "MeshStandardMaterial", this.color = new Fe(16777215), this.roughness = 1, this.metalness = 0, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Fe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = ts, this.normalScale = new Pe(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.roughnessMap = null, this.metalnessMap = null, this.alphaMap = null, this.envMap = null, this.envMapIntensity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.vertexTangents = !1, this.setValues(e); } copy(e) { return super.copy(e), this.defines = { STANDARD: "" }, this.color.copy(e.color), this.roughness = e.roughness, this.metalness = e.metalness, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.roughnessMap = e.roughnessMap, this.metalnessMap = e.metalnessMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapIntensity = e.envMapIntensity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this.vertexTangents = e.vertexTangents, this; } } js.prototype.isMeshStandardMaterial = !0; class Il extends js { constructor(e) { super(), this.defines = { STANDARD: "", PHYSICAL: "" }, this.type = "MeshPhysicalMaterial", this.clearcoat = 0, this.clearcoatMap = null, this.clearcoatRoughness = 0, this.clearcoatRoughnessMap = null, this.clearcoatNormalScale = new Pe(1, 1), this.clearcoatNormalMap = null, this.reflectivity = 0.5, Object.defineProperty(this, "ior", { get: function() { return (1 + 0.4 * this.reflectivity) / (1 - 0.4 * this.reflectivity); }, set: function(t) { this.reflectivity = wn(2.5 * (t - 1) / (t + 1), 0, 1); } }), this.sheen = null, this.transmission = 0, this.transmissionMap = null, this.thickness = 0.01, this.thicknessMap = null, this.attenuationDistance = 0, this.attenuationColor = new Fe(1, 1, 1), this.setValues(e); } copy(e) { return super.copy(e), this.defines = { STANDARD: "", PHYSICAL: "" }, this.clearcoat = e.clearcoat, this.clearcoatMap = e.clearcoatMap, this.clearcoatRoughness = e.clearcoatRoughness, this.clearcoatRoughnessMap = e.clearcoatRoughnessMap, this.clearcoatNormalMap = e.clearcoatNormalMap, this.clearcoatNormalScale.copy(e.clearcoatNormalScale), this.reflectivity = e.reflectivity, e.sheen ? this.sheen = (this.sheen || new Fe()).copy(e.sheen) : this.sheen = null, this.transmission = e.transmission, this.transmissionMap = e.transmissionMap, this.thickness = e.thickness, this.thicknessMap = e.thicknessMap, this.attenuationDistance = e.attenuationDistance, this.attenuationColor.copy(e.attenuationColor), this; } } Il.prototype.isMeshPhysicalMaterial = !0; class dp extends sn { constructor(e) { super(), this.type = "MeshPhongMaterial", this.color = new Fe(16777215), this.specular = new Fe(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Fe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = ts, this.normalScale = new Pe(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = vl, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.specular.copy(e.specular), this.shininess = e.shininess, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this; } } dp.prototype.isMeshPhongMaterial = !0; class fp extends sn { constructor(e) { super(), this.defines = { TOON: "" }, this.type = "MeshToonMaterial", this.color = new Fe(16777215), this.map = null, this.gradientMap = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Fe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = ts, this.normalScale = new Pe(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.map = e.map, this.gradientMap = e.gradientMap, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.alphaMap = e.alphaMap, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this; } } fp.prototype.isMeshToonMaterial = !0; class pp extends sn { constructor(e) { super(), this.type = "MeshNormalMaterial", this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = ts, this.normalScale = new Pe(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.setValues(e); } copy(e) { return super.copy(e), this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this; } } pp.prototype.isMeshNormalMaterial = !0; class mp extends sn { constructor(e) { super(), this.type = "MeshLambertMaterial", this.color = new Fe(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Fe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = vl, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this; } } mp.prototype.isMeshLambertMaterial = !0; class gp extends sn { constructor(e) { super(), this.defines = { MATCAP: "" }, this.type = "MeshMatcapMaterial", this.color = new Fe(16777215), this.matcap = null, this.map = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = ts, this.normalScale = new Pe(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.setValues(e); } copy(e) { return super.copy(e), this.defines = { MATCAP: "" }, this.color.copy(e.color), this.matcap = e.matcap, this.map = e.map, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.alphaMap = e.alphaMap, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this; } } gp.prototype.isMeshMatcapMaterial = !0; class vp extends un { constructor(e) { super(), this.type = "LineDashedMaterial", this.scale = 1, this.dashSize = 3, this.gapSize = 1, this.setValues(e); } copy(e) { return super.copy(e), this.scale = e.scale, this.dashSize = e.dashSize, this.gapSize = e.gapSize, this; } } vp.prototype.isLineDashedMaterial = !0; var hF = /* @__PURE__ */ Object.freeze({ __proto__: null, ShadowMaterial: hp, SpriteMaterial: Tl, RawShaderMaterial: da, ShaderMaterial: dr, PointsMaterial: ss, MeshPhysicalMaterial: Il, MeshStandardMaterial: js, MeshPhongMaterial: dp, MeshToonMaterial: fp, MeshNormalMaterial: pp, MeshLambertMaterial: mp, MeshDepthMaterial: Ou, MeshDistanceMaterial: Du, MeshBasicMaterial: Vn, MeshMatcapMaterial: gp, LineDashedMaterial: vp, LineBasicMaterial: un, Material: sn }); const It = { // same as Array.prototype.slice, but also works on typed arrays arraySlice: function(n, e, t) { return It.isTypedArray(n) ? new n.constructor(n.subarray(e, t !== void 0 ? t : n.length)) : n.slice(e, t); }, // converts an array to a specific type convertArray: function(n, e, t) { return !n || // let 'undefined' and 'null' pass !t && n.constructor === e ? n : typeof e.BYTES_PER_ELEMENT == "number" ? new e(n) : Array.prototype.slice.call(n); }, isTypedArray: function(n) { return ArrayBuffer.isView(n) && !(n instanceof DataView); }, // returns an array by which times and values can be sorted getKeyframeOrder: function(n) { function e(r, s) { return n[r] - n[s]; } const t = n.length, i = new Array(t); for (let r = 0; r !== t; ++r) i[r] = r; return i.sort(e), i; }, // uses the array previously returned by 'getKeyframeOrder' to sort data sortedArray: function(n, e, t) { const i = n.length, r = new n.constructor(i); for (let s = 0, o = 0; o !== i; ++s) { const a = t[s] * e; for (let c = 0; c !== e; ++c) r[o++] = n[a + c]; } return r; }, // function for parsing AOS keyframe formats flattenJSON: function(n, e, t, i) { let r = 1, s = n[0]; for (; s !== void 0 && s[i] === void 0; ) s = n[r++]; if (s === void 0) return; let o = s[i]; if (o !== void 0) if (Array.isArray(o)) do o = s[i], o !== void 0 && (e.push(s.time), t.push.apply(t, o)), s = n[r++]; while (s !== void 0); else if (o.toArray !== void 0) do o = s[i], o !== void 0 && (e.push(s.time), o.toArray(t, t.length)), s = n[r++]; while (s !== void 0); else do o = s[i], o !== void 0 && (e.push(s.time), t.push(o)), s = n[r++]; while (s !== void 0); }, subclip: function(n, e, t, i, r = 30) { const s = n.clone(); s.name = e; const o = []; for (let c = 0; c < s.tracks.length; ++c) { const l = s.tracks[c], d = l.getValueSize(), h = [], p = []; for (let g = 0; g < l.times.length; ++g) { const f = l.times[g] * r; if (!(f < t || f >= i)) { h.push(l.times[g]); for (let u = 0; u < d; ++u) p.push(l.values[g * d + u]); } } h.length !== 0 && (l.times = It.convertArray(h, l.times.constructor), l.values = It.convertArray(p, l.values.constructor), o.push(l)); } s.tracks = o; let a = 1 / 0; for (let c = 0; c < s.tracks.length; ++c) a > s.tracks[c].times[0] && (a = s.tracks[c].times[0]); for (let c = 0; c < s.tracks.length; ++c) s.tracks[c].shift(-1 * a); return s.resetDuration(), s; }, makeClipAdditive: function(n, e = 0, t = n, i = 30) { i <= 0 && (i = 30); const r = t.tracks.length, s = e / i; for (let o = 0; o < r; ++o) { const a = t.tracks[o], c = a.ValueTypeName; if (c === "bool" || c === "string") continue; const l = n.tracks.find(function(v) { return v.name === a.name && v.ValueTypeName === c; }); if (l === void 0) continue; let d = 0; const h = a.getValueSize(); a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (d = h / 3); let p = 0; const g = l.getValueSize(); l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (p = g / 3); const f = a.times.length - 1; let u; if (s <= a.times[0]) { const v = d, m = h - d; u = It.arraySlice(a.values, v, m); } else if (s >= a.times[f]) { const v = f * h + d, m = v + h - d; u = It.arraySlice(a.values, v, m); } else { const v = a.createInterpolant(), m = d, w = h - d; v.evaluate(s), u = It.arraySlice(v.resultBuffer, m, w); } c === "quaternion" && new Sn().fromArray(u).normalize().conjugate().toArray(u); const y = l.times.length; for (let v = 0; v < y; ++v) { const m = v * g + p; if (c === "quaternion") Sn.multiplyQuaternionsFlat( l.values, m, u, 0, l.values, m ); else { const w = g - p * 2; for (let S = 0; S < w; ++S) l.values[m + S] -= u[S]; } } } return n.blendMode = Wf, n; } }; class ki { constructor(e, t, i, r) { this.parameterPositions = e, this._cachedIndex = 0, this.resultBuffer = r !== void 0 ? r : new t.constructor(i), this.sampleValues = t, this.valueSize = i, this.settings = null, this.DefaultSettings_ = {}; } evaluate(e) { const t = this.parameterPositions; let i = this._cachedIndex, r = t[i], s = t[i - 1]; e: { t: { let o; n: { i: if (!(e < r)) { for (let a = i + 2; ; ) { if (r === void 0) { if (e < s) break i; return i = t.length, this._cachedIndex = i, this.afterEnd_(i - 1, e, s); } if (i === a) break; if (s = r, r = t[++i], e < r) break t; } o = t.length; break n; } if (!(e >= s)) { const a = t[1]; e < a && (i = 2, s = a); for (let c = i - 2; ; ) { if (s === void 0) return this._cachedIndex = 0, this.beforeStart_(0, e, r); if (i === c) break; if (r = s, s = t[--i - 1], e >= s) break t; } o = i, i = 0; break n; } break e; } for (; i < o; ) { const a = i + o >>> 1; e < t[a] ? o = a : i = a + 1; } if (r = t[i], s = t[i - 1], s === void 0) return this._cachedIndex = 0, this.beforeStart_(0, e, r); if (r === void 0) return i = t.length, this._cachedIndex = i, this.afterEnd_(i - 1, s, e); } this._cachedIndex = i, this.intervalChanged_(i, s, r); } return this.interpolate_(i, s, e, r); } getSettings_() { return this.settings || this.DefaultSettings_; } copySampleValue_(e) { const t = this.resultBuffer, i = this.sampleValues, r = this.valueSize, s = e * r; for (let o = 0; o !== r; ++o) t[o] = i[s + o]; return t; } // Template methods for derived classes: interpolate_() { throw new Error("call to abstract method"); } intervalChanged_() { } } ki.prototype.beforeStart_ = ki.prototype.copySampleValue_; ki.prototype.afterEnd_ = ki.prototype.copySampleValue_; class jx extends ki { constructor(e, t, i, r) { super(e, t, i, r), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0, this.DefaultSettings_ = { endingStart: xs, endingEnd: xs }; } intervalChanged_(e, t, i) { const r = this.parameterPositions; let s = e - 2, o = e + 1, a = r[s], c = r[o]; if (a === void 0) switch (this.getSettings_().endingStart) { case ws: s = e, a = 2 * t - i; break; case tl: s = r.length - 2, a = t + r[s] - r[s + 1]; break; default: s = e, a = i; } if (c === void 0) switch (this.getSettings_().endingEnd) { case ws: o = e, c = 2 * i - t; break; case tl: o = 1, c = i + r[1] - r[0]; break; default: o = e - 1, c = t; } const l = (i - t) * 0.5, d = this.valueSize; this._weightPrev = l / (t - a), this._weightNext = l / (c - i), this._offsetPrev = s * d, this._offsetNext = o * d; } interpolate_(e, t, i, r) { const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = e * a, l = c - a, d = this._offsetPrev, h = this._offsetNext, p = this._weightPrev, g = this._weightNext, f = (i - t) / (r - t), u = f * f, y = u * f, v = -p * y + 2 * p * u - p * f, m = (1 + p) * y + (-1.5 - 2 * p) * u + (-0.5 + p) * f + 1, w = (-1 - g) * y + (1.5 + g) * u + 0.5 * f, S = g * y - g * u; for (let T = 0; T !== a; ++T) s[T] = v * o[d + T] + m * o[l + T] + w * o[c + T] + S * o[h + T]; return s; } } class yp extends ki { constructor(e, t, i, r) { super(e, t, i, r); } interpolate_(e, t, i, r) { const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = e * a, l = c - a, d = (i - t) / (r - t), h = 1 - d; for (let p = 0; p !== a; ++p) s[p] = o[l + p] * h + o[c + p] * d; return s; } } class $x extends ki { constructor(e, t, i, r) { super(e, t, i, r); } interpolate_(e) { return this.copySampleValue_(e - 1); } } class Ti { constructor(e, t, i, r) { if (e === void 0) throw new Error("THREE.KeyframeTrack: track name is undefined"); if (t === void 0 || t.length === 0) throw new Error("THREE.KeyframeTrack: no keyframes in track named " + e); this.name = e, this.times = It.convertArray(t, this.TimeBufferType), this.values = It.convertArray(i, this.ValueBufferType), this.setInterpolation(r || this.DefaultInterpolation); } // Serialization (in static context, because of constructor invocation // and automatic invocation of .toJSON): static toJSON(e) { const t = e.constructor; let i; if (t.toJSON !== this.toJSON) i = t.toJSON(e); else { i = { name: e.name, times: It.convertArray(e.times, Array), values: It.convertArray(e.values, Array) }; const r = e.getInterpolation(); r !== e.DefaultInterpolation && (i.interpolation = r); } return i.type = e.ValueTypeName, i; } InterpolantFactoryMethodDiscrete(e) { return new $x(this.times, this.values, this.getValueSize(), e); } InterpolantFactoryMethodLinear(e) { return new yp(this.times, this.values, this.getValueSize(), e); } InterpolantFactoryMethodSmooth(e) { return new jx(this.times, this.values, this.getValueSize(), e); } setInterpolation(e) { let t; switch (e) { case Bo: t = this.InterpolantFactoryMethodDiscrete; break; case Is: t = this.InterpolantFactoryMethodLinear; break; case Vc: t = this.InterpolantFactoryMethodSmooth; break; } if (t === void 0) { const i = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name; if (this.createInterpolant === void 0) if (e !== this.DefaultInterpolation) this.setInterpolation(this.DefaultInterpolation); else throw new Error(i); return console.warn("THREE.KeyframeTrack:", i), this; } return this.createInterpolant = t, this; } getInterpolation() { switch (this.createInterpolant) { case this.InterpolantFactoryMethodDiscrete: return Bo; case this.InterpolantFactoryMethodLinear: return Is; case this.InterpolantFactoryMethodSmooth: return Vc; } } getValueSize() { return this.values.length / this.times.length; } // move all keyframes either forwards or backwards in time shift(e) { if (e !== 0) { const t = this.times; for (let i = 0, r = t.length; i !== r; ++i) t[i] += e; } return this; } // scale all keyframe times by a factor (useful for frame <-> seconds conversions) scale(e) { if (e !== 1) { const t = this.times; for (let i = 0, r = t.length; i !== r; ++i) t[i] *= e; } return this; } // removes keyframes before and after animation without changing any values within the range [startTime, endTime]. // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values trim(e, t) { const i = this.times, r = i.length; let s = 0, o = r - 1; for (; s !== r && i[s] < e; ) ++s; for (; o !== -1 && i[o] > t; ) --o; if (++o, s !== 0 || o !== r) { s >= o && (o = Math.max(o, 1), s = o - 1); const a = this.getValueSize(); this.times = It.arraySlice(i, s, o), this.values = It.arraySlice(this.values, s * a, o * a); } return this; } // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable validate() { let e = !0; const t = this.getValueSize(); t - Math.floor(t) !== 0 && (console.error("THREE.KeyframeTrack: Invalid value size in track.", this), e = !1); const i = this.times, r = this.values, s = i.length; s === 0 && (console.error("THREE.KeyframeTrack: Track is empty.", this), e = !1); let o = null; for (let a = 0; a !== s; a++) { const c = i[a]; if (typeof c == "number" && isNaN(c)) { console.error("THREE.KeyframeTrack: Time is not a valid number.", this, a, c), e = !1; break; } if (o !== null && o > c) { console.error("THREE.KeyframeTrack: Out of order keys.", this, a, c, o), e = !1; break; } o = c; } if (r !== void 0 && It.isTypedArray(r)) for (let a = 0, c = r.length; a !== c; ++a) { const l = r[a]; if (isNaN(l)) { console.error("THREE.KeyframeTrack: Value is not a valid number.", this, a, l), e = !1; break; } } return e; } // removes equivalent sequential keys as common in morph target sequences // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) optimize() { const e = It.arraySlice(this.times), t = It.arraySlice(this.values), i = this.getValueSize(), r = this.getInterpolation() === Vc, s = e.length - 1; let o = 1; for (let a = 1; a < s; ++a) { let c = !1; const l = e[a], d = e[a + 1]; if (l !== d && (a !== 1 || l !== e[0])) if (r) c = !0; else { const h = a * i, p = h - i, g = h + i; for (let f = 0; f !== i; ++f) { const u = t[h + f]; if (u !== t[p + f] || u !== t[g + f]) { c = !0; break; } } } if (c) { if (a !== o) { e[o] = e[a]; const h = a * i, p = o * i; for (let g = 0; g !== i; ++g) t[p + g] = t[h + g]; } ++o; } } if (s > 0) { e[o] = e[s]; for (let a = s * i, c = o * i, l = 0; l !== i; ++l) t[c + l] = t[a + l]; ++o; } return o !== e.length ? (this.times = It.arraySlice(e, 0, o), this.values = It.arraySlice(t, 0, o * i)) : (this.times = e, this.values = t), this; } clone() { const e = It.arraySlice(this.times, 0), t = It.arraySlice(this.values, 0), i = this.constructor, r = new i(this.name, e, t); return r.createInterpolant = this.createInterpolant, r; } } Ti.prototype.TimeBufferType = Float32Array; Ti.prototype.ValueBufferType = Float32Array; Ti.prototype.DefaultInterpolation = Is; class $s extends Ti { } $s.prototype.ValueTypeName = "bool"; $s.prototype.ValueBufferType = Array; $s.prototype.DefaultInterpolation = Bo; $s.prototype.InterpolantFactoryMethodLinear = void 0; $s.prototype.InterpolantFactoryMethodSmooth = void 0; class bp extends Ti { } bp.prototype.ValueTypeName = "color"; class qo extends Ti { } qo.prototype.ValueTypeName = "number"; class Zx extends ki { constructor(e, t, i, r) { super(e, t, i, r); } interpolate_(e, t, i, r) { const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = (i - t) / (r - t); let l = e * a; for (let d = l + a; l !== d; l += 4) Sn.slerpFlat(s, 0, o, l - a, o, l, c); return s; } } class Zs extends Ti { InterpolantFactoryMethodLinear(e) { return new Zx(this.times, this.values, this.getValueSize(), e); } } Zs.prototype.ValueTypeName = "quaternion"; Zs.prototype.DefaultInterpolation = Is; Zs.prototype.InterpolantFactoryMethodSmooth = void 0; class Xs extends Ti { } Xs.prototype.ValueTypeName = "string"; Xs.prototype.ValueBufferType = Array; Xs.prototype.DefaultInterpolation = Bo; Xs.prototype.InterpolantFactoryMethodLinear = void 0; Xs.prototype.InterpolantFactoryMethodSmooth = void 0; class Ko extends Ti { } Ko.prototype.ValueTypeName = "vector"; class Qo { constructor(e, t = -1, i, r = Eu) { this.name = e, this.tracks = i, this.duration = t, this.blendMode = r, this.uuid = Jn(), this.duration < 0 && this.resetDuration(); } static parse(e) { const t = [], i = e.tracks, r = 1 / (e.fps || 1); for (let o = 0, a = i.length; o !== a; ++o) t.push(fF(i[o]).scale(r)); const s = new this(e.name, e.duration, t, e.blendMode); return s.uuid = e.uuid, s; } static toJSON(e) { const t = [], i = e.tracks, r = { name: e.name, duration: e.duration, tracks: t, uuid: e.uuid, blendMode: e.blendMode }; for (let s = 0, o = i.length; s !== o; ++s) t.push(Ti.toJSON(i[s])); return r; } static CreateFromMorphTargetSequence(e, t, i, r) { const s = t.length, o = []; for (let a = 0; a < s; a++) { let c = [], l = []; c.push( (a + s - 1) % s, a, (a + 1) % s ), l.push(0, 1, 0); const d = It.getKeyframeOrder(c); c = It.sortedArray(c, 1, d), l = It.sortedArray(l, 1, d), !r && c[0] === 0 && (c.push(s), l.push(l[0])), o.push( new qo( ".morphTargetInfluences[" + t[a].name + "]", c, l ).scale(1 / i) ); } return new this(e, -1, o); } static findByName(e, t) { let i = e; if (!Array.isArray(e)) { const r = e; i = r.geometry && r.geometry.animations || r.animations; } for (let r = 0; r < i.length; r++) if (i[r].name === t) return i[r]; return null; } static CreateClipsFromMorphTargetSequences(e, t, i) { const r = {}, s = /^([\w-]*?)([\d]+)$/; for (let a = 0, c = e.length; a < c; a++) { const l = e[a], d = l.name.match(s); if (d && d.length > 1) { const h = d[1]; let p = r[h]; p || (r[h] = p = []), p.push(l); } } const o = []; for (const a in r) o.push(this.CreateFromMorphTargetSequence(a, r[a], t, i)); return o; } // parse the animation.hierarchy format static parseAnimation(e, t) { if (!e) return console.error("THREE.AnimationClip: No animation in JSONLoader data."), null; const i = function(h, p, g, f, u) { if (g.length !== 0) { const y = [], v = []; It.flattenJSON(g, y, v, f), y.length !== 0 && u.push(new h(p, y, v)); } }, r = [], s = e.name || "default", o = e.fps || 30, a = e.blendMode; let c = e.length || -1; const l = e.hierarchy || []; for (let h = 0; h < l.length; h++) { const p = l[h].keys; if (!(!p || p.length === 0)) if (p[0].morphTargets) { const g = {}; let f; for (f = 0; f < p.length; f++) if (p[f].morphTargets) for (let u = 0; u < p[f].morphTargets.length; u++) g[p[f].morphTargets[u]] = -1; for (const u in g) { const y = [], v = []; for (let m = 0; m !== p[f].morphTargets.length; ++m) { const w = p[f]; y.push(w.time), v.push(w.morphTarget === u ? 1 : 0); } r.push(new qo(".morphTargetInfluence[" + u + "]", y, v)); } c = g.length * (o || 1); } else { const g = ".bones[" + t[h].name + "]"; i( Ko, g + ".position", p, "pos", r ), i( Zs, g + ".quaternion", p, "rot", r ), i( Ko, g + ".scale", p, "scl", r ); } } return r.length === 0 ? null : new this(s, c, r, a); } resetDuration() { const e = this.tracks; let t = 0; for (let i = 0, r = e.length; i !== r; ++i) { const s = this.tracks[i]; t = Math.max(t, s.times[s.times.length - 1]); } return this.duration = t, this; } trim() { for (let e = 0; e < this.tracks.length; e++) this.tracks[e].trim(0, this.duration); return this; } validate() { let e = !0; for (let t = 0; t < this.tracks.length; t++) e = e && this.tracks[t].validate(); return e; } optimize() { for (let e = 0; e < this.tracks.length; e++) this.tracks[e].optimize(); return this; } clone() { const e = []; for (let t = 0; t < this.tracks.length; t++) e.push(this.tracks[t].clone()); return new this.constructor(this.name, this.duration, e, this.blendMode); } toJSON() { return this.constructor.toJSON(this); } } function dF(n) { switch (n.toLowerCase()) { case "scalar": case "double": case "float": case "number": case "integer": return qo; case "vector": case "vector2": case "vector3": case "vector4": return Ko; case "color": return bp; case "quaternion": return Zs; case "bool": case "boolean": return $s; case "string": return Xs; } throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + n); } function fF(n) { if (n.type === void 0) throw new Error("THREE.KeyframeTrack: track type undefined, can not parse"); const e = dF(n.type); if (n.times === void 0) { const t = [], i = []; It.flattenJSON(n.keys, t, i, "value"), n.times = t, n.values = i; } return e.parse !== void 0 ? e.parse(n) : new e(n.name, n.times, n.values, n.interpolation); } const zs = { enabled: !1, files: {}, add: function(n, e) { this.enabled !== !1 && (this.files[n] = e); }, get: function(n) { if (this.enabled !== !1) return this.files[n]; }, remove: function(n) { delete this.files[n]; }, clear: function() { this.files = {}; } }; class xp { constructor(e, t, i) { const r = this; let s = !1, o = 0, a = 0, c; const l = []; this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = i, this.itemStart = function(d) { a++, s === !1 && r.onStart !== void 0 && r.onStart(d, o, a), s = !0; }, this.itemEnd = function(d) { o++, r.onProgress !== void 0 && r.onProgress(d, o, a), o === a && (s = !1, r.onLoad !== void 0 && r.onLoad()); }, this.itemError = function(d) { r.onError !== void 0 && r.onError(d); }, this.resolveURL = function(d) { return c ? c(d) : d; }, this.setURLModifier = function(d) { return c = d, this; }, this.addHandler = function(d, h) { return l.push(d, h), this; }, this.removeHandler = function(d) { const h = l.indexOf(d); return h !== -1 && l.splice(h, 2), this; }, this.getHandler = function(d) { for (let h = 0, p = l.length; h < p; h += 2) { const g = l[h], f = l[h + 1]; if (g.global && (g.lastIndex = 0), g.test(d)) return f; } return null; }; } } const Xx = new xp(); class _n { constructor(e) { this.manager = e !== void 0 ? e : Xx, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {}; } load() { } loadAsync(e, t) { const i = this; return new Promise(function(r, s) { i.load(e, r, t, s); }); } parse() { } setCrossOrigin(e) { return this.crossOrigin = e, this; } setWithCredentials(e) { return this.withCredentials = e, this; } setPath(e) { return this.path = e, this; } setResourcePath(e) { return this.resourcePath = e, this; } setRequestHeader(e) { return this.requestHeader = e, this; } } const pi = {}; class Qn extends _n { constructor(e) { super(e); } load(e, t, i, r) { e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e); const s = this, o = zs.get(e); if (o !== void 0) return s.manager.itemStart(e), setTimeout(function() { t && t(o), s.manager.itemEnd(e); }, 0), o; if (pi[e] !== void 0) { pi[e].push({ onLoad: t, onProgress: i, onError: r }); return; } const a = /^data:(.*?)(;base64)?,(.*)$/, c = e.match(a); let l; if (c) { const d = c[1], h = !!c[2]; let p = c[3]; p = decodeURIComponent(p), h && (p = atob(p)); try { let g; const f = (this.responseType || "").toLowerCase(); switch (f) { case "arraybuffer": case "blob": const u = new Uint8Array(p.length); for (let v = 0; v < p.length; v++) u[v] = p.charCodeAt(v); f === "blob" ? g = new Blob([u.buffer], { type: d }) : g = u.buffer; break; case "document": g = new DOMParser().parseFromString(p, d); break; case "json": g = JSON.parse(p); break; default: g = p; break; } setTimeout(function() { t && t(g), s.manager.itemEnd(e); }, 0); } catch (g) { setTimeout(function() { r && r(g), s.manager.itemError(e), s.manager.itemEnd(e); }, 0); } } else { pi[e] = [], pi[e].push({ onLoad: t, onProgress: i, onError: r }), l = new XMLHttpRequest(), l.open("GET", e, !0), l.addEventListener("load", function(d) { const h = this.response, p = pi[e]; if (delete pi[e], this.status === 200 || this.status === 0) { this.status === 0 && console.warn("THREE.FileLoader: HTTP Status 0 received."), zs.add(e, h); for (let g = 0, f = p.length; g < f; g++) { const u = p[g]; u.onLoad && u.onLoad(h); } s.manager.itemEnd(e); } else { for (let g = 0, f = p.length; g < f; g++) { const u = p[g]; u.onError && u.onError(d); } s.manager.itemError(e), s.manager.itemEnd(e); } }, !1), l.addEventListener("progress", function(d) { const h = pi[e]; for (let p = 0, g = h.length; p < g; p++) { const f = h[p]; f.onProgress && f.onProgress(d); } }, !1), l.addEventListener("error", function(d) { const h = pi[e]; delete pi[e]; for (let p = 0, g = h.length; p < g; p++) { const f = h[p]; f.onError && f.onError(d); } s.manager.itemError(e), s.manager.itemEnd(e); }, !1), l.addEventListener("abort", function(d) { const h = pi[e]; delete pi[e]; for (let p = 0, g = h.length; p < g; p++) { const f = h[p]; f.onError && f.onError(d); } s.manager.itemError(e), s.manager.itemEnd(e); }, !1), this.responseType !== void 0 && (l.responseType = this.responseType), this.withCredentials !== void 0 && (l.withCredentials = this.withCredentials), l.overrideMimeType && l.overrideMimeType(this.mimeType !== void 0 ? this.mimeType : "text/plain"); for (const d in this.requestHeader) l.setRequestHeader(d, this.requestHeader[d]); l.send(null); } return s.manager.itemStart(e), l; } setResponseType(e) { return this.responseType = e, this; } setMimeType(e) { return this.mimeType = e, this; } } class pF extends _n { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = new Qn(this.manager); o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(a) { try { t(s.parse(JSON.parse(a))); } catch (c) { r ? r(c) : console.error(c), s.manager.itemError(e); } }, i, r); } parse(e) { const t = []; for (let i = 0; i < e.length; i++) { const r = Qo.parse(e[i]); t.push(r); } return t; } } class mF extends _n { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = [], a = new np(), c = new Qn(this.manager); c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(s.withCredentials); let l = 0; function d(h) { c.load(e[h], function(p) { const g = s.parse(p, !0); o[h] = { width: g.width, height: g.height, format: g.format, mipmaps: g.mipmaps }, l += 1, l === 6 && (g.mipmapCount === 1 && (a.minFilter = jt), a.image = o, a.format = g.format, a.needsUpdate = !0, t && t(a)); }, i, r); } if (Array.isArray(e)) for (let h = 0, p = e.length; h < p; ++h) d(h); else c.load(e, function(h) { const p = s.parse(h, !0); if (p.isCubemap) { const g = p.mipmaps.length / p.mipmapCount; for (let f = 0; f < g; f++) { o[f] = { mipmaps: [] }; for (let u = 0; u < p.mipmapCount; u++) o[f].mipmaps.push(p.mipmaps[f * p.mipmapCount + u]), o[f].format = p.format, o[f].width = p.width, o[f].height = p.height; } a.image = o; } else a.image.width = p.width, a.image.height = p.height, a.mipmaps = p.mipmaps; p.mipmapCount === 1 && (a.minFilter = jt), a.format = p.format, a.needsUpdate = !0, t && t(a); }, i, r); return a; } } class ol extends _n { constructor(e) { super(e); } load(e, t, i, r) { this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e); const s = this, o = zs.get(e); if (o !== void 0) return s.manager.itemStart(e), setTimeout(function() { t && t(o), s.manager.itemEnd(e); }, 0), o; const a = document.createElementNS("http://www.w3.org/1999/xhtml", "img"); function c() { a.removeEventListener("load", c, !1), a.removeEventListener("error", l, !1), zs.add(e, this), t && t(this), s.manager.itemEnd(e); } function l(d) { a.removeEventListener("load", c, !1), a.removeEventListener("error", l, !1), r && r(d), s.manager.itemError(e), s.manager.itemEnd(e); } return a.addEventListener("load", c, !1), a.addEventListener("error", l, !1), e.substr(0, 5) !== "data:" && this.crossOrigin !== void 0 && (a.crossOrigin = this.crossOrigin), s.manager.itemStart(e), a.src = e, a; } } class Yx extends _n { constructor(e) { super(e); } load(e, t, i, r) { const s = new ca(), o = new ol(this.manager); o.setCrossOrigin(this.crossOrigin), o.setPath(this.path); let a = 0; function c(l) { o.load(e[l], function(d) { s.images[l] = d, a++, a === 6 && (s.needsUpdate = !0, t && t(s)); }, void 0, r); } for (let l = 0; l < e.length; ++l) c(l); return s; } } class Jx extends _n { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = new Cs(), a = new Qn(this.manager); return a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(s.withCredentials), a.load(e, function(c) { const l = s.parse(c); l && (l.image !== void 0 ? o.image = l.image : l.data !== void 0 && (o.image.width = l.width, o.image.height = l.height, o.image.data = l.data), o.wrapS = l.wrapS !== void 0 ? l.wrapS : mn, o.wrapT = l.wrapT !== void 0 ? l.wrapT : mn, o.magFilter = l.magFilter !== void 0 ? l.magFilter : jt, o.minFilter = l.minFilter !== void 0 ? l.minFilter : jt, o.anisotropy = l.anisotropy !== void 0 ? l.anisotropy : 1, l.encoding !== void 0 && (o.encoding = l.encoding), l.flipY !== void 0 && (o.flipY = l.flipY), l.format !== void 0 && (o.format = l.format), l.type !== void 0 && (o.type = l.type), l.mipmaps !== void 0 && (o.mipmaps = l.mipmaps, o.minFilter = br), l.mipmapCount === 1 && (o.minFilter = jt), l.generateMipmaps !== void 0 && (o.generateMipmaps = l.generateMipmaps), o.needsUpdate = !0, t && t(o, l)); }, i, r), o; } } class wp extends _n { constructor(e) { super(e); } load(e, t, i, r) { const s = new nn(), o = new ol(this.manager); return o.setCrossOrigin(this.crossOrigin), o.setPath(this.path), o.load(e, function(a) { s.image = a; const c = e.search(/\.jpe?g($|\?)/i) > 0 || e.search(/^data\:image\/jpeg/) === 0; s.format = c ? ar : Yn, s.needsUpdate = !0, t !== void 0 && t(s); }, i, r), s; } } class qx extends Kn { constructor() { super(), this.type = "CurvePath", this.curves = [], this.autoClose = !1; } add(e) { this.curves.push(e); } closePath() { const e = this.curves[0].getPoint(0), t = this.curves[this.curves.length - 1].getPoint(1); e.equals(t) || this.curves.push(new Pl(t, e)); } // To get accurate point with reference to // entire path distance at time t, // following has to be done: // 1. Length of each sub path have to be known // 2. Locate and identify type of curve // 3. Get t for the curve // 4. Return curve.getPointAt(t') getPoint(e) { const t = e * this.getLength(), i = this.getCurveLengths(); let r = 0; for (; r < i.length; ) { if (i[r] >= t) { const s = i[r] - t, o = this.curves[r], a = o.getLength(), c = a === 0 ? 0 : 1 - s / a; return o.getPointAt(c); } r++; } return null; } // We cannot use the default THREE.Curve getPoint() with getLength() because in // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath // getPoint() depends on getLength getLength() { const e = this.getCurveLengths(); return e[e.length - 1]; } // cacheLengths must be recalculated. updateArcLengths() { this.needsUpdate = !0, this.cacheLengths = null, this.getCurveLengths(); } // Compute lengths and cache them // We cannot overwrite getLengths() because UtoT mapping uses it. getCurveLengths() { if (this.cacheLengths && this.cacheLengths.length === this.curves.length) return this.cacheLengths; const e = []; let t = 0; for (let i = 0, r = this.curves.length; i < r; i++) t += this.curves[i].getLength(), e.push(t); return this.cacheLengths = e, e; } getSpacedPoints(e = 40) { const t = []; for (let i = 0; i <= e; i++) t.push(this.getPoint(i / e)); return this.autoClose && t.push(t[0]), t; } getPoints(e = 12) { const t = []; let i; for (let r = 0, s = this.curves; r < s.length; r++) { const o = s[r], a = o && o.isEllipseCurve ? e * 2 : o && (o.isLineCurve || o.isLineCurve3) ? 1 : o && o.isSplineCurve ? e * o.points.length : e, c = o.getPoints(a); for (let l = 0; l < c.length; l++) { const d = c[l]; i && i.equals(d) || (t.push(d), i = d); } } return this.autoClose && t.length > 1 && !t[t.length - 1].equals(t[0]) && t.push(t[0]), t; } copy(e) { super.copy(e), this.curves = []; for (let t = 0, i = e.curves.length; t < i; t++) { const r = e.curves[t]; this.curves.push(r.clone()); } return this.autoClose = e.autoClose, this; } toJSON() { const e = super.toJSON(); e.autoClose = this.autoClose, e.curves = []; for (let t = 0, i = this.curves.length; t < i; t++) { const r = this.curves[t]; e.curves.push(r.toJSON()); } return e; } fromJSON(e) { super.fromJSON(e), this.autoClose = e.autoClose, this.curves = []; for (let t = 0, i = e.curves.length; t < i; t++) { const r = e.curves[t]; this.curves.push(new cp[r.type]().fromJSON(r)); } return this; } } class al extends qx { constructor(e) { super(), this.type = "Path", this.currentPoint = new Pe(), e && this.setFromPoints(e); } setFromPoints(e) { this.moveTo(e[0].x, e[0].y); for (let t = 1, i = e.length; t < i; t++) this.lineTo(e[t].x, e[t].y); return this; } moveTo(e, t) { return this.currentPoint.set(e, t), this; } lineTo(e, t) { const i = new Pl(this.currentPoint.clone(), new Pe(e, t)); return this.curves.push(i), this.currentPoint.set(e, t), this; } quadraticCurveTo(e, t, i, r) { const s = new zu( this.currentPoint.clone(), new Pe(e, t), new Pe(i, r) ); return this.curves.push(s), this.currentPoint.set(i, r), this; } bezierCurveTo(e, t, i, r, s, o) { const a = new Bu( this.currentPoint.clone(), new Pe(e, t), new Pe(i, r), new Pe(s, o) ); return this.curves.push(a), this.currentPoint.set(s, o), this; } splineThru(e) { const t = [this.currentPoint.clone()].concat(e), i = new Uu(t); return this.curves.push(i), this.currentPoint.copy(e[e.length - 1]), this; } arc(e, t, i, r, s, o) { const a = this.currentPoint.x, c = this.currentPoint.y; return this.absarc( e + a, t + c, i, r, s, o ), this; } absarc(e, t, i, r, s, o) { return this.absellipse(e, t, i, i, r, s, o), this; } ellipse(e, t, i, r, s, o, a, c) { const l = this.currentPoint.x, d = this.currentPoint.y; return this.absellipse(e + l, t + d, i, r, s, o, a, c), this; } absellipse(e, t, i, r, s, o, a, c) { const l = new Rl(e, t, i, r, s, o, a, c); if (this.curves.length > 0) { const h = l.getPoint(0); h.equals(this.currentPoint) || this.lineTo(h.x, h.y); } this.curves.push(l); const d = l.getPoint(1); return this.currentPoint.copy(d), this; } copy(e) { return super.copy(e), this.currentPoint.copy(e.currentPoint), this; } toJSON() { const e = super.toJSON(); return e.currentPoint = this.currentPoint.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.currentPoint.fromArray(e.currentPoint), this; } } class Gr extends al { constructor(e) { super(e), this.uuid = Jn(), this.type = "Shape", this.holes = []; } getPointsHoles(e) { const t = []; for (let i = 0, r = this.holes.length; i < r; i++) t[i] = this.holes[i].getPoints(e); return t; } // get points of shape and holes (keypoints based on segments parameter) extractPoints(e) { return { shape: this.getPoints(e), holes: this.getPointsHoles(e) }; } copy(e) { super.copy(e), this.holes = []; for (let t = 0, i = e.holes.length; t < i; t++) { const r = e.holes[t]; this.holes.push(r.clone()); } return this; } toJSON() { const e = super.toJSON(); e.uuid = this.uuid, e.holes = []; for (let t = 0, i = this.holes.length; t < i; t++) { const r = this.holes[t]; e.holes.push(r.toJSON()); } return e; } fromJSON(e) { super.fromJSON(e), this.uuid = e.uuid, this.holes = []; for (let t = 0, i = e.holes.length; t < i; t++) { const r = e.holes[t]; this.holes.push(new al().fromJSON(r)); } return this; } } class Mi extends ot { constructor(e, t = 1) { super(), this.type = "Light", this.color = new Fe(e), this.intensity = t; } dispose() { } copy(e) { return super.copy(e), this.color.copy(e.color), this.intensity = e.intensity, this; } toJSON(e) { const t = super.toJSON(e); return t.object.color = this.color.getHex(), t.object.intensity = this.intensity, this.groundColor !== void 0 && (t.object.groundColor = this.groundColor.getHex()), this.distance !== void 0 && (t.object.distance = this.distance), this.angle !== void 0 && (t.object.angle = this.angle), this.decay !== void 0 && (t.object.decay = this.decay), this.penumbra !== void 0 && (t.object.penumbra = this.penumbra), this.shadow !== void 0 && (t.object.shadow = this.shadow.toJSON()), t; } } Mi.prototype.isLight = !0; class Mp extends Mi { constructor(e, t, i) { super(e, i), this.type = "HemisphereLight", this.position.copy(ot.DefaultUp), this.updateMatrix(), this.groundColor = new Fe(t); } copy(e) { return Mi.prototype.copy.call(this, e), this.groundColor.copy(e.groundColor), this; } } Mp.prototype.isHemisphereLight = !0; const lv = /* @__PURE__ */ new $e(), cv = /* @__PURE__ */ new X(), uv = /* @__PURE__ */ new X(); class Sp { constructor(e) { this.camera = e, this.bias = 0, this.normalBias = 0, this.radius = 1, this.mapSize = new Pe(512, 512), this.map = null, this.mapPass = null, this.matrix = new $e(), this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new Ml(), this._frameExtents = new Pe(1, 1), this._viewportCount = 1, this._viewports = [ new _t(0, 0, 1, 1) ]; } getViewportCount() { return this._viewportCount; } getFrustum() { return this._frustum; } updateMatrices(e) { const t = this.camera, i = this.matrix; cv.setFromMatrixPosition(e.matrixWorld), t.position.copy(cv), uv.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(uv), t.updateMatrixWorld(), lv.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(lv), i.set( 0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1 ), i.multiply(t.projectionMatrix), i.multiply(t.matrixWorldInverse); } getViewport(e) { return this._viewports[e]; } getFrameExtents() { return this._frameExtents; } dispose() { this.map && this.map.dispose(), this.mapPass && this.mapPass.dispose(); } copy(e) { return this.camera = e.camera.clone(), this.bias = e.bias, this.radius = e.radius, this.mapSize.copy(e.mapSize), this; } clone() { return new this.constructor().copy(this); } toJSON() { const e = {}; return this.bias !== 0 && (e.bias = this.bias), this.normalBias !== 0 && (e.normalBias = this.normalBias), this.radius !== 1 && (e.radius = this.radius), (this.mapSize.x !== 512 || this.mapSize.y !== 512) && (e.mapSize = this.mapSize.toArray()), e.camera = this.camera.toJSON(!1).object, delete e.camera.matrix, e; } } class Kx extends Sp { constructor() { super(new an(50, 1, 0.5, 500)), this.focus = 1; } updateMatrices(e) { const t = this.camera, i = nl * 2 * e.angle * this.focus, r = this.mapSize.width / this.mapSize.height, s = e.distance || t.far; (i !== t.fov || r !== t.aspect || s !== t.far) && (t.fov = i, t.aspect = r, t.far = s, t.updateProjectionMatrix()), super.updateMatrices(e); } copy(e) { return super.copy(e), this.focus = e.focus, this; } } Kx.prototype.isSpotLightShadow = !0; class ku extends Mi { constructor(e, t, i = 0, r = Math.PI / 3, s = 0, o = 1) { super(e, t), this.type = "SpotLight", this.position.copy(ot.DefaultUp), this.updateMatrix(), this.target = new ot(), this.distance = i, this.angle = r, this.penumbra = s, this.decay = o, this.shadow = new Kx(); } get power() { return this.intensity * Math.PI; } set power(e) { this.intensity = e / Math.PI; } dispose() { this.shadow.dispose(); } copy(e) { return super.copy(e), this.distance = e.distance, this.angle = e.angle, this.penumbra = e.penumbra, this.decay = e.decay, this.target = e.target.clone(), this.shadow = e.shadow.clone(), this; } } ku.prototype.isSpotLight = !0; const hv = /* @__PURE__ */ new $e(), Ca = /* @__PURE__ */ new X(), Fh = /* @__PURE__ */ new X(); class Qx extends Sp { constructor() { super(new an(90, 1, 0.5, 500)), this._frameExtents = new Pe(4, 2), this._viewportCount = 6, this._viewports = [ // These viewports map a cube-map onto a 2D texture with the // following orientation: // // xzXZ // y Y // // X - Positive x direction // x - Negative x direction // Y - Positive y direction // y - Negative y direction // Z - Positive z direction // z - Negative z direction // positive X new _t(2, 1, 1, 1), // negative X new _t(0, 1, 1, 1), // positive Z new _t(3, 1, 1, 1), // negative Z new _t(1, 1, 1, 1), // positive Y new _t(3, 0, 1, 1), // negative Y new _t(1, 0, 1, 1) ], this._cubeDirections = [ new X(1, 0, 0), new X(-1, 0, 0), new X(0, 0, 1), new X(0, 0, -1), new X(0, 1, 0), new X(0, -1, 0) ], this._cubeUps = [ new X(0, 1, 0), new X(0, 1, 0), new X(0, 1, 0), new X(0, 1, 0), new X(0, 0, 1), new X(0, 0, -1) ]; } updateMatrices(e, t = 0) { const i = this.camera, r = this.matrix, s = e.distance || i.far; s !== i.far && (i.far = s, i.updateProjectionMatrix()), Ca.setFromMatrixPosition(e.matrixWorld), i.position.copy(Ca), Fh.copy(i.position), Fh.add(this._cubeDirections[t]), i.up.copy(this._cubeUps[t]), i.lookAt(Fh), i.updateMatrixWorld(), r.makeTranslation(-Ca.x, -Ca.y, -Ca.z), hv.multiplyMatrices(i.projectionMatrix, i.matrixWorldInverse), this._frustum.setFromProjectionMatrix(hv); } } Qx.prototype.isPointLightShadow = !0; class Gu extends Mi { constructor(e, t, i = 0, r = 1) { super(e, t), this.type = "PointLight", this.distance = i, this.decay = r, this.shadow = new Qx(); } get power() { return this.intensity * 4 * Math.PI; } set power(e) { this.intensity = e / (4 * Math.PI); } dispose() { this.shadow.dispose(); } copy(e) { return super.copy(e), this.distance = e.distance, this.decay = e.decay, this.shadow = e.shadow.clone(), this; } } Gu.prototype.isPointLight = !0; class fa extends wl { constructor(e = -1, t = 1, i = 1, r = -1, s = 0.1, o = 2e3) { super(), this.type = "OrthographicCamera", this.zoom = 1, this.view = null, this.left = e, this.right = t, this.top = i, this.bottom = r, this.near = s, this.far = o, this.updateProjectionMatrix(); } copy(e, t) { return super.copy(e, t), this.left = e.left, this.right = e.right, this.top = e.top, this.bottom = e.bottom, this.near = e.near, this.far = e.far, this.zoom = e.zoom, this.view = e.view === null ? null : Object.assign({}, e.view), this; } setViewOffset(e, t, i, r, s, o) { this.view === null && (this.view = { enabled: !0, fullWidth: 1, fullHeight: 1, offsetX: 0, offsetY: 0, width: 1, height: 1 }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = i, this.view.offsetY = r, this.view.width = s, this.view.height = o, this.updateProjectionMatrix(); } clearViewOffset() { this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix(); } updateProjectionMatrix() { const e = (this.right - this.left) / (2 * this.zoom), t = (this.top - this.bottom) / (2 * this.zoom), i = (this.right + this.left) / 2, r = (this.top + this.bottom) / 2; let s = i - e, o = i + e, a = r + t, c = r - t; if (this.view !== null && this.view.enabled) { const l = (this.right - this.left) / this.view.fullWidth / this.zoom, d = (this.top - this.bottom) / this.view.fullHeight / this.zoom; s += l * this.view.offsetX, o = s + l * this.view.width, a -= d * this.view.offsetY, c = a - d * this.view.height; } this.projectionMatrix.makeOrthographic(s, o, a, c, this.near, this.far), this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); } toJSON(e) { const t = super.toJSON(e); return t.object.zoom = this.zoom, t.object.left = this.left, t.object.right = this.right, t.object.top = this.top, t.object.bottom = this.bottom, t.object.near = this.near, t.object.far = this.far, this.view !== null && (t.object.view = Object.assign({}, this.view)), t; } } fa.prototype.isOrthographicCamera = !0; class ew extends Sp { constructor() { super(new fa(-5, 5, 5, -5, 0.5, 500)); } } ew.prototype.isDirectionalLightShadow = !0; class Hu extends Mi { constructor(e, t) { super(e, t), this.type = "DirectionalLight", this.position.copy(ot.DefaultUp), this.updateMatrix(), this.target = new ot(), this.shadow = new ew(); } dispose() { this.shadow.dispose(); } copy(e) { return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this; } } Hu.prototype.isDirectionalLight = !0; class _p extends Mi { constructor(e, t) { super(e, t), this.type = "AmbientLight"; } } _p.prototype.isAmbientLight = !0; class Tp extends Mi { constructor(e, t, i = 10, r = 10) { super(e, t), this.type = "RectAreaLight", this.width = i, this.height = r; } copy(e) { return super.copy(e), this.width = e.width, this.height = e.height, this; } toJSON(e) { const t = super.toJSON(e); return t.object.width = this.width, t.object.height = this.height, t; } } Tp.prototype.isRectAreaLight = !0; class Ep { constructor() { this.coefficients = []; for (let e = 0; e < 9; e++) this.coefficients.push(new X()); } set(e) { for (let t = 0; t < 9; t++) this.coefficients[t].copy(e[t]); return this; } zero() { for (let e = 0; e < 9; e++) this.coefficients[e].set(0, 0, 0); return this; } // get the radiance in the direction of the normal // target is a Vector3 getAt(e, t) { const i = e.x, r = e.y, s = e.z, o = this.coefficients; return t.copy(o[0]).multiplyScalar(0.282095), t.addScaledVector(o[1], 0.488603 * r), t.addScaledVector(o[2], 0.488603 * s), t.addScaledVector(o[3], 0.488603 * i), t.addScaledVector(o[4], 1.092548 * (i * r)), t.addScaledVector(o[5], 1.092548 * (r * s)), t.addScaledVector(o[6], 0.315392 * (3 * s * s - 1)), t.addScaledVector(o[7], 1.092548 * (i * s)), t.addScaledVector(o[8], 0.546274 * (i * i - r * r)), t; } // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal // target is a Vector3 // https://graphics.stanford.edu/papers/envmap/envmap.pdf getIrradianceAt(e, t) { const i = e.x, r = e.y, s = e.z, o = this.coefficients; return t.copy(o[0]).multiplyScalar(0.886227), t.addScaledVector(o[1], 2 * 0.511664 * r), t.addScaledVector(o[2], 2 * 0.511664 * s), t.addScaledVector(o[3], 2 * 0.511664 * i), t.addScaledVector(o[4], 2 * 0.429043 * i * r), t.addScaledVector(o[5], 2 * 0.429043 * r * s), t.addScaledVector(o[6], 0.743125 * s * s - 0.247708), t.addScaledVector(o[7], 2 * 0.429043 * i * s), t.addScaledVector(o[8], 0.429043 * (i * i - r * r)), t; } add(e) { for (let t = 0; t < 9; t++) this.coefficients[t].add(e.coefficients[t]); return this; } addScaledSH(e, t) { for (let i = 0; i < 9; i++) this.coefficients[i].addScaledVector(e.coefficients[i], t); return this; } scale(e) { for (let t = 0; t < 9; t++) this.coefficients[t].multiplyScalar(e); return this; } lerp(e, t) { for (let i = 0; i < 9; i++) this.coefficients[i].lerp(e.coefficients[i], t); return this; } equals(e) { for (let t = 0; t < 9; t++) if (!this.coefficients[t].equals(e.coefficients[t])) return !1; return !0; } copy(e) { return this.set(e.coefficients); } clone() { return new this.constructor().copy(this); } fromArray(e, t = 0) { const i = this.coefficients; for (let r = 0; r < 9; r++) i[r].fromArray(e, t + r * 3); return this; } toArray(e = [], t = 0) { const i = this.coefficients; for (let r = 0; r < 9; r++) i[r].toArray(e, t + r * 3); return e; } // evaluate the basis functions // shBasis is an Array[ 9 ] static getBasisAt(e, t) { const i = e.x, r = e.y, s = e.z; t[0] = 0.282095, t[1] = 0.488603 * r, t[2] = 0.488603 * s, t[3] = 0.488603 * i, t[4] = 1.092548 * i * r, t[5] = 1.092548 * r * s, t[6] = 0.315392 * (3 * s * s - 1), t[7] = 1.092548 * i * s, t[8] = 0.546274 * (i * i - r * r); } } Ep.prototype.isSphericalHarmonics3 = !0; class Ol extends Mi { constructor(e = new Ep(), t = 1) { super(void 0, t), this.sh = e; } copy(e) { return super.copy(e), this.sh.copy(e.sh), this; } fromJSON(e) { return this.intensity = e.intensity, this.sh.fromArray(e.sh), this; } toJSON(e) { const t = super.toJSON(e); return t.object.sh = this.sh.toArray(), t; } } Ol.prototype.isLightProbe = !0; class tw extends _n { constructor(e) { super(e), this.textures = {}; } load(e, t, i, r) { const s = this, o = new Qn(s.manager); o.setPath(s.path), o.setRequestHeader(s.requestHeader), o.setWithCredentials(s.withCredentials), o.load(e, function(a) { try { t(s.parse(JSON.parse(a))); } catch (c) { r ? r(c) : console.error(c), s.manager.itemError(e); } }, i, r); } parse(e) { const t = this.textures; function i(s) { return t[s] === void 0 && console.warn("THREE.MaterialLoader: Undefined texture", s), t[s]; } const r = new hF[e.type](); if (e.uuid !== void 0 && (r.uuid = e.uuid), e.name !== void 0 && (r.name = e.name), e.color !== void 0 && r.color !== void 0 && r.color.setHex(e.color), e.roughness !== void 0 && (r.roughness = e.roughness), e.metalness !== void 0 && (r.metalness = e.metalness), e.sheen !== void 0 && (r.sheen = new Fe().setHex(e.sheen)), e.emissive !== void 0 && r.emissive !== void 0 && r.emissive.setHex(e.emissive), e.specular !== void 0 && r.specular !== void 0 && r.specular.setHex(e.specular), e.shininess !== void 0 && (r.shininess = e.shininess), e.clearcoat !== void 0 && (r.clearcoat = e.clearcoat), e.clearcoatRoughness !== void 0 && (r.clearcoatRoughness = e.clearcoatRoughness), e.transmission !== void 0 && (r.transmission = e.transmission), e.thickness !== void 0 && (r.thickness = e.thickness), e.attenuationDistance !== void 0 && (r.attenuationDistance = e.attenuationDistance), e.attenuationColor !== void 0 && r.attenuationColor !== void 0 && r.attenuationColor.setHex(e.attenuationColor), e.fog !== void 0 && (r.fog = e.fog), e.flatShading !== void 0 && (r.flatShading = e.flatShading), e.blending !== void 0 && (r.blending = e.blending), e.combine !== void 0 && (r.combine = e.combine), e.side !== void 0 && (r.side = e.side), e.shadowSide !== void 0 && (r.shadowSide = e.shadowSide), e.opacity !== void 0 && (r.opacity = e.opacity), e.transparent !== void 0 && (r.transparent = e.transparent), e.alphaTest !== void 0 && (r.alphaTest = e.alphaTest), e.depthTest !== void 0 && (r.depthTest = e.depthTest), e.depthWrite !== void 0 && (r.depthWrite = e.depthWrite), e.colorWrite !== void 0 && (r.colorWrite = e.colorWrite), e.stencilWrite !== void 0 && (r.stencilWrite = e.stencilWrite), e.stencilWriteMask !== void 0 && (r.stencilWriteMask = e.stencilWriteMask), e.stencilFunc !== void 0 && (r.stencilFunc = e.stencilFunc), e.stencilRef !== void 0 && (r.stencilRef = e.stencilRef), e.stencilFuncMask !== void 0 && (r.stencilFuncMask = e.stencilFuncMask), e.stencilFail !== void 0 && (r.stencilFail = e.stencilFail), e.stencilZFail !== void 0 && (r.stencilZFail = e.stencilZFail), e.stencilZPass !== void 0 && (r.stencilZPass = e.stencilZPass), e.wireframe !== void 0 && (r.wireframe = e.wireframe), e.wireframeLinewidth !== void 0 && (r.wireframeLinewidth = e.wireframeLinewidth), e.wireframeLinecap !== void 0 && (r.wireframeLinecap = e.wireframeLinecap), e.wireframeLinejoin !== void 0 && (r.wireframeLinejoin = e.wireframeLinejoin), e.rotation !== void 0 && (r.rotation = e.rotation), e.linewidth !== 1 && (r.linewidth = e.linewidth), e.dashSize !== void 0 && (r.dashSize = e.dashSize), e.gapSize !== void 0 && (r.gapSize = e.gapSize), e.scale !== void 0 && (r.scale = e.scale), e.polygonOffset !== void 0 && (r.polygonOffset = e.polygonOffset), e.polygonOffsetFactor !== void 0 && (r.polygonOffsetFactor = e.polygonOffsetFactor), e.polygonOffsetUnits !== void 0 && (r.polygonOffsetUnits = e.polygonOffsetUnits), e.morphTargets !== void 0 && (r.morphTargets = e.morphTargets), e.morphNormals !== void 0 && (r.morphNormals = e.morphNormals), e.dithering !== void 0 && (r.dithering = e.dithering), e.alphaToCoverage !== void 0 && (r.alphaToCoverage = e.alphaToCoverage), e.premultipliedAlpha !== void 0 && (r.premultipliedAlpha = e.premultipliedAlpha), e.vertexTangents !== void 0 && (r.vertexTangents = e.vertexTangents), e.visible !== void 0 && (r.visible = e.visible), e.toneMapped !== void 0 && (r.toneMapped = e.toneMapped), e.userData !== void 0 && (r.userData = e.userData), e.vertexColors !== void 0 && (typeof e.vertexColors == "number" ? r.vertexColors = e.vertexColors > 0 : r.vertexColors = e.vertexColors), e.uniforms !== void 0) for (const s in e.uniforms) { const o = e.uniforms[s]; switch (r.uniforms[s] = {}, o.type) { case "t": r.uniforms[s].value = i(o.value); break; case "c": r.uniforms[s].value = new Fe().setHex(o.value); break; case "v2": r.uniforms[s].value = new Pe().fromArray(o.value); break; case "v3": r.uniforms[s].value = new X().fromArray(o.value); break; case "v4": r.uniforms[s].value = new _t().fromArray(o.value); break; case "m3": r.uniforms[s].value = new ln().fromArray(o.value); break; case "m4": r.uniforms[s].value = new $e().fromArray(o.value); break; default: r.uniforms[s].value = o.value; } } if (e.defines !== void 0 && (r.defines = e.defines), e.vertexShader !== void 0 && (r.vertexShader = e.vertexShader), e.fragmentShader !== void 0 && (r.fragmentShader = e.fragmentShader), e.extensions !== void 0) for (const s in e.extensions) r.extensions[s] = e.extensions[s]; if (e.shading !== void 0 && (r.flatShading = e.shading === 1), e.size !== void 0 && (r.size = e.size), e.sizeAttenuation !== void 0 && (r.sizeAttenuation = e.sizeAttenuation), e.map !== void 0 && (r.map = i(e.map)), e.matcap !== void 0 && (r.matcap = i(e.matcap)), e.alphaMap !== void 0 && (r.alphaMap = i(e.alphaMap)), e.bumpMap !== void 0 && (r.bumpMap = i(e.bumpMap)), e.bumpScale !== void 0 && (r.bumpScale = e.bumpScale), e.normalMap !== void 0 && (r.normalMap = i(e.normalMap)), e.normalMapType !== void 0 && (r.normalMapType = e.normalMapType), e.normalScale !== void 0) { let s = e.normalScale; Array.isArray(s) === !1 && (s = [s, s]), r.normalScale = new Pe().fromArray(s); } return e.displacementMap !== void 0 && (r.displacementMap = i(e.displacementMap)), e.displacementScale !== void 0 && (r.displacementScale = e.displacementScale), e.displacementBias !== void 0 && (r.displacementBias = e.displacementBias), e.roughnessMap !== void 0 && (r.roughnessMap = i(e.roughnessMap)), e.metalnessMap !== void 0 && (r.metalnessMap = i(e.metalnessMap)), e.emissiveMap !== void 0 && (r.emissiveMap = i(e.emissiveMap)), e.emissiveIntensity !== void 0 && (r.emissiveIntensity = e.emissiveIntensity), e.specularMap !== void 0 && (r.specularMap = i(e.specularMap)), e.envMap !== void 0 && (r.envMap = i(e.envMap)), e.envMapIntensity !== void 0 && (r.envMapIntensity = e.envMapIntensity), e.reflectivity !== void 0 && (r.reflectivity = e.reflectivity), e.refractionRatio !== void 0 && (r.refractionRatio = e.refractionRatio), e.lightMap !== void 0 && (r.lightMap = i(e.lightMap)), e.lightMapIntensity !== void 0 && (r.lightMapIntensity = e.lightMapIntensity), e.aoMap !== void 0 && (r.aoMap = i(e.aoMap)), e.aoMapIntensity !== void 0 && (r.aoMapIntensity = e.aoMapIntensity), e.gradientMap !== void 0 && (r.gradientMap = i(e.gradientMap)), e.clearcoatMap !== void 0 && (r.clearcoatMap = i(e.clearcoatMap)), e.clearcoatRoughnessMap !== void 0 && (r.clearcoatRoughnessMap = i(e.clearcoatRoughnessMap)), e.clearcoatNormalMap !== void 0 && (r.clearcoatNormalMap = i(e.clearcoatNormalMap)), e.clearcoatNormalScale !== void 0 && (r.clearcoatNormalScale = new Pe().fromArray(e.clearcoatNormalScale)), e.transmissionMap !== void 0 && (r.transmissionMap = i(e.transmissionMap)), e.thicknessMap !== void 0 && (r.thicknessMap = i(e.thicknessMap)), r; } setTextures(e) { return this.textures = e, this; } } class lr { static decodeText(e) { if (typeof TextDecoder < "u") return new TextDecoder().decode(e); let t = ""; for (let i = 0, r = e.length; i < r; i++) t += String.fromCharCode(e[i]); try { return decodeURIComponent(escape(t)); } catch { return t; } } static extractUrlBase(e) { const t = e.lastIndexOf("/"); return t === -1 ? "./" : e.substr(0, t + 1); } } class Ap extends Je { constructor() { super(), this.type = "InstancedBufferGeometry", this.instanceCount = 1 / 0; } copy(e) { return super.copy(e), this.instanceCount = e.instanceCount, this; } clone() { return new this.constructor().copy(this); } toJSON() { const e = super.toJSON(this); return e.instanceCount = this.instanceCount, e.isInstancedBufferGeometry = !0, e; } } Ap.prototype.isInstancedBufferGeometry = !0; class Cp extends nt { constructor(e, t, i, r = 1) { typeof i == "number" && (r = i, i = !1, console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")), super(e, t, i), this.meshPerAttribute = r; } copy(e) { return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this; } toJSON() { const e = super.toJSON(); return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e; } } Cp.prototype.isInstancedBufferAttribute = !0; class nw extends _n { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = new Qn(s.manager); o.setPath(s.path), o.setRequestHeader(s.requestHeader), o.setWithCredentials(s.withCredentials), o.load(e, function(a) { try { t(s.parse(JSON.parse(a))); } catch (c) { r ? r(c) : console.error(c), s.manager.itemError(e); } }, i, r); } parse(e) { const t = {}, i = {}; function r(g, f) { if (t[f] !== void 0) return t[f]; const y = g.interleavedBuffers[f], v = s(g, y.buffer), m = Mo(y.type, v), w = new rs(m, y.stride); return w.uuid = y.uuid, t[f] = w, w; } function s(g, f) { if (i[f] !== void 0) return i[f]; const y = g.arrayBuffers[f], v = new Uint32Array(y).buffer; return i[f] = v, v; } const o = e.isInstancedBufferGeometry ? new Ap() : new Je(), a = e.data.index; if (a !== void 0) { const g = Mo(a.type, a.array); o.setIndex(new nt(g, 1)); } const c = e.data.attributes; for (const g in c) { const f = c[g]; let u; if (f.isInterleavedBufferAttribute) { const y = r(e.data, f.data); u = new fr(y, f.itemSize, f.offset, f.normalized); } else { const y = Mo(f.type, f.array), v = f.isInstancedBufferAttribute ? Cp : nt; u = new v(y, f.itemSize, f.normalized); } f.name !== void 0 && (u.name = f.name), f.usage !== void 0 && u.setUsage(f.usage), f.updateRange !== void 0 && (u.updateRange.offset = f.updateRange.offset, u.updateRange.count = f.updateRange.count), o.setAttribute(g, u); } const l = e.data.morphAttributes; if (l) for (const g in l) { const f = l[g], u = []; for (let y = 0, v = f.length; y < v; y++) { const m = f[y]; let w; if (m.isInterleavedBufferAttribute) { const S = r(e.data, m.data); w = new fr(S, m.itemSize, m.offset, m.normalized); } else { const S = Mo(m.type, m.array); w = new nt(S, m.itemSize, m.normalized); } m.name !== void 0 && (w.name = m.name), u.push(w); } o.morphAttributes[g] = u; } e.data.morphTargetsRelative && (o.morphTargetsRelative = !0); const h = e.data.groups || e.data.drawcalls || e.data.offsets; if (h !== void 0) for (let g = 0, f = h.length; g !== f; ++g) { const u = h[g]; o.addGroup(u.start, u.count, u.materialIndex); } const p = e.data.boundingSphere; if (p !== void 0) { const g = new X(); p.center !== void 0 && g.fromArray(p.center), o.boundingSphere = new xr(g, p.radius); } return e.name && (o.name = e.name), e.userData && (o.userData = e.userData), o; } } class gF extends _n { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = this.path === "" ? lr.extractUrlBase(e) : this.path; this.resourcePath = this.resourcePath || o; const a = new Qn(this.manager); a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(c) { let l = null; try { l = JSON.parse(c); } catch (h) { r !== void 0 && r(h), console.error("THREE:ObjectLoader: Can't parse " + e + ".", h.message); return; } const d = l.metadata; if (d === void 0 || d.type === void 0 || d.type.toLowerCase() === "geometry") { console.error("THREE.ObjectLoader: Can't load " + e); return; } s.parse(l, t); }, i, r); } async loadAsync(e, t) { const i = this, r = this.path === "" ? lr.extractUrlBase(e) : this.path; this.resourcePath = this.resourcePath || r; const s = new Qn(this.manager); s.setPath(this.path), s.setRequestHeader(this.requestHeader), s.setWithCredentials(this.withCredentials); const o = await s.loadAsync(e, t), a = JSON.parse(o), c = a.metadata; if (c === void 0 || c.type === void 0 || c.type.toLowerCase() === "geometry") throw new Error("THREE.ObjectLoader: Can't load " + e); return await i.parseAsync(a); } parse(e, t) { const i = this.parseAnimations(e.animations), r = this.parseShapes(e.shapes), s = this.parseGeometries(e.geometries, r), o = this.parseImages(e.images, function() { t !== void 0 && t(l); }), a = this.parseTextures(e.textures, o), c = this.parseMaterials(e.materials, a), l = this.parseObject(e.object, s, c, a, i), d = this.parseSkeletons(e.skeletons, l); if (this.bindSkeletons(l, d), t !== void 0) { let h = !1; for (const p in o) if (o[p] instanceof HTMLImageElement) { h = !0; break; } h === !1 && t(l); } return l; } async parseAsync(e) { const t = this.parseAnimations(e.animations), i = this.parseShapes(e.shapes), r = this.parseGeometries(e.geometries, i), s = await this.parseImagesAsync(e.images), o = this.parseTextures(e.textures, s), a = this.parseMaterials(e.materials, o), c = this.parseObject(e.object, r, a, o, t), l = this.parseSkeletons(e.skeletons, c); return this.bindSkeletons(c, l), c; } parseShapes(e) { const t = {}; if (e !== void 0) for (let i = 0, r = e.length; i < r; i++) { const s = new Gr().fromJSON(e[i]); t[s.uuid] = s; } return t; } parseSkeletons(e, t) { const i = {}, r = {}; if (t.traverse(function(s) { s.isBone && (r[s.uuid] = s); }), e !== void 0) for (let s = 0, o = e.length; s < o; s++) { const a = new Ll().fromJSON(e[s], r); i[a.uuid] = a; } return i; } parseGeometries(e, t) { const i = {}; if (e !== void 0) { const r = new nw(); for (let s = 0, o = e.length; s < o; s++) { let a; const c = e[s]; switch (c.type) { case "BufferGeometry": case "InstancedBufferGeometry": a = r.parse(c); break; case "Geometry": console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported."); break; default: c.type in av ? a = av[c.type].fromJSON(c, t) : console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`); } a.uuid = c.uuid, c.name !== void 0 && (a.name = c.name), a.isBufferGeometry === !0 && c.userData !== void 0 && (a.userData = c.userData), i[c.uuid] = a; } } return i; } parseMaterials(e, t) { const i = {}, r = {}; if (e !== void 0) { const s = new tw(); s.setTextures(t); for (let o = 0, a = e.length; o < a; o++) { const c = e[o]; if (c.type === "MultiMaterial") { const l = []; for (let d = 0; d < c.materials.length; d++) { const h = c.materials[d]; i[h.uuid] === void 0 && (i[h.uuid] = s.parse(h)), l.push(i[h.uuid]); } r[c.uuid] = l; } else i[c.uuid] === void 0 && (i[c.uuid] = s.parse(c)), r[c.uuid] = i[c.uuid]; } } return r; } parseAnimations(e) { const t = {}; if (e !== void 0) for (let i = 0; i < e.length; i++) { const r = e[i], s = Qo.parse(r); t[s.uuid] = s; } return t; } parseImages(e, t) { const i = this, r = {}; let s; function o(c) { return i.manager.itemStart(c), s.load(c, function() { i.manager.itemEnd(c); }, void 0, function() { i.manager.itemError(c), i.manager.itemEnd(c); }); } function a(c) { if (typeof c == "string") { const l = c, d = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(l) ? l : i.resourcePath + l; return o(d); } else return c.data ? { data: Mo(c.type, c.data), width: c.width, height: c.height } : null; } if (e !== void 0 && e.length > 0) { const c = new xp(t); s = new ol(c), s.setCrossOrigin(this.crossOrigin); for (let l = 0, d = e.length; l < d; l++) { const h = e[l], p = h.url; if (Array.isArray(p)) { r[h.uuid] = []; for (let g = 0, f = p.length; g < f; g++) { const u = p[g], y = a(u); y !== null && (y instanceof HTMLImageElement ? r[h.uuid].push(y) : r[h.uuid].push(new Cs(y.data, y.width, y.height))); } } else { const g = a(h.url); g !== null && (r[h.uuid] = g); } } } return r; } async parseImagesAsync(e) { const t = this, i = {}; let r; async function s(o) { if (typeof o == "string") { const a = o, c = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(a) ? a : t.resourcePath + a; return await r.loadAsync(c); } else return o.data ? { data: Mo(o.type, o.data), width: o.width, height: o.height } : null; } if (e !== void 0 && e.length > 0) { r = new ol(this.manager), r.setCrossOrigin(this.crossOrigin); for (let o = 0, a = e.length; o < a; o++) { const c = e[o], l = c.url; if (Array.isArray(l)) { i[c.uuid] = []; for (let d = 0, h = l.length; d < h; d++) { const p = l[d], g = await s(p); g !== null && (g instanceof HTMLImageElement ? i[c.uuid].push(g) : i[c.uuid].push(new Cs(g.data, g.width, g.height))); } } else { const d = await s(c.url); d !== null && (i[c.uuid] = d); } } } return i; } parseTextures(e, t) { function i(s, o) { return typeof s == "number" ? s : (console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", s), o[s]); } const r = {}; if (e !== void 0) for (let s = 0, o = e.length; s < o; s++) { const a = e[s]; a.image === void 0 && console.warn('THREE.ObjectLoader: No "image" specified for', a.uuid), t[a.image] === void 0 && console.warn("THREE.ObjectLoader: Undefined image", a.image); let c; const l = t[a.image]; Array.isArray(l) ? (c = new ca(l), l.length === 6 && (c.needsUpdate = !0)) : (l && l.data ? c = new Cs(l.data, l.width, l.height) : c = new nn(l), l && (c.needsUpdate = !0)), c.uuid = a.uuid, a.name !== void 0 && (c.name = a.name), a.mapping !== void 0 && (c.mapping = i(a.mapping, vF)), a.offset !== void 0 && c.offset.fromArray(a.offset), a.repeat !== void 0 && c.repeat.fromArray(a.repeat), a.center !== void 0 && c.center.fromArray(a.center), a.rotation !== void 0 && (c.rotation = a.rotation), a.wrap !== void 0 && (c.wrapS = i(a.wrap[0], dv), c.wrapT = i(a.wrap[1], dv)), a.format !== void 0 && (c.format = a.format), a.type !== void 0 && (c.type = a.type), a.encoding !== void 0 && (c.encoding = a.encoding), a.minFilter !== void 0 && (c.minFilter = i(a.minFilter, fv)), a.magFilter !== void 0 && (c.magFilter = i(a.magFilter, fv)), a.anisotropy !== void 0 && (c.anisotropy = a.anisotropy), a.flipY !== void 0 && (c.flipY = a.flipY), a.premultiplyAlpha !== void 0 && (c.premultiplyAlpha = a.premultiplyAlpha), a.unpackAlignment !== void 0 && (c.unpackAlignment = a.unpackAlignment), r[a.uuid] = c; } return r; } parseObject(e, t, i, r, s) { let o; function a(p) { return t[p] === void 0 && console.warn("THREE.ObjectLoader: Undefined geometry", p), t[p]; } function c(p) { if (p !== void 0) { if (Array.isArray(p)) { const g = []; for (let f = 0, u = p.length; f < u; f++) { const y = p[f]; i[y] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", y), g.push(i[y]); } return g; } return i[p] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", p), i[p]; } } function l(p) { return r[p] === void 0 && console.warn("THREE.ObjectLoader: Undefined texture", p), r[p]; } let d, h; switch (e.type) { case "Scene": o = new Nu(), e.background !== void 0 && (Number.isInteger(e.background) ? o.background = new Fe(e.background) : o.background = l(e.background)), e.environment !== void 0 && (o.environment = l(e.environment)), e.fog !== void 0 && (e.fog.type === "Fog" ? o.fog = new _l(e.fog.color, e.fog.near, e.fog.far) : e.fog.type === "FogExp2" && (o.fog = new Sl(e.fog.color, e.fog.density))); break; case "PerspectiveCamera": o = new an(e.fov, e.aspect, e.near, e.far), e.focus !== void 0 && (o.focus = e.focus), e.zoom !== void 0 && (o.zoom = e.zoom), e.filmGauge !== void 0 && (o.filmGauge = e.filmGauge), e.filmOffset !== void 0 && (o.filmOffset = e.filmOffset), e.view !== void 0 && (o.view = Object.assign({}, e.view)); break; case "OrthographicCamera": o = new fa(e.left, e.right, e.top, e.bottom, e.near, e.far), e.zoom !== void 0 && (o.zoom = e.zoom), e.view !== void 0 && (o.view = Object.assign({}, e.view)); break; case "AmbientLight": o = new _p(e.color, e.intensity); break; case "DirectionalLight": o = new Hu(e.color, e.intensity); break; case "PointLight": o = new Gu(e.color, e.intensity, e.distance, e.decay); break; case "RectAreaLight": o = new Tp(e.color, e.intensity, e.width, e.height); break; case "SpotLight": o = new ku(e.color, e.intensity, e.distance, e.angle, e.penumbra, e.decay); break; case "HemisphereLight": o = new Mp(e.color, e.groundColor, e.intensity); break; case "LightProbe": o = new Ol().fromJSON(e); break; case "SkinnedMesh": d = a(e.geometry), h = c(e.material), o = new Al(d, h), e.bindMode !== void 0 && (o.bindMode = e.bindMode), e.bindMatrix !== void 0 && o.bindMatrix.fromArray(e.bindMatrix), e.skeleton !== void 0 && (o.skeleton = e.skeleton); break; case "Mesh": d = a(e.geometry), h = c(e.material), o = new tn(d, h); break; case "InstancedMesh": d = a(e.geometry), h = c(e.material); const p = e.count, g = e.instanceMatrix, f = e.instanceColor; o = new tp(d, h, p), o.instanceMatrix = new nt(new Float32Array(g.array), 16), f !== void 0 && (o.instanceColor = new nt(new Float32Array(f.array), f.itemSize)); break; case "LOD": o = new Bx(); break; case "Line": o = new Ui(a(e.geometry), c(e.material)); break; case "LineLoop": o = new Fu(a(e.geometry), c(e.material)); break; case "LineSegments": o = new Fn(a(e.geometry), c(e.material)); break; case "PointCloud": case "Points": o = new ha(a(e.geometry), c(e.material)); break; case "Sprite": o = new El(c(e.material)); break; case "Group": o = new Pi(); break; case "Bone": o = new Cl(); break; default: o = new ot(); } if (o.uuid = e.uuid, e.name !== void 0 && (o.name = e.name), e.matrix !== void 0 ? (o.matrix.fromArray(e.matrix), e.matrixAutoUpdate !== void 0 && (o.matrixAutoUpdate = e.matrixAutoUpdate), o.matrixAutoUpdate && o.matrix.decompose(o.position, o.quaternion, o.scale)) : (e.position !== void 0 && o.position.fromArray(e.position), e.rotation !== void 0 && o.rotation.fromArray(e.rotation), e.quaternion !== void 0 && o.quaternion.fromArray(e.quaternion), e.scale !== void 0 && o.scale.fromArray(e.scale)), e.castShadow !== void 0 && (o.castShadow = e.castShadow), e.receiveShadow !== void 0 && (o.receiveShadow = e.receiveShadow), e.shadow && (e.shadow.bias !== void 0 && (o.shadow.bias = e.shadow.bias), e.shadow.normalBias !== void 0 && (o.shadow.normalBias = e.shadow.normalBias), e.shadow.radius !== void 0 && (o.shadow.radius = e.shadow.radius), e.shadow.mapSize !== void 0 && o.shadow.mapSize.fromArray(e.shadow.mapSize), e.shadow.camera !== void 0 && (o.shadow.camera = this.parseObject(e.shadow.camera))), e.visible !== void 0 && (o.visible = e.visible), e.frustumCulled !== void 0 && (o.frustumCulled = e.frustumCulled), e.renderOrder !== void 0 && (o.renderOrder = e.renderOrder), e.userData !== void 0 && (o.userData = e.userData), e.layers !== void 0 && (o.layers.mask = e.layers), e.children !== void 0) { const p = e.children; for (let g = 0; g < p.length; g++) o.add(this.parseObject(p[g], t, i, r, s)); } if (e.animations !== void 0) { const p = e.animations; for (let g = 0; g < p.length; g++) { const f = p[g]; o.animations.push(s[f]); } } if (e.type === "LOD") { e.autoUpdate !== void 0 && (o.autoUpdate = e.autoUpdate); const p = e.levels; for (let g = 0; g < p.length; g++) { const f = p[g], u = o.getObjectByProperty("uuid", f.object); u !== void 0 && o.addLevel(u, f.distance); } } return o; } bindSkeletons(e, t) { Object.keys(t).length !== 0 && e.traverse(function(i) { if (i.isSkinnedMesh === !0 && i.skeleton !== void 0) { const r = t[i.skeleton]; r === void 0 ? console.warn("THREE.ObjectLoader: No skeleton found with UUID:", i.skeleton) : i.bind(r, i.bindMatrix); } }); } /* DEPRECATED */ setTexturePath(e) { return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."), this.setResourcePath(e); } } const vF = { UVMapping: _u, CubeReflectionMapping: yl, CubeRefractionMapping: bl, EquirectangularReflectionMapping: Qc, EquirectangularRefractionMapping: eu, CubeUVReflectionMapping: la, CubeUVRefractionMapping: xl }, dv = { RepeatWrapping: Jr, ClampToEdgeWrapping: mn, MirroredRepeatWrapping: No }, fv = { NearestFilter: Kt, NearestMipmapNearestFilter: Ka, NearestMipmapLinearFilter: Qa, LinearFilter: jt, LinearMipmapNearestFilter: Tu, LinearMipmapLinearFilter: br }; class Lp extends _n { constructor(e) { super(e), typeof createImageBitmap > "u" && console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."), typeof fetch > "u" && console.warn("THREE.ImageBitmapLoader: fetch() not supported."), this.options = { premultiplyAlpha: "none" }; } setOptions(e) { return this.options = e, this; } load(e, t, i, r) { e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e); const s = this, o = zs.get(e); if (o !== void 0) return s.manager.itemStart(e), setTimeout(function() { t && t(o), s.manager.itemEnd(e); }, 0), o; const a = {}; a.credentials = this.crossOrigin === "anonymous" ? "same-origin" : "include", a.headers = this.requestHeader, fetch(e, a).then(function(c) { return c.blob(); }).then(function(c) { return createImageBitmap(c, Object.assign(s.options, { colorSpaceConversion: "none" })); }).then(function(c) { zs.add(e, c), t && t(c), s.manager.itemEnd(e); }).catch(function(c) { r && r(c), s.manager.itemError(e), s.manager.itemEnd(e); }), s.manager.itemStart(e); } } Lp.prototype.isImageBitmapLoader = !0; class iw { constructor() { this.type = "ShapePath", this.color = new Fe(), this.subPaths = [], this.currentPath = null; } moveTo(e, t) { return this.currentPath = new al(), this.subPaths.push(this.currentPath), this.currentPath.moveTo(e, t), this; } lineTo(e, t) { return this.currentPath.lineTo(e, t), this; } quadraticCurveTo(e, t, i, r) { return this.currentPath.quadraticCurveTo(e, t, i, r), this; } bezierCurveTo(e, t, i, r, s, o) { return this.currentPath.bezierCurveTo(e, t, i, r, s, o), this; } splineThru(e) { return this.currentPath.splineThru(e), this; } toShapes(e, t) { function i(m) { const w = []; for (let S = 0, T = m.length; S < T; S++) { const M = m[S], x = new Gr(); x.curves = M.curves, w.push(x); } return w; } function r(m, w) { const S = w.length; let T = !1; for (let M = S - 1, x = 0; x < S; M = x++) { let _ = w[M], E = w[x], L = E.x - _.x, R = E.y - _.y; if (Math.abs(R) > Number.EPSILON) { if (R < 0 && (_ = w[x], L = -L, E = w[M], R = -R), m.y < _.y || m.y > E.y) continue; if (m.y === _.y) { if (m.x === _.x) return !0; } else { const C = R * (m.x - _.x) - L * (m.y - _.y); if (C === 0) return !0; if (C < 0) continue; T = !T; } } else { if (m.y !== _.y) continue; if (E.x <= m.x && m.x <= _.x || _.x <= m.x && m.x <= E.x) return !0; } } return T; } const s = Fi.isClockWise, o = this.subPaths; if (o.length === 0) return []; if (t === !0) return i(o); let a, c, l; const d = []; if (o.length === 1) return c = o[0], l = new Gr(), l.curves = c.curves, d.push(l), d; let h = !s(o[0].getPoints()); h = e ? !h : h; const p = [], g = []; let f = [], u = 0, y; g[u] = void 0, f[u] = []; for (let m = 0, w = o.length; m < w; m++) c = o[m], y = c.getPoints(), a = s(y), a = e ? !a : a, a ? (!h && g[u] && u++, g[u] = { s: new Gr(), p: y }, g[u].s.curves = c.curves, h && u++, f[u] = []) : f[u].push({ h: c, p: y[0] }); if (!g[0]) return i(o); if (g.length > 1) { let m = !1; const w = []; for (let S = 0, T = g.length; S < T; S++) p[S] = []; for (let S = 0, T = g.length; S < T; S++) { const M = f[S]; for (let x = 0; x < M.length; x++) { const _ = M[x]; let E = !0; for (let L = 0; L < g.length; L++) r(_.p, g[L].p) && (S !== L && w.push({ froms: S, tos: L, hole: x }), E ? (E = !1, p[L].push(_)) : m = !0); E && p[S].push(_); } } w.length > 0 && (m || (f = p)); } let v; for (let m = 0, w = g.length; m < w; m++) { l = g[m].s, d.push(l), v = f[m]; for (let S = 0, T = v.length; S < T; S++) l.holes.push(v[S].h); } return d; } } class Rp { constructor(e) { this.type = "Font", this.data = e; } generateShapes(e, t = 100) { const i = [], r = yF(e, t, this.data); for (let s = 0, o = r.length; s < o; s++) Array.prototype.push.apply(i, r[s].toShapes()); return i; } } function yF(n, e, t) { const i = Array.from(n), r = e / t.resolution, s = (t.boundingBox.yMax - t.boundingBox.yMin + t.underlineThickness) * r, o = []; let a = 0, c = 0; for (let l = 0; l < i.length; l++) { const d = i[l]; if (d === ` `) a = 0, c -= s; else { const h = bF(d, r, a, c, t); a += h.offsetX, o.push(h.path); } } return o; } function bF(n, e, t, i, r) { const s = r.glyphs[n] || r.glyphs["?"]; if (!s) { console.error('THREE.Font: character "' + n + '" does not exists in font family ' + r.familyName + "."); return; } const o = new iw(); let a, c, l, d, h, p, g, f; if (s.o) { const u = s._cachedOutline || (s._cachedOutline = s.o.split(" ")); for (let y = 0, v = u.length; y < v; ) switch (u[y++]) { case "m": a = u[y++] * e + t, c = u[y++] * e + i, o.moveTo(a, c); break; case "l": a = u[y++] * e + t, c = u[y++] * e + i, o.lineTo(a, c); break; case "q": l = u[y++] * e + t, d = u[y++] * e + i, h = u[y++] * e + t, p = u[y++] * e + i, o.quadraticCurveTo(h, p, l, d); break; case "b": l = u[y++] * e + t, d = u[y++] * e + i, h = u[y++] * e + t, p = u[y++] * e + i, g = u[y++] * e + t, f = u[y++] * e + i, o.bezierCurveTo(h, p, g, f, l, d); break; } } return { offsetX: s.ha * e, path: o }; } Rp.prototype.isFont = !0; class xF extends _n { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = new Qn(this.manager); o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(s.withCredentials), o.load(e, function(a) { let c; try { c = JSON.parse(a); } catch { console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."), c = JSON.parse(a.substring(65, a.length - 2)); } const l = s.parse(c); t && t(l); }, i, r); } parse(e) { return new Rp(e); } } let wc; const Pp = { getContext: function() { return wc === void 0 && (wc = new (window.AudioContext || window.webkitAudioContext)()), wc; }, setContext: function(n) { wc = n; } }; class rw extends _n { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = new Qn(this.manager); o.setResponseType("arraybuffer"), o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(a) { try { const c = a.slice(0); Pp.getContext().decodeAudioData(c, function(d) { t(d); }); } catch (c) { r ? r(c) : console.error(c), s.manager.itemError(e); } }, i, r); } } class sw extends Ol { constructor(e, t, i = 1) { super(void 0, i); const r = new Fe().set(e), s = new Fe().set(t), o = new X(r.r, r.g, r.b), a = new X(s.r, s.g, s.b), c = Math.sqrt(Math.PI), l = c * Math.sqrt(0.75); this.sh.coefficients[0].copy(o).add(a).multiplyScalar(c), this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(l); } } sw.prototype.isHemisphereLightProbe = !0; class ow extends Ol { constructor(e, t = 1) { super(void 0, t); const i = new Fe().set(e); this.sh.coefficients[0].set(i.r, i.g, i.b).multiplyScalar(2 * Math.sqrt(Math.PI)); } } ow.prototype.isAmbientLightProbe = !0; const pv = /* @__PURE__ */ new $e(), mv = /* @__PURE__ */ new $e(); class wF { constructor() { this.type = "StereoCamera", this.aspect = 1, this.eyeSep = 0.064, this.cameraL = new an(), this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new an(), this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = !1, this._cache = { focus: null, fov: null, aspect: null, near: null, far: null, zoom: null, eyeSep: null }; } update(e) { const t = this._cache; if (t.focus !== e.focus || t.fov !== e.fov || t.aspect !== e.aspect * this.aspect || t.near !== e.near || t.far !== e.far || t.zoom !== e.zoom || t.eyeSep !== this.eyeSep) { t.focus = e.focus, t.fov = e.fov, t.aspect = e.aspect * this.aspect, t.near = e.near, t.far = e.far, t.zoom = e.zoom, t.eyeSep = this.eyeSep; const r = e.projectionMatrix.clone(), s = t.eyeSep / 2, o = s * t.near / t.focus, a = t.near * Math.tan(As * t.fov * 0.5) / t.zoom; let c, l; mv.elements[12] = -s, pv.elements[12] = s, c = -a * t.aspect + o, l = a * t.aspect + o, r.elements[0] = 2 * t.near / (l - c), r.elements[8] = (l + c) / (l - c), this.cameraL.projectionMatrix.copy(r), c = -a * t.aspect - o, l = a * t.aspect - o, r.elements[0] = 2 * t.near / (l - c), r.elements[8] = (l + c) / (l - c), this.cameraR.projectionMatrix.copy(r); } this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(mv), this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(pv); } } class aw { constructor(e = !0) { this.autoStart = e, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = !1; } start() { this.startTime = gv(), this.oldTime = this.startTime, this.elapsedTime = 0, this.running = !0; } stop() { this.getElapsedTime(), this.running = !1, this.autoStart = !1; } getElapsedTime() { return this.getDelta(), this.elapsedTime; } getDelta() { let e = 0; if (this.autoStart && !this.running) return this.start(), 0; if (this.running) { const t = gv(); e = (t - this.oldTime) / 1e3, this.oldTime = t, this.elapsedTime += e; } return e; } } function gv() { return (typeof performance > "u" ? Date : performance).now(); } const hs = /* @__PURE__ */ new X(), vv = /* @__PURE__ */ new Sn(), MF = /* @__PURE__ */ new X(), ds = /* @__PURE__ */ new X(); class SF extends ot { constructor() { super(), this.type = "AudioListener", this.context = Pp.getContext(), this.gain = this.context.createGain(), this.gain.connect(this.context.destination), this.filter = null, this.timeDelta = 0, this._clock = new aw(); } getInput() { return this.gain; } removeFilter() { return this.filter !== null && (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination), this.gain.connect(this.context.destination), this.filter = null), this; } getFilter() { return this.filter; } setFilter(e) { return this.filter !== null ? (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination)) : this.gain.disconnect(this.context.destination), this.filter = e, this.gain.connect(this.filter), this.filter.connect(this.context.destination), this; } getMasterVolume() { return this.gain.gain.value; } setMasterVolume(e) { return this.gain.gain.setTargetAtTime(e, this.context.currentTime, 0.01), this; } updateMatrixWorld(e) { super.updateMatrixWorld(e); const t = this.context.listener, i = this.up; if (this.timeDelta = this._clock.getDelta(), this.matrixWorld.decompose(hs, vv, MF), ds.set(0, 0, -1).applyQuaternion(vv), t.positionX) { const r = this.context.currentTime + this.timeDelta; t.positionX.linearRampToValueAtTime(hs.x, r), t.positionY.linearRampToValueAtTime(hs.y, r), t.positionZ.linearRampToValueAtTime(hs.z, r), t.forwardX.linearRampToValueAtTime(ds.x, r), t.forwardY.linearRampToValueAtTime(ds.y, r), t.forwardZ.linearRampToValueAtTime(ds.z, r), t.upX.linearRampToValueAtTime(i.x, r), t.upY.linearRampToValueAtTime(i.y, r), t.upZ.linearRampToValueAtTime(i.z, r); } else t.setPosition(hs.x, hs.y, hs.z), t.setOrientation(ds.x, ds.y, ds.z, i.x, i.y, i.z); } } class Ip extends ot { constructor(e) { super(), this.type = "Audio", this.listener = e, this.context = e.context, this.gain = this.context.createGain(), this.gain.connect(e.getInput()), this.autoplay = !1, this.buffer = null, this.detune = 0, this.loop = !1, this.loopStart = 0, this.loopEnd = 0, this.offset = 0, this.duration = void 0, this.playbackRate = 1, this.isPlaying = !1, this.hasPlaybackControl = !0, this.source = null, this.sourceType = "empty", this._startedAt = 0, this._progress = 0, this._connected = !1, this.filters = []; } getOutput() { return this.gain; } setNodeSource(e) { return this.hasPlaybackControl = !1, this.sourceType = "audioNode", this.source = e, this.connect(), this; } setMediaElementSource(e) { return this.hasPlaybackControl = !1, this.sourceType = "mediaNode", this.source = this.context.createMediaElementSource(e), this.connect(), this; } setMediaStreamSource(e) { return this.hasPlaybackControl = !1, this.sourceType = "mediaStreamNode", this.source = this.context.createMediaStreamSource(e), this.connect(), this; } setBuffer(e) { return this.buffer = e, this.sourceType = "buffer", this.autoplay && this.play(), this; } play(e = 0) { if (this.isPlaying === !0) { console.warn("THREE.Audio: Audio is already playing."); return; } if (this.hasPlaybackControl === !1) { console.warn("THREE.Audio: this Audio has no playback control."); return; } this._startedAt = this.context.currentTime + e; const t = this.context.createBufferSource(); return t.buffer = this.buffer, t.loop = this.loop, t.loopStart = this.loopStart, t.loopEnd = this.loopEnd, t.onended = this.onEnded.bind(this), t.start(this._startedAt, this._progress + this.offset, this.duration), this.isPlaying = !0, this.source = t, this.setDetune(this.detune), this.setPlaybackRate(this.playbackRate), this.connect(); } pause() { if (this.hasPlaybackControl === !1) { console.warn("THREE.Audio: this Audio has no playback control."); return; } return this.isPlaying === !0 && (this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate, this.loop === !0 && (this._progress = this._progress % (this.duration || this.buffer.duration)), this.source.stop(), this.source.onended = null, this.isPlaying = !1), this; } stop() { if (this.hasPlaybackControl === !1) { console.warn("THREE.Audio: this Audio has no playback control."); return; } return this._progress = 0, this.source.stop(), this.source.onended = null, this.isPlaying = !1, this; } connect() { if (this.filters.length > 0) { this.source.connect(this.filters[0]); for (let e = 1, t = this.filters.length; e < t; e++) this.filters[e - 1].connect(this.filters[e]); this.filters[this.filters.length - 1].connect(this.getOutput()); } else this.source.connect(this.getOutput()); return this._connected = !0, this; } disconnect() { if (this.filters.length > 0) { this.source.disconnect(this.filters[0]); for (let e = 1, t = this.filters.length; e < t; e++) this.filters[e - 1].disconnect(this.filters[e]); this.filters[this.filters.length - 1].disconnect(this.getOutput()); } else this.source.disconnect(this.getOutput()); return this._connected = !1, this; } getFilters() { return this.filters; } setFilters(e) { return e || (e = []), this._connected === !0 ? (this.disconnect(), this.filters = e.slice(), this.connect()) : this.filters = e.slice(), this; } setDetune(e) { if (this.detune = e, this.source.detune !== void 0) return this.isPlaying === !0 && this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01), this; } getDetune() { return this.detune; } getFilter() { return this.getFilters()[0]; } setFilter(e) { return this.setFilters(e ? [e] : []); } setPlaybackRate(e) { if (this.hasPlaybackControl === !1) { console.warn("THREE.Audio: this Audio has no playback control."); return; } return this.playbackRate = e, this.isPlaying === !0 && this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01), this; } getPlaybackRate() { return this.playbackRate; } onEnded() { this.isPlaying = !1; } getLoop() { return this.hasPlaybackControl === !1 ? (console.warn("THREE.Audio: this Audio has no playback control."), !1) : this.loop; } setLoop(e) { if (this.hasPlaybackControl === !1) { console.warn("THREE.Audio: this Audio has no playback control."); return; } return this.loop = e, this.isPlaying === !0 && (this.source.loop = this.loop), this; } setLoopStart(e) { return this.loopStart = e, this; } setLoopEnd(e) { return this.loopEnd = e, this; } getVolume() { return this.gain.gain.value; } setVolume(e) { return this.gain.gain.setTargetAtTime(e, this.context.currentTime, 0.01), this; } } const fs = /* @__PURE__ */ new X(), yv = /* @__PURE__ */ new Sn(), _F = /* @__PURE__ */ new X(), ps = /* @__PURE__ */ new X(); class TF extends Ip { constructor(e) { super(e), this.panner = this.context.createPanner(), this.panner.panningModel = "HRTF", this.panner.connect(this.gain); } getOutput() { return this.panner; } getRefDistance() { return this.panner.refDistance; } setRefDistance(e) { return this.panner.refDistance = e, this; } getRolloffFactor() { return this.panner.rolloffFactor; } setRolloffFactor(e) { return this.panner.rolloffFactor = e, this; } getDistanceModel() { return this.panner.distanceModel; } setDistanceModel(e) { return this.panner.distanceModel = e, this; } getMaxDistance() { return this.panner.maxDistance; } setMaxDistance(e) { return this.panner.maxDistance = e, this; } setDirectionalCone(e, t, i) { return this.panner.coneInnerAngle = e, this.panner.coneOuterAngle = t, this.panner.coneOuterGain = i, this; } updateMatrixWorld(e) { if (super.updateMatrixWorld(e), this.hasPlaybackControl === !0 && this.isPlaying === !1) return; this.matrixWorld.decompose(fs, yv, _F), ps.set(0, 0, 1).applyQuaternion(yv); const t = this.panner; if (t.positionX) { const i = this.context.currentTime + this.listener.timeDelta; t.positionX.linearRampToValueAtTime(fs.x, i), t.positionY.linearRampToValueAtTime(fs.y, i), t.positionZ.linearRampToValueAtTime(fs.z, i), t.orientationX.linearRampToValueAtTime(ps.x, i), t.orientationY.linearRampToValueAtTime(ps.y, i), t.orientationZ.linearRampToValueAtTime(ps.z, i); } else t.setPosition(fs.x, fs.y, fs.z), t.setOrientation(ps.x, ps.y, ps.z); } } class lw { constructor(e, t = 2048) { this.analyser = e.context.createAnalyser(), this.analyser.fftSize = t, this.data = new Uint8Array(this.analyser.frequencyBinCount), e.getOutput().connect(this.analyser); } getFrequencyData() { return this.analyser.getByteFrequencyData(this.data), this.data; } getAverageFrequency() { let e = 0; const t = this.getFrequencyData(); for (let i = 0; i < t.length; i++) e += t[i]; return e / t.length; } } class cw { constructor(e, t, i) { this.binding = e, this.valueSize = i; let r, s, o; switch (t) { case "quaternion": r = this._slerp, s = this._slerpAdditive, o = this._setAdditiveIdentityQuaternion, this.buffer = new Float64Array(i * 6), this._workIndex = 5; break; case "string": case "bool": r = this._select, s = this._select, o = this._setAdditiveIdentityOther, this.buffer = new Array(i * 5); break; default: r = this._lerp, s = this._lerpAdditive, o = this._setAdditiveIdentityNumeric, this.buffer = new Float64Array(i * 5); } this._mixBufferRegion = r, this._mixBufferRegionAdditive = s, this._setIdentity = o, this._origIndex = 3, this._addIndex = 4, this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, this.useCount = 0, this.referenceCount = 0; } // accumulate data in the 'incoming' region into 'accu' accumulate(e, t) { const i = this.buffer, r = this.valueSize, s = e * r + r; let o = this.cumulativeWeight; if (o === 0) { for (let a = 0; a !== r; ++a) i[s + a] = i[a]; o = t; } else { o += t; const a = t / o; this._mixBufferRegion(i, s, 0, a, r); } this.cumulativeWeight = o; } // accumulate data in the 'incoming' region into 'add' accumulateAdditive(e) { const t = this.buffer, i = this.valueSize, r = i * this._addIndex; this.cumulativeWeightAdditive === 0 && this._setIdentity(), this._mixBufferRegionAdditive(t, r, 0, e, i), this.cumulativeWeightAdditive += e; } // apply the state of 'accu' to the binding when accus differ apply(e) { const t = this.valueSize, i = this.buffer, r = e * t + t, s = this.cumulativeWeight, o = this.cumulativeWeightAdditive, a = this.binding; if (this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, s < 1) { const c = t * this._origIndex; this._mixBufferRegion( i, r, c, 1 - s, t ); } o > 0 && this._mixBufferRegionAdditive(i, r, this._addIndex * t, 1, t); for (let c = t, l = t + t; c !== l; ++c) if (i[c] !== i[c + t]) { a.setValue(i, r); break; } } // remember the state of the bound property and copy it to both accus saveOriginalState() { const e = this.binding, t = this.buffer, i = this.valueSize, r = i * this._origIndex; e.getValue(t, r); for (let s = i, o = r; s !== o; ++s) t[s] = t[r + s % i]; this._setIdentity(), this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0; } // apply the state previously taken via 'saveOriginalState' to the binding restoreOriginalState() { const e = this.valueSize * 3; this.binding.setValue(this.buffer, e); } _setAdditiveIdentityNumeric() { const e = this._addIndex * this.valueSize, t = e + this.valueSize; for (let i = e; i < t; i++) this.buffer[i] = 0; } _setAdditiveIdentityQuaternion() { this._setAdditiveIdentityNumeric(), this.buffer[this._addIndex * this.valueSize + 3] = 1; } _setAdditiveIdentityOther() { const e = this._origIndex * this.valueSize, t = this._addIndex * this.valueSize; for (let i = 0; i < this.valueSize; i++) this.buffer[t + i] = this.buffer[e + i]; } // mix functions _select(e, t, i, r, s) { if (r >= 0.5) for (let o = 0; o !== s; ++o) e[t + o] = e[i + o]; } _slerp(e, t, i, r) { Sn.slerpFlat(e, t, e, t, e, i, r); } _slerpAdditive(e, t, i, r, s) { const o = this._workIndex * s; Sn.multiplyQuaternionsFlat(e, o, e, t, e, i), Sn.slerpFlat(e, t, e, t, e, o, r); } _lerp(e, t, i, r, s) { const o = 1 - r; for (let a = 0; a !== s; ++a) { const c = t + a; e[c] = e[c] * o + e[i + a] * r; } } _lerpAdditive(e, t, i, r, s) { for (let o = 0; o !== s; ++o) { const a = t + o; e[a] = e[a] + e[i + o] * r; } } } const Op = "\\[\\]\\.:\\/", EF = new RegExp("[" + Op + "]", "g"), Dp = "[^" + Op + "]", AF = "[^" + Op.replace("\\.", "") + "]", CF = /((?:WC+[\/:])*)/.source.replace("WC", Dp), LF = /(WCOD+)?/.source.replace("WCOD", AF), RF = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", Dp), PF = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", Dp), IF = new RegExp( "^" + CF + LF + RF + PF + "$" ), OF = ["material", "materials", "bones"]; class DF { constructor(e, t, i) { const r = i || ft.parseTrackName(t); this._targetGroup = e, this._bindings = e.subscribe_(t, r); } getValue(e, t) { this.bind(); const i = this._targetGroup.nCachedObjects_, r = this._bindings[i]; r !== void 0 && r.getValue(e, t); } setValue(e, t) { const i = this._bindings; for (let r = this._targetGroup.nCachedObjects_, s = i.length; r !== s; ++r) i[r].setValue(e, t); } bind() { const e = this._bindings; for (let t = this._targetGroup.nCachedObjects_, i = e.length; t !== i; ++t) e[t].bind(); } unbind() { const e = this._bindings; for (let t = this._targetGroup.nCachedObjects_, i = e.length; t !== i; ++t) e[t].unbind(); } } class ft { constructor(e, t, i) { this.path = t, this.parsedPath = i || ft.parseTrackName(t), this.node = ft.findNode(e, this.parsedPath.nodeName) || e, this.rootNode = e, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound; } static create(e, t, i) { return e && e.isAnimationObjectGroup ? new ft.Composite(e, t, i) : new ft(e, t, i); } /** * Replaces spaces with underscores and removes unsupported characters from * node names, to ensure compatibility with parseTrackName(). * * @param {string} name Node name to be sanitized. * @return {string} */ static sanitizeNodeName(e) { return e.replace(/\s/g, "_").replace(EF, ""); } static parseTrackName(e) { const t = IF.exec(e); if (!t) throw new Error("PropertyBinding: Cannot parse trackName: " + e); const i = { // directoryName: matches[ 1 ], // (tschw) currently unused nodeName: t[2], objectName: t[3], objectIndex: t[4], propertyName: t[5], // required propertyIndex: t[6] }, r = i.nodeName && i.nodeName.lastIndexOf("."); if (r !== void 0 && r !== -1) { const s = i.nodeName.substring(r + 1); OF.indexOf(s) !== -1 && (i.nodeName = i.nodeName.substring(0, r), i.objectName = s); } if (i.propertyName === null || i.propertyName.length === 0) throw new Error("PropertyBinding: can not parse propertyName from trackName: " + e); return i; } static findNode(e, t) { if (!t || t === "" || t === "." || t === -1 || t === e.name || t === e.uuid) return e; if (e.skeleton) { const i = e.skeleton.getBoneByName(t); if (i !== void 0) return i; } if (e.children) { const i = function(s) { for (let o = 0; o < s.length; o++) { const a = s[o]; if (a.name === t || a.uuid === t) return a; const c = i(a.children); if (c) return c; } return null; }, r = i(e.children); if (r) return r; } return null; } // these are used to "bind" a nonexistent property _getValue_unavailable() { } _setValue_unavailable() { } // Getters _getValue_direct(e, t) { e[t] = this.node[this.propertyName]; } _getValue_array(e, t) { const i = this.resolvedProperty; for (let r = 0, s = i.length; r !== s; ++r) e[t++] = i[r]; } _getValue_arrayElement(e, t) { e[t] = this.resolvedProperty[this.propertyIndex]; } _getValue_toArray(e, t) { this.resolvedProperty.toArray(e, t); } // Direct _setValue_direct(e, t) { this.targetObject[this.propertyName] = e[t]; } _setValue_direct_setNeedsUpdate(e, t) { this.targetObject[this.propertyName] = e[t], this.targetObject.needsUpdate = !0; } _setValue_direct_setMatrixWorldNeedsUpdate(e, t) { this.targetObject[this.propertyName] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0; } // EntireArray _setValue_array(e, t) { const i = this.resolvedProperty; for (let r = 0, s = i.length; r !== s; ++r) i[r] = e[t++]; } _setValue_array_setNeedsUpdate(e, t) { const i = this.resolvedProperty; for (let r = 0, s = i.length; r !== s; ++r) i[r] = e[t++]; this.targetObject.needsUpdate = !0; } _setValue_array_setMatrixWorldNeedsUpdate(e, t) { const i = this.resolvedProperty; for (let r = 0, s = i.length; r !== s; ++r) i[r] = e[t++]; this.targetObject.matrixWorldNeedsUpdate = !0; } // ArrayElement _setValue_arrayElement(e, t) { this.resolvedProperty[this.propertyIndex] = e[t]; } _setValue_arrayElement_setNeedsUpdate(e, t) { this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.needsUpdate = !0; } _setValue_arrayElement_setMatrixWorldNeedsUpdate(e, t) { this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0; } // HasToFromArray _setValue_fromArray(e, t) { this.resolvedProperty.fromArray(e, t); } _setValue_fromArray_setNeedsUpdate(e, t) { this.resolvedProperty.fromArray(e, t), this.targetObject.needsUpdate = !0; } _setValue_fromArray_setMatrixWorldNeedsUpdate(e, t) { this.resolvedProperty.fromArray(e, t), this.targetObject.matrixWorldNeedsUpdate = !0; } _getValue_unbound(e, t) { this.bind(), this.getValue(e, t); } _setValue_unbound(e, t) { this.bind(), this.setValue(e, t); } // create getter / setter pair for a property in the scene graph bind() { let e = this.node; const t = this.parsedPath, i = t.objectName, r = t.propertyName; let s = t.propertyIndex; if (e || (e = ft.findNode(this.rootNode, t.nodeName) || this.rootNode, this.node = e), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, !e) { console.error("THREE.PropertyBinding: Trying to update node for track: " + this.path + " but it wasn't found."); return; } if (i) { let l = t.objectIndex; switch (i) { case "materials": if (!e.material) { console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); return; } if (!e.material.materials) { console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this); return; } e = e.material.materials; break; case "bones": if (!e.skeleton) { console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this); return; } e = e.skeleton.bones; for (let d = 0; d < e.length; d++) if (e[d].name === l) { l = d; break; } break; default: if (e[i] === void 0) { console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this); return; } e = e[i]; } if (l !== void 0) { if (e[l] === void 0) { console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, e); return; } e = e[l]; } } const o = e[r]; if (o === void 0) { const l = t.nodeName; console.error("THREE.PropertyBinding: Trying to update property for track: " + l + "." + r + " but it wasn't found.", e); return; } let a = this.Versioning.None; this.targetObject = e, e.needsUpdate !== void 0 ? a = this.Versioning.NeedsUpdate : e.matrixWorldNeedsUpdate !== void 0 && (a = this.Versioning.MatrixWorldNeedsUpdate); let c = this.BindingType.Direct; if (s !== void 0) { if (r === "morphTargetInfluences") { if (!e.geometry) { console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this); return; } if (e.geometry.isBufferGeometry) { if (!e.geometry.morphAttributes) { console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this); return; } e.morphTargetDictionary[s] !== void 0 && (s = e.morphTargetDictionary[s]); } else { console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.", this); return; } } c = this.BindingType.ArrayElement, this.resolvedProperty = o, this.propertyIndex = s; } else o.fromArray !== void 0 && o.toArray !== void 0 ? (c = this.BindingType.HasFromToArray, this.resolvedProperty = o) : Array.isArray(o) ? (c = this.BindingType.EntireArray, this.resolvedProperty = o) : this.propertyName = r; this.getValue = this.GetterByBindingType[c], this.setValue = this.SetterByBindingTypeAndVersioning[c][a]; } unbind() { this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound; } } ft.Composite = DF; ft.prototype.BindingType = { Direct: 0, EntireArray: 1, ArrayElement: 2, HasFromToArray: 3 }; ft.prototype.Versioning = { None: 0, NeedsUpdate: 1, MatrixWorldNeedsUpdate: 2 }; ft.prototype.GetterByBindingType = [ ft.prototype._getValue_direct, ft.prototype._getValue_array, ft.prototype._getValue_arrayElement, ft.prototype._getValue_toArray ]; ft.prototype.SetterByBindingTypeAndVersioning = [ [ // Direct ft.prototype._setValue_direct, ft.prototype._setValue_direct_setNeedsUpdate, ft.prototype._setValue_direct_setMatrixWorldNeedsUpdate ], [ // EntireArray ft.prototype._setValue_array, ft.prototype._setValue_array_setNeedsUpdate, ft.prototype._setValue_array_setMatrixWorldNeedsUpdate ], [ // ArrayElement ft.prototype._setValue_arrayElement, ft.prototype._setValue_arrayElement_setNeedsUpdate, ft.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate ], [ // HasToFromArray ft.prototype._setValue_fromArray, ft.prototype._setValue_fromArray_setNeedsUpdate, ft.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate ] ]; class uw { constructor() { this.uuid = Jn(), this._objects = Array.prototype.slice.call(arguments), this.nCachedObjects_ = 0; const e = {}; this._indicesByUUID = e; for (let i = 0, r = arguments.length; i !== r; ++i) e[arguments[i].uuid] = i; this._paths = [], this._parsedPaths = [], this._bindings = [], this._bindingsIndicesByPath = {}; const t = this; this.stats = { objects: { get total() { return t._objects.length; }, get inUse() { return this.total - t.nCachedObjects_; } }, get bindingsPerObject() { return t._bindings.length; } }; } add() { const e = this._objects, t = this._indicesByUUID, i = this._paths, r = this._parsedPaths, s = this._bindings, o = s.length; let a, c = e.length, l = this.nCachedObjects_; for (let d = 0, h = arguments.length; d !== h; ++d) { const p = arguments[d], g = p.uuid; let f = t[g]; if (f === void 0) { f = c++, t[g] = f, e.push(p); for (let u = 0, y = o; u !== y; ++u) s[u].push(new ft(p, i[u], r[u])); } else if (f < l) { a = e[f]; const u = --l, y = e[u]; t[y.uuid] = f, e[f] = y, t[g] = u, e[u] = p; for (let v = 0, m = o; v !== m; ++v) { const w = s[v], S = w[u]; let T = w[f]; w[f] = S, T === void 0 && (T = new ft(p, i[v], r[v])), w[u] = T; } } else e[f] !== a && console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes."); } this.nCachedObjects_ = l; } remove() { const e = this._objects, t = this._indicesByUUID, i = this._bindings, r = i.length; let s = this.nCachedObjects_; for (let o = 0, a = arguments.length; o !== a; ++o) { const c = arguments[o], l = c.uuid, d = t[l]; if (d !== void 0 && d >= s) { const h = s++, p = e[h]; t[p.uuid] = d, e[d] = p, t[l] = h, e[h] = c; for (let g = 0, f = r; g !== f; ++g) { const u = i[g], y = u[h], v = u[d]; u[d] = y, u[h] = v; } } } this.nCachedObjects_ = s; } // remove & forget uncache() { const e = this._objects, t = this._indicesByUUID, i = this._bindings, r = i.length; let s = this.nCachedObjects_, o = e.length; for (let a = 0, c = arguments.length; a !== c; ++a) { const l = arguments[a], d = l.uuid, h = t[d]; if (h !== void 0) if (delete t[d], h < s) { const p = --s, g = e[p], f = --o, u = e[f]; t[g.uuid] = h, e[h] = g, t[u.uuid] = p, e[p] = u, e.pop(); for (let y = 0, v = r; y !== v; ++y) { const m = i[y], w = m[p], S = m[f]; m[h] = w, m[p] = S, m.pop(); } } else { const p = --o, g = e[p]; p > 0 && (t[g.uuid] = h), e[h] = g, e.pop(); for (let f = 0, u = r; f !== u; ++f) { const y = i[f]; y[h] = y[p], y.pop(); } } } this.nCachedObjects_ = s; } // Internal interface used by befriended PropertyBinding.Composite: subscribe_(e, t) { const i = this._bindingsIndicesByPath; let r = i[e]; const s = this._bindings; if (r !== void 0) return s[r]; const o = this._paths, a = this._parsedPaths, c = this._objects, l = c.length, d = this.nCachedObjects_, h = new Array(l); r = s.length, i[e] = r, o.push(e), a.push(t), s.push(h); for (let p = d, g = c.length; p !== g; ++p) { const f = c[p]; h[p] = new ft(f, e, t); } return h; } unsubscribe_(e) { const t = this._bindingsIndicesByPath, i = t[e]; if (i !== void 0) { const r = this._paths, s = this._parsedPaths, o = this._bindings, a = o.length - 1, c = o[a], l = e[a]; t[l] = i, o[i] = c, o.pop(), s[i] = s[a], s.pop(), r[i] = r[a], r.pop(); } } } uw.prototype.isAnimationObjectGroup = !0; class NF { constructor(e, t, i = null, r = t.blendMode) { this._mixer = e, this._clip = t, this._localRoot = i, this.blendMode = r; const s = t.tracks, o = s.length, a = new Array(o), c = { endingStart: xs, endingEnd: xs }; for (let l = 0; l !== o; ++l) { const d = s[l].createInterpolant(null); a[l] = d, d.settings = c; } this._interpolantSettings = c, this._interpolants = a, this._propertyBindings = new Array(o), this._cacheIndex = null, this._byClipCacheIndex = null, this._timeScaleInterpolant = null, this._weightInterpolant = null, this.loop = ix, this._loopCount = -1, this._startTime = null, this.time = 0, this.timeScale = 1, this._effectiveTimeScale = 1, this.weight = 1, this._effectiveWeight = 1, this.repetitions = 1 / 0, this.paused = !1, this.enabled = !0, this.clampWhenFinished = !1, this.zeroSlopeAtStart = !0, this.zeroSlopeAtEnd = !0; } // State & Scheduling play() { return this._mixer._activateAction(this), this; } stop() { return this._mixer._deactivateAction(this), this.reset(); } reset() { return this.paused = !1, this.enabled = !0, this.time = 0, this._loopCount = -1, this._startTime = null, this.stopFading().stopWarping(); } isRunning() { return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this); } // return true when play has been called isScheduled() { return this._mixer._isActiveAction(this); } startAt(e) { return this._startTime = e, this; } setLoop(e, t) { return this.loop = e, this.repetitions = t, this; } // Weight // set the weight stopping any scheduled fading // although .enabled = false yields an effective weight of zero, this // method does *not* change .enabled, because it would be confusing setEffectiveWeight(e) { return this.weight = e, this._effectiveWeight = this.enabled ? e : 0, this.stopFading(); } // return the weight considering fading and .enabled getEffectiveWeight() { return this._effectiveWeight; } fadeIn(e) { return this._scheduleFading(e, 0, 1); } fadeOut(e) { return this._scheduleFading(e, 1, 0); } crossFadeFrom(e, t, i) { if (e.fadeOut(t), this.fadeIn(t), i) { const r = this._clip.duration, s = e._clip.duration, o = s / r, a = r / s; e.warp(1, o, t), this.warp(a, 1, t); } return this; } crossFadeTo(e, t, i) { return e.crossFadeFrom(this, t, i); } stopFading() { const e = this._weightInterpolant; return e !== null && (this._weightInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this; } // Time Scale Control // set the time scale stopping any scheduled warping // although .paused = true yields an effective time scale of zero, this // method does *not* change .paused, because it would be confusing setEffectiveTimeScale(e) { return this.timeScale = e, this._effectiveTimeScale = this.paused ? 0 : e, this.stopWarping(); } // return the time scale considering warping and .paused getEffectiveTimeScale() { return this._effectiveTimeScale; } setDuration(e) { return this.timeScale = this._clip.duration / e, this.stopWarping(); } syncWith(e) { return this.time = e.time, this.timeScale = e.timeScale, this.stopWarping(); } halt(e) { return this.warp(this._effectiveTimeScale, 0, e); } warp(e, t, i) { const r = this._mixer, s = r.time, o = this.timeScale; let a = this._timeScaleInterpolant; a === null && (a = r._lendControlInterpolant(), this._timeScaleInterpolant = a); const c = a.parameterPositions, l = a.sampleValues; return c[0] = s, c[1] = s + i, l[0] = e / o, l[1] = t / o, this; } stopWarping() { const e = this._timeScaleInterpolant; return e !== null && (this._timeScaleInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this; } // Object Accessors getMixer() { return this._mixer; } getClip() { return this._clip; } getRoot() { return this._localRoot || this._mixer._root; } // Interna _update(e, t, i, r) { if (!this.enabled) { this._updateWeight(e); return; } const s = this._startTime; if (s !== null) { const c = (e - s) * i; if (c < 0 || i === 0) return; this._startTime = null, t = i * c; } t *= this._updateTimeScale(e); const o = this._updateTime(t), a = this._updateWeight(e); if (a > 0) { const c = this._interpolants, l = this._propertyBindings; switch (this.blendMode) { case Wf: for (let d = 0, h = c.length; d !== h; ++d) c[d].evaluate(o), l[d].accumulateAdditive(a); break; case Eu: default: for (let d = 0, h = c.length; d !== h; ++d) c[d].evaluate(o), l[d].accumulate(r, a); } } } _updateWeight(e) { let t = 0; if (this.enabled) { t = this.weight; const i = this._weightInterpolant; if (i !== null) { const r = i.evaluate(e)[0]; t *= r, e > i.parameterPositions[1] && (this.stopFading(), r === 0 && (this.enabled = !1)); } } return this._effectiveWeight = t, t; } _updateTimeScale(e) { let t = 0; if (!this.paused) { t = this.timeScale; const i = this._timeScaleInterpolant; if (i !== null) { const r = i.evaluate(e)[0]; t *= r, e > i.parameterPositions[1] && (this.stopWarping(), t === 0 ? this.paused = !0 : this.timeScale = t); } } return this._effectiveTimeScale = t, t; } _updateTime(e) { const t = this._clip.duration, i = this.loop; let r = this.time + e, s = this._loopCount; const o = i === rx; if (e === 0) return s === -1 ? r : o && (s & 1) === 1 ? t - r : r; if (i === nx) { s === -1 && (this._loopCount = 0, this._setEndings(!0, !0, !1)); e: { if (r >= t) r = t; else if (r < 0) r = 0; else { this.time = r; break e; } this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, this.time = r, this._mixer.dispatchEvent({ type: "finished", action: this, direction: e < 0 ? -1 : 1 }); } } else { if (s === -1 && (e >= 0 ? (s = 0, this._setEndings(!0, this.repetitions === 0, o)) : this._setEndings(this.repetitions === 0, !0, o)), r >= t || r < 0) { const a = Math.floor(r / t); r -= t * a, s += Math.abs(a); const c = this.repetitions - s; if (c <= 0) this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, r = e > 0 ? t : 0, this.time = r, this._mixer.dispatchEvent({ type: "finished", action: this, direction: e > 0 ? 1 : -1 }); else { if (c === 1) { const l = e < 0; this._setEndings(l, !l, o); } else this._setEndings(!1, !1, o); this._loopCount = s, this.time = r, this._mixer.dispatchEvent({ type: "loop", action: this, loopDelta: a }); } } else this.time = r; if (o && (s & 1) === 1) return t - r; } return r; } _setEndings(e, t, i) { const r = this._interpolantSettings; i ? (r.endingStart = ws, r.endingEnd = ws) : (e ? r.endingStart = this.zeroSlopeAtStart ? ws : xs : r.endingStart = tl, t ? r.endingEnd = this.zeroSlopeAtEnd ? ws : xs : r.endingEnd = tl); } _scheduleFading(e, t, i) { const r = this._mixer, s = r.time; let o = this._weightInterpolant; o === null && (o = r._lendControlInterpolant(), this._weightInterpolant = o); const a = o.parameterPositions, c = o.sampleValues; return a[0] = s, c[0] = t, a[1] = s + e, c[1] = i, this; } } class hw extends ns { constructor(e) { super(), this._root = e, this._initMemoryManager(), this._accuIndex = 0, this.time = 0, this.timeScale = 1; } _bindAction(e, t) { const i = e._localRoot || this._root, r = e._clip.tracks, s = r.length, o = e._propertyBindings, a = e._interpolants, c = i.uuid, l = this._bindingsByRootAndName; let d = l[c]; d === void 0 && (d = {}, l[c] = d); for (let h = 0; h !== s; ++h) { const p = r[h], g = p.name; let f = d[g]; if (f !== void 0) o[h] = f; else { if (f = o[h], f !== void 0) { f._cacheIndex === null && (++f.referenceCount, this._addInactiveBinding(f, c, g)); continue; } const u = t && t._propertyBindings[h].binding.parsedPath; f = new cw( ft.create(i, g, u), p.ValueTypeName, p.getValueSize() ), ++f.referenceCount, this._addInactiveBinding(f, c, g), o[h] = f; } a[h].resultBuffer = f.buffer; } } _activateAction(e) { if (!this._isActiveAction(e)) { if (e._cacheIndex === null) { const i = (e._localRoot || this._root).uuid, r = e._clip.uuid, s = this._actionsByClip[r]; this._bindAction( e, s && s.knownActions[0] ), this._addInactiveAction(e, r, i); } const t = e._propertyBindings; for (let i = 0, r = t.length; i !== r; ++i) { const s = t[i]; s.useCount++ === 0 && (this._lendBinding(s), s.saveOriginalState()); } this._lendAction(e); } } _deactivateAction(e) { if (this._isActiveAction(e)) { const t = e._propertyBindings; for (let i = 0, r = t.length; i !== r; ++i) { const s = t[i]; --s.useCount === 0 && (s.restoreOriginalState(), this._takeBackBinding(s)); } this._takeBackAction(e); } } // Memory manager _initMemoryManager() { this._actions = [], this._nActiveActions = 0, this._actionsByClip = {}, this._bindings = [], this._nActiveBindings = 0, this._bindingsByRootAndName = {}, this._controlInterpolants = [], this._nActiveControlInterpolants = 0; const e = this; this.stats = { actions: { get total() { return e._actions.length; }, get inUse() { return e._nActiveActions; } }, bindings: { get total() { return e._bindings.length; }, get inUse() { return e._nActiveBindings; } }, controlInterpolants: { get total() { return e._controlInterpolants.length; }, get inUse() { return e._nActiveControlInterpolants; } } }; } // Memory management for AnimationAction objects _isActiveAction(e) { const t = e._cacheIndex; return t !== null && t < this._nActiveActions; } _addInactiveAction(e, t, i) { const r = this._actions, s = this._actionsByClip; let o = s[t]; if (o === void 0) o = { knownActions: [e], actionByRoot: {} }, e._byClipCacheIndex = 0, s[t] = o; else { const a = o.knownActions; e._byClipCacheIndex = a.length, a.push(e); } e._cacheIndex = r.length, r.push(e), o.actionByRoot[i] = e; } _removeInactiveAction(e) { const t = this._actions, i = t[t.length - 1], r = e._cacheIndex; i._cacheIndex = r, t[r] = i, t.pop(), e._cacheIndex = null; const s = e._clip.uuid, o = this._actionsByClip, a = o[s], c = a.knownActions, l = c[c.length - 1], d = e._byClipCacheIndex; l._byClipCacheIndex = d, c[d] = l, c.pop(), e._byClipCacheIndex = null; const h = a.actionByRoot, p = (e._localRoot || this._root).uuid; delete h[p], c.length === 0 && delete o[s], this._removeInactiveBindingsForAction(e); } _removeInactiveBindingsForAction(e) { const t = e._propertyBindings; for (let i = 0, r = t.length; i !== r; ++i) { const s = t[i]; --s.referenceCount === 0 && this._removeInactiveBinding(s); } } _lendAction(e) { const t = this._actions, i = e._cacheIndex, r = this._nActiveActions++, s = t[r]; e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s; } _takeBackAction(e) { const t = this._actions, i = e._cacheIndex, r = --this._nActiveActions, s = t[r]; e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s; } // Memory management for PropertyMixer objects _addInactiveBinding(e, t, i) { const r = this._bindingsByRootAndName, s = this._bindings; let o = r[t]; o === void 0 && (o = {}, r[t] = o), o[i] = e, e._cacheIndex = s.length, s.push(e); } _removeInactiveBinding(e) { const t = this._bindings, i = e.binding, r = i.rootNode.uuid, s = i.path, o = this._bindingsByRootAndName, a = o[r], c = t[t.length - 1], l = e._cacheIndex; c._cacheIndex = l, t[l] = c, t.pop(), delete a[s], Object.keys(a).length === 0 && delete o[r]; } _lendBinding(e) { const t = this._bindings, i = e._cacheIndex, r = this._nActiveBindings++, s = t[r]; e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s; } _takeBackBinding(e) { const t = this._bindings, i = e._cacheIndex, r = --this._nActiveBindings, s = t[r]; e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s; } // Memory management of Interpolants for weight and time scale _lendControlInterpolant() { const e = this._controlInterpolants, t = this._nActiveControlInterpolants++; let i = e[t]; return i === void 0 && (i = new yp( new Float32Array(2), new Float32Array(2), 1, this._controlInterpolantsResultBuffer ), i.__cacheIndex = t, e[t] = i), i; } _takeBackControlInterpolant(e) { const t = this._controlInterpolants, i = e.__cacheIndex, r = --this._nActiveControlInterpolants, s = t[r]; e.__cacheIndex = r, t[r] = e, s.__cacheIndex = i, t[i] = s; } // return an action for a clip optionally using a custom root target // object (this method allocates a lot of dynamic memory in case a // previously unknown clip/root combination is specified) clipAction(e, t, i) { const r = t || this._root, s = r.uuid; let o = typeof e == "string" ? Qo.findByName(r, e) : e; const a = o !== null ? o.uuid : e, c = this._actionsByClip[a]; let l = null; if (i === void 0 && (o !== null ? i = o.blendMode : i = Eu), c !== void 0) { const h = c.actionByRoot[s]; if (h !== void 0 && h.blendMode === i) return h; l = c.knownActions[0], o === null && (o = l._clip); } if (o === null) return null; const d = new NF(this, o, t, i); return this._bindAction(d, l), this._addInactiveAction(d, a, s), d; } // get an existing action existingAction(e, t) { const i = t || this._root, r = i.uuid, s = typeof e == "string" ? Qo.findByName(i, e) : e, o = s ? s.uuid : e, a = this._actionsByClip[o]; return a !== void 0 && a.actionByRoot[r] || null; } // deactivates all previously scheduled actions stopAllAction() { const e = this._actions, t = this._nActiveActions; for (let i = t - 1; i >= 0; --i) e[i].stop(); return this; } // advance the time and update apply the animation update(e) { e *= this.timeScale; const t = this._actions, i = this._nActiveActions, r = this.time += e, s = Math.sign(e), o = this._accuIndex ^= 1; for (let l = 0; l !== i; ++l) t[l]._update(r, e, s, o); const a = this._bindings, c = this._nActiveBindings; for (let l = 0; l !== c; ++l) a[l].apply(o); return this; } // Allows you to seek to a specific time in an animation. setTime(e) { this.time = 0; for (let t = 0; t < this._actions.length; t++) this._actions[t].time = 0; return this.update(e); } // return this mixer's root target object getRoot() { return this._root; } // free all resources specific to a particular clip uncacheClip(e) { const t = this._actions, i = e.uuid, r = this._actionsByClip, s = r[i]; if (s !== void 0) { const o = s.knownActions; for (let a = 0, c = o.length; a !== c; ++a) { const l = o[a]; this._deactivateAction(l); const d = l._cacheIndex, h = t[t.length - 1]; l._cacheIndex = null, l._byClipCacheIndex = null, h._cacheIndex = d, t[d] = h, t.pop(), this._removeInactiveBindingsForAction(l); } delete r[i]; } } // free all resources specific to a particular root target object uncacheRoot(e) { const t = e.uuid, i = this._actionsByClip; for (const o in i) { const a = i[o].actionByRoot, c = a[t]; c !== void 0 && (this._deactivateAction(c), this._removeInactiveAction(c)); } const r = this._bindingsByRootAndName, s = r[t]; if (s !== void 0) for (const o in s) { const a = s[o]; a.restoreOriginalState(), this._removeInactiveBinding(a); } } // remove a targeted clip from the cache uncacheAction(e, t) { const i = this.existingAction(e, t); i !== null && (this._deactivateAction(i), this._removeInactiveAction(i)); } } hw.prototype._controlInterpolantsResultBuffer = new Float32Array(1); class Wu { constructor(e) { typeof e == "string" && (console.warn("THREE.Uniform: Type parameter is no longer needed."), e = arguments[1]), this.value = e; } clone() { return new Wu(this.value.clone === void 0 ? this.value : this.value.clone()); } } class dw extends rs { constructor(e, t, i = 1) { super(e, t), this.meshPerAttribute = i; } copy(e) { return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this; } clone(e) { const t = super.clone(e); return t.meshPerAttribute = this.meshPerAttribute, t; } toJSON(e) { const t = super.toJSON(e); return t.isInstancedInterleavedBuffer = !0, t.meshPerAttribute = this.meshPerAttribute, t; } } dw.prototype.isInstancedInterleavedBuffer = !0; class fw { constructor(e, t, i, r, s) { this.buffer = e, this.type = t, this.itemSize = i, this.elementSize = r, this.count = s, this.version = 0; } set needsUpdate(e) { e === !0 && this.version++; } setBuffer(e) { return this.buffer = e, this; } setType(e, t) { return this.type = e, this.elementSize = t, this; } setItemSize(e) { return this.itemSize = e, this; } setCount(e) { return this.count = e, this; } } fw.prototype.isGLBufferAttribute = !0; class FF { constructor(e, t, i = 0, r = 1 / 0) { this.ray = new is(e, t), this.near = i, this.far = r, this.camera = null, this.layers = new qf(), this.params = { Mesh: {}, Line: { threshold: 1 }, LOD: {}, Points: { threshold: 1 }, Sprite: {} }; } set(e, t) { this.ray.set(e, t); } setFromCamera(e, t) { t && t.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(t.matrixWorld), this.ray.direction.set(e.x, e.y, 0.5).unproject(t).sub(this.ray.origin).normalize(), this.camera = t) : t && t.isOrthographicCamera ? (this.ray.origin.set(e.x, e.y, (t.near + t.far) / (t.near - t.far)).unproject(t), this.ray.direction.set(0, 0, -1).transformDirection(t.matrixWorld), this.camera = t) : console.error("THREE.Raycaster: Unsupported camera type: " + t.type); } intersectObject(e, t = !1, i = []) { return kd(e, this, i, t), i.sort(bv), i; } intersectObjects(e, t = !1, i = []) { for (let r = 0, s = e.length; r < s; r++) kd(e[r], this, i, t); return i.sort(bv), i; } } function bv(n, e) { return n.distance - e.distance; } function kd(n, e, t, i) { if (n.layers.test(e.layers) && n.raycast(e, t), i === !0) { const r = n.children; for (let s = 0, o = r.length; s < o; s++) kd(r[s], e, t, !0); } } class BF { constructor(e = 1, t = 0, i = 0) { return this.radius = e, this.phi = t, this.theta = i, this; } set(e, t, i) { return this.radius = e, this.phi = t, this.theta = i, this; } copy(e) { return this.radius = e.radius, this.phi = e.phi, this.theta = e.theta, this; } // restrict phi to be betwee EPS and PI-EPS makeSafe() { return this.phi = Math.max(1e-6, Math.min(Math.PI - 1e-6, this.phi)), this; } setFromVector3(e) { return this.setFromCartesianCoords(e.x, e.y, e.z); } setFromCartesianCoords(e, t, i) { return this.radius = Math.sqrt(e * e + t * t + i * i), this.radius === 0 ? (this.theta = 0, this.phi = 0) : (this.theta = Math.atan2(e, i), this.phi = Math.acos(wn(t / this.radius, -1, 1))), this; } clone() { return new this.constructor().copy(this); } } class zF { constructor(e = 1, t = 0, i = 0) { return this.radius = e, this.theta = t, this.y = i, this; } set(e, t, i) { return this.radius = e, this.theta = t, this.y = i, this; } copy(e) { return this.radius = e.radius, this.theta = e.theta, this.y = e.y, this; } setFromVector3(e) { return this.setFromCartesianCoords(e.x, e.y, e.z); } setFromCartesianCoords(e, t, i) { return this.radius = Math.sqrt(e * e + i * i), this.theta = Math.atan2(e, i), this.y = t, this; } clone() { return new this.constructor().copy(this); } } const xv = /* @__PURE__ */ new Pe(); class pa { constructor(e = new Pe(1 / 0, 1 / 0), t = new Pe(-1 / 0, -1 / 0)) { this.min = e, this.max = t; } set(e, t) { return this.min.copy(e), this.max.copy(t), this; } setFromPoints(e) { this.makeEmpty(); for (let t = 0, i = e.length; t < i; t++) this.expandByPoint(e[t]); return this; } setFromCenterAndSize(e, t) { const i = xv.copy(t).multiplyScalar(0.5); return this.min.copy(e).sub(i), this.max.copy(e).add(i), this; } clone() { return new this.constructor().copy(this); } copy(e) { return this.min.copy(e.min), this.max.copy(e.max), this; } makeEmpty() { return this.min.x = this.min.y = 1 / 0, this.max.x = this.max.y = -1 / 0, this; } isEmpty() { return this.max.x < this.min.x || this.max.y < this.min.y; } getCenter(e) { return this.isEmpty() ? e.set(0, 0) : e.addVectors(this.min, this.max).multiplyScalar(0.5); } getSize(e) { return this.isEmpty() ? e.set(0, 0) : e.subVectors(this.max, this.min); } expandByPoint(e) { return this.min.min(e), this.max.max(e), this; } expandByVector(e) { return this.min.sub(e), this.max.add(e), this; } expandByScalar(e) { return this.min.addScalar(-e), this.max.addScalar(e), this; } containsPoint(e) { return !(e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y); } containsBox(e) { return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y; } getParameter(e, t) { return t.set( (e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y) ); } intersectsBox(e) { return !(e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y); } clampPoint(e, t) { return t.copy(e).clamp(this.min, this.max); } distanceToPoint(e) { return xv.copy(e).clamp(this.min, this.max).sub(e).length(); } intersect(e) { return this.min.max(e.min), this.max.min(e.max), this; } union(e) { return this.min.min(e.min), this.max.max(e.max), this; } translate(e) { return this.min.add(e), this.max.add(e), this; } equals(e) { return e.min.equals(this.min) && e.max.equals(this.max); } } pa.prototype.isBox2 = !0; const wv = /* @__PURE__ */ new X(), Mc = /* @__PURE__ */ new X(); class pw { constructor(e = new X(), t = new X()) { this.start = e, this.end = t; } set(e, t) { return this.start.copy(e), this.end.copy(t), this; } copy(e) { return this.start.copy(e.start), this.end.copy(e.end), this; } getCenter(e) { return e.addVectors(this.start, this.end).multiplyScalar(0.5); } delta(e) { return e.subVectors(this.end, this.start); } distanceSq() { return this.start.distanceToSquared(this.end); } distance() { return this.start.distanceTo(this.end); } at(e, t) { return this.delta(t).multiplyScalar(e).add(this.start); } closestPointToPointParameter(e, t) { wv.subVectors(e, this.start), Mc.subVectors(this.end, this.start); const i = Mc.dot(Mc); let s = Mc.dot(wv) / i; return t && (s = wn(s, 0, 1)), s; } closestPointToPoint(e, t, i) { const r = this.closestPointToPointParameter(e, t); return this.delta(i).multiplyScalar(r).add(this.start); } applyMatrix4(e) { return this.start.applyMatrix4(e), this.end.applyMatrix4(e), this; } equals(e) { return e.start.equals(this.start) && e.end.equals(this.end); } clone() { return new this.constructor().copy(this); } } class mw extends ot { constructor(e) { super(), this.material = e, this.render = function() { }, this.hasPositions = !1, this.hasNormals = !1, this.hasColors = !1, this.hasUvs = !1, this.positionArray = null, this.normalArray = null, this.colorArray = null, this.uvArray = null, this.count = 0; } } mw.prototype.isImmediateRenderObject = !0; const Mv = /* @__PURE__ */ new X(); class UF extends ot { constructor(e, t) { super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = t; const i = new Je(), r = [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, 1 ]; for (let o = 0, a = 1, c = 32; o < c; o++, a++) { const l = o / c * Math.PI * 2, d = a / c * Math.PI * 2; r.push( Math.cos(l), Math.sin(l), 1, Math.cos(d), Math.sin(d), 1 ); } i.setAttribute("position", new We(r, 3)); const s = new un({ fog: !1, toneMapped: !1 }); this.cone = new Fn(i, s), this.add(this.cone), this.update(); } dispose() { this.cone.geometry.dispose(), this.cone.material.dispose(); } update() { this.light.updateMatrixWorld(); const e = this.light.distance ? this.light.distance : 1e3, t = e * Math.tan(this.light.angle); this.cone.scale.set(t, t, e), Mv.setFromMatrixPosition(this.light.target.matrixWorld), this.cone.lookAt(Mv), this.color !== void 0 ? this.cone.material.color.set(this.color) : this.cone.material.color.copy(this.light.color); } } const Rr = /* @__PURE__ */ new X(), Sc = /* @__PURE__ */ new $e(), Bh = /* @__PURE__ */ new $e(); class gw extends Fn { constructor(e) { const t = vw(e), i = new Je(), r = [], s = [], o = new Fe(0, 0, 1), a = new Fe(0, 1, 0); for (let l = 0; l < t.length; l++) { const d = t[l]; d.parent && d.parent.isBone && (r.push(0, 0, 0), r.push(0, 0, 0), s.push(o.r, o.g, o.b), s.push(a.r, a.g, a.b)); } i.setAttribute("position", new We(r, 3)), i.setAttribute("color", new We(s, 3)); const c = new un({ vertexColors: !0, depthTest: !1, depthWrite: !1, toneMapped: !1, transparent: !0 }); super(i, c), this.type = "SkeletonHelper", this.isSkeletonHelper = !0, this.root = e, this.bones = t, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1; } updateMatrixWorld(e) { const t = this.bones, i = this.geometry, r = i.getAttribute("position"); Bh.copy(this.root.matrixWorld).invert(); for (let s = 0, o = 0; s < t.length; s++) { const a = t[s]; a.parent && a.parent.isBone && (Sc.multiplyMatrices(Bh, a.matrixWorld), Rr.setFromMatrixPosition(Sc), r.setXYZ(o, Rr.x, Rr.y, Rr.z), Sc.multiplyMatrices(Bh, a.parent.matrixWorld), Rr.setFromMatrixPosition(Sc), r.setXYZ(o + 1, Rr.x, Rr.y, Rr.z), o += 2); } i.getAttribute("position").needsUpdate = !0, super.updateMatrixWorld(e); } } function vw(n) { const e = []; n && n.isBone && e.push(n); for (let t = 0; t < n.children.length; t++) e.push.apply(e, vw(n.children[t])); return e; } class VF extends tn { constructor(e, t, i) { const r = new Bs(t, 4, 2), s = new Vn({ wireframe: !0, fog: !1, toneMapped: !1 }); super(r, s), this.light = e, this.light.updateMatrixWorld(), this.color = i, this.type = "PointLightHelper", this.matrix = this.light.matrixWorld, this.matrixAutoUpdate = !1, this.update(); } dispose() { this.geometry.dispose(), this.material.dispose(); } update() { this.color !== void 0 ? this.material.color.set(this.color) : this.material.color.copy(this.light.color); } } const kF = /* @__PURE__ */ new X(), Sv = /* @__PURE__ */ new Fe(), _v = /* @__PURE__ */ new Fe(); class GF extends ot { constructor(e, t, i) { super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = i; const r = new Ns(t); r.rotateY(Math.PI * 0.5), this.material = new Vn({ wireframe: !0, fog: !1, toneMapped: !1 }), this.color === void 0 && (this.material.vertexColors = !0); const s = r.getAttribute("position"), o = new Float32Array(s.count * 3); r.setAttribute("color", new nt(o, 3)), this.add(new tn(r, this.material)), this.update(); } dispose() { this.children[0].geometry.dispose(), this.children[0].material.dispose(); } update() { const e = this.children[0]; if (this.color !== void 0) this.material.color.set(this.color); else { const t = e.geometry.getAttribute("color"); Sv.copy(this.light.color), _v.copy(this.light.groundColor); for (let i = 0, r = t.count; i < r; i++) { const s = i < r / 2 ? Sv : _v; t.setXYZ(i, s.r, s.g, s.b); } t.needsUpdate = !0; } e.lookAt(kF.setFromMatrixPosition(this.light.matrixWorld).negate()); } } class yw extends Fn { constructor(e = 10, t = 10, i = 4473924, r = 8947848) { i = new Fe(i), r = new Fe(r); const s = t / 2, o = e / t, a = e / 2, c = [], l = []; for (let p = 0, g = 0, f = -a; p <= t; p++, f += o) { c.push(-a, 0, f, a, 0, f), c.push(f, 0, -a, f, 0, a); const u = p === s ? i : r; u.toArray(l, g), g += 3, u.toArray(l, g), g += 3, u.toArray(l, g), g += 3, u.toArray(l, g), g += 3; } const d = new Je(); d.setAttribute("position", new We(c, 3)), d.setAttribute("color", new We(l, 3)); const h = new un({ vertexColors: !0, toneMapped: !1 }); super(d, h), this.type = "GridHelper"; } } class HF extends Fn { constructor(e = 10, t = 16, i = 8, r = 64, s = 4473924, o = 8947848) { s = new Fe(s), o = new Fe(o); const a = [], c = []; for (let h = 0; h <= t; h++) { const p = h / t * (Math.PI * 2), g = Math.sin(p) * e, f = Math.cos(p) * e; a.push(0, 0, 0), a.push(g, 0, f); const u = h & 1 ? s : o; c.push(u.r, u.g, u.b), c.push(u.r, u.g, u.b); } for (let h = 0; h <= i; h++) { const p = h & 1 ? s : o, g = e - e / i * h; for (let f = 0; f < r; f++) { let u = f / r * (Math.PI * 2), y = Math.sin(u) * g, v = Math.cos(u) * g; a.push(y, 0, v), c.push(p.r, p.g, p.b), u = (f + 1) / r * (Math.PI * 2), y = Math.sin(u) * g, v = Math.cos(u) * g, a.push(y, 0, v), c.push(p.r, p.g, p.b); } } const l = new Je(); l.setAttribute("position", new We(a, 3)), l.setAttribute("color", new We(c, 3)); const d = new un({ vertexColors: !0, toneMapped: !1 }); super(l, d), this.type = "PolarGridHelper"; } } const Tv = /* @__PURE__ */ new X(), _c = /* @__PURE__ */ new X(), Ev = /* @__PURE__ */ new X(); class WF extends ot { constructor(e, t, i) { super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = i, t === void 0 && (t = 1); let r = new Je(); r.setAttribute("position", new We([ -t, t, 0, t, t, 0, t, -t, 0, -t, -t, 0, -t, t, 0 ], 3)); const s = new un({ fog: !1, toneMapped: !1 }); this.lightPlane = new Ui(r, s), this.add(this.lightPlane), r = new Je(), r.setAttribute("position", new We([0, 0, 0, 0, 0, 1], 3)), this.targetLine = new Ui(r, s), this.add(this.targetLine), this.update(); } dispose() { this.lightPlane.geometry.dispose(), this.lightPlane.material.dispose(), this.targetLine.geometry.dispose(), this.targetLine.material.dispose(); } update() { Tv.setFromMatrixPosition(this.light.matrixWorld), _c.setFromMatrixPosition(this.light.target.matrixWorld), Ev.subVectors(_c, Tv), this.lightPlane.lookAt(_c), this.color !== void 0 ? (this.lightPlane.material.color.set(this.color), this.targetLine.material.color.set(this.color)) : (this.lightPlane.material.color.copy(this.light.color), this.targetLine.material.color.copy(this.light.color)), this.targetLine.lookAt(_c), this.targetLine.scale.z = Ev.length(); } } const Tc = /* @__PURE__ */ new X(), Gt = /* @__PURE__ */ new wl(); class jF extends Fn { constructor(e) { const t = new Je(), i = new un({ color: 16777215, vertexColors: !0, toneMapped: !1 }), r = [], s = [], o = {}, a = new Fe(16755200), c = new Fe(16711680), l = new Fe(43775), d = new Fe(16777215), h = new Fe(3355443); p("n1", "n2", a), p("n2", "n4", a), p("n4", "n3", a), p("n3", "n1", a), p("f1", "f2", a), p("f2", "f4", a), p("f4", "f3", a), p("f3", "f1", a), p("n1", "f1", a), p("n2", "f2", a), p("n3", "f3", a), p("n4", "f4", a), p("p", "n1", c), p("p", "n2", c), p("p", "n3", c), p("p", "n4", c), p("u1", "u2", l), p("u2", "u3", l), p("u3", "u1", l), p("c", "t", d), p("p", "c", h), p("cn1", "cn2", h), p("cn3", "cn4", h), p("cf1", "cf2", h), p("cf3", "cf4", h); function p(f, u, y) { g(f, y), g(u, y); } function g(f, u) { r.push(0, 0, 0), s.push(u.r, u.g, u.b), o[f] === void 0 && (o[f] = []), o[f].push(r.length / 3 - 1); } t.setAttribute("position", new We(r, 3)), t.setAttribute("color", new We(s, 3)), super(t, i), this.type = "CameraHelper", this.camera = e, this.camera.updateProjectionMatrix && this.camera.updateProjectionMatrix(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.pointMap = o, this.update(); } update() { const e = this.geometry, t = this.pointMap, i = 1, r = 1; Gt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse), Yt("c", t, e, Gt, 0, 0, -1), Yt("t", t, e, Gt, 0, 0, 1), Yt("n1", t, e, Gt, -i, -r, -1), Yt("n2", t, e, Gt, i, -r, -1), Yt("n3", t, e, Gt, -i, r, -1), Yt("n4", t, e, Gt, i, r, -1), Yt("f1", t, e, Gt, -i, -r, 1), Yt("f2", t, e, Gt, i, -r, 1), Yt("f3", t, e, Gt, -i, r, 1), Yt("f4", t, e, Gt, i, r, 1), Yt("u1", t, e, Gt, i * 0.7, r * 1.1, -1), Yt("u2", t, e, Gt, -i * 0.7, r * 1.1, -1), Yt("u3", t, e, Gt, 0, r * 2, -1), Yt("cf1", t, e, Gt, -i, 0, 1), Yt("cf2", t, e, Gt, i, 0, 1), Yt("cf3", t, e, Gt, 0, -r, 1), Yt("cf4", t, e, Gt, 0, r, 1), Yt("cn1", t, e, Gt, -i, 0, -1), Yt("cn2", t, e, Gt, i, 0, -1), Yt("cn3", t, e, Gt, 0, -r, -1), Yt("cn4", t, e, Gt, 0, r, -1), e.getAttribute("position").needsUpdate = !0; } dispose() { this.geometry.dispose(), this.material.dispose(); } } function Yt(n, e, t, i, r, s, o) { Tc.set(r, s, o).unproject(i); const a = e[n]; if (a !== void 0) { const c = t.getAttribute("position"); for (let l = 0, d = a.length; l < d; l++) c.setXYZ(a[l], Tc.x, Tc.y, Tc.z); } } const Ec = /* @__PURE__ */ new Hn(); class bw extends Fn { constructor(e, t = 16776960) { const i = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]), r = new Float32Array(8 * 3), s = new Je(); s.setIndex(new nt(i, 1)), s.setAttribute("position", new nt(r, 3)), super(s, new un({ color: t, toneMapped: !1 })), this.object = e, this.type = "BoxHelper", this.matrixAutoUpdate = !1, this.update(); } update(e) { if (e !== void 0 && console.warn("THREE.BoxHelper: .update() has no longer arguments."), this.object !== void 0 && Ec.setFromObject(this.object), Ec.isEmpty()) return; const t = Ec.min, i = Ec.max, r = this.geometry.attributes.position, s = r.array; s[0] = i.x, s[1] = i.y, s[2] = i.z, s[3] = t.x, s[4] = i.y, s[5] = i.z, s[6] = t.x, s[7] = t.y, s[8] = i.z, s[9] = i.x, s[10] = t.y, s[11] = i.z, s[12] = i.x, s[13] = i.y, s[14] = t.z, s[15] = t.x, s[16] = i.y, s[17] = t.z, s[18] = t.x, s[19] = t.y, s[20] = t.z, s[21] = i.x, s[22] = t.y, s[23] = t.z, r.needsUpdate = !0, this.geometry.computeBoundingSphere(); } setFromObject(e) { return this.object = e, this.update(), this; } copy(e) { return Fn.prototype.copy.call(this, e), this.object = e.object, this; } } class $F extends Fn { constructor(e, t = 16776960) { const i = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]), r = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1], s = new Je(); s.setIndex(new nt(i, 1)), s.setAttribute("position", new We(r, 3)), super(s, new un({ color: t, toneMapped: !1 })), this.box = e, this.type = "Box3Helper", this.geometry.computeBoundingSphere(); } updateMatrixWorld(e) { const t = this.box; t.isEmpty() || (t.getCenter(this.position), t.getSize(this.scale), this.scale.multiplyScalar(0.5), super.updateMatrixWorld(e)); } } class ZF extends Ui { constructor(e, t = 1, i = 16776960) { const r = i, s = [1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0], o = new Je(); o.setAttribute("position", new We(s, 3)), o.computeBoundingSphere(), super(o, new un({ color: r, toneMapped: !1 })), this.type = "PlaneHelper", this.plane = e, this.size = t; const a = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1], c = new Je(); c.setAttribute("position", new We(a, 3)), c.computeBoundingSphere(), this.add(new tn(c, new Vn({ color: r, opacity: 0.2, transparent: !0, depthWrite: !1, toneMapped: !1 }))); } updateMatrixWorld(e) { let t = -this.plane.constant; Math.abs(t) < 1e-8 && (t = 1e-8), this.scale.set(0.5 * this.size, 0.5 * this.size, t), this.children[0].material.side = t < 0 ? qt : Xr, this.lookAt(this.plane.normal), super.updateMatrixWorld(e); } } const Av = /* @__PURE__ */ new X(); let Ac, zh; class XF extends ot { // dir is assumed to be normalized constructor(e = new X(0, 0, 1), t = new X(0, 0, 0), i = 1, r = 16776960, s = i * 0.2, o = s * 0.2) { super(), this.type = "ArrowHelper", Ac === void 0 && (Ac = new Je(), Ac.setAttribute("position", new We([0, 0, 0, 0, 1, 0], 3)), zh = new qr(0, 0.5, 1, 5, 1), zh.translate(0, -0.5, 0)), this.position.copy(t), this.line = new Ui(Ac, new un({ color: r, toneMapped: !1 })), this.line.matrixAutoUpdate = !1, this.add(this.line), this.cone = new tn(zh, new Vn({ color: r, toneMapped: !1 })), this.cone.matrixAutoUpdate = !1, this.add(this.cone), this.setDirection(e), this.setLength(i, s, o); } setDirection(e) { if (e.y > 0.99999) this.quaternion.set(0, 0, 0, 1); else if (e.y < -0.99999) this.quaternion.set(1, 0, 0, 0); else { Av.set(e.z, 0, -e.x).normalize(); const t = Math.acos(e.y); this.quaternion.setFromAxisAngle(Av, t); } } setLength(e, t = e * 0.2, i = t * 0.2) { this.line.scale.set(1, Math.max(1e-4, e - t), 1), this.line.updateMatrix(), this.cone.scale.set(i, t, i), this.cone.position.y = e, this.cone.updateMatrix(); } setColor(e) { this.line.material.color.set(e), this.cone.material.color.set(e); } copy(e) { return super.copy(e, !1), this.line.copy(e.line), this.cone.copy(e.cone), this; } } class xw extends Fn { constructor(e = 1) { const t = [ 0, 0, 0, e, 0, 0, 0, 0, 0, 0, e, 0, 0, 0, 0, 0, 0, e ], i = [ 1, 0, 0, 1, 0.6, 0, 0, 1, 0, 0.6, 1, 0, 0, 0, 1, 0, 0.6, 1 ], r = new Je(); r.setAttribute("position", new We(t, 3)), r.setAttribute("color", new We(i, 3)); const s = new un({ vertexColors: !0, toneMapped: !1 }); super(r, s), this.type = "AxesHelper"; } setColors(e, t, i) { const r = new Fe(), s = this.geometry.attributes.color.array; return r.set(e), r.toArray(s, 0), r.toArray(s, 3), r.set(t), r.toArray(s, 6), r.toArray(s, 9), r.set(i), r.toArray(s, 12), r.toArray(s, 15), this.geometry.attributes.color.needsUpdate = !0, this; } dispose() { this.geometry.dispose(), this.material.dispose(); } } const ww = new Float32Array(1), YF = new Int32Array(ww.buffer); class JF { // Converts float32 to float16 (stored as uint16 value). static toHalfFloat(e) { ww[0] = e; const t = YF[0]; let i = t >> 16 & 32768, r = t >> 12 & 2047; const s = t >> 23 & 255; return s < 103 ? i : s > 142 ? (i |= 31744, i |= (s == 255 ? 0 : 1) && t & 8388607, i) : s < 113 ? (r |= 2048, i |= (r >> 114 - s) + (r >> 113 - s & 1), i) : (i |= s - 112 << 10 | r >> 1, i += r & 1, i); } } const Eo = 4, Hr = 8, Ci = Math.pow(2, Hr), Mw = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], Sw = Hr - Eo + 1 + Mw.length, mo = 20, Ii = { [Dn]: 0, [Os]: 1, [Cu]: 2, [$f]: 3, [Zf]: 4, [Xf]: 5, [Au]: 6 }, ms = new Vn({ side: qt, depthWrite: !1, depthTest: !1 }), qF = new tn(new hr(), ms), Uh = /* @__PURE__ */ new fa(), { _lodPlanes: La, _sizeLods: Cv, _sigmas: Cc } = /* @__PURE__ */ eB(), Lv = /* @__PURE__ */ new Fe(); let Vh = null; const gs = (1 + Math.sqrt(5)) / 2, go = 1 / gs, Rv = [ /* @__PURE__ */ new X(1, 1, 1), /* @__PURE__ */ new X(-1, 1, 1), /* @__PURE__ */ new X(1, 1, -1), /* @__PURE__ */ new X(-1, 1, -1), /* @__PURE__ */ new X(0, gs, go), /* @__PURE__ */ new X(0, gs, -go), /* @__PURE__ */ new X(go, 0, gs), /* @__PURE__ */ new X(-go, 0, gs), /* @__PURE__ */ new X(gs, go, 0), /* @__PURE__ */ new X(-gs, go, 0) ]; function Pv(n) { const e = Math.max(n.r, n.g, n.b), t = Math.min(Math.max(Math.ceil(Math.log2(e)), -128), 127); return n.multiplyScalar(Math.pow(2, -t)), (t + 128) / 255; } class KF { constructor(e) { this._renderer = e, this._pingPongRenderTarget = null, this._blurMaterial = tB(mo), this._equirectShader = null, this._cubemapShader = null, this._compileMaterial(this._blurMaterial); } /** * Generates a PMREM from a supplied Scene, which can be faster than using an * image if networking bandwidth is low. Optional sigma specifies a blur radius * in radians to be applied to the scene before PMREM generation. Optional near * and far planes ensure the scene is rendered in its entirety (the cubeCamera * is placed at the origin). */ fromScene(e, t = 0, i = 0.1, r = 100) { Vh = this._renderer.getRenderTarget(); const s = this._allocateTargets(); return this._sceneToCubeUV(e, i, r, s), t > 0 && this._blur(s, 0, 0, t), this._applyPMREM(s), this._cleanup(s), s; } /** * Generates a PMREM from an equirectangular texture, which can be either LDR * (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512), * as this matches best with the 256 x 256 cubemap output. */ fromEquirectangular(e) { return this._fromTexture(e); } /** * Generates a PMREM from an cubemap texture, which can be either LDR * (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256, * as this matches best with the 256 x 256 cubemap output. */ fromCubemap(e) { return this._fromTexture(e); } /** * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during * your texture's network fetch for increased concurrency. */ compileCubemapShader() { this._cubemapShader === null && (this._cubemapShader = Dv(), this._compileMaterial(this._cubemapShader)); } /** * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during * your texture's network fetch for increased concurrency. */ compileEquirectangularShader() { this._equirectShader === null && (this._equirectShader = Ov(), this._compileMaterial(this._equirectShader)); } /** * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on * one of them will cause any others to also become unusable. */ dispose() { this._blurMaterial.dispose(), this._cubemapShader !== null && this._cubemapShader.dispose(), this._equirectShader !== null && this._equirectShader.dispose(); for (let e = 0; e < La.length; e++) La[e].dispose(); } // private interface _cleanup(e) { this._pingPongRenderTarget.dispose(), this._renderer.setRenderTarget(Vh), e.scissorTest = !1, Lc(e, 0, 0, e.width, e.height); } _fromTexture(e) { Vh = this._renderer.getRenderTarget(); const t = this._allocateTargets(e); return this._textureToCubeUV(e, t), this._applyPMREM(t), this._cleanup(t), t; } _allocateTargets(e) { const t = { magFilter: Kt, minFilter: Kt, generateMipmaps: !1, type: Ps, format: bb, encoding: QF(e) ? e.encoding : Cu, depthBuffer: !1 }, i = Iv(t); return i.depthBuffer = !e, this._pingPongRenderTarget = Iv(t), i; } _compileMaterial(e) { const t = new tn(La[0], e); this._renderer.compile(t, Uh); } _sceneToCubeUV(e, t, i, r) { const a = new an(90, 1, t, i), c = [1, -1, 1, 1, 1, 1], l = [1, 1, 1, -1, -1, -1], d = this._renderer, h = d.autoClear, p = d.outputEncoding, g = d.toneMapping; d.getClearColor(Lv), d.toneMapping = Vr, d.outputEncoding = Dn, d.autoClear = !1; let f = !1; const u = e.background; if (u) { if (u.isColor) { ms.color.copy(u).convertSRGBToLinear(), e.background = null; const y = Pv(ms.color); ms.opacity = y, f = !0; } } else { ms.color.copy(Lv).convertSRGBToLinear(); const y = Pv(ms.color); ms.opacity = y, f = !0; } for (let y = 0; y < 6; y++) { const v = y % 3; v == 0 ? (a.up.set(0, c[y], 0), a.lookAt(l[y], 0, 0)) : v == 1 ? (a.up.set(0, 0, c[y]), a.lookAt(0, l[y], 0)) : (a.up.set(0, c[y], 0), a.lookAt(0, 0, l[y])), Lc( r, v * Ci, y > 2 ? Ci : 0, Ci, Ci ), d.setRenderTarget(r), f && d.render(qF, a), d.render(e, a); } d.toneMapping = g, d.outputEncoding = p, d.autoClear = h; } _textureToCubeUV(e, t) { const i = this._renderer; e.isCubeTexture ? this._cubemapShader == null && (this._cubemapShader = Dv()) : this._equirectShader == null && (this._equirectShader = Ov()); const r = e.isCubeTexture ? this._cubemapShader : this._equirectShader, s = new tn(La[0], r), o = r.uniforms; o.envMap.value = e, e.isCubeTexture || o.texelSize.value.set(1 / e.image.width, 1 / e.image.height), o.inputEncoding.value = Ii[e.encoding], o.outputEncoding.value = Ii[t.texture.encoding], Lc(t, 0, 0, 3 * Ci, 2 * Ci), i.setRenderTarget(t), i.render(s, Uh); } _applyPMREM(e) { const t = this._renderer, i = t.autoClear; t.autoClear = !1; for (let r = 1; r < Sw; r++) { const s = Math.sqrt(Cc[r] * Cc[r] - Cc[r - 1] * Cc[r - 1]), o = Rv[(r - 1) % Rv.length]; this._blur(e, r - 1, r, s, o); } t.autoClear = i; } /** * This is a two-pass Gaussian blur for a cubemap. Normally this is done * vertically and horizontally, but this breaks down on a cube. Here we apply * the blur latitudinally (around the poles), and then longitudinally (towards * the poles) to approximate the orthogonally-separable blur. It is least * accurate at the poles, but still does a decent job. */ _blur(e, t, i, r, s) { const o = this._pingPongRenderTarget; this._halfBlur( e, o, t, i, r, "latitudinal", s ), this._halfBlur( o, e, i, i, r, "longitudinal", s ); } _halfBlur(e, t, i, r, s, o, a) { const c = this._renderer, l = this._blurMaterial; o !== "latitudinal" && o !== "longitudinal" && console.error( "blur direction must be either latitudinal or longitudinal!" ); const d = 3, h = new tn(La[r], l), p = l.uniforms, g = Cv[i] - 1, f = isFinite(s) ? Math.PI / (2 * g) : 2 * Math.PI / (2 * mo - 1), u = s / f, y = isFinite(s) ? 1 + Math.floor(d * u) : mo; y > mo && console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${mo}`); const v = []; let m = 0; for (let M = 0; M < mo; ++M) { const x = M / u, _ = Math.exp(-x * x / 2); v.push(_), M == 0 ? m += _ : M < y && (m += 2 * _); } for (let M = 0; M < v.length; M++) v[M] = v[M] / m; p.envMap.value = e.texture, p.samples.value = y, p.weights.value = v, p.latitudinal.value = o === "latitudinal", a && (p.poleAxis.value = a), p.dTheta.value = f, p.mipInt.value = Hr - i, p.inputEncoding.value = Ii[e.texture.encoding], p.outputEncoding.value = Ii[e.texture.encoding]; const w = Cv[r], S = 3 * Math.max(0, Ci - 2 * w), T = (r === 0 ? 0 : 2 * Ci) + 2 * w * (r > Hr - Eo ? r - Hr + Eo : 0); Lc(t, S, T, 3 * w, 2 * w), c.setRenderTarget(t), c.render(h, Uh); } } function QF(n) { return n === void 0 || n.type !== Ps ? !1 : n.encoding === Dn || n.encoding === Os || n.encoding === Au; } function eB() { const n = [], e = [], t = []; let i = Hr; for (let r = 0; r < Sw; r++) { const s = Math.pow(2, i); e.push(s); let o = 1 / s; r > Hr - Eo ? o = Mw[r - Hr + Eo - 1] : r == 0 && (o = 0), t.push(o); const a = 1 / (s - 1), c = -a / 2, l = 1 + a / 2, d = [c, c, l, c, l, l, c, c, l, l, c, l], h = 6, p = 6, g = 3, f = 2, u = 1, y = new Float32Array(g * p * h), v = new Float32Array(f * p * h), m = new Float32Array(u * p * h); for (let S = 0; S < h; S++) { const T = S % 3 * 2 / 3 - 1, M = S > 2 ? 0 : -1, x = [ T, M, 0, T + 2 / 3, M, 0, T + 2 / 3, M + 1, 0, T, M, 0, T + 2 / 3, M + 1, 0, T, M + 1, 0 ]; y.set(x, g * p * S), v.set(d, f * p * S); const _ = [S, S, S, S, S, S]; m.set(_, u * p * S); } const w = new Je(); w.setAttribute("position", new nt(y, g)), w.setAttribute("uv", new nt(v, f)), w.setAttribute("faceIndex", new nt(m, u)), n.push(w), i > Eo && i--; } return { _lodPlanes: n, _sizeLods: e, _sigmas: t }; } function Iv(n) { const e = new bi(3 * Ci, 3 * Ci, n); return e.texture.mapping = la, e.texture.name = "PMREM.cubeUv", e.scissorTest = !0, e; } function Lc(n, e, t, i, r) { n.viewport.set(e, t, i, r), n.scissor.set(e, t, i, r); } function tB(n) { const e = new Float32Array(n), t = new X(0, 1, 0); return new da({ name: "SphericalGaussianBlur", defines: { n }, uniforms: { envMap: { value: null }, samples: { value: 1 }, weights: { value: e }, latitudinal: { value: !1 }, dTheta: { value: 0 }, mipInt: { value: 0 }, poleAxis: { value: t }, inputEncoding: { value: Ii[Dn] }, outputEncoding: { value: Ii[Dn] } }, vertexShader: Np(), fragmentShader: ( /* glsl */ ` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; ${Fp()} #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } gl_FragColor = linearToOutputTexel( gl_FragColor ); } ` ), blending: or, depthTest: !1, depthWrite: !1 }); } function Ov() { const n = new Pe(1, 1); return new da({ name: "EquirectangularToCubeUV", uniforms: { envMap: { value: null }, texelSize: { value: n }, inputEncoding: { value: Ii[Dn] }, outputEncoding: { value: Ii[Dn] } }, vertexShader: Np(), fragmentShader: ( /* glsl */ ` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform vec2 texelSize; ${Fp()} #include void main() { gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); vec2 f = fract( uv / texelSize - 0.5 ); uv -= f * texelSize; vec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb; uv.x += texelSize.x; vec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb; uv.y += texelSize.y; vec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb; uv.x -= texelSize.x; vec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb; vec3 tm = mix( tl, tr, f.x ); vec3 bm = mix( bl, br, f.x ); gl_FragColor.rgb = mix( tm, bm, f.y ); gl_FragColor = linearToOutputTexel( gl_FragColor ); } ` ), blending: or, depthTest: !1, depthWrite: !1 }); } function Dv() { return new da({ name: "CubemapToCubeUV", uniforms: { envMap: { value: null }, inputEncoding: { value: Ii[Dn] }, outputEncoding: { value: Ii[Dn] } }, vertexShader: Np(), fragmentShader: ( /* glsl */ ` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform samplerCube envMap; ${Fp()} void main() { gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb; gl_FragColor = linearToOutputTexel( gl_FragColor ); } ` ), blending: or, depthTest: !1, depthWrite: !1 }); } function Np() { return ( /* glsl */ ` precision mediump float; precision mediump int; attribute vec3 position; attribute vec2 uv; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } ` ); } function Fp() { return ( /* glsl */ ` uniform int inputEncoding; uniform int outputEncoding; #include vec4 inputTexelToLinear( vec4 value ) { if ( inputEncoding == 0 ) { return value; } else if ( inputEncoding == 1 ) { return sRGBToLinear( value ); } else if ( inputEncoding == 2 ) { return RGBEToLinear( value ); } else if ( inputEncoding == 3 ) { return RGBMToLinear( value, 7.0 ); } else if ( inputEncoding == 4 ) { return RGBMToLinear( value, 16.0 ); } else if ( inputEncoding == 5 ) { return RGBDToLinear( value, 256.0 ); } else { return GammaToLinear( value, 2.2 ); } } vec4 linearToOutputTexel( vec4 value ) { if ( outputEncoding == 0 ) { return value; } else if ( outputEncoding == 1 ) { return LinearTosRGB( value ); } else if ( outputEncoding == 2 ) { return LinearToRGBE( value ); } else if ( outputEncoding == 3 ) { return LinearToRGBM( value, 7.0 ); } else if ( outputEncoding == 4 ) { return LinearToRGBM( value, 16.0 ); } else if ( outputEncoding == 5 ) { return LinearToRGBD( value, 256.0 ); } else { return LinearToGamma( value, 2.2 ); } } vec4 envMapTexelToLinear( vec4 color ) { return inputTexelToLinear( color ); } ` ); } const nB = 0, iB = 1, rB = 0, sB = 1, oB = 2; function aB(n) { return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."), n; } function lB(n = []) { return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."), n.isMultiMaterial = !0, n.materials = n, n.clone = function() { return n.slice(); }, n; } function cB(n, e) { return console.warn("THREE.PointCloud has been renamed to THREE.Points."), new ha(n, e); } function uB(n) { return console.warn("THREE.Particle has been renamed to THREE.Sprite."), new El(n); } function hB(n, e) { return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."), new ha(n, e); } function dB(n) { return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."), new ss(n); } function fB(n) { return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."), new ss(n); } function pB(n) { return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."), new ss(n); } function mB(n, e, t) { return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."), new X(n, e, t); } function gB(n, e) { return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."), new nt(n, e).setUsage(Uo); } function vB(n, e) { return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."), new gx(n, e); } function yB(n, e) { return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."), new vx(n, e); } function bB(n, e) { return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."), new yx(n, e); } function xB(n, e) { return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."), new bx(n, e); } function wB(n, e) { return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."), new Lu(n, e); } function MB(n, e) { return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."), new xx(n, e); } function SB(n, e) { return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."), new Ru(n, e); } function _B(n, e) { return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."), new We(n, e); } function TB(n, e) { return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."), new Mx(n, e); } Kn.create = function(n, e) { return console.log("THREE.Curve.create() has been deprecated"), n.prototype = Object.create(Kn.prototype), n.prototype.constructor = n, n.prototype.getPoint = e, n; }; al.prototype.fromPoints = function(n) { return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."), this.setFromPoints(n); }; function EB(n) { return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."), new xw(n); } function AB(n, e) { return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."), new bw(n, e); } function CB(n, e) { return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."), new Fn(new ip(n.geometry), new un({ color: e !== void 0 ? e : 16777215 })); } yw.prototype.setColors = function() { console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead."); }; gw.prototype.update = function() { console.error("THREE.SkeletonHelper: update() no longer needs to be called."); }; function LB(n, e) { return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."), new Fn(new up(n.geometry), new un({ color: e !== void 0 ? e : 16777215 })); } _n.prototype.extractUrlBase = function(n) { return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."), lr.extractUrlBase(n); }; _n.Handlers = { add: function() { console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead."); }, get: function() { console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead."); } }; function RB(n) { return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."), new Qn(n); } function PB(n) { return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."), new Jx(n); } pa.prototype.center = function(n) { return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."), this.getCenter(n); }; pa.prototype.empty = function() { return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."), this.isEmpty(); }; pa.prototype.isIntersectionBox = function(n) { return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n); }; pa.prototype.size = function(n) { return console.warn("THREE.Box2: .size() has been renamed to .getSize()."), this.getSize(n); }; Hn.prototype.center = function(n) { return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."), this.getCenter(n); }; Hn.prototype.empty = function() { return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."), this.isEmpty(); }; Hn.prototype.isIntersectionBox = function(n) { return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n); }; Hn.prototype.isIntersectionSphere = function(n) { return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(n); }; Hn.prototype.size = function(n) { return console.warn("THREE.Box3: .size() has been renamed to .getSize()."), this.getSize(n); }; xr.prototype.empty = function() { return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."), this.isEmpty(); }; Ml.prototype.setFromMatrix = function(n) { return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."), this.setFromProjectionMatrix(n); }; pw.prototype.center = function(n) { return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."), this.getCenter(n); }; ln.prototype.flattenToArrayOffset = function(n, e) { return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(n, e); }; ln.prototype.multiplyVector3 = function(n) { return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."), n.applyMatrix3(this); }; ln.prototype.multiplyVector3Array = function() { console.error("THREE.Matrix3: .multiplyVector3Array() has been removed."); }; ln.prototype.applyToBufferAttribute = function(n) { return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."), n.applyMatrix3(this); }; ln.prototype.applyToVector3Array = function() { console.error("THREE.Matrix3: .applyToVector3Array() has been removed."); }; ln.prototype.getInverse = function(n) { return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."), this.copy(n).invert(); }; $e.prototype.extractPosition = function(n) { return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."), this.copyPosition(n); }; $e.prototype.flattenToArrayOffset = function(n, e) { return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(n, e); }; $e.prototype.getPosition = function() { return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."), new X().setFromMatrixColumn(this, 3); }; $e.prototype.setRotationFromQuaternion = function(n) { return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."), this.makeRotationFromQuaternion(n); }; $e.prototype.multiplyToArray = function() { console.warn("THREE.Matrix4: .multiplyToArray() has been removed."); }; $e.prototype.multiplyVector3 = function(n) { return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this); }; $e.prototype.multiplyVector4 = function(n) { return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this); }; $e.prototype.multiplyVector3Array = function() { console.error("THREE.Matrix4: .multiplyVector3Array() has been removed."); }; $e.prototype.rotateAxis = function(n) { console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."), n.transformDirection(this); }; $e.prototype.crossVector = function(n) { return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this); }; $e.prototype.translate = function() { console.error("THREE.Matrix4: .translate() has been removed."); }; $e.prototype.rotateX = function() { console.error("THREE.Matrix4: .rotateX() has been removed."); }; $e.prototype.rotateY = function() { console.error("THREE.Matrix4: .rotateY() has been removed."); }; $e.prototype.rotateZ = function() { console.error("THREE.Matrix4: .rotateZ() has been removed."); }; $e.prototype.rotateByAxis = function() { console.error("THREE.Matrix4: .rotateByAxis() has been removed."); }; $e.prototype.applyToBufferAttribute = function(n) { return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."), n.applyMatrix4(this); }; $e.prototype.applyToVector3Array = function() { console.error("THREE.Matrix4: .applyToVector3Array() has been removed."); }; $e.prototype.makeFrustum = function(n, e, t, i, r, s) { return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."), this.makePerspective(n, e, i, t, r, s); }; $e.prototype.getInverse = function(n) { return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."), this.copy(n).invert(); }; Li.prototype.isIntersectionLine = function(n) { return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."), this.intersectsLine(n); }; Sn.prototype.multiplyVector3 = function(n) { return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."), n.applyQuaternion(this); }; Sn.prototype.inverse = function() { return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."), this.invert(); }; is.prototype.isIntersectionBox = function(n) { return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n); }; is.prototype.isIntersectionPlane = function(n) { return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."), this.intersectsPlane(n); }; is.prototype.isIntersectionSphere = function(n) { return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(n); }; Qt.prototype.area = function() { return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."), this.getArea(); }; Qt.prototype.barycoordFromPoint = function(n, e) { return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), this.getBarycoord(n, e); }; Qt.prototype.midpoint = function(n) { return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."), this.getMidpoint(n); }; Qt.prototypenormal = function(n) { return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), this.getNormal(n); }; Qt.prototype.plane = function(n) { return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."), this.getPlane(n); }; Qt.barycoordFromPoint = function(n, e, t, i, r) { return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), Qt.getBarycoord(n, e, t, i, r); }; Qt.normal = function(n, e, t, i) { return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), Qt.getNormal(n, e, t, i); }; Gr.prototype.extractAllPoints = function(n) { return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."), this.extractPoints(n); }; Gr.prototype.extrude = function(n) { return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."), new wi(this, n); }; Gr.prototype.makeGeometry = function(n) { return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."), new Fs(this, n); }; Pe.prototype.fromAttribute = function(n, e, t) { return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(n, e, t); }; Pe.prototype.distanceToManhattan = function(n) { return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(n); }; Pe.prototype.lengthManhattan = function() { return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength(); }; X.prototype.setEulerFromRotationMatrix = function() { console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead."); }; X.prototype.setEulerFromQuaternion = function() { console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead."); }; X.prototype.getPositionFromMatrix = function(n) { return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."), this.setFromMatrixPosition(n); }; X.prototype.getScaleFromMatrix = function(n) { return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."), this.setFromMatrixScale(n); }; X.prototype.getColumnFromMatrix = function(n, e) { return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."), this.setFromMatrixColumn(e, n); }; X.prototype.applyProjection = function(n) { return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."), this.applyMatrix4(n); }; X.prototype.fromAttribute = function(n, e, t) { return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(n, e, t); }; X.prototype.distanceToManhattan = function(n) { return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(n); }; X.prototype.lengthManhattan = function() { return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength(); }; _t.prototype.fromAttribute = function(n, e, t) { return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(n, e, t); }; _t.prototype.lengthManhattan = function() { return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength(); }; ot.prototype.getChildByName = function(n) { return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."), this.getObjectByName(n); }; ot.prototype.renderDepth = function() { console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead."); }; ot.prototype.translate = function(n, e) { return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."), this.translateOnAxis(e, n); }; ot.prototype.getWorldRotation = function() { console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead."); }; ot.prototype.applyMatrix = function(n) { return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(n); }; Object.defineProperties(ot.prototype, { eulerOrder: { get: function() { return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order; }, set: function(n) { console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order = n; } }, useQuaternion: { get: function() { console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default."); }, set: function() { console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default."); } } }); tn.prototype.setDrawMode = function() { console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary."); }; Object.defineProperties(tn.prototype, { drawMode: { get: function() { return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."), sx; }, set: function() { console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary."); } } }); Al.prototype.initBones = function() { console.error("THREE.SkinnedMesh: initBones() has been removed."); }; an.prototype.setLens = function(n, e) { console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."), e !== void 0 && (this.filmGauge = e), this.setFocalLength(n); }; Object.defineProperties(Mi.prototype, { onlyShadow: { set: function() { console.warn("THREE.Light: .onlyShadow has been removed."); } }, shadowCameraFov: { set: function(n) { console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."), this.shadow.camera.fov = n; } }, shadowCameraLeft: { set: function(n) { console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."), this.shadow.camera.left = n; } }, shadowCameraRight: { set: function(n) { console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."), this.shadow.camera.right = n; } }, shadowCameraTop: { set: function(n) { console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."), this.shadow.camera.top = n; } }, shadowCameraBottom: { set: function(n) { console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."), this.shadow.camera.bottom = n; } }, shadowCameraNear: { set: function(n) { console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."), this.shadow.camera.near = n; } }, shadowCameraFar: { set: function(n) { console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."), this.shadow.camera.far = n; } }, shadowCameraVisible: { set: function() { console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead."); } }, shadowBias: { set: function(n) { console.warn("THREE.Light: .shadowBias is now .shadow.bias."), this.shadow.bias = n; } }, shadowDarkness: { set: function() { console.warn("THREE.Light: .shadowDarkness has been removed."); } }, shadowMapWidth: { set: function(n) { console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."), this.shadow.mapSize.width = n; } }, shadowMapHeight: { set: function(n) { console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."), this.shadow.mapSize.height = n; } } }); Object.defineProperties(nt.prototype, { length: { get: function() { return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."), this.array.length; } }, dynamic: { get: function() { return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."), this.usage === Uo; }, set: function() { console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."), this.setUsage(Uo); } } }); nt.prototype.setDynamic = function(n) { return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."), this.setUsage(n === !0 ? Uo : zo), this; }; nt.prototype.copyIndicesArray = function() { console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed."); }, nt.prototype.setArray = function() { console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers"); }; Je.prototype.addIndex = function(n) { console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."), this.setIndex(n); }; Je.prototype.addAttribute = function(n, e) { return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."), !(e && e.isBufferAttribute) && !(e && e.isInterleavedBufferAttribute) ? (console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."), this.setAttribute(n, new nt(arguments[1], arguments[2]))) : n === "index" ? (console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."), this.setIndex(e), this) : this.setAttribute(n, e); }; Je.prototype.addDrawCall = function(n, e, t) { t !== void 0 && console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."), console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."), this.addGroup(n, e); }; Je.prototype.clearDrawCalls = function() { console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."), this.clearGroups(); }; Je.prototype.computeOffsets = function() { console.warn("THREE.BufferGeometry: .computeOffsets() has been removed."); }; Je.prototype.removeAttribute = function(n) { return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."), this.deleteAttribute(n); }; Je.prototype.applyMatrix = function(n) { return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(n); }; Object.defineProperties(Je.prototype, { drawcalls: { get: function() { return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."), this.groups; } }, offsets: { get: function() { return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."), this.groups; } } }); rs.prototype.setDynamic = function(n) { return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."), this.setUsage(n === !0 ? Uo : zo), this; }; rs.prototype.setArray = function() { console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers"); }; wi.prototype.getArrays = function() { console.error("THREE.ExtrudeGeometry: .getArrays() has been removed."); }; wi.prototype.addShapeList = function() { console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed."); }; wi.prototype.addShape = function() { console.error("THREE.ExtrudeGeometry: .addShape() has been removed."); }; Nu.prototype.dispose = function() { console.error("THREE.Scene: .dispose() has been removed."); }; Wu.prototype.onUpdate = function() { return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."), this; }; Object.defineProperties(sn.prototype, { wrapAround: { get: function() { console.warn("THREE.Material: .wrapAround has been removed."); }, set: function() { console.warn("THREE.Material: .wrapAround has been removed."); } }, overdraw: { get: function() { console.warn("THREE.Material: .overdraw has been removed."); }, set: function() { console.warn("THREE.Material: .overdraw has been removed."); } }, wrapRGB: { get: function() { return console.warn("THREE.Material: .wrapRGB has been removed."), new Fe(); } }, shading: { get: function() { console.error("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."); }, set: function(n) { console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."), this.flatShading = n === kf; } }, stencilMask: { get: function() { return console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."), this.stencilFuncMask; }, set: function(n) { console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."), this.stencilFuncMask = n; } } }); Object.defineProperties(dr.prototype, { derivatives: { get: function() { return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives; }, set: function(n) { console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives = n; } } }); Et.prototype.clearTarget = function(n, e, t, i) { console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."), this.setRenderTarget(n), this.clear(e, t, i); }; Et.prototype.animate = function(n) { console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."), this.setAnimationLoop(n); }; Et.prototype.getCurrentRenderTarget = function() { return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."), this.getRenderTarget(); }; Et.prototype.getMaxAnisotropy = function() { return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."), this.capabilities.getMaxAnisotropy(); }; Et.prototype.getPrecision = function() { return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."), this.capabilities.precision; }; Et.prototype.resetGLState = function() { return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."), this.state.reset(); }; Et.prototype.supportsFloatTextures = function() { return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."), this.extensions.get("OES_texture_float"); }; Et.prototype.supportsHalfFloatTextures = function() { return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."), this.extensions.get("OES_texture_half_float"); }; Et.prototype.supportsStandardDerivatives = function() { return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."), this.extensions.get("OES_standard_derivatives"); }; Et.prototype.supportsCompressedTextureS3TC = function() { return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."), this.extensions.get("WEBGL_compressed_texture_s3tc"); }; Et.prototype.supportsCompressedTexturePVRTC = function() { return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."), this.extensions.get("WEBGL_compressed_texture_pvrtc"); }; Et.prototype.supportsBlendMinMax = function() { return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."), this.extensions.get("EXT_blend_minmax"); }; Et.prototype.supportsVertexTextures = function() { return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."), this.capabilities.vertexTextures; }; Et.prototype.supportsInstancedArrays = function() { return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."), this.extensions.get("ANGLE_instanced_arrays"); }; Et.prototype.enableScissorTest = function(n) { console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."), this.setScissorTest(n); }; Et.prototype.initMaterial = function() { console.warn("THREE.WebGLRenderer: .initMaterial() has been removed."); }; Et.prototype.addPrePlugin = function() { console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed."); }; Et.prototype.addPostPlugin = function() { console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed."); }; Et.prototype.updateShadowMap = function() { console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed."); }; Et.prototype.setFaceCulling = function() { console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed."); }; Et.prototype.allocTextureUnit = function() { console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed."); }; Et.prototype.setTexture = function() { console.warn("THREE.WebGLRenderer: .setTexture() has been removed."); }; Et.prototype.setTexture2D = function() { console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed."); }; Et.prototype.setTextureCube = function() { console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed."); }; Et.prototype.getActiveMipMapLevel = function() { return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."), this.getActiveMipmapLevel(); }; Object.defineProperties(Et.prototype, { shadowMapEnabled: { get: function() { return this.shadowMap.enabled; }, set: function(n) { console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."), this.shadowMap.enabled = n; } }, shadowMapType: { get: function() { return this.shadowMap.type; }, set: function(n) { console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."), this.shadowMap.type = n; } }, shadowMapCullFace: { get: function() { console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead."); }, set: function() { console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead."); } }, context: { get: function() { return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."), this.getContext(); } }, vr: { get: function() { return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"), this.xr; } }, gammaInput: { get: function() { return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."), !1; }, set: function() { console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."); } }, gammaOutput: { get: function() { return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."), !1; }, set: function(n) { console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."), this.outputEncoding = n === !0 ? Os : Dn; } }, toneMappingWhitePoint: { get: function() { return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."), 1; }, set: function() { console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."); } } }); Object.defineProperties(Ox.prototype, { cullFace: { get: function() { console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead."); }, set: function() { console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead."); } }, renderReverseSided: { get: function() { console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead."); }, set: function() { console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead."); } }, renderSingleSided: { get: function() { console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead."); }, set: function() { console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead."); } } }); function IB(n, e, t) { return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."), new Iu(n, t); } Object.defineProperties(bi.prototype, { wrapS: { get: function() { return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS = n; } }, wrapT: { get: function() { return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT = n; } }, magFilter: { get: function() { return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter = n; } }, minFilter: { get: function() { return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter = n; } }, anisotropy: { get: function() { return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy = n; } }, offset: { get: function() { return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset = n; } }, repeat: { get: function() { return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat = n; } }, format: { get: function() { return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format = n; } }, type: { get: function() { return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type = n; } }, generateMipmaps: { get: function() { return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps = n; } } }); Ip.prototype.load = function(n) { console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead."); const e = this; return new rw().load(n, function(i) { e.setBuffer(i); }), this; }; lw.prototype.getData = function() { return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."), this.getFrequencyData(); }; Pu.prototype.updateCubeMap = function(n, e) { return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."), this.update(n, e); }; Pu.prototype.clear = function(n, e, t, i) { return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."), this.renderTarget.clear(n, e, t, i); }; Hs.crossOrigin = void 0; Hs.loadTexture = function(n, e, t, i) { console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead."); const r = new wp(); r.setCrossOrigin(this.crossOrigin); const s = r.load(n, t, void 0, i); return e && (s.mapping = e), s; }; Hs.loadTextureCube = function(n, e, t, i) { console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead."); const r = new Yx(); r.setCrossOrigin(this.crossOrigin); const s = r.load(n, t, void 0, i); return e && (s.mapping = e), s; }; Hs.loadCompressedTexture = function() { console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead."); }; Hs.loadCompressedTextureCube = function() { console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead."); }; function OB() { console.error("THREE.CanvasRenderer has been removed"); } function DB() { console.error("THREE.JSONLoader has been removed."); } const NB = { createMultiMaterialObject: function() { console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js"); }, detach: function() { console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js"); }, attach: function() { console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js"); } }; function FB() { console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js"); } typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: { revision: Uf } })); typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = Uf); const BB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, ACESFilmicToneMapping: lb, AddEquation: ys, AddOperation: rb, AdditiveAnimationBlendMode: Wf, AdditiveBlending: bd, AlphaFormat: gb, AlwaysDepth: qy, AlwaysStencilFunc: hx, AmbientLight: _p, AmbientLightProbe: ow, AnimationClip: Qo, AnimationLoader: pF, AnimationMixer: hw, AnimationObjectGroup: uw, AnimationUtils: It, ArcCurve: rp, ArrayCamera: ep, ArrowHelper: XF, Audio: Ip, AudioAnalyser: lw, AudioContext: Pp, AudioListener: SF, AudioLoader: rw, AxesHelper: xw, AxisHelper: EB, BackSide: qt, BasicDepthPacking: lx, BasicShadowMap: CP, BinaryTextureLoader: PB, Bone: Cl, BooleanKeyframeTrack: $s, BoundingBoxHelper: AB, Box2: pa, Box3: Hn, Box3Helper: $F, BoxBufferGeometry: hr, BoxGeometry: hr, BoxHelper: bw, BufferAttribute: nt, BufferGeometry: Je, BufferGeometryLoader: nw, ByteType: ub, Cache: zs, Camera: wl, CameraHelper: jF, CanvasRenderer: OB, CanvasTexture: Ux, CatmullRomCurve3: op, CineonToneMapping: ab, CircleBufferGeometry: ko, CircleGeometry: ko, ClampToEdgeWrapping: mn, Clock: aw, Color: Fe, ColorKeyframeTrack: bp, CompressedTexture: np, CompressedTextureLoader: mF, ConeBufferGeometry: Go, ConeGeometry: Go, CubeCamera: Pu, CubeReflectionMapping: yl, CubeRefractionMapping: bl, CubeTexture: ca, CubeTextureLoader: Yx, CubeUVReflectionMapping: la, CubeUVRefractionMapping: xl, CubicBezierCurve: Bu, CubicBezierCurve3: ap, CubicInterpolant: jx, CullFaceBack: yd, CullFaceFront: Fy, CullFaceFrontBack: AP, CullFaceNone: Ny, Curve: Kn, CurvePath: qx, CustomBlending: zy, CustomToneMapping: cb, CylinderBufferGeometry: qr, CylinderGeometry: qr, Cylindrical: zF, DataTexture: Cs, DataTexture2DArray: Kf, DataTexture3D: Qf, DataTextureLoader: Jx, DataUtils: JF, DecrementStencilOp: BP, DecrementWrapStencilOp: UP, DefaultLoadingManager: Xx, DepthFormat: Es, DepthStencilFormat: Fo, DepthTexture: Vx, DirectionalLight: Hu, DirectionalLightHelper: WF, DiscreteInterpolant: $x, DodecahedronBufferGeometry: Ho, DodecahedronGeometry: Ho, DoubleSide: Yr, DstAlphaFactor: jy, DstColorFactor: Zy, DynamicBufferAttribute: gB, DynamicCopyUsage: QP, DynamicDrawUsage: Uo, DynamicReadUsage: JP, EdgesGeometry: ip, EdgesHelper: CB, EllipseCurve: Rl, EqualDepth: Qy, EqualStencilFunc: HP, EquirectangularReflectionMapping: Qc, EquirectangularRefractionMapping: eu, Euler: Ws, EventDispatcher: ns, ExtrudeBufferGeometry: wi, ExtrudeGeometry: wi, FaceColors: sB, FileLoader: Qn, FlatShading: kf, Float16BufferAttribute: wx, Float32Attribute: _B, Float32BufferAttribute: We, Float64Attribute: TB, Float64BufferAttribute: Mx, FloatType: nr, Fog: _l, FogExp2: Sl, Font: Rp, FontLoader: xF, FrontSide: Xr, Frustum: Ml, GLBufferAttribute: fw, GLSL1: tI, GLSL3: Dd, GammaEncoding: Au, GreaterDepth: tb, GreaterEqualDepth: eb, GreaterEqualStencilFunc: ZP, GreaterStencilFunc: jP, GridHelper: yw, Group: Pi, HalfFloatType: Ts, HemisphereLight: Mp, HemisphereLightHelper: GF, HemisphereLightProbe: sw, IcosahedronBufferGeometry: Wo, IcosahedronGeometry: Wo, ImageBitmapLoader: Lp, ImageLoader: ol, ImageUtils: Hs, ImmediateRenderObject: mw, IncrementStencilOp: FP, IncrementWrapStencilOp: zP, InstancedBufferAttribute: Cp, InstancedBufferGeometry: Ap, InstancedInterleavedBuffer: dw, InstancedMesh: tp, Int16Attribute: xB, Int16BufferAttribute: bx, Int32Attribute: MB, Int32BufferAttribute: xx, Int8Attribute: vB, Int8BufferAttribute: gx, IntType: db, InterleavedBuffer: rs, InterleavedBufferAttribute: fr, Interpolant: ki, InterpolateDiscrete: Bo, InterpolateLinear: Is, InterpolateSmooth: Vc, InvertStencilOp: VP, JSONLoader: DB, KeepStencilOp: kc, KeyframeTrack: Ti, LOD: Bx, LatheBufferGeometry: jo, LatheGeometry: jo, Layers: qf, LensFlare: FB, LessDepth: Ky, LessEqualDepth: Kc, LessEqualStencilFunc: WP, LessStencilFunc: GP, Light: Mi, LightProbe: Ol, Line: Ui, Line3: pw, LineBasicMaterial: un, LineCurve: Pl, LineCurve3: kx, LineDashedMaterial: vp, LineLoop: Fu, LinePieces: iB, LineSegments: Fn, LineStrip: nB, LinearEncoding: Dn, LinearFilter: jt, LinearInterpolant: yp, LinearMipMapLinearFilter: OP, LinearMipMapNearestFilter: IP, LinearMipmapLinearFilter: br, LinearMipmapNearestFilter: Tu, LinearToneMapping: sb, Loader: _n, LoaderUtils: lr, LoadingManager: xp, LogLuvEncoding: ax, LoopOnce: nx, LoopPingPong: rx, LoopRepeat: ix, LuminanceAlphaFormat: yb, LuminanceFormat: vb, MOUSE: TP, Material: sn, MaterialLoader: tw, Math: Fd, MathUtils: Fd, Matrix3: ln, Matrix4: $e, MaxEquation: Sd, Mesh: tn, MeshBasicMaterial: Vn, MeshDepthMaterial: Ou, MeshDistanceMaterial: Du, MeshFaceMaterial: aB, MeshLambertMaterial: mp, MeshMatcapMaterial: gp, MeshNormalMaterial: pp, MeshPhongMaterial: dp, MeshPhysicalMaterial: Il, MeshStandardMaterial: js, MeshToonMaterial: fp, MinEquation: Md, MirroredRepeatWrapping: No, MixOperation: ib, MultiMaterial: lB, MultiplyBlending: wd, MultiplyOperation: vl, NearestFilter: Kt, NearestMipMapLinearFilter: PP, NearestMipMapNearestFilter: RP, NearestMipmapLinearFilter: Qa, NearestMipmapNearestFilter: Ka, NeverDepth: Jy, NeverStencilFunc: kP, NoBlending: or, NoColors: rB, NoToneMapping: Vr, NormalAnimationBlendMode: Eu, NormalBlending: _o, NotEqualDepth: nb, NotEqualStencilFunc: $P, NumberKeyframeTrack: qo, Object3D: ot, ObjectLoader: gF, ObjectSpaceNormalMap: ux, OctahedronBufferGeometry: Ns, OctahedronGeometry: Ns, OneFactor: Gy, OneMinusDstAlphaFactor: $y, OneMinusDstColorFactor: Xy, OneMinusSrcAlphaFactor: Hf, OneMinusSrcColorFactor: Wy, OrthographicCamera: fa, PCFShadowMap: Vf, PCFSoftShadowMap: By, PMREMGenerator: KF, ParametricBufferGeometry: tu, ParametricGeometry: tu, Particle: uB, ParticleBasicMaterial: fB, ParticleSystem: hB, ParticleSystemMaterial: pB, Path: al, PerspectiveCamera: an, Plane: Li, PlaneBufferGeometry: Ds, PlaneGeometry: Ds, PlaneHelper: ZF, PointCloud: cB, PointCloudMaterial: dB, PointLight: Gu, PointLightHelper: VF, Points: ha, PointsMaterial: ss, PolarGridHelper: HF, PolyhedronBufferGeometry: Vi, PolyhedronGeometry: Vi, PositionalAudio: TF, PropertyBinding: ft, PropertyMixer: cw, QuadraticBezierCurve: zu, QuadraticBezierCurve3: lp, Quaternion: Sn, QuaternionKeyframeTrack: Zs, QuaternionLinearInterpolant: Zx, REVISION: Uf, RGBADepthPacking: cx, RGBAFormat: Yn, RGBAIntegerFormat: Tb, RGBA_ASTC_10x10_Format: zb, RGBA_ASTC_10x5_Format: Nb, RGBA_ASTC_10x6_Format: Fb, RGBA_ASTC_10x8_Format: Bb, RGBA_ASTC_12x10_Format: Ub, RGBA_ASTC_12x12_Format: Vb, RGBA_ASTC_4x4_Format: Ab, RGBA_ASTC_5x4_Format: Cb, RGBA_ASTC_5x5_Format: Lb, RGBA_ASTC_6x5_Format: Rb, RGBA_ASTC_6x6_Format: Pb, RGBA_ASTC_8x5_Format: Ib, RGBA_ASTC_8x6_Format: Ob, RGBA_ASTC_8x8_Format: Db, RGBA_BPTC_Format: kb, RGBA_ETC2_EAC_Format: Od, RGBA_PVRTC_2BPPV1_Format: Pd, RGBA_PVRTC_4BPPV1_Format: Rd, RGBA_S3TC_DXT1_Format: Td, RGBA_S3TC_DXT3_Format: Ed, RGBA_S3TC_DXT5_Format: Ad, RGBDEncoding: Xf, RGBEEncoding: Cu, RGBEFormat: bb, RGBFormat: ar, RGBIntegerFormat: _b, RGBM16Encoding: Zf, RGBM7Encoding: $f, RGB_ETC1_Format: Eb, RGB_ETC2_Format: Id, RGB_PVRTC_2BPPV1_Format: Ld, RGB_PVRTC_4BPPV1_Format: Cd, RGB_S3TC_DXT1_Format: _d, RGFormat: Mb, RGIntegerFormat: Sb, RawShaderMaterial: da, Ray: is, Raycaster: FF, RectAreaLight: Tp, RedFormat: xb, RedIntegerFormat: wb, ReinhardToneMapping: ob, RepeatWrapping: Jr, ReplaceStencilOp: NP, ReverseSubtractEquation: Vy, RingBufferGeometry: $o, RingGeometry: $o, SRGB8_ALPHA8_ASTC_10x10_Format: Qb, SRGB8_ALPHA8_ASTC_10x5_Format: Jb, SRGB8_ALPHA8_ASTC_10x6_Format: qb, SRGB8_ALPHA8_ASTC_10x8_Format: Kb, SRGB8_ALPHA8_ASTC_12x10_Format: ex, SRGB8_ALPHA8_ASTC_12x12_Format: tx, SRGB8_ALPHA8_ASTC_4x4_Format: Gb, SRGB8_ALPHA8_ASTC_5x4_Format: Hb, SRGB8_ALPHA8_ASTC_5x5_Format: Wb, SRGB8_ALPHA8_ASTC_6x5_Format: jb, SRGB8_ALPHA8_ASTC_6x6_Format: $b, SRGB8_ALPHA8_ASTC_8x5_Format: Zb, SRGB8_ALPHA8_ASTC_8x6_Format: Xb, SRGB8_ALPHA8_ASTC_8x8_Format: Yb, Scene: Nu, SceneUtils: NB, ShaderChunk: ct, ShaderLib: gi, ShaderMaterial: dr, ShadowMaterial: hp, Shape: Gr, ShapeBufferGeometry: Fs, ShapeGeometry: Fs, ShapePath: iw, ShapeUtils: Fi, ShortType: hb, Skeleton: Ll, SkeletonHelper: gw, SkinnedMesh: Al, SmoothShading: LP, Sphere: xr, SphereBufferGeometry: Bs, SphereGeometry: Bs, Spherical: BF, SphericalHarmonics3: Ep, SplineCurve: Uu, SpotLight: ku, SpotLightHelper: UF, Sprite: El, SpriteMaterial: Tl, SrcAlphaFactor: Gf, SrcAlphaSaturateFactor: Yy, SrcColorFactor: Hy, StaticCopyUsage: KP, StaticDrawUsage: zo, StaticReadUsage: YP, StereoCamera: wF, StreamCopyUsage: eI, StreamDrawUsage: XP, StreamReadUsage: qP, StringKeyframeTrack: Xs, SubtractEquation: Uy, SubtractiveBlending: xd, TOUCH: EP, TangentSpaceNormalMap: ts, TetrahedronBufferGeometry: Zo, TetrahedronGeometry: Zo, TextBufferGeometry: nu, TextGeometry: nu, Texture: nn, TextureLoader: wp, TorusBufferGeometry: Xo, TorusGeometry: Xo, TorusKnotBufferGeometry: Yo, TorusKnotGeometry: Yo, Triangle: Qt, TriangleFanDrawMode: jf, TriangleStripDrawMode: ox, TrianglesDrawMode: sx, TubeBufferGeometry: Jo, TubeGeometry: Jo, UVMapping: _u, Uint16Attribute: wB, Uint16BufferAttribute: Lu, Uint32Attribute: SB, Uint32BufferAttribute: Ru, Uint8Attribute: yB, Uint8BufferAttribute: vx, Uint8ClampedAttribute: bB, Uint8ClampedBufferAttribute: yx, Uniform: Wu, UniformsLib: ze, UniformsUtils: _x, UnsignedByteType: Ps, UnsignedInt248Type: To, UnsignedIntType: Va, UnsignedShort4444Type: fb, UnsignedShort5551Type: pb, UnsignedShort565Type: mb, UnsignedShortType: el, VSMShadowMap: wo, Vector2: Pe, Vector3: X, Vector4: _t, VectorKeyframeTrack: Ko, Vertex: mB, VertexColors: oB, VideoTexture: zx, WebGL1Renderer: Nx, WebGLCubeRenderTarget: Iu, WebGLMultipleRenderTargets: px, WebGLMultisampleRenderTarget: Jf, WebGLRenderTarget: bi, WebGLRenderTargetCube: IB, WebGLRenderer: Et, WebGLUtils: Dx, WireframeGeometry: up, WireframeHelper: LB, WrapAroundEnding: tl, XHRLoader: RB, ZeroCurvatureEnding: xs, ZeroFactor: ky, ZeroSlopeEnding: ws, ZeroStencilOp: DP, sRGBEncoding: Os }, Symbol.toStringTag, { value: "Module" })), zB = /* @__PURE__ */ xu(BB); function UB(n, e) { if (!(n instanceof e)) throw new TypeError("Cannot call a class as a function"); } function VB(n, e) { for (var t = 0; t < e.length; t++) { var i = e[t]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(n, i.key, i); } } function kB(n, e, t) { return e && VB(n.prototype, e), n; } function GB(n, e) { if (typeof e != "function" && e !== null) throw new TypeError("Super expression must either be null or a function"); n.prototype = Object.create(e && e.prototype, { constructor: { value: n, writable: !0, configurable: !0 } }), e && Gd(n, e); } function iu(n) { return iu = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t); }, iu(n); } function Gd(n, e) { return Gd = Object.setPrototypeOf || function(i, r) { return i.__proto__ = r, i; }, Gd(n, e); } function HB() { if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1; if (typeof Proxy == "function") return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { })), !0; } catch { return !1; } } function WB(n) { if (n === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return n; } function jB(n, e) { return e && (typeof e == "object" || typeof e == "function") ? e : WB(n); } function $B(n) { var e = HB(); return function() { var i = iu(n), r; if (e) { var s = iu(this).constructor; r = Reflect.construct(i, arguments, s); } else r = i.apply(this, arguments); return jB(this, r); }; } function Nv(n, e) { return XB(n) || JB(n, e) || _w(n, e) || KB(); } function Rc(n) { return ZB(n) || YB(n) || _w(n) || qB(); } function ZB(n) { if (Array.isArray(n)) return Hd(n); } function XB(n) { if (Array.isArray(n)) return n; } function YB(n) { if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null) return Array.from(n); } function JB(n, e) { var t = n && (typeof Symbol < "u" && n[Symbol.iterator] || n["@@iterator"]); if (t != null) { var i = [], r = !0, s = !1, o, a; try { for (t = t.call(n); !(r = (o = t.next()).done) && (i.push(o.value), !(e && i.length === e)); r = !0) ; } catch (c) { s = !0, a = c; } finally { try { !r && t.return != null && t.return(); } finally { if (s) throw a; } } return i; } } function _w(n, e) { if (n) { if (typeof n == "string") return Hd(n, e); var t = Object.prototype.toString.call(n).slice(8, -1); if (t === "Object" && n.constructor && (t = n.constructor.name), t === "Map" || t === "Set") return Array.from(n); if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return Hd(n, e); } } function Hd(n, e) { (e == null || e > n.length) && (e = n.length); for (var t = 0, i = new Array(e); t < e; t++) i[t] = n[t]; return i; } function qB() { throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } function KB() { throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } var Ra = typeof window < "u" && window.THREE ? window.THREE : { LinearFilter: jt, Sprite: El, SpriteMaterial: Tl, Texture: nn }, QB = /* @__PURE__ */ function(n) { GB(t, n); var e = $B(t); function t() { var i, r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10, o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "rgba(255, 255, 255, 1)"; return UB(this, t), i = e.call(this, new Ra.SpriteMaterial({ map: new Ra.Texture() })), i._text = "".concat(r), i._textHeight = s, i._color = o, i._backgroundColor = !1, i._padding = 0, i._borderWidth = 0, i._borderRadius = 0, i._borderColor = "white", i._strokeWidth = 0, i._strokeColor = "white", i._fontFace = "Arial", i._fontSize = 90, i._fontWeight = "normal", i._canvas = document.createElement("canvas"), i._texture = i.material.map, i._texture.minFilter = Ra.LinearFilter, i._genCanvas(), i; } return kB(t, [{ key: "text", get: function() { return this._text; }, set: function(r) { this._text = r, this._genCanvas(); } }, { key: "textHeight", get: function() { return this._textHeight; }, set: function(r) { this._textHeight = r, this._genCanvas(); } }, { key: "color", get: function() { return this._color; }, set: function(r) { this._color = r, this._genCanvas(); } }, { key: "backgroundColor", get: function() { return this._backgroundColor; }, set: function(r) { this._backgroundColor = r, this._genCanvas(); } }, { key: "padding", get: function() { return this._padding; }, set: function(r) { this._padding = r, this._genCanvas(); } }, { key: "borderWidth", get: function() { return this._borderWidth; }, set: function(r) { this._borderWidth = r, this._genCanvas(); } }, { key: "borderRadius", get: function() { return this._borderRadius; }, set: function(r) { this._borderRadius = r, this._genCanvas(); } }, { key: "borderColor", get: function() { return this._borderColor; }, set: function(r) { this._borderColor = r, this._genCanvas(); } }, { key: "fontFace", get: function() { return this._fontFace; }, set: function(r) { this._fontFace = r, this._genCanvas(); } }, { key: "fontSize", get: function() { return this._fontSize; }, set: function(r) { this._fontSize = r, this._genCanvas(); } }, { key: "fontWeight", get: function() { return this._fontWeight; }, set: function(r) { this._fontWeight = r, this._genCanvas(); } }, { key: "strokeWidth", get: function() { return this._strokeWidth; }, set: function(r) { this._strokeWidth = r, this._genCanvas(); } }, { key: "strokeColor", get: function() { return this._strokeColor; }, set: function(r) { this._strokeColor = r, this._genCanvas(); } }, { key: "_genCanvas", value: function() { var r = this, s = this._canvas, o = s.getContext("2d"), a = Array.isArray(this.borderWidth) ? this.borderWidth : [this.borderWidth, this.borderWidth], c = a.map(function(x) { return x * r.fontSize * 0.1; }), l = Array.isArray(this.borderRadius) ? this.borderRadius : [this.borderRadius, this.borderRadius, this.borderRadius, this.borderRadius], d = l.map(function(x) { return x * r.fontSize * 0.1; }), h = Array.isArray(this.padding) ? this.padding : [this.padding, this.padding], p = h.map(function(x) { return x * r.fontSize * 0.1; }), g = this.text.split(` `), f = "".concat(this.fontWeight, " ").concat(this.fontSize, "px ").concat(this.fontFace); o.font = f; var u = Math.max.apply(Math, Rc(g.map(function(x) { return o.measureText(x).width; }))), y = this.fontSize * g.length; if (s.width = u + c[0] * 2 + p[0] * 2, s.height = y + c[1] * 2 + p[1] * 2, this.borderWidth) { if (o.strokeStyle = this.borderColor, c[0]) { var v = c[0] / 2; o.lineWidth = c[0], o.beginPath(), o.moveTo(v, d[0]), o.lineTo(v, s.height - d[3]), o.moveTo(s.width - v, d[1]), o.lineTo(s.width - v, s.height - d[2]), o.stroke(); } if (c[1]) { var m = c[1] / 2; o.lineWidth = c[1], o.beginPath(), o.moveTo(Math.max(c[0], d[0]), m), o.lineTo(s.width - Math.max(c[0], d[1]), m), o.moveTo(Math.max(c[0], d[3]), s.height - m), o.lineTo(s.width - Math.max(c[0], d[2]), s.height - m), o.stroke(); } if (this.borderRadius) { var w = Math.max.apply(Math, Rc(c)), S = w / 2; o.lineWidth = w, o.beginPath(), [!!d[0] && [d[0], S, S, d[0]], !!d[1] && [s.width - d[1], s.width - S, S, d[1]], !!d[2] && [s.width - d[2], s.width - S, s.height - S, s.height - d[2]], !!d[3] && [d[3], S, s.height - S, s.height - d[3]]].filter(function(x) { return x; }).forEach(function(x) { var _ = Nv(x, 4), E = _[0], L = _[1], R = _[2], C = _[3]; o.moveTo(E, R), o.quadraticCurveTo(L, R, L, C); }), o.stroke(); } } this.backgroundColor && (o.fillStyle = this.backgroundColor, this.borderRadius ? (o.beginPath(), o.moveTo(c[0], d[0]), [ [c[0], d[0], s.width - d[1], c[1], c[1], c[1]], // t [s.width - c[0], s.width - c[0], s.width - c[0], c[1], d[1], s.height - d[2]], // r [s.width - c[0], s.width - d[2], d[3], s.height - c[1], s.height - c[1], s.height - c[1]], // b [c[0], c[0], c[0], s.height - c[1], s.height - d[3], d[0]] // t ].forEach(function(x) { var _ = Nv(x, 6), E = _[0], L = _[1], R = _[2], C = _[3], A = _[4], P = _[5]; o.quadraticCurveTo(E, C, L, A), o.lineTo(R, P); }), o.closePath(), o.fill()) : o.fillRect(c[0], c[1], s.width - c[0] * 2, s.height - c[1] * 2)), o.translate.apply(o, Rc(c)), o.translate.apply(o, Rc(p)), o.font = f, o.fillStyle = this.color, o.textBaseline = "bottom"; var T = this.strokeWidth > 0; T && (o.lineWidth = this.strokeWidth * this.fontSize / 10, o.strokeStyle = this.strokeColor), g.forEach(function(x, _) { var E = (u - o.measureText(x).width) / 2, L = (_ + 1) * r.fontSize; T && o.strokeText(x, E, L), o.fillText(x, E, L); }), this._texture.image = s, this._texture.needsUpdate = !0; var M = this.textHeight * g.length + a[1] * 2 + h[1] * 2; this.scale.set(M * s.width / s.height, M, 0); } }, { key: "clone", value: function() { return new this.constructor(this.text, this.textHeight, this.color).copy(this); } }, { key: "copy", value: function(r) { return Ra.Sprite.prototype.copy.call(this, r), this.color = r.color, this.backgroundColor = r.backgroundColor, this.padding = r.padding, this.borderWidth = r.borderWidth, this.borderColor = r.borderColor, this.fontFace = r.fontFace, this.fontSize = r.fontSize, this.fontWeight = r.fontWeight, this.strokeWidth = r.strokeWidth, this.strokeColor = r.strokeColor, this; } }]), t; }(Ra.Sprite); const ez = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: QB }, Symbol.toStringTag, { value: "Module" })), tz = /* @__PURE__ */ xu(ez); var kh = { exports: {} }, Fv; function nz() { return Fv || (Fv = 1, function(n, e) { (function(t, i) { n.exports = i(); })(typeof window < "u" ? window : Fr, function() { if (typeof window > "u") return null; var t = typeof window < "u" && window.Math == Math ? window : typeof self < "u" && self.Math == Math ? self : Function("return this")(), i = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || function(d) { return t.setTimeout(d, 20); }, r = t.cancelAnimationFrame || t.mozCancelAnimationFrame || t.webkitCancelAnimationFrame || function(d) { t.clearTimeout(d); }; function s(d, h) { var p = Object.prototype.toString.call(d), g = p === "[object Array]" || p === "[object NodeList]" || p === "[object HTMLCollection]" || p === "[object Object]" || typeof jQuery < "u" && d instanceof jQuery || typeof Elements < "u" && d instanceof Elements, f = 0, u = d.length; if (g) for (; f < u; f++) h(d[f]); else h(d); } function o(d) { if (!d.getBoundingClientRect) return { width: d.offsetWidth, height: d.offsetHeight }; var h = d.getBoundingClientRect(); return { width: Math.round(h.width), height: Math.round(h.height) }; } function a(d, h) { Object.keys(h).forEach(function(p) { d.style[p] = h[p]; }); } var c = function(d, h) { var p = 0; function g() { var u = []; this.add = function(m) { u.push(m); }; var y, v; this.call = function(m) { for (y = 0, v = u.length; y < v; y++) u[y].call(this, m); }, this.remove = function(m) { var w = []; for (y = 0, v = u.length; y < v; y++) u[y] !== m && w.push(u[y]); u = w; }, this.length = function() { return u.length; }; } function f(u, y) { if (u) { if (u.resizedAttached) { u.resizedAttached.add(y); return; } u.resizedAttached = new g(), u.resizedAttached.add(y), u.resizeSensor = document.createElement("div"), u.resizeSensor.dir = "ltr", u.resizeSensor.className = "resize-sensor"; var v = { pointerEvents: "none", position: "absolute", left: "0px", top: "0px", right: "0px", bottom: "0px", overflow: "hidden", zIndex: "-1", visibility: "hidden", maxWidth: "100%" }, m = { position: "absolute", left: "0px", top: "0px", transition: "0s" }; a(u.resizeSensor, v); var w = document.createElement("div"); w.className = "resize-sensor-expand", a(w, v); var S = document.createElement("div"); a(S, m), w.appendChild(S); var T = document.createElement("div"); T.className = "resize-sensor-shrink", a(T, v); var M = document.createElement("div"); a(M, m), a(M, { width: "200%", height: "200%" }), T.appendChild(M), u.resizeSensor.appendChild(w), u.resizeSensor.appendChild(T), u.appendChild(u.resizeSensor); var x = window.getComputedStyle(u), _ = x ? x.getPropertyValue("position") : null; _ !== "absolute" && _ !== "relative" && _ !== "fixed" && _ !== "sticky" && (u.style.position = "relative"); var E = !1, L = 0, R = o(u), C = 0, A = 0, P = !0; p = 0; var I = function() { var B = u.offsetWidth, U = u.offsetHeight; S.style.width = B + 10 + "px", S.style.height = U + 10 + "px", w.scrollLeft = B + 10, w.scrollTop = U + 10, T.scrollLeft = B + 10, T.scrollTop = U + 10; }, b = function() { if (P) { var B = u.offsetWidth === 0 && u.offsetHeight === 0; if (B) { p || (p = i(function() { p = 0, b(); })); return; } else P = !1; } I(); }; u.resizeSensor.resetSensor = b; var O = function() { L = 0, E && (C = R.width, A = R.height, u.resizedAttached && u.resizedAttached.call(R)); }, N = function() { R = o(u), E = R.width !== C || R.height !== A, E && !L && (L = i(O)), b(); }, D = function(B, U, k) { B.attachEvent ? B.attachEvent("on" + U, k) : B.addEventListener(U, k); }; D(w, "scroll", N), D(T, "scroll", N), p = i(function() { p = 0, b(); }); } } s(d, function(u) { f(u, h); }), this.detach = function(u) { p || (r(p), p = 0), c.detach(d, u); }, this.reset = function() { d.resizeSensor.resetSensor(); }; }; if (c.reset = function(d) { s(d, function(h) { h.resizeSensor.resetSensor(); }); }, c.detach = function(d, h) { s(d, function(p) { p && (p.resizedAttached && typeof h == "function" && (p.resizedAttached.remove(h), p.resizedAttached.length()) || p.resizeSensor && (p.contains(p.resizeSensor) && p.removeChild(p.resizeSensor), delete p.resizeSensor, delete p.resizedAttached)); }); }, typeof MutationObserver < "u") { var l = new MutationObserver(function(d) { for (var h in d) if (d.hasOwnProperty(h)) for (var p = d[h].addedNodes, g = 0; g < p.length; g++) p[g].resizeSensor && c.reset(p[g]); }); document.addEventListener("DOMContentLoaded", function(d) { l.observe(document.body, { childList: !0, subtree: !0 }); }); } return c; }); }(kh)), kh.exports; } class iz extends _n { constructor(e) { super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) { return new az(t); }), this.register(function(t) { return new cz(t); }), this.register(function(t) { return new uz(t); }), this.register(function(t) { return new lz(t); }), this.register(function(t) { return new sz(t); }), this.register(function(t) { return new hz(t); }); } load(e, t, i, r) { const s = this; let o; this.resourcePath !== "" ? o = this.resourcePath : this.path !== "" ? o = this.path : o = lr.extractUrlBase(e), this.manager.itemStart(e); const a = function(l) { r ? r(l) : console.error(l), s.manager.itemError(e), s.manager.itemEnd(e); }, c = new Qn(this.manager); c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(e, function(l) { try { s.parse(l, o, function(d) { t(d), s.manager.itemEnd(e); }, a); } catch (d) { a(d); } }, i, a); } setDRACOLoader(e) { return this.dracoLoader = e, this; } setDDSLoader() { throw new Error( 'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".' ); } setKTX2Loader(e) { return this.ktx2Loader = e, this; } setMeshoptDecoder(e) { return this.meshoptDecoder = e, this; } register(e) { return this.pluginCallbacks.indexOf(e) === -1 && this.pluginCallbacks.push(e), this; } unregister(e) { return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this; } parse(e, t, i, r) { let s; const o = {}, a = {}; if (typeof e == "string") s = e; else if (lr.decodeText(new Uint8Array(e, 0, 4)) === Tw) { try { o[vt.KHR_BINARY_GLTF] = new dz(e); } catch (h) { r && r(h); return; } s = o[vt.KHR_BINARY_GLTF].content; } else s = lr.decodeText(new Uint8Array(e)); const c = JSON.parse(s); if (c.asset === void 0 || c.asset.version[0] < 2) { r && r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")); return; } const l = new Mz(c, { path: t || this.resourcePath || "", crossOrigin: this.crossOrigin, requestHeader: this.requestHeader, manager: this.manager, ktx2Loader: this.ktx2Loader, meshoptDecoder: this.meshoptDecoder }); l.fileLoader.setRequestHeader(this.requestHeader); for (let d = 0; d < this.pluginCallbacks.length; d++) { const h = this.pluginCallbacks[d](l); a[h.name] = h, o[h.name] = !0; } if (c.extensionsUsed) for (let d = 0; d < c.extensionsUsed.length; ++d) { const h = c.extensionsUsed[d], p = c.extensionsRequired || []; switch (h) { case vt.KHR_MATERIALS_UNLIT: o[h] = new oz(); break; case vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: o[h] = new mz(); break; case vt.KHR_DRACO_MESH_COMPRESSION: o[h] = new fz(c, this.dracoLoader); break; case vt.KHR_TEXTURE_TRANSFORM: o[h] = new pz(); break; case vt.KHR_MESH_QUANTIZATION: o[h] = new gz(); break; default: p.indexOf(h) >= 0 && a[h] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h + '".'); } } l.setExtensions(o), l.setPlugins(a), l.parse(i, r); } } function rz() { let n = {}; return { get: function(e) { return n[e]; }, add: function(e, t) { n[e] = t; }, remove: function(e) { delete n[e]; }, removeAll: function() { n = {}; } }; } const vt = { KHR_BINARY_GLTF: "KHR_binary_glTF", KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression", KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual", KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat", KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness", KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission", KHR_MATERIALS_UNLIT: "KHR_materials_unlit", KHR_TEXTURE_BASISU: "KHR_texture_basisu", KHR_TEXTURE_TRANSFORM: "KHR_texture_transform", KHR_MESH_QUANTIZATION: "KHR_mesh_quantization", EXT_TEXTURE_WEBP: "EXT_texture_webp", EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression" }; class sz { constructor(e) { this.parser = e, this.name = vt.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} }; } _markDefs() { const e = this.parser, t = this.parser.json.nodes || []; for (let i = 0, r = t.length; i < r; i++) { const s = t[i]; s.extensions && s.extensions[this.name] && s.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, s.extensions[this.name].light); } } _loadLight(e) { const t = this.parser, i = "light:" + e; let r = t.cache.get(i); if (r) return r; const s = t.json, c = ((s.extensions && s.extensions[this.name] || {}).lights || [])[e]; let l; const d = new Fe(16777215); c.color !== void 0 && d.fromArray(c.color); const h = c.range !== void 0 ? c.range : 0; switch (c.type) { case "directional": l = new Hu(d), l.target.position.set(0, 0, -1), l.add(l.target); break; case "point": l = new Gu(d), l.distance = h; break; case "spot": l = new ku(d), l.distance = h, c.spot = c.spot || {}, c.spot.innerConeAngle = c.spot.innerConeAngle !== void 0 ? c.spot.innerConeAngle : 0, c.spot.outerConeAngle = c.spot.outerConeAngle !== void 0 ? c.spot.outerConeAngle : Math.PI / 4, l.angle = c.spot.outerConeAngle, l.penumbra = 1 - c.spot.innerConeAngle / c.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target); break; default: throw new Error("THREE.GLTFLoader: Unexpected light type: " + c.type); } return l.position.set(0, 0, 0), l.decay = 2, c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), r = Promise.resolve(l), t.cache.add(i, r), r; } createNodeAttachment(e) { const t = this, i = this.parser, s = i.json.nodes[e], a = (s.extensions && s.extensions[this.name] || {}).light; return a === void 0 ? null : this._loadLight(a).then(function(c) { return i._getNodeRef(t.cache, a, c); }); } } class oz { constructor() { this.name = vt.KHR_MATERIALS_UNLIT; } getMaterialType() { return Vn; } extendParams(e, t, i) { const r = []; e.color = new Fe(1, 1, 1), e.opacity = 1; const s = t.pbrMetallicRoughness; if (s) { if (Array.isArray(s.baseColorFactor)) { const o = s.baseColorFactor; e.color.fromArray(o), e.opacity = o[3]; } s.baseColorTexture !== void 0 && r.push(i.assignTexture(e, "map", s.baseColorTexture)); } return Promise.all(r); } } class az { constructor(e) { this.parser = e, this.name = vt.KHR_MATERIALS_CLEARCOAT; } getMaterialType(e) { const i = this.parser.json.materials[e]; return !i.extensions || !i.extensions[this.name] ? null : Il; } extendMaterialParams(e, t) { const i = this.parser, r = i.json.materials[e]; if (!r.extensions || !r.extensions[this.name]) return Promise.resolve(); const s = [], o = r.extensions[this.name]; if (o.clearcoatFactor !== void 0 && (t.clearcoat = o.clearcoatFactor), o.clearcoatTexture !== void 0 && s.push(i.assignTexture(t, "clearcoatMap", o.clearcoatTexture)), o.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = o.clearcoatRoughnessFactor), o.clearcoatRoughnessTexture !== void 0 && s.push(i.assignTexture(t, "clearcoatRoughnessMap", o.clearcoatRoughnessTexture)), o.clearcoatNormalTexture !== void 0 && (s.push(i.assignTexture(t, "clearcoatNormalMap", o.clearcoatNormalTexture)), o.clearcoatNormalTexture.scale !== void 0)) { const a = o.clearcoatNormalTexture.scale; t.clearcoatNormalScale = new Pe(a, -a); } return Promise.all(s); } } class lz { constructor(e) { this.parser = e, this.name = vt.KHR_MATERIALS_TRANSMISSION; } getMaterialType(e) { const i = this.parser.json.materials[e]; return !i.extensions || !i.extensions[this.name] ? null : Il; } extendMaterialParams(e, t) { const i = this.parser, r = i.json.materials[e]; if (!r.extensions || !r.extensions[this.name]) return Promise.resolve(); const s = [], o = r.extensions[this.name]; return o.transmissionFactor !== void 0 && (t.transmission = o.transmissionFactor), o.transmissionTexture !== void 0 && s.push(i.assignTexture(t, "transmissionMap", o.transmissionTexture)), Promise.all(s); } } class cz { constructor(e) { this.parser = e, this.name = vt.KHR_TEXTURE_BASISU; } loadTexture(e) { const t = this.parser, i = t.json, r = i.textures[e]; if (!r.extensions || !r.extensions[this.name]) return null; const s = r.extensions[this.name], o = i.images[s.source], a = t.options.ktx2Loader; if (!a) { if (i.extensionsRequired && i.extensionsRequired.indexOf(this.name) >= 0) throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures"); return null; } return t.loadTextureImage(e, o, a); } } class uz { constructor(e) { this.parser = e, this.name = vt.EXT_TEXTURE_WEBP, this.isSupported = null; } loadTexture(e) { const t = this.name, i = this.parser, r = i.json, s = r.textures[e]; if (!s.extensions || !s.extensions[t]) return null; const o = s.extensions[t], a = r.images[o.source]; let c = i.textureLoader; if (a.uri) { const l = i.options.manager.getHandler(a.uri); l !== null && (c = l); } return this.detectSupport().then(function(l) { if (l) return i.loadTextureImage(e, a, c); if (r.extensionsRequired && r.extensionsRequired.indexOf(t) >= 0) throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported."); return i.loadTexture(e); }); } detectSupport() { return this.isSupported || (this.isSupported = new Promise(function(e) { const t = new Image(); t.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", t.onload = t.onerror = function() { e(t.height === 1); }; })), this.isSupported; } } class hz { constructor(e) { this.name = vt.EXT_MESHOPT_COMPRESSION, this.parser = e; } loadBufferView(e) { const t = this.parser.json, i = t.bufferViews[e]; if (i.extensions && i.extensions[this.name]) { const r = i.extensions[this.name], s = this.parser.getDependency("buffer", r.buffer), o = this.parser.options.meshoptDecoder; if (!o || !o.supported) { if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0) throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files"); return null; } return Promise.all([s, o.ready]).then(function(a) { const c = r.byteOffset || 0, l = r.byteLength || 0, d = r.count, h = r.byteStride, p = new ArrayBuffer(d * h), g = new Uint8Array(a[0], c, l); return o.decodeGltfBuffer(new Uint8Array(p), d, h, g, r.mode, r.filter), p; }); } else return null; } } const Tw = "glTF", Pa = 12, Bv = { JSON: 1313821514, BIN: 5130562 }; class dz { constructor(e) { this.name = vt.KHR_BINARY_GLTF, this.content = null, this.body = null; const t = new DataView(e, 0, Pa); if (this.header = { magic: lr.decodeText(new Uint8Array(e.slice(0, 4))), version: t.getUint32(4, !0), length: t.getUint32(8, !0) }, this.header.magic !== Tw) throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header."); if (this.header.version < 2) throw new Error("THREE.GLTFLoader: Legacy binary file detected."); const i = this.header.length - Pa, r = new DataView(e, Pa); let s = 0; for (; s < i; ) { const o = r.getUint32(s, !0); s += 4; const a = r.getUint32(s, !0); if (s += 4, a === Bv.JSON) { const c = new Uint8Array(e, Pa + s, o); this.content = lr.decodeText(c); } else if (a === Bv.BIN) { const c = Pa + s; this.body = e.slice(c, c + o); } s += o; } if (this.content === null) throw new Error("THREE.GLTFLoader: JSON content not found."); } } class fz { constructor(e, t) { if (!t) throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided."); this.name = vt.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload(); } decodePrimitive(e, t) { const i = this.json, r = this.dracoLoader, s = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, a = {}, c = {}, l = {}; for (const d in o) { const h = jd[d] || d.toLowerCase(); a[h] = o[d]; } for (const d in e.attributes) { const h = jd[d] || d.toLowerCase(); if (o[d] !== void 0) { const p = i.accessors[e.attributes[d]], g = ll[p.componentType]; l[h] = g, c[h] = p.normalized === !0; } } return t.getDependency("bufferView", s).then(function(d) { return new Promise(function(h) { r.decodeDracoFile(d, function(p) { for (const g in p.attributes) { const f = p.attributes[g], u = c[g]; u !== void 0 && (f.normalized = u); } h(p); }, a, l); }); }); } } class pz { constructor() { this.name = vt.KHR_TEXTURE_TRANSFORM; } extendTexture(e, t) { return t.texCoord !== void 0 && console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.'), t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (e = e.clone(), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0), e; } } class Wd extends js { constructor(e) { super(), this.isGLTFSpecularGlossinessMaterial = !0; const t = [ "#ifdef USE_SPECULARMAP", " uniform sampler2D specularMap;", "#endif" ].join(` `), i = [ "#ifdef USE_GLOSSINESSMAP", " uniform sampler2D glossinessMap;", "#endif" ].join(` `), r = [ "vec3 specularFactor = specular;", "#ifdef USE_SPECULARMAP", " vec4 texelSpecular = texture2D( specularMap, vUv );", " texelSpecular = sRGBToLinear( texelSpecular );", " // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture", " specularFactor *= texelSpecular.rgb;", "#endif" ].join(` `), s = [ "float glossinessFactor = glossiness;", "#ifdef USE_GLOSSINESSMAP", " vec4 texelGlossiness = texture2D( glossinessMap, vUv );", " // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture", " glossinessFactor *= texelGlossiness.a;", "#endif" ].join(` `), o = [ "PhysicalMaterial material;", "material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );", "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );", "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );", "material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.", "material.specularRoughness += geometryRoughness;", "material.specularRoughness = min( material.specularRoughness, 1.0 );", "material.specularColor = specularFactor;" ].join(` `), a = { specular: { value: new Fe().setHex(16777215) }, glossiness: { value: 1 }, specularMap: { value: null }, glossinessMap: { value: null } }; this._extraUniforms = a, this.onBeforeCompile = function(c) { for (const l in a) c.uniforms[l] = a[l]; c.fragmentShader = c.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;").replace("uniform float metalness;", "uniform float glossiness;").replace("#include ", t).replace("#include ", i).replace("#include ", r).replace("#include ", s).replace("#include ", o); }, Object.defineProperties(this, { specular: { get: function() { return a.specular.value; }, set: function(c) { a.specular.value = c; } }, specularMap: { get: function() { return a.specularMap.value; }, set: function(c) { a.specularMap.value = c, c ? this.defines.USE_SPECULARMAP = "" : delete this.defines.USE_SPECULARMAP; } }, glossiness: { get: function() { return a.glossiness.value; }, set: function(c) { a.glossiness.value = c; } }, glossinessMap: { get: function() { return a.glossinessMap.value; }, set: function(c) { a.glossinessMap.value = c, c ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_UV = "") : (delete this.defines.USE_GLOSSINESSMAP, delete this.defines.USE_UV); } } }), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(e); } copy(e) { return super.copy(e), this.specularMap = e.specularMap, this.specular.copy(e.specular), this.glossinessMap = e.glossinessMap, this.glossiness = e.glossiness, delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this; } } class mz { constructor() { this.name = vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS, this.specularGlossinessParams = [ "color", "map", "lightMap", "lightMapIntensity", "aoMap", "aoMapIntensity", "emissive", "emissiveIntensity", "emissiveMap", "bumpMap", "bumpScale", "normalMap", "normalMapType", "displacementMap", "displacementScale", "displacementBias", "specularMap", "specular", "glossinessMap", "glossiness", "alphaMap", "envMap", "envMapIntensity", "refractionRatio" ]; } getMaterialType() { return Wd; } extendParams(e, t, i) { const r = t.extensions[this.name]; e.color = new Fe(1, 1, 1), e.opacity = 1; const s = []; if (Array.isArray(r.diffuseFactor)) { const o = r.diffuseFactor; e.color.fromArray(o), e.opacity = o[3]; } if (r.diffuseTexture !== void 0 && s.push(i.assignTexture(e, "map", r.diffuseTexture)), e.emissive = new Fe(0, 0, 0), e.glossiness = r.glossinessFactor !== void 0 ? r.glossinessFactor : 1, e.specular = new Fe(1, 1, 1), Array.isArray(r.specularFactor) && e.specular.fromArray(r.specularFactor), r.specularGlossinessTexture !== void 0) { const o = r.specularGlossinessTexture; s.push(i.assignTexture(e, "glossinessMap", o)), s.push(i.assignTexture(e, "specularMap", o)); } return Promise.all(s); } createMaterial(e) { const t = new Wd(e); return t.fog = !0, t.color = e.color, t.map = e.map === void 0 ? null : e.map, t.lightMap = null, t.lightMapIntensity = 1, t.aoMap = e.aoMap === void 0 ? null : e.aoMap, t.aoMapIntensity = 1, t.emissive = e.emissive, t.emissiveIntensity = 1, t.emissiveMap = e.emissiveMap === void 0 ? null : e.emissiveMap, t.bumpMap = e.bumpMap === void 0 ? null : e.bumpMap, t.bumpScale = 1, t.normalMap = e.normalMap === void 0 ? null : e.normalMap, t.normalMapType = ts, e.normalScale && (t.normalScale = e.normalScale), t.displacementMap = null, t.displacementScale = 1, t.displacementBias = 0, t.specularMap = e.specularMap === void 0 ? null : e.specularMap, t.specular = e.specular, t.glossinessMap = e.glossinessMap === void 0 ? null : e.glossinessMap, t.glossiness = e.glossiness, t.alphaMap = null, t.envMap = e.envMap === void 0 ? null : e.envMap, t.envMapIntensity = 1, t.refractionRatio = 0.98, t; } } class gz { constructor() { this.name = vt.KHR_MESH_QUANTIZATION; } } class ea extends ki { constructor(e, t, i, r) { super(e, t, i, r); } copySampleValue_(e) { const t = this.resultBuffer, i = this.sampleValues, r = this.valueSize, s = e * r * 3 + r; for (let o = 0; o !== r; o++) t[o] = i[s + o]; return t; } } ea.prototype.beforeStart_ = ea.prototype.copySampleValue_; ea.prototype.afterEnd_ = ea.prototype.copySampleValue_; ea.prototype.interpolate_ = function(n, e, t, i) { const r = this.resultBuffer, s = this.sampleValues, o = this.valueSize, a = o * 2, c = o * 3, l = i - e, d = (t - e) / l, h = d * d, p = h * d, g = n * c, f = g - c, u = -2 * p + 3 * h, y = p - h, v = 1 - u, m = y - h + d; for (let w = 0; w !== o; w++) { const S = s[f + w + o], T = s[f + w + a] * l, M = s[g + w + o], x = s[g + w] * l; r[w] = v * S + m * T + u * M + y * x; } return r; }; const qi = { FLOAT: 5126, //FLOAT_MAT2: 35674, FLOAT_MAT3: 35675, FLOAT_MAT4: 35676, FLOAT_VEC2: 35664, FLOAT_VEC3: 35665, FLOAT_VEC4: 35666, LINEAR: 9729, REPEAT: 10497, SAMPLER_2D: 35678, POINTS: 0, LINES: 1, LINE_LOOP: 2, LINE_STRIP: 3, TRIANGLES: 4, TRIANGLE_STRIP: 5, TRIANGLE_FAN: 6, UNSIGNED_BYTE: 5121, UNSIGNED_SHORT: 5123 }, ll = { 5120: Int8Array, 5121: Uint8Array, 5122: Int16Array, 5123: Uint16Array, 5125: Uint32Array, 5126: Float32Array }, zv = { 9728: Kt, 9729: jt, 9984: Ka, 9985: Tu, 9986: Qa, 9987: br }, Uv = { 33071: mn, 33648: No, 10497: Jr }, Vv = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT2: 4, MAT3: 9, MAT4: 16 }, jd = { POSITION: "position", NORMAL: "normal", TANGENT: "tangent", TEXCOORD_0: "uv", TEXCOORD_1: "uv2", COLOR_0: "color", WEIGHTS_0: "skinWeight", JOINTS_0: "skinIndex" }, Pr = { scale: "scale", translation: "position", rotation: "quaternion", weights: "morphTargetInfluences" }, vz = { CUBICSPLINE: void 0, // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each // keyframe track will be initialized with a default interpolation type, then modified. LINEAR: Is, STEP: Bo }, Gh = { OPAQUE: "OPAQUE", MASK: "MASK", BLEND: "BLEND" }; function kv(n, e) { return typeof n != "string" || n === "" ? "" : (/^https?:\/\//i.test(e) && /^\//.test(n) && (e = e.replace(/(^https?:\/\/[^\/]+).*/i, "$1")), /^(https?:)?\/\//i.test(n) || /^data:.*,.*$/i.test(n) || /^blob:.*$/i.test(n) ? n : e + n); } function yz(n) { return n.DefaultMaterial === void 0 && (n.DefaultMaterial = new js({ color: 16777215, emissive: 0, metalness: 1, roughness: 1, transparent: !1, depthTest: !0, side: Xr })), n.DefaultMaterial; } function Ia(n, e, t) { for (const i in t.extensions) n[i] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[i] = t.extensions[i]); } function vs(n, e) { e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(n.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras)); } function bz(n, e, t) { let i = !1, r = !1; for (let a = 0, c = e.length; a < c; a++) { const l = e[a]; if (l.POSITION !== void 0 && (i = !0), l.NORMAL !== void 0 && (r = !0), i && r) break; } if (!i && !r) return Promise.resolve(n); const s = [], o = []; for (let a = 0, c = e.length; a < c; a++) { const l = e[a]; if (i) { const d = l.POSITION !== void 0 ? t.getDependency("accessor", l.POSITION) : n.attributes.position; s.push(d); } if (r) { const d = l.NORMAL !== void 0 ? t.getDependency("accessor", l.NORMAL) : n.attributes.normal; o.push(d); } } return Promise.all([ Promise.all(s), Promise.all(o) ]).then(function(a) { const c = a[0], l = a[1]; return i && (n.morphAttributes.position = c), r && (n.morphAttributes.normal = l), n.morphTargetsRelative = !0, n; }); } function xz(n, e) { if (n.updateMorphTargets(), e.weights !== void 0) for (let t = 0, i = e.weights.length; t < i; t++) n.morphTargetInfluences[t] = e.weights[t]; if (e.extras && Array.isArray(e.extras.targetNames)) { const t = e.extras.targetNames; if (n.morphTargetInfluences.length === t.length) { n.morphTargetDictionary = {}; for (let i = 0, r = t.length; i < r; i++) n.morphTargetDictionary[t[i]] = i; } else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names."); } } function wz(n) { const e = n.extensions && n.extensions[vt.KHR_DRACO_MESH_COMPRESSION]; let t; return e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + Gv(e.attributes) : t = n.indices + ":" + Gv(n.attributes) + ":" + n.mode, t; } function Gv(n) { let e = ""; const t = Object.keys(n).sort(); for (let i = 0, r = t.length; i < r; i++) e += t[i] + ":" + n[t[i]] + ";"; return e; } function $d(n) { switch (n) { case Int8Array: return 1 / 127; case Uint8Array: return 1 / 255; case Int16Array: return 1 / 32767; case Uint16Array: return 1 / 65535; default: throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type."); } } class Mz { constructor(e = {}, t = {}) { this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new rz(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.textureCache = {}, this.nodeNamesUsed = {}, typeof createImageBitmap < "u" && /Firefox/.test(navigator.userAgent) === !1 ? this.textureLoader = new Lp(this.options.manager) : this.textureLoader = new wp(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Qn(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0); } setExtensions(e) { this.extensions = e; } setPlugins(e) { this.plugins = e; } parse(e, t) { const i = this, r = this.json, s = this.extensions; this.cache.removeAll(), this._invokeAll(function(o) { return o._markDefs && o._markDefs(); }), Promise.all(this._invokeAll(function(o) { return o.beforeRoot && o.beforeRoot(); })).then(function() { return Promise.all([ i.getDependencies("scene"), i.getDependencies("animation"), i.getDependencies("camera") ]); }).then(function(o) { const a = { scene: o[0][r.scene || 0], scenes: o[0], animations: o[1], cameras: o[2], asset: r.asset, parser: i, userData: {} }; Ia(s, a, r), vs(a, r), Promise.all(i._invokeAll(function(c) { return c.afterRoot && c.afterRoot(a); })).then(function() { e(a); }); }).catch(t); } /** * Marks the special nodes/meshes in json for efficient parse. */ _markDefs() { const e = this.json.nodes || [], t = this.json.skins || [], i = this.json.meshes || []; for (let r = 0, s = t.length; r < s; r++) { const o = t[r].joints; for (let a = 0, c = o.length; a < c; a++) e[o[a]].isBone = !0; } for (let r = 0, s = e.length; r < s; r++) { const o = e[r]; o.mesh !== void 0 && (this._addNodeRef(this.meshCache, o.mesh), o.skin !== void 0 && (i[o.mesh].isSkinnedMesh = !0)), o.camera !== void 0 && this._addNodeRef(this.cameraCache, o.camera); } } /** * Counts references to shared node / Object3D resources. These resources * can be reused, or "instantiated", at multiple nodes in the scene * hierarchy. Mesh, Camera, and Light instances are instantiated and must * be marked. Non-scenegraph resources (like Materials, Geometries, and * Textures) can be reused directly and are not marked here. * * Example: CesiumMilkTruck sample model reuses "Wheel" meshes. */ _addNodeRef(e, t) { t !== void 0 && (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++); } /** Returns a reference to a shared resource, cloning it if necessary. */ _getNodeRef(e, t, i) { if (e.refs[t] <= 1) return i; const r = i.clone(); return r.name += "_instance_" + e.uses[t]++, r; } _invokeOne(e) { const t = Object.values(this.plugins); t.push(this); for (let i = 0; i < t.length; i++) { const r = e(t[i]); if (r) return r; } return null; } _invokeAll(e) { const t = Object.values(this.plugins); t.unshift(this); const i = []; for (let r = 0; r < t.length; r++) { const s = e(t[r]); s && i.push(s); } return i; } /** * Requests the specified dependency asynchronously, with caching. * @param {string} type * @param {number} index * @return {Promise} */ getDependency(e, t) { const i = e + ":" + t; let r = this.cache.get(i); if (!r) { switch (e) { case "scene": r = this.loadScene(t); break; case "node": r = this.loadNode(t); break; case "mesh": r = this._invokeOne(function(s) { return s.loadMesh && s.loadMesh(t); }); break; case "accessor": r = this.loadAccessor(t); break; case "bufferView": r = this._invokeOne(function(s) { return s.loadBufferView && s.loadBufferView(t); }); break; case "buffer": r = this.loadBuffer(t); break; case "material": r = this._invokeOne(function(s) { return s.loadMaterial && s.loadMaterial(t); }); break; case "texture": r = this._invokeOne(function(s) { return s.loadTexture && s.loadTexture(t); }); break; case "skin": r = this.loadSkin(t); break; case "animation": r = this.loadAnimation(t); break; case "camera": r = this.loadCamera(t); break; default: throw new Error("Unknown type: " + e); } this.cache.add(i, r); } return r; } /** * Requests all dependencies of the specified type asynchronously, with caching. * @param {string} type * @return {Promise>} */ getDependencies(e) { let t = this.cache.get(e); if (!t) { const i = this, r = this.json[e + (e === "mesh" ? "es" : "s")] || []; t = Promise.all(r.map(function(s, o) { return i.getDependency(e, o); })), this.cache.add(e, t); } return t; } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views * @param {number} bufferIndex * @return {Promise} */ loadBuffer(e) { const t = this.json.buffers[e], i = this.fileLoader; if (t.type && t.type !== "arraybuffer") throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported."); if (t.uri === void 0 && e === 0) return Promise.resolve(this.extensions[vt.KHR_BINARY_GLTF].body); const r = this.options; return new Promise(function(s, o) { i.load(kv(t.uri, r.path), s, void 0, function() { o(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".')); }); }); } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views * @param {number} bufferViewIndex * @return {Promise} */ loadBufferView(e) { const t = this.json.bufferViews[e]; return this.getDependency("buffer", t.buffer).then(function(i) { const r = t.byteLength || 0, s = t.byteOffset || 0; return i.slice(s, s + r); }); } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors * @param {number} accessorIndex * @return {Promise} */ loadAccessor(e) { const t = this, i = this.json, r = this.json.accessors[e]; if (r.bufferView === void 0 && r.sparse === void 0) return Promise.resolve(null); const s = []; return r.bufferView !== void 0 ? s.push(this.getDependency("bufferView", r.bufferView)) : s.push(null), r.sparse !== void 0 && (s.push(this.getDependency("bufferView", r.sparse.indices.bufferView)), s.push(this.getDependency("bufferView", r.sparse.values.bufferView))), Promise.all(s).then(function(o) { const a = o[0], c = Vv[r.type], l = ll[r.componentType], d = l.BYTES_PER_ELEMENT, h = d * c, p = r.byteOffset || 0, g = r.bufferView !== void 0 ? i.bufferViews[r.bufferView].byteStride : void 0, f = r.normalized === !0; let u, y; if (g && g !== h) { const v = Math.floor(p / g), m = "InterleavedBuffer:" + r.bufferView + ":" + r.componentType + ":" + v + ":" + r.count; let w = t.cache.get(m); w || (u = new l(a, v * g, r.count * g / d), w = new rs(u, g / d), t.cache.add(m, w)), y = new fr(w, c, p % g / d, f); } else a === null ? u = new l(r.count * c) : u = new l(a, p, r.count * c), y = new nt(u, c, f); if (r.sparse !== void 0) { const v = Vv.SCALAR, m = ll[r.sparse.indices.componentType], w = r.sparse.indices.byteOffset || 0, S = r.sparse.values.byteOffset || 0, T = new m(o[1], w, r.sparse.count * v), M = new l(o[2], S, r.sparse.count * c); a !== null && (y = new nt(y.array.slice(), y.itemSize, y.normalized)); for (let x = 0, _ = T.length; x < _; x++) { const E = T[x]; if (y.setX(E, M[x * c]), c >= 2 && y.setY(E, M[x * c + 1]), c >= 3 && y.setZ(E, M[x * c + 2]), c >= 4 && y.setW(E, M[x * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute."); } } return y; }); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures * @param {number} textureIndex * @return {Promise} */ loadTexture(e) { const t = this.json, i = this.options, r = t.textures[e], s = t.images[r.source]; let o = this.textureLoader; if (s.uri) { const a = i.manager.getHandler(s.uri); a !== null && (o = a); } return this.loadTextureImage(e, s, o); } loadTextureImage(e, t, i) { const r = this, s = this.json, o = this.options, a = s.textures[e], c = (t.uri || t.bufferView) + ":" + a.sampler; if (this.textureCache[c]) return this.textureCache[c]; const l = self.URL || self.webkitURL; let d = t.uri || "", h = !1, p = !0; const g = d.search(/\.jpe?g($|\?)/i) > 0 || d.search(/^data\:image\/jpeg/) === 0; if ((t.mimeType === "image/jpeg" || g) && (p = !1), t.bufferView !== void 0) d = r.getDependency("bufferView", t.bufferView).then(function(u) { if (t.mimeType === "image/png") { const v = new DataView(u, 25, 1).getUint8(0, !1); p = v === 6 || v === 4 || v === 3; } h = !0; const y = new Blob([u], { type: t.mimeType }); return d = l.createObjectURL(y), d; }); else if (t.uri === void 0) throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView"); const f = Promise.resolve(d).then(function(u) { return new Promise(function(y, v) { let m = y; i.isImageBitmapLoader === !0 && (m = function(w) { const S = new nn(w); S.needsUpdate = !0, y(S); }), i.load(kv(u, o.path), m, void 0, v); }); }).then(function(u) { h === !0 && l.revokeObjectURL(d), u.flipY = !1, a.name && (u.name = a.name), p || (u.format = ar); const v = (s.samplers || {})[a.sampler] || {}; return u.magFilter = zv[v.magFilter] || jt, u.minFilter = zv[v.minFilter] || br, u.wrapS = Uv[v.wrapS] || Jr, u.wrapT = Uv[v.wrapT] || Jr, r.associations.set(u, { type: "textures", index: e }), u; }).catch(function() { return console.error("THREE.GLTFLoader: Couldn't load texture", d), null; }); return this.textureCache[c] = f, f; } /** * Asynchronously assigns a texture to the given material parameters. * @param {Object} materialParams * @param {string} mapName * @param {Object} mapDef * @return {Promise} */ assignTexture(e, t, i) { const r = this; return this.getDependency("texture", i.index).then(function(s) { if (i.texCoord !== void 0 && i.texCoord != 0 && !(t === "aoMap" && i.texCoord == 1) && console.warn("THREE.GLTFLoader: Custom UV set " + i.texCoord + " for texture " + t + " not yet supported."), r.extensions[vt.KHR_TEXTURE_TRANSFORM]) { const o = i.extensions !== void 0 ? i.extensions[vt.KHR_TEXTURE_TRANSFORM] : void 0; if (o) { const a = r.associations.get(s); s = r.extensions[vt.KHR_TEXTURE_TRANSFORM].extendTexture(s, o), r.associations.set(s, a); } } e[t] = s; }); } /** * Assigns final material to a Mesh, Line, or Points instance. The instance * already has a material (generated from the glTF material options alone) * but reuse of the same glTF material may require multiple threejs materials * to accommodate different primitive types, defines, etc. New materials will * be created if necessary, and reused from a cache. * @param {Object3D} mesh Mesh, Line, or Points instance. */ assignFinalMaterial(e) { const t = e.geometry; let i = e.material; const r = t.attributes.tangent !== void 0, s = t.attributes.color !== void 0, o = t.attributes.normal === void 0, a = Object.keys(t.morphAttributes).length > 0, c = a && t.morphAttributes.normal !== void 0; if (e.isPoints) { const l = "PointsMaterial:" + i.uuid; let d = this.cache.get(l); d || (d = new ss(), sn.prototype.copy.call(d, i), d.color.copy(i.color), d.map = i.map, d.sizeAttenuation = !1, this.cache.add(l, d)), i = d; } else if (e.isLine) { const l = "LineBasicMaterial:" + i.uuid; let d = this.cache.get(l); d || (d = new un(), sn.prototype.copy.call(d, i), d.color.copy(i.color), this.cache.add(l, d)), i = d; } if (r || s || o || a) { let l = "ClonedMaterial:" + i.uuid + ":"; i.isGLTFSpecularGlossinessMaterial && (l += "specular-glossiness:"), r && (l += "vertex-tangents:"), s && (l += "vertex-colors:"), o && (l += "flat-shading:"), a && (l += "morph-targets:"), c && (l += "morph-normals:"); let d = this.cache.get(l); d || (d = i.clone(), s && (d.vertexColors = !0), o && (d.flatShading = !0), a && (d.morphTargets = !0), c && (d.morphNormals = !0), r && (d.vertexTangents = !0, d.normalScale && (d.normalScale.y *= -1), d.clearcoatNormalScale && (d.clearcoatNormalScale.y *= -1)), this.cache.add(l, d), this.associations.set(d, this.associations.get(i))), i = d; } i.aoMap && t.attributes.uv2 === void 0 && t.attributes.uv !== void 0 && t.setAttribute("uv2", t.attributes.uv), e.material = i; } getMaterialType() { return js; } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials * @param {number} materialIndex * @return {Promise} */ loadMaterial(e) { const t = this, i = this.json, r = this.extensions, s = i.materials[e]; let o; const a = {}, c = s.extensions || {}, l = []; if (c[vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) { const h = r[vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]; o = h.getMaterialType(), l.push(h.extendParams(a, s, t)); } else if (c[vt.KHR_MATERIALS_UNLIT]) { const h = r[vt.KHR_MATERIALS_UNLIT]; o = h.getMaterialType(), l.push(h.extendParams(a, s, t)); } else { const h = s.pbrMetallicRoughness || {}; if (a.color = new Fe(1, 1, 1), a.opacity = 1, Array.isArray(h.baseColorFactor)) { const p = h.baseColorFactor; a.color.fromArray(p), a.opacity = p[3]; } h.baseColorTexture !== void 0 && l.push(t.assignTexture(a, "map", h.baseColorTexture)), a.metalness = h.metallicFactor !== void 0 ? h.metallicFactor : 1, a.roughness = h.roughnessFactor !== void 0 ? h.roughnessFactor : 1, h.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(a, "metalnessMap", h.metallicRoughnessTexture)), l.push(t.assignTexture(a, "roughnessMap", h.metallicRoughnessTexture))), o = this._invokeOne(function(p) { return p.getMaterialType && p.getMaterialType(e); }), l.push(Promise.all(this._invokeAll(function(p) { return p.extendMaterialParams && p.extendMaterialParams(e, a); }))); } s.doubleSided === !0 && (a.side = Yr); const d = s.alphaMode || Gh.OPAQUE; return d === Gh.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, d === Gh.MASK && (a.alphaTest = s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), s.normalTexture !== void 0 && o !== Vn && (l.push(t.assignTexture(a, "normalMap", s.normalTexture)), a.normalScale = new Pe(1, -1), s.normalTexture.scale !== void 0 && a.normalScale.set(s.normalTexture.scale, -s.normalTexture.scale)), s.occlusionTexture !== void 0 && o !== Vn && (l.push(t.assignTexture(a, "aoMap", s.occlusionTexture)), s.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = s.occlusionTexture.strength)), s.emissiveFactor !== void 0 && o !== Vn && (a.emissive = new Fe().fromArray(s.emissiveFactor)), s.emissiveTexture !== void 0 && o !== Vn && l.push(t.assignTexture(a, "emissiveMap", s.emissiveTexture)), Promise.all(l).then(function() { let h; return o === Wd ? h = r[vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a) : h = new o(a), s.name && (h.name = s.name), h.map && (h.map.encoding = Os), h.emissiveMap && (h.emissiveMap.encoding = Os), vs(h, s), t.associations.set(h, { type: "materials", index: e }), s.extensions && Ia(r, h, s), h; }); } /** When Object3D instances are targeted by animation, they need unique names. */ createUniqueName(e) { const t = ft.sanitizeNodeName(e || ""); let i = t; for (let r = 1; this.nodeNamesUsed[i]; ++r) i = t + "_" + r; return this.nodeNamesUsed[i] = !0, i; } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry * * Creates BufferGeometries from primitives. * * @param {Array} primitives * @return {Promise>} */ loadGeometries(e) { const t = this, i = this.extensions, r = this.primitiveCache; function s(a) { return i[vt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(c) { return Hv(c, a, t); }); } const o = []; for (let a = 0, c = e.length; a < c; a++) { const l = e[a], d = wz(l), h = r[d]; if (h) o.push(h.promise); else { let p; l.extensions && l.extensions[vt.KHR_DRACO_MESH_COMPRESSION] ? p = s(l) : p = Hv(new Je(), l, t), r[d] = { primitive: l, promise: p }, o.push(p); } } return Promise.all(o); } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes * @param {number} meshIndex * @return {Promise} */ loadMesh(e) { const t = this, i = this.json, r = this.extensions, s = i.meshes[e], o = s.primitives, a = []; for (let c = 0, l = o.length; c < l; c++) { const d = o[c].material === void 0 ? yz(this.cache) : this.getDependency("material", o[c].material); a.push(d); } return a.push(t.loadGeometries(o)), Promise.all(a).then(function(c) { const l = c.slice(0, c.length - 1), d = c[c.length - 1], h = []; for (let g = 0, f = d.length; g < f; g++) { const u = d[g], y = o[g]; let v; const m = l[g]; if (y.mode === qi.TRIANGLES || y.mode === qi.TRIANGLE_STRIP || y.mode === qi.TRIANGLE_FAN || y.mode === void 0) v = s.isSkinnedMesh === !0 ? new Al(u, m) : new tn(u, m), v.isSkinnedMesh === !0 && !v.geometry.attributes.skinWeight.normalized && v.normalizeSkinWeights(), y.mode === qi.TRIANGLE_STRIP ? v.geometry = Wv(v.geometry, ox) : y.mode === qi.TRIANGLE_FAN && (v.geometry = Wv(v.geometry, jf)); else if (y.mode === qi.LINES) v = new Fn(u, m); else if (y.mode === qi.LINE_STRIP) v = new Ui(u, m); else if (y.mode === qi.LINE_LOOP) v = new Fu(u, m); else if (y.mode === qi.POINTS) v = new ha(u, m); else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode); Object.keys(v.geometry.morphAttributes).length > 0 && xz(v, s), v.name = t.createUniqueName(s.name || "mesh_" + e), vs(v, s), y.extensions && Ia(r, v, y), t.assignFinalMaterial(v), h.push(v); } if (h.length === 1) return h[0]; const p = new Pi(); for (let g = 0, f = h.length; g < f; g++) p.add(h[g]); return p; }); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras * @param {number} cameraIndex * @return {Promise} */ loadCamera(e) { let t; const i = this.json.cameras[e], r = i[i.type]; if (!r) { console.warn("THREE.GLTFLoader: Missing camera parameters."); return; } return i.type === "perspective" ? t = new an(Fd.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : i.type === "orthographic" && (t = new fa(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), i.name && (t.name = this.createUniqueName(i.name)), vs(t, i), Promise.resolve(t); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins * @param {number} skinIndex * @return {Promise} */ loadSkin(e) { const t = this.json.skins[e], i = { joints: t.joints }; return t.inverseBindMatrices === void 0 ? Promise.resolve(i) : this.getDependency("accessor", t.inverseBindMatrices).then(function(r) { return i.inverseBindMatrices = r, i; }); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations * @param {number} animationIndex * @return {Promise} */ loadAnimation(e) { const i = this.json.animations[e], r = [], s = [], o = [], a = [], c = []; for (let l = 0, d = i.channels.length; l < d; l++) { const h = i.channels[l], p = i.samplers[h.sampler], g = h.target, f = g.node !== void 0 ? g.node : g.id, u = i.parameters !== void 0 ? i.parameters[p.input] : p.input, y = i.parameters !== void 0 ? i.parameters[p.output] : p.output; r.push(this.getDependency("node", f)), s.push(this.getDependency("accessor", u)), o.push(this.getDependency("accessor", y)), a.push(p), c.push(g); } return Promise.all([ Promise.all(r), Promise.all(s), Promise.all(o), Promise.all(a), Promise.all(c) ]).then(function(l) { const d = l[0], h = l[1], p = l[2], g = l[3], f = l[4], u = []; for (let v = 0, m = d.length; v < m; v++) { const w = d[v], S = h[v], T = p[v], M = g[v], x = f[v]; if (w === void 0) continue; w.updateMatrix(), w.matrixAutoUpdate = !0; let _; switch (Pr[x.path]) { case Pr.weights: _ = qo; break; case Pr.rotation: _ = Zs; break; case Pr.position: case Pr.scale: default: _ = Ko; break; } const E = w.name ? w.name : w.uuid, L = M.interpolation !== void 0 ? vz[M.interpolation] : Is, R = []; Pr[x.path] === Pr.weights ? w.traverse(function(A) { A.isMesh === !0 && A.morphTargetInfluences && R.push(A.name ? A.name : A.uuid); }) : R.push(E); let C = T.array; if (T.normalized) { const A = $d(C.constructor), P = new Float32Array(C.length); for (let I = 0, b = C.length; I < b; I++) P[I] = C[I] * A; C = P; } for (let A = 0, P = R.length; A < P; A++) { const I = new _( R[A] + "." + Pr[x.path], S.array, C, L ); M.interpolation === "CUBICSPLINE" && (I.createInterpolant = function(O) { return new ea(this.times, this.values, this.getValueSize() / 3, O); }, I.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0), u.push(I); } } const y = i.name ? i.name : "animation_" + e; return new Qo(y, void 0, u); }); } createNodeMesh(e) { const t = this.json, i = this, r = t.nodes[e]; return r.mesh === void 0 ? null : i.getDependency("mesh", r.mesh).then(function(s) { const o = i._getNodeRef(i.meshCache, r.mesh, s); return r.weights !== void 0 && o.traverse(function(a) { if (a.isMesh) for (let c = 0, l = r.weights.length; c < l; c++) a.morphTargetInfluences[c] = r.weights[c]; }), o; }); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy * @param {number} nodeIndex * @return {Promise} */ loadNode(e) { const t = this.json, i = this.extensions, r = this, s = t.nodes[e], o = s.name ? r.createUniqueName(s.name) : ""; return function() { const a = [], c = r._invokeOne(function(l) { return l.createNodeMesh && l.createNodeMesh(e); }); return c && a.push(c), s.camera !== void 0 && a.push(r.getDependency("camera", s.camera).then(function(l) { return r._getNodeRef(r.cameraCache, s.camera, l); })), r._invokeAll(function(l) { return l.createNodeAttachment && l.createNodeAttachment(e); }).forEach(function(l) { a.push(l); }), Promise.all(a); }().then(function(a) { let c; if (s.isBone === !0 ? c = new Cl() : a.length > 1 ? c = new Pi() : a.length === 1 ? c = a[0] : c = new ot(), c !== a[0]) for (let l = 0, d = a.length; l < d; l++) c.add(a[l]); if (s.name && (c.userData.name = s.name, c.name = o), vs(c, s), s.extensions && Ia(i, c, s), s.matrix !== void 0) { const l = new $e(); l.fromArray(s.matrix), c.applyMatrix4(l); } else s.translation !== void 0 && c.position.fromArray(s.translation), s.rotation !== void 0 && c.quaternion.fromArray(s.rotation), s.scale !== void 0 && c.scale.fromArray(s.scale); return r.associations.set(c, { type: "nodes", index: e }), c; }); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes * @param {number} sceneIndex * @return {Promise} */ loadScene(e) { const t = this.json, i = this.extensions, r = this.json.scenes[e], s = this, o = new Pi(); r.name && (o.name = s.createUniqueName(r.name)), vs(o, r), r.extensions && Ia(i, o, r); const a = r.nodes || [], c = []; for (let l = 0, d = a.length; l < d; l++) c.push(Ew(a[l], o, t, s)); return Promise.all(c).then(function() { return o; }); } } function Ew(n, e, t, i) { const r = t.nodes[n]; return i.getDependency("node", n).then(function(s) { if (r.skin === void 0) return s; let o; return i.getDependency("skin", r.skin).then(function(a) { o = a; const c = []; for (let l = 0, d = o.joints.length; l < d; l++) c.push(i.getDependency("node", o.joints[l])); return Promise.all(c); }).then(function(a) { return s.traverse(function(c) { if (!c.isMesh) return; const l = [], d = []; for (let h = 0, p = a.length; h < p; h++) { const g = a[h]; if (g) { l.push(g); const f = new $e(); o.inverseBindMatrices !== void 0 && f.fromArray(o.inverseBindMatrices.array, h * 16), d.push(f); } else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', o.joints[h]); } c.bind(new Ll(l, d), c.matrixWorld); }), s; }); }).then(function(s) { e.add(s); const o = []; if (r.children) { const a = r.children; for (let c = 0, l = a.length; c < l; c++) { const d = a[c]; o.push(Ew(d, s, t, i)); } } return Promise.all(o); }); } function Sz(n, e, t) { const i = e.attributes, r = new Hn(); if (i.POSITION !== void 0) { const a = t.json.accessors[i.POSITION], c = a.min, l = a.max; if (c !== void 0 && l !== void 0) { if (r.set( new X(c[0], c[1], c[2]), new X(l[0], l[1], l[2]) ), a.normalized) { const d = $d(ll[a.componentType]); r.min.multiplyScalar(d), r.max.multiplyScalar(d); } } else { console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."); return; } } else return; const s = e.targets; if (s !== void 0) { const a = new X(), c = new X(); for (let l = 0, d = s.length; l < d; l++) { const h = s[l]; if (h.POSITION !== void 0) { const p = t.json.accessors[h.POSITION], g = p.min, f = p.max; if (g !== void 0 && f !== void 0) { if (c.setX(Math.max(Math.abs(g[0]), Math.abs(f[0]))), c.setY(Math.max(Math.abs(g[1]), Math.abs(f[1]))), c.setZ(Math.max(Math.abs(g[2]), Math.abs(f[2]))), p.normalized) { const u = $d(ll[p.componentType]); c.multiplyScalar(u); } a.max(c); } else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."); } } r.expandByVector(a); } n.boundingBox = r; const o = new xr(); r.getCenter(o.center), o.radius = r.min.distanceTo(r.max) / 2, n.boundingSphere = o; } function Hv(n, e, t) { const i = e.attributes, r = []; function s(o, a) { return t.getDependency("accessor", o).then(function(c) { n.setAttribute(a, c); }); } for (const o in i) { const a = jd[o] || o.toLowerCase(); a in n.attributes || r.push(s(i[o], a)); } if (e.indices !== void 0 && !n.index) { const o = t.getDependency("accessor", e.indices).then(function(a) { n.setIndex(a); }); r.push(o); } return vs(n, e), Sz(n, e, t), Promise.all(r).then(function() { return e.targets !== void 0 ? bz(n, e.targets, t) : n; }); } function Wv(n, e) { let t = n.getIndex(); if (t === null) { const o = [], a = n.getAttribute("position"); if (a !== void 0) { for (let c = 0; c < a.count; c++) o.push(c); n.setIndex(o), t = n.getIndex(); } else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), n; } const i = t.count - 2, r = []; if (e === jf) for (let o = 1; o <= i; o++) r.push(t.getX(0)), r.push(t.getX(o)), r.push(t.getX(o + 1)); else for (let o = 0; o < i; o++) o % 2 === 0 ? (r.push(t.getX(o)), r.push(t.getX(o + 1)), r.push(t.getX(o + 2))) : (r.push(t.getX(o + 2)), r.push(t.getX(o + 1)), r.push(t.getX(o))); r.length / 3 !== i && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."); const s = n.clone(); return s.setIndex(r), s; } const _z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, GLTFLoader: iz }, Symbol.toStringTag, { value: "Module" })), Tz = /* @__PURE__ */ xu(_z); var Hh = { exports: {} }, jv; function Ez() { return jv || (jv = 1, function(n) { function e(l) { var d = {}; function h(g) { if (d[g]) return d[g].exports; var f = d[g] = { /******/ i: g, /******/ l: !1, /******/ exports: {} /******/ }; return l[g].call(f.exports, f, f.exports, h), f.l = !0, f.exports; } h.m = l, h.c = d, h.i = function(g) { return g; }, h.d = function(g, f, u) { h.o(g, f) || Object.defineProperty(g, f, { /******/ configurable: !1, /******/ enumerable: !0, /******/ get: u /******/ }); }, h.r = function(g) { Object.defineProperty(g, "__esModule", { value: !0 }); }, h.n = function(g) { var f = g && g.__esModule ? ( /******/ function() { return g.default; } ) : ( /******/ function() { return g; } ); return h.d(f, "a", f), f; }, h.o = function(g, f) { return Object.prototype.hasOwnProperty.call(g, f); }, h.p = "/", h.oe = function(g) { throw console.error(g), g; }; var p = h(h.s = ENTRY_MODULE); return p.default || p; } var t = "[\\.|\\-|\\+|\\w|/|@]+", i = "\\(\\s*(/\\*.*?\\*/)?\\s*.*?(" + t + ").*?\\)"; function r(l) { return (l + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&"); } function s(l) { return !isNaN(1 * l); } function o(l, d, h) { var p = {}; p[h] = []; var g = d.toString(), f = g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/); if (!f) return p; for (var u = f[1], y = new RegExp("(\\\\n|\\W)" + r(u) + i, "g"), v; v = y.exec(g); ) v[3] !== "dll-reference" && p[h].push(v[3]); for (y = new RegExp("\\(" + r(u) + '\\("(dll-reference\\s(' + t + '))"\\)\\)' + i, "g"); v = y.exec(g); ) l[v[2]] || (p[h].push(v[1]), l[v[2]] = __webpack_require__(v[1]).m), p[v[2]] = p[v[2]] || [], p[v[2]].push(v[4]); for (var m = Object.keys(p), w = 0; w < m.length; w++) for (var S = 0; S < p[m[w]].length; S++) s(p[m[w]][S]) && (p[m[w]][S] = 1 * p[m[w]][S]); return p; } function a(l) { var d = Object.keys(l); return d.reduce(function(h, p) { return h || l[p].length > 0; }, !1); } function c(l, d) { for (var h = { main: [d] }, p = { main: [] }, g = { main: {} }; a(h); ) for (var f = Object.keys(h), u = 0; u < f.length; u++) { var y = f[u], v = h[y], m = v.pop(); if (g[y] = g[y] || {}, !(g[y][m] || !l[y][m])) { g[y][m] = !0, p[y] = p[y] || [], p[y].push(m); for (var w = o(l, l[y][m], y), S = Object.keys(w), T = 0; T < S.length; T++) h[S[T]] = h[S[T]] || [], h[S[T]] = h[S[T]].concat(w[S[T]]); } } return p; } n.exports = function(l, d) { d = d || {}; var h = { main: __webpack_modules__ }, p = d.all ? { main: Object.keys(h.main) } : c(h, l), g = ""; Object.keys(p).filter(function(m) { return m !== "main"; }).forEach(function(m) { for (var w = 0; p[m][w]; ) w++; p[m].push(w), h[m][w] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", g = g + "var " + m + " = (" + e.toString().replace("ENTRY_MODULE", JSON.stringify(w)) + ")({" + p[m].map(function(S) { return "" + JSON.stringify(S) + ": " + h[m][S].toString(); }).join(",") + `}); `; }), g = g + "new ((" + e.toString().replace("ENTRY_MODULE", JSON.stringify(l)) + ")({" + p.main.map(function(m) { return "" + JSON.stringify(m) + ": " + h.main[m].toString(); }).join(",") + "}))(self);"; var f = new window.Blob([g], { type: "text/javascript" }); if (d.bare) return f; var u = window.URL || window.webkitURL || window.mozURL || window.msURL, y = u.createObjectURL(f), v = new window.Worker(y); return v.objectURL = y, v; }; }(Hh)), Hh.exports; } function Az(n) { var e = this.constructor; return this.then( function(t) { return e.resolve(n()).then(function() { return t; }); }, function(t) { return e.resolve(n()).then(function() { return e.reject(t); }); } ); } function Cz(n) { var e = this; return new e(function(t, i) { if (!(n && typeof n.length < "u")) return i( new TypeError( typeof n + " " + n + " is not iterable(cannot read property Symbol(Symbol.iterator))" ) ); var r = Array.prototype.slice.call(n); if (r.length === 0) return t([]); var s = r.length; function o(c, l) { if (l && (typeof l == "object" || typeof l == "function")) { var d = l.then; if (typeof d == "function") { d.call( l, function(h) { o(c, h); }, function(h) { r[c] = { status: "rejected", reason: h }, --s === 0 && t(r); } ); return; } } r[c] = { status: "fulfilled", value: l }, --s === 0 && t(r); } for (var a = 0; a < r.length; a++) o(a, r[a]); }); } function Aw(n, e) { this.name = "AggregateError", this.errors = n, this.message = e || ""; } Aw.prototype = Error.prototype; function Lz(n) { var e = this; return new e(function(t, i) { if (!(n && typeof n.length < "u")) return i(new TypeError("Promise.any accepts an array")); var r = Array.prototype.slice.call(n); if (r.length === 0) return i(); for (var s = [], o = 0; o < r.length; o++) try { e.resolve(r[o]).then(t).catch(function(a) { s.push(a), s.length === r.length && i( new Aw( s, "All promises were rejected" ) ); }); } catch (a) { i(a); } }); } var Rz = setTimeout; function Cw(n) { return !!(n && typeof n.length < "u"); } function Pz() { } function Iz(n, e) { return function() { n.apply(e, arguments); }; } function Ut(n) { if (!(this instanceof Ut)) throw new TypeError("Promises must be constructed via new"); if (typeof n != "function") throw new TypeError("not a function"); this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], Rw(n, this); } function Lw(n, e) { for (; n._state === 3; ) n = n._value; if (n._state === 0) { n._deferreds.push(e); return; } n._handled = !0, Ut._immediateFn(function() { var t = n._state === 1 ? e.onFulfilled : e.onRejected; if (t === null) { (n._state === 1 ? Zd : cl)(e.promise, n._value); return; } var i; try { i = t(n._value); } catch (r) { cl(e.promise, r); return; } Zd(e.promise, i); }); } function Zd(n, e) { try { if (e === n) throw new TypeError("A promise cannot be resolved with itself."); if (e && (typeof e == "object" || typeof e == "function")) { var t = e.then; if (e instanceof Ut) { n._state = 3, n._value = e, Xd(n); return; } else if (typeof t == "function") { Rw(Iz(t, e), n); return; } } n._state = 1, n._value = e, Xd(n); } catch (i) { cl(n, i); } } function cl(n, e) { n._state = 2, n._value = e, Xd(n); } function Xd(n) { n._state === 2 && n._deferreds.length === 0 && Ut._immediateFn(function() { n._handled || Ut._unhandledRejectionFn(n._value); }); for (var e = 0, t = n._deferreds.length; e < t; e++) Lw(n, n._deferreds[e]); n._deferreds = null; } function Oz(n, e, t) { this.onFulfilled = typeof n == "function" ? n : null, this.onRejected = typeof e == "function" ? e : null, this.promise = t; } function Rw(n, e) { var t = !1; try { n( function(i) { t || (t = !0, Zd(e, i)); }, function(i) { t || (t = !0, cl(e, i)); } ); } catch (i) { if (t) return; t = !0, cl(e, i); } } Ut.prototype.catch = function(n) { return this.then(null, n); }; Ut.prototype.then = function(n, e) { var t = new this.constructor(Pz); return Lw(this, new Oz(n, e, t)), t; }; Ut.prototype.finally = Az; Ut.all = function(n) { return new Ut(function(e, t) { if (!Cw(n)) return t(new TypeError("Promise.all accepts an array")); var i = Array.prototype.slice.call(n); if (i.length === 0) return e([]); var r = i.length; function s(a, c) { try { if (c && (typeof c == "object" || typeof c == "function")) { var l = c.then; if (typeof l == "function") { l.call( c, function(d) { s(a, d); }, t ); return; } } i[a] = c, --r === 0 && e(i); } catch (d) { t(d); } } for (var o = 0; o < i.length; o++) s(o, i[o]); }); }; Ut.any = Lz; Ut.allSettled = Cz; Ut.resolve = function(n) { return n && typeof n == "object" && n.constructor === Ut ? n : new Ut(function(e) { e(n); }); }; Ut.reject = function(n) { return new Ut(function(e, t) { t(n); }); }; Ut.race = function(n) { return new Ut(function(e, t) { if (!Cw(n)) return t(new TypeError("Promise.race accepts an array")); for (var i = 0, r = n.length; i < r; i++) Ut.resolve(n[i]).then(e, t); }); }; Ut._immediateFn = // @ts-ignore typeof setImmediate == "function" && function(n) { setImmediate(n); } || function(n) { Rz(n, 0); }; Ut._unhandledRejectionFn = function(e) { typeof console < "u" && console && console.warn("Possible Unhandled Promise Rejection:", e); }; const Dz = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Ut }, Symbol.toStringTag, { value: "Module" })), Nz = /* @__PURE__ */ xu(Dz); (function(n, e) { (function(i, r) { n.exports = r(); })(Fr, () => ( /******/ (() => { var t = [ /* 0 */ /***/ (o, a, c) => { c(1); var l = c(2), d = l.version, h = function() { this.Revision = d, this.defaultMaterialColor = 16777215, this.defaultOpacity = 1, this.modelPrefix = void 0, this.Geometry = c(3).Geometry, this.Glyph = c(16).Glyph, this.Glyphset = c(18).Glyphset, this.Pointset = c(22).Pointset, this.Label = c(17).Label, this.Lines = c(24).Lines, this.TextureArray = c(25).TextureArray, this.TextureSlides = c(27).TextureSlides, this.Renderer = c(30).Renderer, this.Scene = c(32).Scene, this.GeometryCSG = c(50).GeometryCSG, this.GlyphsetCSG = c(56).GlyphsetCSG, this.Viewport = c(43).Viewport, this.CameraControls = c(43).CameraControls, this.SmoothCameraTransition = c(43).SmoothCameraTransition, this.RayCaster = c(43).RayCaster, this.CameraAutoTumble = c(43).CameraAutoTumble, this.StereoEffect = c(43).StereoEffect, this.loadExternalFile = c(5).loadExternalFile, this.loadExternalFiles = c(5).loadExternalFiles, this.THREE = c(4); }; o.exports = new h(); }, /* 1 */ /***/ (o) => { o.exports = _P(); }, /* 2 */ /***/ (o) => { o.exports = /* @__PURE__ */ JSON.parse('{"name":"zincjs","version":"1.11.4","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu ","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}'); }, /* 3 */ /***/ function(o, a, c) { var l = c(4), d = c(5).toBufferGeometry, h = (g, f, u) => { var y = d(g, u), v = !1; 1 > u.opacity && (v = !0); var m; if (y._video === void 0) { var w = u.localTimeEnabled || u.localMorphColour; f ? (m = f, m.morphTargets = w, m.morphNormals = u.localTimeEnabled) : y instanceof l.BufferGeometry && y.attributes.color === void 0 ? m = new l.MeshPhongMaterial({ color: u.colour, morphTargets: w, morphNormals: u.localTimeEnabled, transparent: v, opacity: u.opacity, side: l.DoubleSide }) : m = new l.MeshPhongMaterial({ color: u.colour, morphTargets: w, morphNormals: u.localTimeEnabled, vertexColors: l.VertexColors, transparent: v, opacity: u.opacity, side: l.DoubleSide }), u.localMorphColour && y.morphAttributes.color && (m.onBeforeCompile = c(9).augmentMorphColor()); } else { var S = y._video.createCanvasVideoTexture(); m = new l.MeshBasicMaterial({ morphTargets: u.localTimeEnabled, color: new l.Color(1, 1, 1), transparent: v, opacity: u.opacity, map: S, side: l.DoubleSide }), this.videoHandler = y._video; } return new l.Mesh(y, m); }, p = function() { c(10).ZincObject.call(this), this.videoHandler = void 0, this.isGeometry = !0, this.createMesh = (g, f, u) => { if (!(this.morph && this.morph.geometry && g != null)) { var y = h(g, f, u); this.setMesh(y, u.localTimeEnabled, u.localMorphColour); } }, this.calculateUVs = () => { this.geometry.computeBoundingBox(); var g = this.geometry.boundingBox.max, f = this.geometry.boundingBox.min, u = new l.Vector2(0 - f.x, 0 - f.y), y = new l.Vector2(g.x - f.x, g.y - f.y); this.geometry.faceVertexUvs[0] = []; for (var v = 0; v < this.geometry.faces.length; v++) { var m = this.geometry.vertices[this.geometry.faces[v].a], w = this.geometry.vertices[this.geometry.faces[v].b], S = this.geometry.vertices[this.geometry.faces[v].c]; geometry.faceVertexUvs[0].push([new l.Vector2((m.x + u.x) / y.x, (m.y + u.y) / y.y), new l.Vector2((w.x + u.x) / y.x, (w.y + u.y) / y.y), new l.Vector2((S.x + u.x) / y.x, (S.y + u.y) / y.y)]); } geometry.uvsNeedUpdate = !0; }, this.checkTransparentMesh = function() { this._lod.checkTransparentMesh(); }, this.setWireframe = (g) => { this.morph.material.wireframe = g; }, this.editVertices = function(g, f) { if (g && g.length) { var u = this.getMorph(), y = u.geometry.getAttribute("position"); if (!u || 0 > f) return; var v = 3 * f; g.forEach((m) => { y.array[v++] = m[0], y.array[v++] = m[1], y.array[v++] = m[2]; }), y.needsUpdate = !0, u.geometry.computeBoundingBox(), u.geometry.computeBoundingSphere(), this.boundingBoxUpdateRequired = !0; } }; }; p.prototype = Object.create(c(10).ZincObject.prototype), a.Geometry = p; }, /* 4 */ /***/ (o) => { o.exports = zB; }, /* 5 */ /***/ (o, a, c) => { function l(x) { throw new TypeError('"' + x + '" is read-only'); } var d = c(4), h = c(6).Geometry, p = c(7).default; function g(x) { var _ = x, E = c(0).modelPrefix; return E && (E[E.length - 1] != "/" && l("prefix"), /^(?:[a-z]+:)?\/\//i.test(x) || (_ = E + x)), _; } function f(x, _) { var E = (R, C) => { try { var A = new URL(R, C).href; if (R && 2 > R.split("?").length) { var P = C.split("?"); P.length === 2 && (A = A + "?" + P[1]); } return A; } catch { console.error("There is an issue creting the url link with: ".concat(R, ".")); } }; if (!Array.isArray(x)) return E(x, _); var L = []; return x.forEach((R) => { L.push(E(R, _)); }), L; } function u(x, _, E, L, R) { var C = x.morphTargetInfluences, A = void 0; x.geometry && (A = x.geometry.morphAttributes); var P = !1; if (C && A && A.position) { L.set(0, 0, 0), R.set(0, 0, 0); for (var I = 0; I < C.length; I++) 0 < C[I] && (P = !0, E.setFromArray(A.position[I].array), L.add(E.min.multiplyScalar(C[I])), R.add(E.max.multiplyScalar(C[I]))); P && _.set(L, R); } P || _.setFromBufferAttribute(x.geometry.attributes.position), x.updateWorldMatrix(!0, !0), _.applyMatrix4(x.matrixWorld); } function y(x, _, E, L) { var R = new XMLHttpRequest(); R.open("GET", g(x), !0), R.onreadystatechange = () => { R.readyState == 4 && (R.status == 200 ? E(R.responseText, _) : L(x)); }, R.send(null); } function v(x, _, E) { function L(I, b) { A[b] = I, C++, C == R && _(A); } for (var R = x.length, C = 0, A = [], P = 0; P < R; P++) y(x[P], P, L, E); } a.getColorsRGB = (x, _) => { var E = Math.floor(_ / 3), L = _ % 3, R = 0; L == 0 ? R = x[E].r : L == 1 ? R = x[E].g : L == 2 && (R = x[E].b); var C = new d.Color(R); return [C.r, C.g, C.b]; }, a.updateMorphColorAttribute = function(x, _) { if (_ && x && x.morphAttributes && x.morphAttributes.color) { var E = x.morphAttributes.color, L = _.morphTargetInfluences, R = L.length; x.deleteAttribute("morphColor0"), x.deleteAttribute("morphColor1"); for (var C = 0, A = [], P = 0; 1 > C || P < R; P++) 0 < L[P] && (C++, A.push([P, L[P]])); A.length == 2 ? (x.setAttribute("morphColor0", E[A[0][0]]), x.setAttribute("morphColor1", E[A[1][0]])) : A.length == 1 && (x.setAttribute("morphColor0", E[A[0][0]]), x.setAttribute("morphColor1", E[A[0][0]])); } }, a.toBufferGeometry = (x, _) => { var E; return x instanceof h ? (_.localTimeEnabled && !x.morphNormalsReady && (x.morphNormals == null || x.morphNormals.length == 0) && x.computeMorphNormals(), E = x.toIndexedBufferGeometry(), _.localMorphColour && m(x, E)) : x instanceof d.BufferGeometry && (E = x.clone()), E.colorsNeedUpdate = !0, E.computeBoundingBox(), E.computeBoundingSphere(), x._video && (E._video = x._video), E; }, a.copyMorphColorsToBufferGeometry = (x, _) => { if (x && x.morphColors && 0 < x.morphColors.length) { for (var E = [], L = x.morphColors, R = c(5).getColorsRGB, C = 0, A = L.length; C < A; C++) { for (var P = L[C], I = [], b = 0; b < x.faces.length; b++) { var O = x.faces[b], N = R(P.colors, O.a); I.push(N[0], N[1], N[2]), N = R(P.colors, O.b), I.push(N[0], N[1], N[2]), N = R(P.colors, O.c), I.push(N[0], N[1], N[2]); } var D = new d.Float32BufferAttribute(3 * (3 * x.faces.length), 3); D.name = P.name, E.push(D.copyArray(I)); } _.morphAttributes.color = E; } }; var m = (x, _) => { if (x && x.morphColors && 0 < x.morphColors.length) { for (var E = [], L = x.morphColors, R = c(5).getColorsRGB, C = 0, A = L.length; C < A; C++) { for (var P, I = L[C], b = [], O = 0; O < 3 * I.colors.length; O++) P = R(I.colors, O), b.push(P[0], P[1], P[2]); var N = new d.Float32BufferAttribute(b, 3); N.name = I.name, E.push(N); } _.morphAttributes.color = E; } }; a.mergeVertices = function(x) { var _ = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : 1e-4; _ = Math.max(_, Number.EPSILON); for (var E, L = {}, R = x.getIndex(), C = x.getAttribute("position"), A = R ? R.count : C.count, P = 0, I = Object.keys(x.attributes), b = {}, O = {}, le = [], N = ["getX", "getY", "getZ", "getW"], D = 0, B = I.length; D < B; D++) { E = I[D], b[E] = []; var U = x.morphAttributes[E]; U && (O[E] = Array(U.length).fill().map(() => [])); } for (var k = Math.log10(1 / _), K = Math.pow(10, k), D = 0; D < A; D++) { for (var ie = R ? R.getX(D) : D, j = "", G = 0, B = I.length; G < B; G++) for (var E = I[G], W = x.getAttribute(E), q = W.itemSize, Q = 0; Q < q; Q++) j += "".concat(~~(W[N[Q]](ie) * K), ","); if (j in L) le.push(L[j]); else { for (var G = 0, B = I.length; G < B; G++) for (var ee, E = I[G], W = x.getAttribute(E), U = x.morphAttributes[E], q = W.itemSize, ne = b[E], Y = O[E], Q = 0; Q < q; Q++) if (ee = N[Q], ne.push(W[ee](ie)), U) for (var te = 0, F = U.length; te < F; te++) Y[te].push(U[te][ee](ie)); L[j] = P, le.push(P), P++; } } for (var $ = x.clone(), D = 0, B = I.length; D < B; D++) { var W, E = I[D], J = x.getAttribute(E), z = new J.array.constructor(b[E]); if (J.isInterleavedBufferAttribute ? W = new d.BufferAttribute(z, J.itemSize, J.itemSize) : (W = x.getAttribute(E).clone(), W.setArray(z)), $.setAttribute(E, W), E in O) for (var V, G = 0; G < O[E].length; G++) V = x.morphAttributes[E][G].clone(), V.setArray(new V.array.constructor(O[E][G])), $.morphAttributes[E][G] = V; } var oe = Uint8Array; le.length >= Math.pow(2, 8) && (oe = Uint16Array), le.length >= Math.pow(2, 16) && (oe = Uint32Array); var ue = new oe(le), le = null; return R === null ? le = new d.BufferAttribute(ue, 1) : (le = x.getIndex().clone(), le.setArray(ue)), $.setIndex(le), $; }; function w(x) { if (x.isMeshPhongMaterial) { var _ = new d.MeshToonMaterial({ color: x.color.clone(), morphTargets: x.morphTargets, morphNormals: x.morphNormals, vertexColors: x.vertexColors, transparent: x.transparent, opacity: x.opacity, side: x.side }); return x.map && (_.map = x.map), _; } return x; } function S(x, _) { if (_ && x >= _.length) { var E = new d.BufferGeometry(), L = new Float32Array(3 * x), R = 0; return _.forEach((C) => { L[R++] = C[0], L[R++] = C[1], L[R++] = C[2]; }), E.setAttribute("position", new d.BufferAttribute(L, 3)), E.setDrawRange(0, _.length), E; } } function T() { var x = new Image(); x.src = c(8); var _ = new d.Texture(); return _.image = x, _.needsUpdate = !0, _; } function M(x, _, E, L, R, C) { var A = new p(x, _, E, L, R, C); return A.fontFace = L, A.fontSize = R, A.fontWeight = C, A.material.map.generateMipmaps = !1, A.material.map.anisotropy = 4, A.material.sizeAttenuation = !1, A.material.alphaTest = 0.5, A.material.transparent = !0, A.material.depthWrite = !1, A.material.depthTest = !1, A.center.set(0.5, -1.2), A.renderOrder = 1e4, A; } a.getBoundingBox = u, a.createNewURL = f, a.createBufferGeometry = S, a.getCircularTexture = T, a.resolveURL = g, a.loadExternalFile = y, a.loadExternalFiles = v, a.PhongToToon = w, a.createNewSpriteText = M; }, /* 6 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ Face3: () => ( /* binding */ y ), /* harmony export */ Geometry: () => ( /* binding */ f ) /* harmony export */ }); var l = c(4), d = new l.Matrix4(), h = new l.Object3D(), p = new l.Vector3(), g = new l.Vector3(); function f() { this.uuid = l.MathUtils.generateUUID(), this.name = "", this.type = "Geometry", this.vertices = [], this.colors = [], this.faces = [], this.faceVertexUvs = [[]], this.normals = [], this.uvs = [], this.morphTargets = [], this.morphNormals = [], this.skinWeights = [], this.skinIndices = [], this.lineDistances = [], this.boundingBox = null, this.boundingSphere = null, this.elementsNeedUpdate = !1, this.verticesNeedUpdate = !1, this.uvsNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.lineDistancesNeedUpdate = !1, this.groupsNeedUpdate = !1, this.morphNormalsReady = !1; } f.prototype = Object.assign(Object.create(l.EventDispatcher.prototype), { constructor: f, isGeometry: !0, applyMatrix4: function(m) { for (var w, S = new l.Matrix3().getNormalMatrix(m), T = 0, M = this.vertices.length; T < M; T++) w = this.vertices[T], w.applyMatrix4(m); for (var x, _ = 0, E = this.faces.length; _ < E; _++) { x = this.faces[_], x.normal.applyMatrix3(S).normalize(); for (var L = 0, R = x.vertexNormals.length; L < R; L++) x.vertexNormals[L].applyMatrix3(S).normalize(); } return this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this.verticesNeedUpdate = !0, this.normalsNeedUpdate = !0, this; }, rotateX: function(m) { return d.makeRotationX(m), this.applyMatrix4(d), this; }, rotateY: function(m) { return d.makeRotationY(m), this.applyMatrix4(d), this; }, rotateZ: function(m) { return d.makeRotationZ(m), this.applyMatrix4(d), this; }, translate: function(m, w, S) { return d.makeTranslation(m, w, S), this.applyMatrix4(d), this; }, scale: function(m, w, S) { return d.makeScale(m, w, S), this.applyMatrix4(d), this; }, lookAt: function(m) { return h.lookAt(m), h.updateMatrix(), this.applyMatrix4(h.matrix), this; }, fromBufferGeometry: function(m) { function w(k, K, ie, j) { var G = E === void 0 ? [] : [S.colors[k].clone(), S.colors[K].clone(), S.colors[ie].clone()], W = _ === void 0 ? [] : [new l.Vector3().fromBufferAttribute(_, k), new l.Vector3().fromBufferAttribute(_, K), new l.Vector3().fromBufferAttribute(_, ie)], q = new y(k, K, ie, W, G, j); S.faces.push(q), L !== void 0 && S.faceVertexUvs[0].push([new l.Vector2().fromBufferAttribute(L, k), new l.Vector2().fromBufferAttribute(L, K), new l.Vector2().fromBufferAttribute(L, ie)]), R !== void 0 && S.faceVertexUvs[1].push([new l.Vector2().fromBufferAttribute(R, k), new l.Vector2().fromBufferAttribute(R, K), new l.Vector2().fromBufferAttribute(R, ie)]); } var S = this, T = m.index === null ? void 0 : m.index, M = m.attributes; if (M.position === void 0) return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."), this; var x = M.position, _ = M.normal, E = M.color, L = M.uv, R = M.uv2; R !== void 0 && (this.faceVertexUvs[1] = []); for (var C = 0; C < x.count; C++) S.vertices.push(new l.Vector3().fromBufferAttribute(x, C)), E !== void 0 && S.colors.push(new l.Color().fromBufferAttribute(E, C)); var A = m.groups; if (0 < A.length) for (var P = 0; P < A.length; P++) for (var I = A[P], b = I.start, O = I.count, N = b, D = b + O; N < D; N += 3) T === void 0 ? w(N, N + 1, N + 2, I.materialIndex) : w(T.getX(N), T.getX(N + 1), T.getX(N + 2), I.materialIndex); else if (T !== void 0) for (var B = 0; B < T.count; B += 3) w(T.getX(B), T.getX(B + 1), T.getX(B + 2)); else for (var U = 0; U < x.count; U += 3) w(U, U + 1, U + 2); return this.computeFaceNormals(), m.boundingBox !== null && (this.boundingBox = m.boundingBox.clone()), m.boundingSphere !== null && (this.boundingSphere = m.boundingSphere.clone()), this; }, center: function() { return this.computeBoundingBox(), this.boundingBox.getCenter(p).negate(), this.translate(p.x, p.y, p.z), this; }, normalize: function() { this.computeBoundingSphere(); var m = this.boundingSphere.center, w = this.boundingSphere.radius, S = w === 0 ? 1 : 1 / w, T = new l.Matrix4(); return T.set(S, 0, 0, -S * m.x, 0, S, 0, -S * m.y, 0, 0, S, -S * m.z, 0, 0, 0, 1), this.applyMatrix4(T), this; }, computeFaceNormals: function() { for (var m = new l.Vector3(), w = new l.Vector3(), S = 0, T = this.faces.length; S < T; S++) { var M = this.faces[S], x = this.vertices[M.a], _ = this.vertices[M.b], E = this.vertices[M.c]; m.subVectors(E, _), w.subVectors(x, _), m.cross(w), m.normalize(), M.normal.copy(m); } }, computeVertexNormals: function() { for (var m = !(0 < arguments.length && arguments[0] !== void 0) || arguments[0], w = Array(this.vertices.length), S = 0, T = this.vertices.length; S < T; S++) w[S] = new l.Vector3(); if (m) for (var M = new l.Vector3(), x = new l.Vector3(), _ = 0, E = this.faces.length; _ < E; _++) { var L = this.faces[_], R = this.vertices[L.a], C = this.vertices[L.b], A = this.vertices[L.c]; M.subVectors(A, C), x.subVectors(R, C), M.cross(x), w[L.a].add(M), w[L.b].add(M), w[L.c].add(M); } else { this.computeFaceNormals(); for (var P, I = 0, b = this.faces.length; I < b; I++) P = this.faces[I], w[P.a].add(P.normal), w[P.b].add(P.normal), w[P.c].add(P.normal); } for (var O = 0, N = this.vertices.length; O < N; O++) w[O].normalize(); for (var D = 0, B = this.faces.length; D < B; D++) { var U = this.faces[D], k = U.vertexNormals; k.length === 3 ? (k[0].copy(w[U.a]), k[1].copy(w[U.b]), k[2].copy(w[U.c])) : (k[0] = w[U.a].clone(), k[1] = w[U.b].clone(), k[2] = w[U.c].clone()); } return 0 < this.faces.length && (this.normalsNeedUpdate = !0), w; }, computeFlatVertexNormals: function() { this.computeFaceNormals(); for (var m = 0, w = this.faces.length; m < w; m++) { var S = this.faces[m], T = S.vertexNormals; T.length === 3 ? (T[0].copy(S.normal), T[1].copy(S.normal), T[2].copy(S.normal)) : (T[0] = S.normal.clone(), T[1] = S.normal.clone(), T[2] = S.normal.clone()); } 0 < this.faces.length && (this.normalsNeedUpdate = !0); }, computeMorphNormals: function() { for (var m, w = 0, S = this.faces.length; w < S; w++) { m = this.faces[w], m.__originalFaceNormal ? m.__originalFaceNormal.copy(m.normal) : m.__originalFaceNormal = m.normal.clone(), m.__originalVertexNormals || (m.__originalVertexNormals = []); for (var T = 0, M = m.vertexNormals.length; T < M; T++) m.__originalVertexNormals[T] ? m.__originalVertexNormals[T].copy(m.vertexNormals[T]) : m.__originalVertexNormals[T] = m.vertexNormals[T].clone(); } var x = new f(); x.faces = this.faces; for (var _ = 0, E = this.morphTargets.length; _ < E; _++) { if (!this.morphNormals[_]) { this.morphNormals[_] = {}, this.morphNormals[_].faceNormals = [], this.morphNormals[_].vertexNormals = []; for (var L = this.morphNormals[_].faceNormals, R = this.morphNormals[_].vertexNormals, C = 0, A = this.faces.length; C < A; C++) { var P = new l.Vector3(), I = { a: new l.Vector3(), b: new l.Vector3(), c: new l.Vector3() }; L.push(P), R.push(I); } } var b = this.morphNormals[_]; x.vertices = this.morphTargets[_].vertices, x.computeFaceNormals(); var O = x.computeVertexNormals(); if (O && 0 < O.length) { this.morphTargets[_].normals = Array(this.vertices.length); for (var N = 0; N < O.length; N++) this.morphTargets[_].normals[N] = O[N].clone(); } for (var D = 0, B = this.faces.length; D < B; D++) { var U = this.faces[D], k = b.faceNormals[D], K = b.vertexNormals[D]; k.copy(U.normal), K.a.copy(U.vertexNormals[0]), K.b.copy(U.vertexNormals[1]), K.c.copy(U.vertexNormals[2]); } } for (var ie, j = 0, G = this.faces.length; j < G; j++) ie = this.faces[j], ie.normal = ie.__originalFaceNormal, ie.vertexNormals = ie.__originalVertexNormals; this.morphNormalsReady = !0; }, computeBoundingBox: function() { this.boundingBox === null && (this.boundingBox = new l.Box3()), this.boundingBox.setFromPoints(this.vertices); }, computeBoundingSphere: function() { this.boundingSphere === null && (this.boundingSphere = new l.Sphere()), this.boundingSphere.setFromPoints(this.vertices); }, mergeMorph: function(m, w) { var S = this.morphTargets.length, T = this.morphTargets, M = m.morphTargets, x = this.morphColors.length, _ = this.morphColors, E = m.morphColors; if (0 < S && S == M.length) for (var L = 0, R = T.length; L < R; L++) { for (var C = T[L], A = M[L], P = 0, I = A.vertices.length; P < I; P++) { var b = A.vertices[P], O = b.clone(); w !== void 0 && O.applyMatrix4(w), C.vertices.push(O); } if (C.normals && A.normals) for (var N = 0; N < A.normals.length; N += 3) g.set(A.normals2[N], A.normals2[N + 1], A.normals2[N + 2]), w !== void 0 && g.applyMatrix4(w), C.normals.push(g.x, g.y, g.z); } if (0 < x && x == E.length) for (var D = 0, B = _.length; D < B; D++) for (var U = _[D], k = E[D], K = 0, ie = k.colors; K < ie; K++) U.colors.push(k.colors[K].clone()); }, merge: function(m, w) { var S = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : 0; if (!(m && m.isGeometry)) return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", m); var T, M = this.vertices.length, x = this.vertices, _ = m.vertices, E = m.normals, L = this.faces, R = m.faces, C = this.colors, A = m.colors; w !== void 0 && (T = new l.Matrix3().getNormalMatrix(w)); for (var P = 0, I = _.length; P < I; P++) { var b = _[P], O = b.clone(); w !== void 0 && O.applyMatrix4(w), x.push(O); } for (var N = 0; N < E.length; N += 3) g.set(E[N], E[N + 1], E[N + 2]), w !== void 0 && g.applyMatrix4(w), this.normals.push(g.x, g.y, g.z); for (var D = 0, B = A.length; D < B; D++) typeof A[D] == "number" ? C.push(A[D]) : C.push(A[D].clone()); for (var U = 0, k = R.length; U < k; U++) { var K = R[U], ie = void 0, j = void 0, G = K.vertexNormals, W = K.vertexColors, q = new y(K.a + M, K.b + M, K.c + M); q.normal.copy(K.normal), T !== void 0 && q.normal.applyMatrix3(T).normalize(); for (var Q = 0, ee = G.length; Q < ee; Q++) ie = G[Q].clone(), T !== void 0 && ie.applyMatrix3(T).normalize(), q.vertexNormals.push(ie); q.color.copy(K.color); for (var ne = 0, Y = W.length; ne < Y; ne++) j = W[ne], q.vertexColors.push(j.clone()); q.materialIndex = K.materialIndex + S, L.push(q); } for (var te, F = 0, $ = m.faceVertexUvs.length; F < $; F++) { te = m.faceVertexUvs[F], this.faceVertexUvs[F] === void 0 && (this.faceVertexUvs[F] = []); for (var J = 0, z = te.length; J < z; J++) { for (var V = te[J], oe = [], ue = 0, le = V.length; ue < le; ue++) oe.push(V[ue].clone()); this.faceVertexUvs[F].push(oe); } } this.mergeMorph(m, w); }, mergeMesh: function(m) { return m && m.isMesh ? (m.matrixAutoUpdate && m.updateMatrix(), void this.merge(m.geometry, m.matrix)) : void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.", m); }, /* * Checks for duplicate vertices with hashmap. * Duplicated vertices are removed * and faces' vertices are updated. */ mergeVertices: function() { for (var m = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : 4, w = {}, S = [], T = [], M = Math.pow(10, m), x = 0, _ = this.vertices.length; x < _; x++) { var E = this.vertices[x], L = Math.round(E.x * M) + "_" + Math.round(E.y * M) + "_" + Math.round(E.z * M); w[L] === void 0 ? (w[L] = x, S.push(this.vertices[x]), T[x] = S.length - 1) : T[x] = T[w[L]]; } for (var R, C = [], A = 0, P = this.faces.length; A < P; A++) { R = this.faces[A], R.a = T[R.a], R.b = T[R.b], R.c = T[R.c]; for (var I = [R.a, R.b, R.c], b = 0; 3 > b; b++) if (I[b] === I[(b + 1) % 3]) { C.push(A); break; } } for (var O, N = C.length - 1; 0 <= N; N--) { O = C[N], this.faces.splice(O, 1); for (var D = 0, B = this.faceVertexUvs.length; D < B; D++) this.faceVertexUvs[D].splice(O, 1); } var U = this.vertices.length - S.length; return this.vertices = S, U; }, setFromPoints: function(m) { this.vertices = []; for (var w, S = 0, T = m.length; S < T; S++) w = m[S], this.vertices.push(new l.Vector3(w.x, w.y, w.z || 0)); return this; }, sortFacesByMaterialIndex: function() { for (var m = this.faces, w = m.length, S = 0; S < w; S++) m[S]._id = S; m.sort(function(R, C) { return R.materialIndex - C.materialIndex; }); var T, M, x = this.faceVertexUvs[0], _ = this.faceVertexUvs[1]; x && x.length === w && (T = []), _ && _.length === w && (M = []); for (var E, L = 0; L < w; L++) E = m[L]._id, T && T.push(x[E]), M && M.push(_[E]); T && (this.faceVertexUvs[0] = T), M && (this.faceVertexUvs[1] = M); }, toJSON: function() { function m(Y, te, F) { return F ? Y | 1 << te : Y & ~(1 << te); } function w(Y) { var te = Y.x.toString() + Y.y.toString() + Y.z.toString(); return P[te] === void 0 && (P[te] = A.length / 3, A.push(Y.x, Y.y, Y.z)), P[te]; } function S(Y) { var te = Y.r.toString() + Y.g.toString() + Y.b.toString(); return b[te] === void 0 && (b[te] = I.length, I.push(Y.getHex())), b[te]; } function T(Y) { var te = Y.x.toString() + Y.y.toString(); return N[te] === void 0 && (N[te] = O.length / 2, O.push(Y.x, Y.y)), N[te]; } var M = { metadata: { version: 4.5, type: "Geometry", generator: "Geometry.toJSON" } }; if (M.uuid = this.uuid, M.type = this.type, this.name !== "" && (M.name = this.name), this.parameters !== void 0) { var x = this.parameters; for (var _ in x) x[_] !== void 0 && (M[_] = x[_]); return M; } for (var E, L = [], R = 0; R < this.vertices.length; R++) E = this.vertices[R], L.push(E.x, E.y, E.z); for (var C = [], A = [], P = {}, I = [], b = {}, O = [], N = {}, D = 0; D < this.faces.length; D++) { var B = this.faces[D], U = !0, k = !1, K = this.faceVertexUvs[0][D] !== void 0, ie = 0 < B.normal.length(), j = 0 < B.vertexNormals.length, G = B.color.r !== 1 || B.color.g !== 1 || B.color.b !== 1, W = 0 < B.vertexColors.length, q = 0; if (q = m(q, 0, 0), q = m(q, 1, U), q = m(q, 2, k), q = m(q, 3, K), q = m(q, 4, ie), q = m(q, 5, j), q = m(q, 6, G), q = m(q, 7, W), C.push(q), C.push(B.a, B.b, B.c), C.push(B.materialIndex), K) { var Q = this.faceVertexUvs[0][D]; C.push(T(Q[0]), T(Q[1]), T(Q[2])); } if (ie && C.push(w(B.normal)), j) { var ee = B.vertexNormals; C.push(w(ee[0]), w(ee[1]), w(ee[2])); } if (G && C.push(S(B.color)), W) { var ne = B.vertexColors; C.push(S(ne[0]), S(ne[1]), S(ne[2])); } } return M.data = {}, M.data.vertices = L, M.data.normals = A, 0 < I.length && (M.data.colors = I), 0 < O.length && (M.data.uvs = [O]), M.data.faces = C, M; }, clone: function() { return new f().copy(this); }, copy: function(m) { this.vertices = [], this.colors = [], this.faces = [], this.faceVertexUvs = [[]], this.morphTargets = [], this.morphNormals = [], this.skinWeights = [], this.skinIndices = [], this.lineDistances = [], this.boundingBox = null, this.boundingSphere = null, this.name = m.name; for (var w = m.vertices, S = 0, T = w.length; S < T; S++) this.vertices.push(w[S].clone()); for (var M = m.colors, x = 0, _ = M.length; x < _; x++) this.colors.push(M[x].clone()); for (var E = m.faces, L = 0, R = E.length; L < R; L++) this.faces.push(E[L].clone()); for (var C, A = 0, P = m.faceVertexUvs.length; A < P; A++) { C = m.faceVertexUvs[A], this.faceVertexUvs[A] === void 0 && (this.faceVertexUvs[A] = []); for (var I = 0, b = C.length; I < b; I++) { for (var O, N = C[I], D = [], B = 0, U = N.length; B < U; B++) O = N[B], D.push(O.clone()); this.faceVertexUvs[A].push(D); } } for (var k, K = m.morphTargets, ie = 0, j = K.length; ie < j; ie++) { if (k = {}, k.name = K[ie].name, K[ie].vertices !== void 0) { k.vertices = []; for (var G = 0, W = K[ie].vertices.length; G < W; G++) k.vertices.push(K[ie].vertices[G].clone()); } if (K[ie].normals !== void 0) { k.normals = []; for (var q = 0, Q = K[ie].normals.length; q < Q; q++) k.normals.push(K[ie].normals[q].clone()); } this.morphTargets.push(k); } for (var ee, ne = m.morphNormals, Y = 0, te = ne.length; Y < te; Y++) { if (ee = {}, ne[Y].vertexNormals !== void 0) { ee.vertexNormals = []; for (var F = 0, $ = ne[Y].vertexNormals.length; F < $; F++) { var J = ne[Y].vertexNormals[F], z = {}; z.a = J.a.clone(), z.b = J.b.clone(), z.c = J.c.clone(), ee.vertexNormals.push(z); } } if (ne[Y].faceNormals !== void 0) { ee.faceNormals = []; for (var V = 0, oe = ne[Y].faceNormals.length; V < oe; V++) ee.faceNormals.push(ne[Y].faceNormals[V].clone()); } this.morphNormals.push(ee); } for (var ue = m.skinWeights, le = 0, ve = ue.length; le < ve; le++) this.skinWeights.push(ue[le].clone()); for (var xe = m.skinIndices, Te = 0, de = xe.length; Te < de; Te++) this.skinIndices.push(xe[Te].clone()); for (var we = m.lineDistances, se = 0, Se = we.length; se < Se; se++) this.lineDistances.push(we[se]); var ge = m.boundingBox; ge !== null && (this.boundingBox = ge.clone()); var be = m.boundingSphere; return be !== null && (this.boundingSphere = be.clone()), this.elementsNeedUpdate = m.elementsNeedUpdate, this.verticesNeedUpdate = m.verticesNeedUpdate, this.uvsNeedUpdate = m.uvsNeedUpdate, this.normalsNeedUpdate = m.normalsNeedUpdate, this.colorsNeedUpdate = m.colorsNeedUpdate, this.lineDistancesNeedUpdate = m.lineDistancesNeedUpdate, this.groupsNeedUpdate = m.groupsNeedUpdate, this; }, computeGroups() { var v, m, w = [], S = void 0, T = this.faces; for (m = 0; m < T.length; m++) { var M = T[m]; M.materialIndex !== S && (S = M.materialIndex, v !== void 0 && (v.count = 3 * m - v.start, w.push(v)), v = { start: 3 * m, materialIndex: S }); } return v !== void 0 && (v.count = 3 * m - v.start, w.push(v)), w; }, toBufferGeometry: function() { var m = new u().fromGeometry(this), w = new l.BufferGeometry(), S = new Float32Array(3 * m.vertices.length); if (w.setAttribute("position", new l.BufferAttribute(S, 3).copyVector3sArray(m.vertices)), 0 < m.normals.length) { var T = new Float32Array(3 * m.normals.length); w.setAttribute("normal", new l.BufferAttribute(T, 3).copyVector3sArray(m.normals)); } if (0 < m.colors.length) { var M = new Float32Array(3 * m.colors.length); w.setAttribute("color", new l.BufferAttribute(M, 3).copyColorsArray(m.colors)); } if (0 < m.uvs.length) { var x = new Float32Array(2 * m.uvs.length); w.setAttribute("uv", new l.BufferAttribute(x, 2).copyVector2sArray(m.uvs)); } if (0 < m.uvs2.length) { var _ = new Float32Array(2 * m.uvs2.length); w.setAttribute("uv2", new l.BufferAttribute(_, 2).copyVector2sArray(m.uvs2)); } for (var E in w.groups = m.groups, m.morphTargets) { for (var L = [], R = m.morphTargets[E], C = 0, A = R.length; C < A; C++) { var P = R[C], I = new l.Float32BufferAttribute(3 * P.data.length, 3); I.name = P.name, L.push(I.copyVector3sArray(P.data)); } w.morphAttributes[E] = L; } if (0 < m.skinIndices.length) { var b = new l.Float32BufferAttribute(4 * m.skinIndices.length, 4); w.setAttribute("skinIndex", b.copyVector4sArray(m.skinIndices)); } if (0 < m.skinWeights.length) { var O = new l.Float32BufferAttribute(4 * m.skinWeights.length, 4); w.setAttribute("skinWeight", O.copyVector4sArray(m.skinWeights)); } return m.boundingSphere !== null && (w.boundingSphere = m.boundingSphere.clone()), m.boundingBox !== null && (w.boundingBox = m.boundingBox.clone()), w; }, toIndexedBufferGeometry: function() { var m = new l.BufferGeometry(), w = new Float32Array(3 * this.vertices.length); if (m.setAttribute("position", new l.BufferAttribute(w, 3).copyVector3sArray(this.vertices)), 0 < this.normals.length) { var S = new Float32Array(this.normals.length), T = new l.BufferAttribute(S, 3).copyArray(this.normals); m.setAttribute("normal", T); } if (0 < this.uvs.length && 0 < this.uvs[0].length) { var M = new Float32Array(2 * this.uvs[0].length); m.setAttribute("uv", new l.BufferAttribute(M, 2).copyArray(this.uvs[0])); } if (1 < this.uvs.length && 0 < this.uvs[1].length) { var x = new Float32Array(2 * this.uvs[1].length); m.setAttribute("uv2", new l.BufferAttribute(x, 2).copyArray(this.uvs[1])); } if (0 < this.colors.length) { for (var _ = [], E = 0; E < this.colors.length; E++) _.push(new l.Color(this.colors[E])); var L = new Float32Array(3 * _.length); m.setAttribute("color", new l.BufferAttribute(L, 3).copyColorsArray(_)); } else { for (var R = new Float32Array(3 * this.vertices.length), C = 0; C < 3 * this.vertices.length; C++) R[C] = 1; m.setAttribute("color", new l.BufferAttribute(R, 3)); } if (0 < this.faces.length) { for (var A = [], P = [], I = 0; I < this.faces.length; I++) { P.push(this.faces[I].a, this.faces[I].b, this.faces[I].c); var b = this.faces[I].vertexColors; if (b.length === 3) A.push(b[0], b[1], b[2]); else { var O = this.faces[I].color; A.push(O, O, O); } } m.setIndex(P), m.groups = this.computeGroups(); } if (0 < this.morphTargets.length) { for (var N = [], D = [], B = 0, U = this.morphTargets.length; B < U; B++) { var k = this.morphTargets[B], K = new l.Float32BufferAttribute(3 * k.vertices.length, 3); if (K.name = k.name, N.push(K.copyVector3sArray(k.vertices)), k.normals) { var ie = new l.Float32BufferAttribute(3 * k.normals.length, 3); ie.name = k.name, D.push(ie.copyVector3sArray(k.normals)); } } m.morphAttributes.position = N, m.morphAttributes.normal = D; } if (0 < this.skinIndices.length) { var j = new l.Float32BufferAttribute(4 * this.skinIndices.length, 4); m.setAttribute("skinIndex", j.copyVector4sArray(this.skinIndices)); } if (0 < this.skinWeights.length) { var G = new l.Float32BufferAttribute(4 * this.skinWeights.length, 4); m.setAttribute("skinWeight", G.copyVector4sArray(this.skinWeights)); } return this.boundingSphere !== null && (m.boundingSphere = this.boundingSphere.clone()), this.boundingBox !== null && (m.boundingBox = this.boundingBox.clone()), m; }, computeTangents: function() { console.error("THREE.Geometry: .computeTangents() has been removed."); }, computeLineDistances: function() { console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead."); }, applyMatrix: function(m) { return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(m); }, dispose: function() { this.dispatchEvent({ type: "dispose" }); } }), f.createBufferGeometryFromObject = function(v) { var m = new l.BufferGeometry(), w = v.geometry; if (v.isPoints || v.isLine) { var S = new l.Float32BufferAttribute(3 * w.vertices.length, 3), T = new l.Float32BufferAttribute(3 * w.colors.length, 3); if (m.setAttribute("position", S.copyVector3sArray(w.vertices)), m.setAttribute("color", T.copyColorsArray(w.colors)), w.lineDistances && w.lineDistances.length === w.vertices.length) { var M = new l.Float32BufferAttribute(w.lineDistances.length, 1); m.setAttribute("lineDistance", M.copyArray(w.lineDistances)); } w.boundingSphere !== null && (m.boundingSphere = w.boundingSphere.clone()), w.boundingBox !== null && (m.boundingBox = w.boundingBox.clone()); } else v.isMesh && (m = w.toBufferGeometry()); return m; }; class u { constructor() { this.vertices = [], this.normals = [], this.colors = [], this.uvs = [], this.uvs2 = [], this.groups = [], this.morphTargets = {}, this.skinWeights = [], this.skinIndices = [], this.boundingBox = null, this.boundingSphere = null, this.verticesNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.uvsNeedUpdate = !1, this.groupsNeedUpdate = !1; } computeGroups(m) { var w, S, T = [], M = void 0, x = m.faces; for (S = 0; S < x.length; S++) { var _ = x[S]; _.materialIndex !== M && (M = _.materialIndex, w !== void 0 && (w.count = 3 * S - w.start, T.push(w)), w = { start: 3 * S, materialIndex: M }); } w !== void 0 && (w.count = 3 * S - w.start, T.push(w)), this.groups = T; } fromGeometry(m) { var w, S = m.faces, T = m.vertices, M = m.faceVertexUvs, x = M[0] && 0 < M[0].length, _ = M[1] && 0 < M[1].length, E = m.morphTargets, L = E.length; if (0 < L) { w = []; for (var R = 0; R < L; R++) w[R] = { name: E[R].name, data: [] }; this.morphTargets.position = w; } var C, A = m.morphNormals, P = A.length; if (0 < P) { C = []; for (var I = 0; I < P; I++) C[I] = { name: A[I].name, data: [] }; this.morphTargets.normal = C; } var b = m.skinIndices, O = m.skinWeights, N = b.length === T.length, D = O.length === T.length; 0 < T.length && S.length === 0 && console.error("THREE.DirectGeometry: Faceless geometries are not supported."); for (var B, U = 0; U < S.length; U++) { B = S[U], this.vertices.push(T[B.a], T[B.b], T[B.c]); var k = B.vertexNormals; if (k.length === 3) this.normals.push(k[0], k[1], k[2]); else { var K = B.normal; this.normals.push(K, K, K); } var ie = B.vertexColors; if (ie.length === 3) this.colors.push(ie[0], ie[1], ie[2]); else { var j = B.color; this.colors.push(j, j, j); } if (x === !0) { var G = M[0][U]; G === void 0 ? (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ", U), this.uvs.push(new l.Vector2(), new l.Vector2(), new l.Vector2())) : this.uvs.push(G[0], G[1], G[2]); } if (_ === !0) { var W = M[1][U]; W === void 0 ? (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ", U), this.uvs2.push(new l.Vector2(), new l.Vector2(), new l.Vector2())) : this.uvs2.push(W[0], W[1], W[2]); } for (var q, Q = 0; Q < L; Q++) q = E[Q].vertices, w[Q].data.push(q[B.a], q[B.b], q[B.c]); for (var ee, ne = 0; ne < P; ne++) ee = A[ne].vertexNormals[U], C[ne].data.push(ee.a, ee.b, ee.c); N && this.skinIndices.push(b[B.a], b[B.b], b[B.c]), D && this.skinWeights.push(O[B.a], O[B.b], O[B.c]); } return this.computeGroups(m), this.verticesNeedUpdate = m.verticesNeedUpdate, this.normalsNeedUpdate = m.normalsNeedUpdate, this.colorsNeedUpdate = m.colorsNeedUpdate, this.uvsNeedUpdate = m.uvsNeedUpdate, this.groupsNeedUpdate = m.groupsNeedUpdate, m.boundingSphere !== null && (this.boundingSphere = m.boundingSphere.clone()), m.boundingBox !== null && (this.boundingBox = m.boundingBox.clone()), this; } } class y { constructor(m, w, S, T, M) { var x = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : 0; this.a = m, this.b = w, this.c = S, this.normal = T && T.isVector3 ? T : new l.Vector3(), this.vertexNormals = Array.isArray(T) ? T : [], this.color = M && M.isColor ? M : new l.Color(), this.vertexColors = Array.isArray(M) ? M : [], this.materialIndex = x; } clone() { return new this.constructor().copy(this); } copy(m) { this.a = m.a, this.b = m.b, this.c = m.c, this.normal.copy(m.normal), this.color.copy(m.color), this.materialIndex = m.materialIndex; for (var w = 0, S = m.vertexNormals.length; w < S; w++) this.vertexNormals[w] = m.vertexNormals[w].clone(); for (var T = 0, M = m.vertexColors.length; T < M; T++) this.vertexColors[T] = m.vertexColors[T].clone(); return this; } } }, /* 7 */ /***/ (o) => { o.exports = tz; }, /* 8 */ /***/ (o) => { o.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg=="; }, /* 9 */ /***/ (o, a) => { a.augmentMorphColor = function() { return function(c) { c.vertexShader = c.vertexShader.replace("#include ", ["varying vec3 vColor;", "attribute vec3 morphColor0;", "attribute vec3 morphColor1;"].join(` `)), c.vertexShader = c.vertexShader.replace("#include ", ["vColor.xyz = color.xyz;", "#ifdef USE_MORPHTARGETS", "vColor = morphColor0 * morphTargetInfluences[ 0 ];", "vColor += morphColor1 * morphTargetInfluences[ 1 ];", "#endif"].join(` `)); }; }; }, /* 10 */ /***/ (o, a, c) => { var l = c(4), d = c(5).createBufferGeometry, h = c(5).resolveURL, p = 0, g = function() { return "pr" + p++; }, f = function() { this.isZincObject = !0, this.geometry = void 0, this.morph = void 0, this.group = new l.Group(), this._lod = new (c(11)).LOD(this), this.groupName = void 0, this.timeEnabled = !1, this.morphColour = !1, this.inbuildTime = 0, this.mixer = void 0, this.animationGroup = void 0, this.duration = 6e3, this.clipAction = void 0, this.userData = {}, this.videoHandler = void 0, this.marker = void 0, this.markerNumber = void 0, this.markerUpdateRequired = !0, this.closestVertexIndex = -1, this.boundingBoxUpdateRequired = !0, this.cachedBoundingBox = new l.Box3(), this.anatomicalId = void 0, this.region = void 0, this.animationClip = void 0, this.markerMode = "inherited", this.uuid = g(), this._v1 = new l.Vector3(), this._v2 = new l.Vector3(), this._b1 = new l.Box3(), this.center = new l.Vector3(), this.radius = 0, this.visible = !0, this.drawRange = -1; }; f.prototype.setDuration = function(u) { this.duration = u, this.clipAction && this.clipAction.setDuration(this.duration); }, f.prototype.getDuration = function() { return this.duration; }, f.prototype.setRegion = function(u) { this.region = u; }, f.prototype.getRegion = function() { return this.region; }, f.prototype.getMorph = function() { var u = this._lod.getCurrentMorph(); return u || this.morph; }, f.prototype.getGroup = function() { return this.group; }, f.prototype.setMorph = function(u) { this.morph = u, this.group.add(this.morph); var y = this._lod.calculateDistance("far"); this._lod.addLevel(u, y), this._lod.setMaterial(u.material); }, f.prototype.checkTransparentMesh = function() { }, f.prototype.setMesh = function(u, y, v) { this.animationGroup = new l.AnimationObjectGroup(u), this.mixer = new l.AnimationMixer(this.animationGroup); var m = u.geometry; if (this.geometry = u.geometry, this.clipAction = void 0, m && m.morphAttributes) { var w = m.morphAttributes.position; w || (w = m.morphAttributes.color ? m.morphAttributes.color : m.morphAttributes.normal), w && (this.animationClip = l.AnimationClip.CreateClipsFromMorphTargetSequences(w, 10, !0), this.animationClip && this.animationClip[0] != null && (this.clipAction = this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration), this.clipAction.loop = l.loopOnce, this.clipAction.clampWhenFinished = !0, this.clipAction.play())); } this.timeEnabled = y, this.morphColour = v, u.userData = this, u.matrixAutoUpdate = !1, this.setMorph(u), this.checkTransparentMesh(), this.timeEnabled ? this.setFrustumCulled(!1) : this.morphColour && (m.setAttribute("morphTarget0", m.getAttribute("position")), m.setAttribute("morphTarget1", m.getAttribute("position"))), this.boundingBoxUpdateRequired = !0; }, f.prototype.setName = function(u) { this.groupName = u, this._lod.setName(u); }, f.prototype.getCurrentTime = function() { if (this.clipAction) { var u = this.clipAction.time / this.clipAction._clip.duration; return this.duration * u; } return this.inbuildTime; }, f.prototype.setMorphTime = function(u) { var y = !1; if (this.clipAction) { var v = u / this.duration, m = this.clipAction._clip.duration, w = v * m; w != this.clipAction.time && (this.clipAction.time = w, y = !0), y && this.isTimeVarying() && this.mixer.update(0); } else { var S = u; S = u > this.duration ? this.duration : 0 > u ? 0 : u, S != this.inbuildTime && (this.inbuildTime = S, y = !0); } y && (this.boundingBoxUpdateRequired = !0, this._lod.updateMorphColorAttribute(!0), this.timeEnabled && (this.markerUpdateRequired = !0)); }, f.prototype.isTimeVarying = function() { return !!(this.timeEnabled || this.morphColour); }, f.prototype.getVisibility = function() { return this.visible; }, f.prototype.setVisibility = function(u) { u !== this.visible && (this.visible = u, this.group.visible = u, this.region && (this.region.pickableUpdateRequired = !0)); }, f.prototype.setAlpha = function(u) { var y = this._lod._material, v = !1; 1 > u && (v = !0), y.opacity = u, y.transparent = v, this.checkTransparentMesh(); }, f.prototype.setFrustumCulled = function(u) { this._lod.setFrustumCulled(u); }, f.prototype.setVertexColors = function(u) { this._lod.setVertexColors(u); }, f.prototype.getColour = function() { return this._lod._material ? this._lod._material.color : void 0; }, f.prototype.setColour = function(u) { this._lod.setColour(u); }, f.prototype.getColourHex = function() { return !this.morphColour && this._lod._material && this._lod._material.color ? this._lod._material.color.getHexString() : void 0; }, f.prototype.setColourHex = function(u) { this._lod._material.color.setHex(u), this._lod._secondaryMaterial && this._lod._secondaryMaterial.color.setHex(u); }, f.prototype.setEmissiveRGB = function(u) { this._lod._material && this._lod._material.emissive && this._lod._material.emissive.setRGB(...u), this._lod._secondaryMaterial && this._lod._secondaryMaterial.emissive.setRGB(...u); }, f.prototype.setMaterial = function(u) { this._lod.setMaterial(u); }, f.prototype.getClosestVertexIndex = function() { var u = -1, y = this.getMorph(); if (y && y.geoemtry) { var v = y.geometry.attributes.position; if (this._b1.setFromBufferAttribute(v), this._b1.getCenter(this._v1), v) for (var m = -1, w = 0, S = 0; S < v.count; S++) this._v2.fromArray(v.array, 3 * S), w = this._v2.distanceTo(this._v1), m == -1 ? m = w : m > w && (m = w, u = S); } return u; }, f.prototype.getClosestVertex = function(u) { var y = new l.Vector3(); this.closestVertexIndex == -1 && (this.closestVertexIndex = this.getClosestVertexIndex()); var v = this.getMorph(); if (v && v.geometry && 0 <= this.closestVertexIndex) { var m = v.morphTargetInfluences, w = v.geometry.morphAttributes; if (m && w && w.position) { for (var S = !1, T = 0; T < m.length; T++) 0 < m[T] && (S = !0, this._v1.fromArray(w.position[T].array, 3 * this.closestVertexIndex), y.add(this._v1.multiplyScalar(m[T]))); if (S) return u ? y.applyMatrix4(v.matrixWorld) : y; } else return y.fromArray(v.geometry.attributes.position.array, 3 * this.closestVertexIndex), u ? y.applyMatrix4(v.matrixWorld) : y; } return this.getBoundingBox(), y.copy(this.center), u ? y.applyMatrix4(this.morph.matrixWorld) : y; }, f.prototype.getBoundingBox = function() { if (this.visible) { var u = this._lod.getCurrentMorph(); if (u && u.visible) return this.boundingBoxUpdateRequired && (c(5).getBoundingBox(u, this.cachedBoundingBox, this._b1, this._v1, this._v2), this.cachedBoundingBox.getCenter(this.center), this.radius = this.center.distanceTo(this.cachedBoundingBox.max), this.boundingBoxUpdateRequired = !1), this.cachedBoundingBox; } }, f.prototype.dispose = function() { this._lod.dispose(), this.animationGroup = void 0, this.mixer = void 0, this.morph = void 0, this.group = void 0, this.clipAction = void 0, this.groupName = void 0; }, f.prototype.markerIsRequired = function(u) { return !!(this.visible && (this.markerMode === "on" || u && u.displayMarkers && this.markerMode === "inherited")); }, f.prototype.updateMarker = function(u, y) { if (u == !1 && this.markerIsRequired(y)) { var v = y.ndcToBeUpdated; if (this.groupName) { if (this.marker || (this.marker = new (c(14)).Marker(this), this.markerUpdateRequired = !0), this.markerUpdateRequired) { var m = this.getClosestVertex(!1); m && (this.marker.setPosition(m.x, m.y, m.z), this.markerUpdateRequired = !1); } this.marker.isEnabled() || (y.markersList && !(this.marker.uuid in y.markersList) && (v = !0, y.markersList[this.marker.uuid] = this.marker), this.marker.enable(), this.group.add(this.marker.morph)), this.marker.setNumber(this.markerNumber), this.markerImgURL ? this.marker.loadUserSprite(this.markerImgURL) : this.marker.setDefaultSprite(), y && y.camera && (v || y.markerCluster.markerUpdateRequired) && (this.marker.updateNDC(y.camera.cameraObject), y.markerCluster.markerUpdateRequired = !0); } } else this.marker && this.marker.isEnabled() && (this.marker.disable(), this.group.remove(this.marker.morph), y.markersList && this.marker.uuid in y.markersList && (y.markerCluster.markerUpdateRequired = !0, delete y.markersList[this.marker.uuid])), this.markerUpdateRequired = !0; }, f.prototype.processMarkerVisual = function(u, y) { this.marker && this.marker.isEnabled() && this.marker.updateVisual(u, y); }, f.prototype.initiateMorphColor = function() { this.morphColour == 1 && this._lod.updateMorphColorAttribute(!1); }, f.prototype.setRenderOrder = function(u) { this._lod.setRenderOrder(u); }, f.prototype.getClosestVertexDOMElementCoords = function(u) { if (u && u.camera) { var y = !0, v = this.getClosestVertex(!0); return v.project(u.camera), v.z = Math.min(Math.max(v.z, 0), 1), (1 < v.x || -1 > v.x || 1 < v.y || -1 > v.y) && (y = !1), u.getZincCameraControls().getRelativeCoordsFromNDC(v.x, v.y, v), { position: v, inView: y }; } }, f.prototype.setMarkerMode = function(u, y) { u !== this.markerMode && (this.markerMode = u === "on" || u === "off" ? u : "inherited", this.region && (this.region.pickableUpdateRequired = !0)), y && (this.markerNumber = y.number, this.markerImgURL = y.imgURL); }, f.prototype.render = function(u, y, v, m) { if (this.visible && !(this.timeEnabled && y) && this._lod.update(v, this.center), y == !0) { if (this.clipAction && this.isTimeVarying()) this.mixer.update(u); else { var w = this.inbuildTime + u; w > this.duration && (w -= this.duration), this.inbuildTime = w; } this.visible && u != 0 && (this.boundingBoxUpdateRequired = !0, this.morphColour == 1 && this._lod.updateMorphColorAttribute(!0)); } this.updateMarker(y, m); }, f.prototype.addLOD = function(u, y, v, m, w) { this._lod.addLevelFromURL(u, y, v, m, w); }, f.prototype.addVertices = function(u) { var y = this.getMorph(), v = void 0; if (!y) v = d(500, u), this.drawRange = u.length; else if (-1 < this.drawRange) { var m = y.geometry.getAttribute("position"); u.forEach((w) => { m.setXYZ(this.drawRange, w[0], w[1], w[2]), ++this.drawRange; }), m.needsUpdate = !0, y.geometry.setDrawRange(0, this.drawRange), y.geometry.computeBoundingBox(), y.geometry.computeBoundingSphere(), v = y.geoemtry, this.boundingBoxUpdateRequired = !0; } return v; }, f.prototype.setPosition = function(u, y, v) { var m = this.getGroup(); m && (m.position.set(u, y, v), m.updateMatrix(), this.boundingBoxUpdateRequired = !0); }, f.prototype.loadAdditionalSources = function(u) { u.load(h(filename), meshloader(region, colour, opacity, localTimeEnabled, localMorphColour, void 0, void 0, void 0, void 0, finishCallback), this.onProgress(filename), this.onError(finishCallback)); }, f.prototype.setScaleAll = function(u) { var y = this.getGroup(); y && (y.scale.set(u, u, u), y.updateMatrix(), this.boundingBoxUpdateRequired = !0); }, a.ZincObject = f; }, /* 11 */ /***/ (o, a, c) => { var l = c(4), d = c(5).updateMorphColorAttribute, h = c(5).toBufferGeometry, p = function(g) { this.levels = [], this._currentLevel = 0, this._renderOrder = 1, this._material = void 0, this._secondaryMaterial = void 0, this._loader = void 0, this._parent = g, this.addLevel = (u, y) => { if (u) { var v, m = Math.abs(y); for (v = 0; v < this.levels.length && !(m < this.levels[v].distance); v++) ; this.levels.splice(v, 0, { distance: m, morph: u, loaded: !0, loading: !1, url: "" }), u.renderOrder = this._renderOrder; } }, this.levelLoaded = (u, y) => { if (u) { for (var v = Math.abs(y), m = 0; m < this.levels.length; m++) if (v === this.levels[m].distance) { this._parent.group.add(u), this.levels[m].morph = u, this.levels[m].loaded = !0, this.levels[m].loading = !1; break; } this.checkTransparentMesh(); } }, this.addLevelFromURL = (u, y, v, m, w) => { this._loader = u; var S, T = this.calculateDistance(y); for (S = 0; S < this.levels.length && !(T < this.levels[S].distance); S++) ; this.levels.splice(S, 0, { distance: T, morph: void 0, loaded: !1, loading: !1, url: v, index: m }), w && this.loadLevel(S); }, this.loadLevel = (u) => { var y = this.levels[u]; return y.morph || y.loaded || y.loading || (y.loading = !0, this._loader.load(y.url, this.lodLoader(y.distance), void 0, void 0, { index: y.index })), y.morph === void 0; }, this.calculateDistance = function(u) { this._parent.getBoundingBox(); var y = this._parent.radius, v = 0; return u === "far" ? v = 4.5 * y : u === "medium" ? v = 2.5 * y : u == "close" && (v = 0), v; }, this.containsLevels = () => !!(this.levels && 1 < this.levels.length), this.checkTransparentMesh = () => { var u = this.levels[this._currentLevel]; this._material && (this._material.transparent ? (!this._secondaryMaterial && (this._secondaryMaterial = this._material.clone(), this._secondaryMaterial.side = l.FrontSide), this._secondaryMaterial.opacity = this._material.opacity, this._secondaryMaterial.emissive && this._secondaryMaterial.emissive.copy(this._material.emissive), this._secondaryMaterial.needsUpdate = !0, !u.secondaryMesh && (u.secondaryMesh = new l.Mesh(u.morph.geometry, this._secondaryMaterial), u.secondaryMesh.renderOrder = u.morph.renderOrder + 1, u.secondaryMesh.userData = u.morph.userData, u.secondaryMesh.name = u.morph.name), this._material.side = l.BackSide, this._material.needsUpdate = !0, !u.secondaryMesh.parent && (u.morph.add(u.secondaryMesh), this._parent.animationGroup && this._parent.animationGroup.add(u.secondaryMesh))) : (u.secondaryMesh && (u.morph.remove(u.secondaryMesh), this._parent.animationGroup && (this._parent.animationGroup.uncache(u.secondaryMesh), this._parent.animationGroup.remove(u.secondaryMesh))), this._material.side = l.DoubleSide, this._material.needsUpdate = !0)); }, this.dispose = () => { this.levels.forEach((u) => { u.morph && u.morph.geometry && u.morph.geometry.dispose(); }), this._material && this._material.dispose(), this._secondaryMaterial && this._secondaryMaterial.dispose(); }, this.getCurrentLevel = () => this._currentLevel, this.getCurrentMorph = () => { var u = this.levels[this._currentLevel]; return u && u.morph ? u.morph : this._parent.morph; }, this.lodLoader = function(u) { return (y) => { var v = this._material, m = { localTimeEnabled: this._parent.timeEnabled, localMorphColour: this._parent.morphColour }, w = h(y, m), S = void 0; this._parent.isGeometry ? S = new l.Mesh(w, v) : this._parent.isLines && (S = new (c(12)).LineSegments(w, v)), S.userData = this._parent, S.renderOrder = this._renderOrder, y.dispose(), this.levelLoaded(S, u); }; }, this.updateMorphColorAttribute = (u) => { if (this._material && (this._material.vertexColors == l.VertexColors || this._material.vertexColors == !0)) if (u) { var y = this.getCurrentMorph(); d(y.geometry, y); } else this.levels.forEach((v) => { v.morph && v.morph.geometry && d(v.morph.geometry, v.morph); }); }, this.setColour = (u) => { this._material.color = u, this._secondaryMaterial && (this._secondaryMaterial.color = u), f(); }, this.setFrustumCulled = (u) => { this.levels.forEach((y) => { y.morph && (y.morph.frustumCulled = u), y.secondaryMesh && (y.secondaryMesh.frustumCulled = u); }); }, this.setMaterial = (u) => { u && (!this._material || this._material.id !== u.id) && (this._material = u, this._secondaryMaterial && this._secondaryMaterial.dispose(), this._secondaryMaterial = u.clone(), this._secondaryMaterial.side = l.FrontSide, this._secondaryMaterial.transparent = !0, this.levels.forEach((y) => { y.morph && (y.morph.material = this._material, y.morph.geometry && (y.morph.geometry.colorsNeedUpdate = !0)), y.secondaryMesh && (y.secondaryMesh.material = this._secondaryMaterial); })); }, this.setName = (u) => { this.levels.forEach((y) => { y.morph && (y.morph.name = u), y.secondaryMesh && (y.secondaryMesh.name = u); }); }, this.setRenderOrder = (u) => { this._renderOrder = u, this.levels.forEach((y) => { y.morph && (y.morph.renderOrder = u), y.secondaryMesh && (y.secondaryMesh.renderOrder = u); }); }, this.setVertexColors = (u) => { this._material.vertexColors = u, f(), this._secondaryMaterial && (this._secondaryMaterial.vertexColors = u); }, this.update = (u, y) => { var v = this.levels; if (1 < v.length) { var m, w, S = u.cameraObject.position.distanceTo(y), T = -1, M = -1; for (m = 0, w = v.length; m < w && S >= v[m].distance; m++) v[m].morph ? (-1 < T && v[T].morph && (v[T].morph.visible = !1), T = m, v[m].morph.visible = !0, M = -1) : M = m; for (-1 < M && this.loadLevel(M); m < w; m++) v[m].morph && (-1 < T ? v[m].morph.visible = !1 : (v[m].morph.visible = !0, T = m)); this._currentLevel != T && (this._currentLevel = T, this.checkTransparentMesh()); } }, this.toggleMarker = (u, y) => { this.levels.forEach((v) => { v.morph && (y ? v.morph.add(u) : v.morph.remove(u)); }); }; var f = () => { this.levels.forEach((u) => { u.morph && u.morph.geometry && (u.morph.geometry.colorsNeedUpdate = !0); }); }; }; a.LOD = p; }, /* 12 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ LineSegments: () => ( /* binding */ g ) /* harmony export */ }); var l = c(13), d = c(4), h = /* @__PURE__ */ new d.Vector3(), p = /* @__PURE__ */ new d.Vector3(); class g extends l.Line { constructor(u, y) { super(u, y), this.type = "LineSegments"; } computeLineDistances() { var u = this.geometry; if (!u.isBufferGeometry) u.isGeometry && console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); else if (u.index === null) { for (var y = u.attributes.position, v = [], m = 0, w = y.count; m < w; m += 2) h.fromBufferAttribute(y, m), p.fromBufferAttribute(y, m + 1), v[m] = m == 0 ? 0 : v[m - 1], v[m + 1] = v[m] + h.distanceTo(p); u.setAttribute("lineDistance", new d.Float32BufferAttribute(v, 1)); } else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); return this; } } g.prototype.isLineSegments = !0; }, /* 13 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ Line: () => ( /* binding */ w ) /* harmony export */ }); var l = c(4), d = /* @__PURE__ */ new l.Vector3(), h = /* @__PURE__ */ new l.Vector3(), p = /* @__PURE__ */ new l.Matrix4(), g = /* @__PURE__ */ new l.Ray(), f = /* @__PURE__ */ new l.Sphere(), u = /* @__PURE__ */ new l.Vector3(), y = /* @__PURE__ */ new l.Vector3(), v = /* @__PURE__ */ new l.Vector3(), m = /* @__PURE__ */ new l.Vector3(); class w extends l.Object3D { constructor() { var M = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new l.BufferGeometry(), x = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new l.LineBasicMaterial(); super(), this.type = "Line", this.geometry = M, this.material = x, this.updateMorphTargets(); } copy(M) { return super.copy(M), this.material = M.material, this.geometry = M.geometry, this; } computeLineDistances() { var M = this.geometry; if (!M.isBufferGeometry) M.isGeometry && console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); else if (M.index === null) { for (var x = M.attributes.position, _ = [0], E = 1, L = x.count; E < L; E++) d.fromBufferAttribute(x, E - 1), h.fromBufferAttribute(x, E), _[E] = _[E - 1], _[E] += d.distanceTo(h); M.setAttribute("lineDistance", new l.Float32BufferAttribute(_, 1)); } else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); return this; } raycast(M, x) { var _ = this.geometry, E = this.matrixWorld, L = M.params.Line.threshold, R = _.drawRange, C = _.morphAttributes.position; if (_.boundingSphere === null && _.computeBoundingSphere(), f.copy(_.boundingSphere), f.applyMatrix4(E), f.radius += L, M.ray.intersectsSphere(f) !== !1) { p.copy(E).invert(), g.copy(M.ray).applyMatrix4(p); var A = L / ((this.scale.x + this.scale.y + this.scale.z) / 3), P = A * A, I = new l.Vector3(), b = new l.Vector3(), O = new l.Vector3(), N = new l.Vector3(), D = this.isLineSegments ? 2 : 1; if (_.isBufferGeometry) { var B = _.index, U = _.attributes, k = U.position; if (B !== null) for (var K = Math.max(0, R.start), ie = Math.min(B.count, R.start + R.count), j = K; j < ie - 1; j += D) { var G = B.getX(j), W = B.getX(j + 1); S(I, b, this, k, C, G, W); var q = g.distanceSqToSegment(I, b, N, O); if (!(q > P)) { N.applyMatrix4(this.matrixWorld); var Q = M.ray.origin.distanceTo(N); Q < M.near || Q > M.far || x.push({ distance: Q, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: O.clone().applyMatrix4(this.matrixWorld), index: j, face: null, faceIndex: null, object: this }); } } else for (var ee = Math.max(0, R.start), ne = Math.min(k.count, R.start + R.count), Y = ee; Y < ne - 1; Y += D) { S(I, b, this, k, C, Y, Y + 1); var te = g.distanceSqToSegment(I, b, N, O); if (!(te > P)) { N.applyMatrix4(this.matrixWorld); var F = M.ray.origin.distanceTo(N); F < M.near || F > M.far || x.push({ distance: F, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: O.clone().applyMatrix4(this.matrixWorld), index: Y, face: null, faceIndex: null, object: this }); } } } else _.isGeometry && console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } } updateMorphTargets() { var M = this.geometry; if (M.isBufferGeometry) { var x = M.morphAttributes, _ = Object.keys(x); if (0 < _.length) { var E = x[_[0]]; if (E !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (var L, R = 0, C = E.length; R < C; R++) L = E[R].name || R + "", this.morphTargetInfluences.push(0), this.morphTargetDictionary[L] = R; } } } else { var A = M.morphTargets; A !== void 0 && 0 < A.length && console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead."); } } } function S(T, M, x, _, E, L, R) { T.fromBufferAttribute(_, L), M.fromBufferAttribute(_, R); var C = x.morphTargetInfluences; if (x.material.morphTargets && E && C) { u.set(0, 0, 0), y.set(0, 0, 0); for (var A = 0, P = E.length; A < P; A++) { var I = C[A], b = E[A]; I !== 0 && (v.fromBufferAttribute(b, L), m.fromBufferAttribute(b, R), u.addScaledVector(v.sub(T), I), y.addScaledVector(m.sub(M), I)); } T.add(u), M.add(y); } } w.prototype.isLine = !0; }, /* 14 */ /***/ (o, a, c) => { var l = c(4), d = new Image(128, 128); d.src = c(15); var h = new l.Texture(); h.image = d, h.needsUpdate = !0; var p = [0.02, 0.03, 1], g = new l.SpriteMaterial({ map: h, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), f = c(5).createNewSpriteText, u = function(y) { c(10).ZincObject.call(this), this.texture = h; var v = void 0, m = void 0, w = void 0, S = void 0, T = void 0, M = !0; this.morph = new l.Group(), this.group = this.morph, this.parent = y, this.isMarker = !0; var x = !1; this.ndc = new l.Vector3(); var _ = void 0, E = void 0, L = () => { v = new l.Sprite(g), v.center.set(0.5, 0), this.morph.add(v), this.morph.position.set(0, 0, 0), this.morph.renderOrder = 1e4, v.scale.set(p[0], p[1], p[2]), v.userData = this; }; this.updateVisual = (R, C) => { var A = 1, P = 0; R !== C && (P = 1 - (this.ndc.z - R) / (C - R), A = 0.6 + 0.4 * P), this.setSpriteSize(A); }, this.updateNDC = (R) => (this.ndc.copy(this.morph.position), this.ndc.project(R), this.ndc.z = Math.min(Math.max(this.ndc.z, 0), 1), this.ndc), this.setPosition = (R, C, A) => { this.morph.position.set(R, C, A); }, this.setSpriteSize = (R) => { v.scale.set(0.015, 0.02, 1), v.scale.multiplyScalar(R); }, this.setUserSprite = () => { S && (this.morph.add(S), M && (this.morph.remove(v), E && this.morph.remove(E), M = !1)); }, this.setImageForUserSprite = (R, C) => { S && (this.morph.remove(S), S = void 0), m && m.dispose(), w && w.dispose(), m = new l.Texture(), m.image = R, m.needsUpdate = !0, w = new l.SpriteMaterial({ map: m, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), C || (C = [0.05, 0.05, 1]), S = new l.Sprite(w), S.center.set(0.5, 0), S.scale.set(C[0], C[1], C[2]), S.userData = this, this.setUserSprite(); }, this.setDefaultSprite = () => { M || (M = !0, this.morph.add(v), S && this.morph.remove(S), E && this.morph.add(E)); }, this.loadUserSprite = (R, C) => { if (R) if (R !== T) { T = R; var A = new Image(128, 128); A.crossOrigin = "anonymous", A.onload = () => { this.setImageForUserSprite(A, C); }, A.src = R; } else this.setUserSprite(); }, this.dispose = () => { this.morph && this.morph.clear(), v && (v.clear(), v = void 0), E && (E.material.map.dispose(), E.material.dispose(), E = void 0); }, this.isEnabled = () => x, this.setNumber = (R) => { (!R || _ != R) && E && (this.morph.remove(E), E.material.map.dispose(), E.material.dispose(), E = void 0), !E && R && (E = f(R, 0.012, "black", "Asap", 120, 700), this.morph.add(E)), _ = R; }, this.getNumber = () => _ || 1, this.setVisibility = function(R) { R !== this.visible && (this.visible = R, this.group.visible = R, this.parent.region && (this.parent.region.pickableUpdateRequired = !0)); }, this.enable = () => { x = !0, this.morph.visible = !0, this.visible = !0; }, this.disable = () => { x = !1, this.morph.visible = !1, this.visible = !1; }, L(); }; u.prototype = Object.create(c(10).ZincObject.prototype), a.Marker = u; }, /* 15 */ /***/ (o) => { o.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgdmlld0JveD0iMCAwIDM2NSA1NjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4NCjxkZWZzPg0KPC9kZWZzPg0KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCAwKSIgaWQ9IjgwOGVkMjgzLTI1MjQtNDQwZi04OGFlLTNiZGI0N2JiNTc0OSIgID4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4NCjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItMTgyLjUiIHk9Ii0yODAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIC8+DQo8L2c+DQo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+DQo8ZyBzdHlsZT0iIiAgID4NCjwvZz4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCA5Ny41KSIgID4NCjxnIHN0eWxlPSIiICAgPg0KPC9nPg0KPC9nPg0KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC45OSAwIDAgMC45OSAxODIuNSAyODApIiAgPg0KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii01NDAiIHk9Ii01NDAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjEwODAiIGhlaWdodD0iMTA4MCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHBhdGggc3R5bGU9InN0cm9rZTogcmdiKDAsMCwwKTsgc3Ryb2tlLXdpZHRoOiAwOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMCw4OSwxMTYpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB0cmFuc2Zvcm09IiB0cmFuc2xhdGUoLTE4Mi45LCAtMjc5Ljg1KSIgZD0iTSAxODIuOSA1NTEuNyBDIDE4Mi45IDU1MS44MDAwMDAwMDAwMDAxIDE4My4xIDU1MiAxODMuMSA1NTIgQyAxODMuMSA1NTIgMzU4LjMgMjgzIDM1OC4zIDE5NC42IEMgMzU4LjMgNjQuNSAyNjkuNSA3LjkwMDAwMDAwMDAwMDAwNiAxODIuOSA3LjY5OTk5OTk5OTk5OTk4OSBDIDk2LjMgNy45IDcuNSA2NC41IDcuNSAxOTQuNiBDIDcuNSAyODMgMTgyLjggNTUyIDE4Mi44IDU1MiBDIDE4Mi44IDU1MiAxODIuOSA1NTEuNyAxODIuOSA1NTEuNyB6IE0gMTIyLjIgMTg3LjIgQyAxMjIuMiAxNTMuNiAxNDkuNCAxMjYuMzk5OTk5OTk5OTk5OTkgMTgzIDEyNi4zOTk5OTk5OTk5OTk5OSBDIDIxNi42IDEyNi4zOTk5OTk5OTk5OTk5OSAyNDMuOCAxNTMuNiAyNDMuOCAxODcuMiBDIDI0My44IDIyMC43OTk5OTk5OTk5OTk5OCAyMTYuNSAyNDggMTgyLjkgMjQ4IEMgMTQ5LjQgMjQ4IDEyMi4yIDIyMC44IDEyMi4yIDE4Ny4yIHoiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPg0KPGNpcmNsZSBzdHlsZT0ic3Ryb2tlOiByZ2IoMCwwLDApOyBzdHJva2Utd2lkdGg6IDA7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtZGFzaG9mZnNldDogMDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDQ7IGZpbGw6IHJnYigyNTUsMjU1LDI1NSk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIGN4PSIwIiBjeT0iMCIgcj0iMzUiIC8+DQo8L2c+DQo8L2c+DQo8L2c+DQo8L3N2Zz4="; }, /* 16 */ /***/ (o, a, c) => { var l = c(4), d = function(h, p, g, f) { c(10).ZincObject.call(this); var u; p && (u = p.clone(), u.vertexColors = l.FaceColors), this.id = g; var y = void 0, v = void 0; this.isGlyph = !0, this.fromMesh = (m) => !!(m && m.isMesh) && (this.morph = m.clone(), this.morph.userData = this, this.group.add(this.morph), !0), h && u && this.fromMesh(new l.Mesh(h, u)), this.getGlyphset = function() { return f; }, this.setLabel = (m) => { m && (typeof m == "string" || m instanceof String) && (v = m, this.morph && (this.morph.name = m)), y && this.showLabel(); }, this.showLabel = (m) => { if (y && (position = y.getPosition(), this.group.remove(y.getSprite()), y.dispose(), y = void 0), v && (typeof v == "string" || v instanceof String)) { var w = [0, 0, 0]; y = new (c(17)).Label(v, m), y.setPosition(w[0], w[1], w[2]), this.group.add(y.getSprite()); } }, this.getLabel = () => v, this.getMesh = () => this.morph, this.setTransformation = (m, w, S, T) => { this.morph && (this.morph.matrix.elements[0] = w[0], this.morph.matrix.elements[1] = w[1], this.morph.matrix.elements[2] = w[2], this.morph.matrix.elements[3] = 0, this.morph.matrix.elements[4] = S[0], this.morph.matrix.elements[5] = S[1], this.morph.matrix.elements[6] = S[2], this.morph.matrix.elements[7] = 0, this.morph.matrix.elements[8] = T[0], this.morph.matrix.elements[9] = T[1], this.morph.matrix.elements[10] = T[2], this.morph.matrix.elements[11] = 0, this.morph.matrix.elements[12] = m[0], this.morph.matrix.elements[13] = m[1], this.morph.matrix.elements[14] = m[2], this.morph.matrix.elements[15] = 1, this.morph.matrixAutoUpdate = !1), y && y.setPosition(m[0], m[1], m[2]); }, this.setColour = (m) => { y && y.setColour(m), this.secondaryMesh && this.secondaryMesh.material && (this.secondaryMesh.material.color = colour), this.geometry.colorsNeedUpdate = !0; }, this.dispose = () => { this.material && this.material.dispose(), this.morph = void 0; }; }; d.prototype = Object.create(c(10).ZincObject.prototype), a.Glyph = d; }, /* 17 */ /***/ (o, a, c) => { var l = c(7).default; a.Label = function(d, h) { var p = d, g = void 0; g = h ? new l(p, 0.015, h.getStyle()) : new l(p, 0.015), g.fontFace = "Asap", g.fontWeight = 700, g.material.map.generateMipmaps = !1, g.material.sizeAttenuation = !1, g.center.x = -0.05, g.center.y = 0, this.getPosition = () => g ? [g.position.x, g.position.y, g.position.z] : [0, 0, 0], this.setPosition = (f, u, y) => { g && g.position.set(f, u, y); }, this.setColour = (f) => { g.color = f.getStyle(); }, this.setScale = (f) => { g && 0 < f && g.scale.set(f, f, 1); }, this.dispose = () => { g.dispose(); }, this.getSprite = () => g, this.getString = () => p; }; }, /* 18 */ /***/ (o, a, c) => { function l(g) { throw new TypeError('"' + g + '" is read-only'); } var d = c(4), h = c(19).JSONLoader, p = function() { c(10).ZincObject.call(this); var g = [], f = void 0, u = void 0, y = void 0, v = void 0, m = void 0, w = void 0, S = void 0, T = 0, M = 0, x = [0, 0, 0], _ = [0, 0, 0], E = [0, 0, 0], L = "NONE"; this.ready = !1; var R = !1, C = !1; this.isGlyphset = !0; for (var A = new d.Matrix4(), P = new d.Color(), I = new d.Color(), b = new d.Box3(), O = new d.Box3(), N = new d.Box3(), D = [], B = [], U = [], k = [], K = [], ie = [], j = [], G = [], W = 0; 8 > W; W++) D[W] = new d.Vector3(); this.load = (F, $, J, z, V) => { f = F.axis1, u = F.axis2, y = F.axis3, v = F.positions, m = F.scale, w = F.colors, S = F.label, R = F.metadata.MorphColours, C = F.metadata.MorphVertices, T = F.metadata.number_of_time_steps, L = F.metadata.repeat_mode, M = F.metadata.number_of_vertices, L == "AXES_2D" || L == "MIRROR" ? M *= 2 : L == "AXES_3D" && (M *= 3), x = F.metadata.base_size, _ = F.metadata.offset, E = F.metadata.scale_factors; var oe = new h(); this.geometry = new d.BufferGeometry(); var ue = new d.InstancedMesh(this.geometry, void 0, M); if (this.setMorph(ue), z) { var le = oe.parse($); te(J, V)(le.geometry, le.materials), le.geometry.dispose(); } else oe.crossOrigin = "Anonymous", oe.load($, te(J, V)); }; var q = (F, $, J, z, V, oe) => { if (L == "NONE" || L == "MIRROR") { for (var ue, le = [0, 0, 0], ve = [0, 0, 0], xe = [0, 0, 0], Te = [0, 0, 0], de = [0, 0, 0], we = [0, 0, 0], se = [0, 0, 0], Se = [0, 0, 0], ge = [0, 0, 0], be = 0; 3 > be; be++) ue = 0 > V[be] ? -1 : 1, le[be] = ue * x[be] + V[be] * E[be]; for (var be = 0; 3 > be; be++) ve[be] = $[be] * le[0], xe[be] = J[be] * le[1], Te[be] = z[be] * le[2], de[be] = F[be] + _[0] * ve[be] + _[1] * xe[be] + _[2] * Te[be], L == "MIRROR" && (we[be] = -ve[be], se[be] = -xe[be], Se[be] = -Te[be], ge[be] = de[be], 0 > V[0] && (de[be] -= ve[be], ge[be] -= we[be])); 0 > Te[0] * (ve[1] * xe[2] - ve[2] * xe[1]) + Te[1] * (ve[2] * xe[0] - ve[0] * xe[2]) + Te[2] * (ve[0] * xe[1] - ve[1] * xe[0]) && (Te[0] = -Te[0], Te[1] = -Te[1], Te[2] = -Te[2]), oe[0] = [de, ve, xe, Te], L == "MIRROR" && (0 > Se[0] * (we[1] * se[2] - we[2] * se[1]) + Se[1] * (we[2] * se[0] - we[0] * se[2]) + Se[2] * (we[0] * se[1] - we[1] * se[0]) && (Se[0] = -Se[0], Se[1] = -Se[1], Se[2] = -Se[2]), oe[1] = [ge, we, se, Se]); } else if (L == "AXES_2D" || L == "AXES_3D") { for (var ue, Ie = [0, 0, 0], et = [0, 0, 0], be = 0; 3 > be; be++) ue = 0 > V[be] ? -1 : 1, Ie[be] = ue * x[0] + V[be] * E[0]; for (var be = 0; 3 > be; be++) et[be] = F[be] + _[0] * Ie[0] * $[be] + _[1] * Ie[1] * J[be] + _[2] * Ie[2] * z[be]; for (var mt = glyph_repeat_mode == "AXES_2D" ? 2 : 3, Ue = 0; Ue < mt; Ue++) { var bt = void 0, Ve = void 0, lt = V[Ue], tt = [0, 0, 0], xt = [0, 0, 0], pt = [0, 0, 0]; Ue == 0 ? (bt = $, Ve = J) : Ue == 1 ? (bt = J, Ve = glyph_repeat_mode == "AXES_2D" ? $ : z) : (bt = z, Ve = $); var Vt = x[0] + lt * E[0]; tt[0] = bt[0] * Vt, tt[1] = bt[1] * Vt, tt[2] = bt[2] * Vt, pt[0] = tt[1] * Ve[2] - Ve[1] * tt[2], pt[1] = tt[2] * Ve[0] - Ve[2] * tt[0], pt[2] = tt[0] * Ve[1] - tt[1] * Ve[0]; var Nt = Math.sqrt(pt[0] * pt[0] + pt[1] * pt[1] + pt[2] * pt[2]); if (0 < Nt) { var re = (x[2] + lt * E[2]) / Nt; L == "AXES_2D" && 0 < Ue && (re *= -1), pt[0] *= re, pt[1] *= re, pt[2] *= re; } if (xt[0] = pt[1] * tt[2] - tt[1] * pt[2], xt[1] = pt[2] * tt[0] - tt[2] * pt[0], xt[2] = pt[0] * tt[1] - pt[1] * tt[0], Nt = Math.sqrt(xt[0] * xt[0] + xt[1] * xt[1] + xt[2] * xt[2]), 0 < Nt) { var Ee = (x[1] + lt * E[1]) / Nt; xt[0] *= Ee, xt[1] *= Ee, xt[2] *= Ee; } oe[Ue] = [et, tt, xt, pt]; } } return oe; }, Q = (F, $, J, z, V) => { var oe = 1; L == "AXES_2D" || L == "MIRROR" ? oe = 2 : L == "AXES_3D" && (oe = 3); var ue = F.length / 3, le = 0; G.length = oe; for (var ve = 0; ve < ue; ve++) { var xe = 3 * ve, Te = [F[xe], F[xe + 1], F[xe + 2]], de = [$[xe], $[xe + 1], $[xe + 2]], we = [J[xe], J[xe + 1], J[xe + 2]], se = [z[xe], z[xe + 1], z[xe + 2]], Se = [V[xe], V[xe + 1], V[xe + 2]], ge = q(Te, de, we, se, Se, G); if (ge.length == oe) for (var be = 0; be < oe; be++) { A.elements[0] = ge[be][1][0], A.elements[1] = ge[be][1][1], A.elements[2] = ge[be][1][2], A.elements[3] = 0, A.elements[4] = ge[be][2][0], A.elements[5] = ge[be][2][1], A.elements[6] = ge[be][2][2], A.elements[7] = 0, A.elements[8] = ge[be][3][0], A.elements[9] = ge[be][3][1], A.elements[10] = ge[be][3][2], A.elements[11] = 0, A.elements[12] = ge[be][0][0], A.elements[13] = ge[be][0][1], A.elements[14] = ge[be][0][2], A.elements[15] = 1, this.morph.setMatrixAt(le, A); var Ie = g[le]; Ie && Ie.setTransformation(ge[be][0], ge[be][1], ge[be][2], ge[be][3]), le++; } } this.morph.instanceMatrix.needsUpdate = !0; }, ee = (F) => { var $ = 1; L == "AXES_2D" || L == "MIRROR" ? $ = 2 : L == "AXES_3D" && ($ = 3); for (var J, z = F.length, V = 0, oe = 0; oe < z; oe++) { J = F[oe]; for (var ue = 0; ue < $; ue++) { P.setHex(J), this.morph.setColorAt(V, P); var le = g[V]; le && le.setColour(P), V++; } } this.morph.instanceColor.needsUpdate = !0; }, ne = () => { var F = B, $ = U, J = k, z = K, V = ie, oe = j, ue = this.inbuildTime / this.duration * (T - 1), le = Math.floor(ue), ve = 1 - (ue - le), xe = Math.ceil(ue); if (C) { var Te = v[le.toString()], de = v[xe.toString()], we = f[le.toString()], se = f[xe.toString()], Se = u[le.toString()], ge = u[xe.toString()], be = y[le.toString()], Ie = y[xe.toString()], et = m[le.toString()], mt = m[xe.toString()]; B.length = Te.length, U.length = Te.length, k.length = Te.length, K.length = Te.length, ie.length = Te.length; for (var Ue = 0; Ue < Te.length; Ue++) F[Ue] = ve * Te[Ue] + (1 - ve) * de[Ue], $[Ue] = ve * we[Ue] + (1 - ve) * se[Ue], J[Ue] = ve * Se[Ue] + (1 - ve) * ge[Ue], z[Ue] = ve * be[Ue] + (1 - ve) * Ie[Ue], V[Ue] = ve * et[Ue] + (1 - ve) * mt[Ue]; } else v[0], l("current_positions"), f[0], l("current_axis1s"), u[0], l("current_axis2s"), y[0], l("current_axis3s"), m[0], l("current_scales"); if (Q(F, $, J, z, V), this.boundingBoxUpdateRequired = !0, w != null) { if (R) { var bt = w[le.toString()], Ve = w[xe.toString()]; oe.length = bt.length; for (var lt = 0; lt < bt.length; lt++) P.setHex(bt[lt]), I.setHex(Ve[lt]), P.setRGB(P.r * ve + I.r * (1 - ve), P.g * ve + I.g * (1 - ve), P.b * ve + I.b * (1 - ve)), oe[lt] = P.getHex(); } else w[0], l("current_colors"); ee(oe); } }; this.showLabel = () => { for (var F = 0; F < g.length; F++) g[F].showLabel(this.morph.material ? this.morph.material.color : void 0); }; var Y = (F) => { if (S != null && F) for (var $, J = 0; J < M; J++) $ = new (c(16)).Glyph(void 0, void 0, J, this), S != null && S[J] != null && $.setLabel(S[J]), 0 < T && $.setFrustumCulled(!1), g[J] = $, this.morph.add($.getGroup()); S != null && F && this.showLabel(this.morph.material ? this.morph.material.color : void 0), Q(v[0], f[0], u[0], y[0], m[0]), w != null && ee(w[0]), this.ready = !0, this.boundingBoxUpdateRequired = !0; }; this.addCustomGlyph = (F) => { F.isGlyph && g.push(F), this.ready = !0, this.boundingBoxUpdateRequired = !0; }, this.addMeshAsGlyph = (F, $) => { if (F.isMesh) { var J = new (c(16)).Glyph(void 0, void 0, $, this); return J.fromMesh(F), g.push(J), this.morph.add(J.getGroup()), this.ready = !0, this.boundingBoxUpdateRequired = !0, J; } }, this.forEachGlyph = (F) => { for (var $ = 0; $ < g.length; $++) F(g[$]); }; var te = (F, $) => (J, z) => { var V = J.toBufferGeometry(); this.geometry.copy(V), this.geometry.computeBoundingSphere(), this.geometry.computeBoundingBox(), V.dispose(), z && z[0] && (this.morph.material = z[0]), Y($), this.morph.name = this.groupName, this.morph.userData = this, this.setMorph(this.morph), J.dispose(), F != null && typeof F == "function" && F(this); }; this.getClosestVertexIndex = function() { var F = -1; if (this.morph && this.ready) { this.getBoundingBox().getCenter(this._v1); for (var $, J = v[0], z = J.length / 3, V = -1, oe = 0, ue = 0; ue < z; ue++) $ = 3 * ue, this._v2.set(J[$], J[$ + 1], J[$ + 2]), oe = this._v1.distanceTo(this._v2), (V == -1 || V > oe) && (V = oe, F = ue); } return F; }, this.getClosestVertex = function() { if (this.closestVertexIndex == -1 && (this.closestVertexIndex = this.getClosestVertexIndex()), 0 <= this.closestVertexIndex && this.morph) { var F = new d.Vector3(); return this.morph.getMatrixAt(this.closestVertexIndex, A), F.setFromMatrixPosition(A), F; } }, this.getBoundingBox = () => { if (this.morph && this.ready && this.morph.visible) { if (this.boundingBoxUpdateRequired) { b.setFromBufferAttribute(this.morph.geometry.attributes.position); for (var F = 0; F < M; F++) this.morph.getMatrixAt(F, A), O.copy(b).applyMatrix4(A), F == 0 ? N.copy(O) : N.union(O); if (N) this.cachedBoundingBox.copy(N), this.morph.updateWorldMatrix(!0, !0), this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld), this.boundingBoxUpdateRequired = !1; else return; } return this.cachedBoundingBox; } }, this.setMorphTime = (F) => { this.inbuildTime = F > this.duration ? this.duration : 0 > F ? 0 : F, (R || C) && (ne(), C && (this.markerUpdateRequired = !0)); }, this.isTimeVarying = () => !!((this.ready === !1 || 0 < T) && (R || C)), this.getCurrentTime = () => this.inbuildTime, this.dispose = () => { for (var F = g.length - 1; 0 <= F; F--) g[F].dispose(); this.geometry && this.geometry.dispose(), this.morph && this.morph.material.dispose(), f = void 0, u = void 0, y = void 0, v = void 0, m = void 0, w = void 0, this.ready = !1, this.groupName = void 0; }, this.render = (F, $, J) => { if ($ == !0) { var z = this.inbuildTime + F; z > this.duration && (z -= this.duration), this.inbuildTime = z, (R || C) && ne(); } this.updateMarker($, J); }; }; p.prototype = Object.create(c(10).ZincObject.prototype), a.Glyphset = p; }, /* 19 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ JSONLoader: () => ( /* binding */ M ) /* harmony export */ }); var l = c(4), d = c(20).Loader, h = l.LoaderUtils, p = l.AnimationClip, g = l.Vector3, f = l.Vector4, u = l.Color, y = l.Vector2, v = c(6).Face3, m = c(6).Geometry, w = l.FileLoader, S = l.DefaultLoadingManager, T = c(21).VideoHandler; function M(x) { typeof x == "boolean" && (console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."), x = void 0), this.manager = x === void 0 ? S : x, this.withCredentials = !1, this.paramsString = ""; } Object.assign(M.prototype, { load: function(_, E, L, R) { var C = this, A = this.texturePath && typeof this.texturePath == "string" ? this.texturePath : h.extractUrlBase(_), P = new w(this.manager); _.split("?"), this.paramsString = _.length === 2 ? paramsStrings[1] : "", P.setWithCredentials(this.withCredentials), P.load(_, function(I) { var b = JSON.parse(I), O = b.metadata; if (O !== void 0) { var N = O.type; if (N !== void 0 && N.toLowerCase() === "object") return void console.error("THREE.JSONLoader: " + _ + " should be loaded with THREE.ObjectLoader instead."); } if (C && C.parse) { var D = C.parse(b, A); E(D.geometry, D.materials); } }, L, R); }, setTexturePath: function(_) { this.texturePath = _; }, parse: /* @__PURE__ */ function() { function x(R, C) { function A(Se, ge) { return Se & 1 << ge; } var P, I, b, O, N, D, B, U, k, K, ie, j, G, W, q, Q, ee, ne, Y, te, F, $, J, z, V, oe, ue, le = R.faces, ve = R.vertices, xe = R.normals, Te = R.colors, de = R.scale, we = 0; if (R.uvs !== void 0) { for (P = 0; P < R.uvs.length; P++) R.uvs[P].length && we++; for (P = 0; P < we; P++) C.faceVertexUvs[P] = []; } for (O = 0, N = ve.length; O < N; ) ne = new g(), ne.x = ve[O++] * de, ne.y = ve[O++] * de, ne.z = ve[O++] * de, C.vertices.push(ne); if (O = 0, N = le.length, R.uvs) for (P = 0; P < R.uvs.length; P++) { C.uvs[P] = []; for (var se = 0; se < R.uvs[P].length; se++) C.uvs[P][se] = R.uvs[P][se]; } if (xe) for (P = 0; P < xe.length; P++) C.normals[P] = xe[P]; if (Te) for (P = 0; P < Te.length; P++) C.colors[P] = Te[P]; for (; O < N; ) if (K = le[O++], ie = A(K, 0), j = A(K, 1), G = A(K, 3), W = A(K, 4), q = A(K, 5), Q = A(K, 6), ee = A(K, 7), ie) { if (te = new v(), te.a = le[O], te.b = le[O + 1], te.c = le[O + 3], F = new v(), F.a = le[O + 1], F.b = le[O + 2], F.c = le[O + 3], O += 4, j && (k = le[O++], te.materialIndex = k, F.materialIndex = k), b = C.faces.length, G) for (P = 0; P < we; P++) for (z = R.uvs[P], C.faceVertexUvs[P][b] = [], C.faceVertexUvs[P][b + 1] = [], I = 0; 4 > I; I++) U = le[O++], oe = z[2 * U], ue = z[2 * U + 1], V = new y(oe, ue), I !== 2 && C.faceVertexUvs[P][b].push(V), I !== 0 && C.faceVertexUvs[P][b + 1].push(V); if (W && (B = 3 * le[O++], te.normal.set(xe[B++], xe[B++], xe[B]), F.normal.copy(te.normal)), q) for (P = 0; 4 > P; P++) B = 3 * le[O++], J = new g(xe[B++], xe[B++], xe[B]), P !== 2 && te.vertexNormals.push(J), P !== 0 && F.vertexNormals.push(J); if (Q && (D = le[O++], $ = Te[D], te.color.setHex($), F.color.setHex($)), ee) for (P = 0; 4 > P; P++) D = le[O++], $ = Te[D], P !== 2 && te.vertexColors.push(new u($)), P !== 0 && F.vertexColors.push(new u($)); C.faces.push(te), C.faces.push(F); } else { if (Y = new v(), Y.a = le[O++], Y.b = le[O++], Y.c = le[O++], j && (k = le[O++], Y.materialIndex = k), b = C.faces.length, G) for (P = 0; P < we; P++) for (z = R.uvs[P], C.faceVertexUvs[P][b] = [], I = 0; 3 > I; I++) U = le[O++], oe = z[2 * U], ue = z[2 * U + 1], V = new y(oe, ue), C.faceVertexUvs[P][b].push(V); if (W && (B = 3 * le[O++], Y.normal.set(xe[B++], xe[B++], xe[B])), q) for (P = 0; 3 > P; P++) B = 3 * le[O++], J = new g(xe[B++], xe[B++], xe[B]), Y.vertexNormals.push(J); if (Q && (D = le[O++], Y.color.setHex(Te[D])), ee) for (P = 0; 3 > P; P++) D = le[O++], Y.vertexColors.push(new u(Te[D])); C.faces.push(Y); } } function _(R, C) { var A = R.influencesPerVertex === void 0 ? 2 : R.influencesPerVertex; if (R.skinWeights) for (var P = 0, I = R.skinWeights.length; P < I; P += A) { var b = R.skinWeights[P], O = 1 < A ? R.skinWeights[P + 1] : 0, N = 2 < A ? R.skinWeights[P + 2] : 0, D = 3 < A ? R.skinWeights[P + 3] : 0; C.skinWeights.push(new f(b, O, N, D)); } if (R.skinIndices) for (var P = 0, I = R.skinIndices.length; P < I; P += A) { var B = R.skinIndices[P], U = 1 < A ? R.skinIndices[P + 1] : 0, k = 2 < A ? R.skinIndices[P + 2] : 0, K = 3 < A ? R.skinIndices[P + 3] : 0; C.skinIndices.push(new f(B, U, k, K)); } C.bones = R.bones, C.bones && 0 < C.bones.length && (C.skinWeights.length !== C.skinIndices.length || C.skinIndices.length !== C.vertices.length) && console.warn("When skinning, number of vertices (" + C.vertices.length + "), skinIndices (" + C.skinIndices.length + "), and skinWeights (" + C.skinWeights.length + ") should match."); } function E(R, C) { var A = R.scale; if (R.morphTargets !== void 0) for (var P = 0, I = R.morphTargets.length; P < I; P++) { C.morphTargets[P] = {}, C.morphTargets[P].name = R.morphTargets[P].name, C.morphTargets[P].vertices = []; for (var b, O = C.morphTargets[P].vertices, N = R.morphTargets[P].vertices, D = 0, B = N.length; D < B; D += 3) b = new g(), b.x = N[D] * A, b.y = N[D + 1] * A, b.z = N[D + 2] * A, O.push(b); } if (R.morphNormals !== void 0) { for (var P = 0, I = R.morphNormals.length; P < I; P++) if (C.morphTargets[P]) { C.morphTargets[P].normals = []; for (var U, k = C.morphTargets[P].normals, K = R.morphNormals[P].normals, D = 0, B = K.length; D < B; D += 3) U = new g(), U.x = K[D], U.y = K[D + 1], U.z = K[D + 2], k.push(U); C.morphNormalsReady = !0; } } if (R.morphColors !== void 0) { var P, I, ie, j, G, W, q; for (P = 0, I = R.morphColors.length; P < I; P++) for (C.morphColors[P] = {}, C.morphColors[P].name = R.morphColors[P].name, C.morphColors[P].colors = [], G = C.morphColors[P].colors, W = R.morphColors[P].colors, ie = 0, j = W.length; ie < j; ie += 3) q = new l.Color(16755200), q.setRGB(W[ie], W[ie + 1], W[ie + 2]), G.push(q); } } function L(R, C) { var A = [], P = []; R.animation !== void 0 && P.push(R.animation), R.animations !== void 0 && (R.animations.length ? P = P.concat(R.animations) : P.push(R.animations)); for (var I, b = 0; b < P.length; b++) I = p.parseAnimation(P[b], C.bones), I && A.push(I); if (C.morphTargets) { var O = p.CreateClipsFromMorphTargetSequences(C.morphTargets, 10); A = A.concat(O); } 0 < A.length && (C.animations = A); } return function(R, C) { R.data !== void 0 && (R = R.data), R.scale = R.scale === void 0 ? 1 : 1 / R.scale; var A = new m(); if (A.morphColors = [], x(R, A), _(R, A), E(R, A), L(R, A), A.computeFaceNormals(), A.computeBoundingSphere(), R.materials === void 0 || R.materials.length === 0) return { geometry: A }; var P = d.prototype.initMaterials(R.materials, C, "Anonymous"); if (R.materials[0].video) { var I = C + R.materials[0].video; this.paramsString && (I += "?".concat(this.paramsString)); var b = new T(I); A._video = b; } return P && 0 < P.length && (P[0].side = R.materials[0].singleSided ? l.FrontSide : R.materials[0].flipSided ? l.BackSide : l.DoubleSide, R.materials[0].specularCoef && (P[0].shininess = Math.floor(R.materials[0].specularCoef / 3))), { geometry: A, materials: P }; }; }() }); }, /* 20 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ Loader: () => ( /* binding */ d ) /* harmony export */ }); var l = c(4); c(4); function d() { } d.Handlers = { handlers: [], add: function(p, g) { this.handlers.push(p, g); }, get: function(p) { for (var g = this.handlers, f = 0, u = g.length; f < u; f += 2) { var y = g[f], v = g[f + 1]; if (y.test(p)) return v; } return null; } }, Object.assign(d.prototype, { crossOrigin: "anonymous", onLoadStart: function() { }, onLoadProgress: function() { }, onLoadComplete: function() { }, initMaterials: function(p, g, f) { for (var u = [], y = 0; y < p.length; ++y) u[y] = this.createMaterial(p[y], g, f); return u; }, createMaterial: function() { var h = { NoBlending: l.NoBlending, NormalBlending: l.NormalBlending, AdditiveBlending: l.AdditiveBlending, SubtractiveBlending: l.SubtractiveBlending, MultiplyBlending: l.MultiplyBlending, CustomBlending: l.CustomBlending }, p = new l.Color(), g = new l.TextureLoader(), f = new l.MaterialLoader(); return function(u, y, v) { function m(x, _, E, L, R) { var C, A = y + x, P = d.Handlers.get(A); P === null ? (g.setCrossOrigin(v), C = g.load(A)) : C = P.load(A), _ !== void 0 && (C.repeat.fromArray(_), _[0] !== 1 && (C.wrapS = l.RepeatWrapping), _[1] !== 1 && (C.wrapT = l.RepeatWrapping)), E !== void 0 && C.offset.fromArray(E), L !== void 0 && (L[0] === "repeat" && (C.wrapS = l.RepeatWrapping), L[0] === "mirror" && (C.wrapS = l.MirroredRepeatWrapping), L[1] === "repeat" && (C.wrapT = l.RepeatWrapping), L[1] === "mirror" && (C.wrapT = l.MirroredRepeatWrapping)), R !== void 0 && (C.anisotropy = R); var I = l.MathUtils.generateUUID(); return w[I] = C, I; } var w = {}, S = { uuid: l.MathUtils.generateUUID(), type: "MeshLambertMaterial" }; for (var T in u) { var M = u[T]; switch (T) { case "DbgColor": case "DbgIndex": case "opticalDensity": case "illumination": break; case "DbgName": S.name = M; break; case "blending": S.blending = h[M]; break; case "colorAmbient": case "mapAmbient": console.warn("THREE.Loader.createMaterial:", T, "is no longer supported."); break; case "colorDiffuse": S.color = p.fromArray(M).getHex(); break; case "colorSpecular": S.specular = p.fromArray(M).getHex(); break; case "colorEmissive": S.emissive = p.fromArray(M).getHex(); break; case "specularCoef": S.shininess = M; break; case "shading": M.toLowerCase() === "basic" && (S.type = "MeshBasicMaterial"), M.toLowerCase() === "phong" && (S.type = "MeshPhongMaterial"), M.toLowerCase() === "standard" && (S.type = "MeshStandardMaterial"); break; case "mapDiffuse": S.map = m(M, u.mapDiffuseRepeat, u.mapDiffuseOffset, u.mapDiffuseWrap, u.mapDiffuseAnisotropy); break; case "mapDiffuseRepeat": case "mapDiffuseOffset": case "mapDiffuseWrap": case "mapDiffuseAnisotropy": break; case "mapEmissive": S.emissiveMap = m(M, u.mapEmissiveRepeat, u.mapEmissiveOffset, u.mapEmissiveWrap, u.mapEmissiveAnisotropy); break; case "mapEmissiveRepeat": case "mapEmissiveOffset": case "mapEmissiveWrap": case "mapEmissiveAnisotropy": break; case "mapLight": S.lightMap = m(M, u.mapLightRepeat, u.mapLightOffset, u.mapLightWrap, u.mapLightAnisotropy); break; case "mapLightRepeat": case "mapLightOffset": case "mapLightWrap": case "mapLightAnisotropy": break; case "mapAO": S.aoMap = m(M, u.mapAORepeat, u.mapAOOffset, u.mapAOWrap, u.mapAOAnisotropy); break; case "mapAORepeat": case "mapAOOffset": case "mapAOWrap": case "mapAOAnisotropy": break; case "mapBump": S.bumpMap = m(M, u.mapBumpRepeat, u.mapBumpOffset, u.mapBumpWrap, u.mapBumpAnisotropy); break; case "mapBumpScale": S.bumpScale = M; break; case "mapBumpRepeat": case "mapBumpOffset": case "mapBumpWrap": case "mapBumpAnisotropy": break; case "mapNormal": S.normalMap = m(M, u.mapNormalRepeat, u.mapNormalOffset, u.mapNormalWrap, u.mapNormalAnisotropy); break; case "mapNormalFactor": S.normalScale = M; break; case "mapNormalRepeat": case "mapNormalOffset": case "mapNormalWrap": case "mapNormalAnisotropy": break; case "mapSpecular": S.specularMap = m(M, u.mapSpecularRepeat, u.mapSpecularOffset, u.mapSpecularWrap, u.mapSpecularAnisotropy); break; case "mapSpecularRepeat": case "mapSpecularOffset": case "mapSpecularWrap": case "mapSpecularAnisotropy": break; case "mapMetalness": S.metalnessMap = m(M, u.mapMetalnessRepeat, u.mapMetalnessOffset, u.mapMetalnessWrap, u.mapMetalnessAnisotropy); break; case "mapMetalnessRepeat": case "mapMetalnessOffset": case "mapMetalnessWrap": case "mapMetalnessAnisotropy": break; case "mapRoughness": S.roughnessMap = m(M, u.mapRoughnessRepeat, u.mapRoughnessOffset, u.mapRoughnessWrap, u.mapRoughnessAnisotropy); break; case "mapRoughnessRepeat": case "mapRoughnessOffset": case "mapRoughnessWrap": case "mapRoughnessAnisotropy": break; case "mapAlpha": S.alphaMap = m(M, u.mapAlphaRepeat, u.mapAlphaOffset, u.mapAlphaWrap, u.mapAlphaAnisotropy); break; case "mapAlphaRepeat": case "mapAlphaOffset": case "mapAlphaWrap": case "mapAlphaAnisotropy": break; case "flipSided": S.side = l.BackSide; break; case "doubleSided": S.side = l.DoubleSide; break; case "transparency": console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"), S.opacity = M; break; case "depthTest": case "depthWrite": case "colorWrite": case "opacity": case "reflectivity": case "transparent": case "visible": case "wireframe": S[T] = M; break; case "vertexColors": M === !0 && (S.vertexColors = l.VertexColors), M === "face" && (S.vertexColors = l.FaceColors); break; default: console.error("THREE.Loader.createMaterial: Unsupported", T, M); } } return S.type === "MeshBasicMaterial" && delete S.emissive, S.type !== "MeshPhongMaterial" && delete S.specular, 1 > S.opacity && (S.transparent = !0), f.setTextures(w), f.parse(S); }; }() }); }, /* 21 */ /***/ (o, a, c) => { var l = c(4); a.VideoHandler = function(d) { var h = this; this.video = void 0, this.videoTexture = void 0, this.setMorphTime = function(p, g) { var f = p / g * h.video.duration; h.video.currentTime = f; }, this.getVideoDuration = function() { return h.video.duration; }, this.createCanvasVideoTexture = function() { return h.videoTexture = new l.VideoTexture(h.video), h.videoTexture.minFilter = l.LinearFilter, h.videoTexture.magFilter = l.LinearFilter, h.videoTexture.format = l.RGBFormat, h.video.currentTime = 0, h.videoTexture; }, this.getCurrentTime = function(p) { return h.video ? p * (h.video.currentTime / h.video.duration) : 0; }, this.isReadyToPlay = function() { return !!(h.video && 3 <= h.video.readyState); }, function() { document && (h.video = document.createElement("video"), h.video.crossOrigin = "anonymous", h.video.src = d, h.video.load(), h.video.loop = !0); }(); }; }, /* 22 */ /***/ (o, a, c) => { var l = c(4), d = c(23).Points, h = c(5).toBufferGeometry, p = c(5).getCircularTexture, g = c(17).Label, f = function() { c(10).ZincObject.call(this), this.isPointset = !0; var u = []; this.createMesh = (v, m, w) => { if (v && m) { var S = h(v, w), T = p(); m.map = T; var M = new d(S, m); this.setMesh(M, w.localTimeEnabled, w.localMorphColour); } }; var y = (v, m, w, S) => { if (w) { var T = new l.Color(S), M = new g(w, T); M.setPosition(m[0], m[1], m[2]); var x = M.getSprite(); x.material.sizeAttenuation = !1, x.material.alphaTest = 0.5, x.material.transparent = !0, x.material.depthWrite = !1, x.material.depthTest = !1, this.group.add(x), u[v] = M; } }; this.addPoints = (v, m, w) => { if (v && 0 < v.length) { var S = this.drawRange - 1, T = this.addVertices(v), M = this.getMorph(); if (!M) { var x = new l.PointsMaterial({ alphaTest: 0.5, size: 10, color: w, sizeAttenuation: !1 }); T.colorsNeedUpdate = !0, this.createMesh(T, x, { localTimeEnabled: !1, localMorphColour: !1 }); } var _ = S + v.length, E = 0; if (Array.isArray(m) && m.length === v.length || typeof m == "string") for (S; S + E < _; ) { var L = typeof m == "string" ? m : m[E]; y(E, v[E], L, w), E++; } this.region && (this.region.pickableUpdateRequired = !0); } }, this.setSize = (v) => { this.morph && this.morph.material && (this.morph.material.size = v, this.morph.material.needsUpdate = !0); }, this.setSizeAttenuation = (v) => { this.morph && this.morph.material && (this.morph.material.sizeAttenuation = v, this.morph.material.needsUpdate = !0); }, this.getVerticesByIndex = function(v) { if (0 <= v && this.drawRange > v) { var m = this.getMorph().geometry.getAttribute("position"); return [m.getX(v), m.getY(v), m.getZ(v)]; } }, this.editVertices = function(v, m) { if (v && v.length) { var w = this.getMorph(), S = m + v.length - 1; if (!w || 0 > m || S >= this.drawRange) return; var T = w.geometry.getAttribute("position"), M = m; v.forEach((x) => { var _ = u[M]; _ && _.setPosition(x[0], x[1], x[2]), T.setXYZ(M++, x[0], x[1], x[2]); }), T.needsUpdate = !0, this.boundingBoxUpdateRequired = !0; } }, this.render = (v, m, w, S) => { this.morph && w && (this.morph.sizePerPixel = w.pixelHeight), f.prototype.render.call(this, v, m, w, S); }; }; f.prototype = Object.create(c(10).ZincObject.prototype), a.Pointset = f; }, /* 23 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ Points: () => ( /* binding */ y ) /* harmony export */ }); var l = c(4), d = /* @__PURE__ */ new l.Matrix4(), h = /* @__PURE__ */ new l.Ray(), p = /* @__PURE__ */ new l.Sphere(), g = /* @__PURE__ */ new l.Vector3(), f = /* @__PURE__ */ new l.Vector3(), u = /* @__PURE__ */ new l.Vector3(); class y extends l.Object3D { constructor() { var S = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new l.BufferGeometry(), T = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new l.PointsMaterial(); super(), this.type = "Points", this.geometry = S, this.material = T, this.sizePerPixel = 1, this.updateMorphTargets(); } copy(S) { return super.copy(S), this.material = S.material, this.geometry = S.geometry, this; } raycast(S, T) { var M = this.geometry, x = this.matrixWorld, _ = S.params.Points.threshold, E = M.drawRange; if (M.boundingSphere === null && M.computeBoundingSphere(), p.copy(M.boundingSphere), p.applyMatrix4(x), p.radius += _, S.ray.intersectsSphere(p) !== !1) { d.copy(x).invert(), h.copy(S.ray).applyMatrix4(d); var L = _ / ((this.scale.x + this.scale.y + this.scale.z) / 3) * this.material.size * this.sizePerPixel, R = L * L; if (M.isBufferGeometry) { var C = M.index, A = M.attributes, P = A.position, I = M.morphAttributes.position; if (C !== null) for (var b, O = Math.max(0, E.start), N = Math.min(C.count, E.start + E.count), D = O; D < N; D++) b = C.getX(D), m(this, P, I, b), v(g, b, R, x, S, T, this); else for (var B = Math.max(0, E.start), U = Math.min(P.count, E.start + E.count), k = B; k < U; k++) m(this, P, I, k), v(g, k, R, x, S, T, this); } else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } } updateMorphTargets() { var S = this.geometry; if (S.isBufferGeometry) { var T = S.morphAttributes, M = Object.keys(T); if (0 < M.length) { var x = T[M[0]]; if (x !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (var _, E = 0, L = x.length; E < L; E++) _ = x[E].name || E + "", this.morphTargetInfluences.push(0), this.morphTargetDictionary[_] = E; } } } else { var R = S.morphTargets; R !== void 0 && 0 < R.length && console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead."); } } } y.prototype.isPoints = !0; function v(w, S, T, M, x, _, E) { var L = h.distanceSqToPoint(w); if (L < T) { var R = new l.Vector3(); h.closestPointToPoint(w, R), R.applyMatrix4(M); var C = x.ray.origin.distanceTo(R); if (C < x.near || C > x.far) return; _.push({ distance: C, distanceToRay: Math.sqrt(L), point: R, index: S, face: null, object: E }); } } function m(w, S, T, M) { g.fromBufferAttribute(S, M); var x = w.morphTargetInfluences; if (w.material.morphTargets && T && x) { f.set(0, 0, 0); for (var _ = 0, E = T.length; _ < E; _++) { var L = x[_], R = T[_]; L !== 0 && (u.fromBufferAttribute(R, M), f.addScaledVector(u.sub(g), L)); } g.add(f); } } }, /* 24 */ /***/ (o, a, c) => { var l = c(4), d = c(5).toBufferGeometry, h = function() { c(10).ZincObject.call(this), this.isLines = !0, this.createLineSegment = (p, g, f) => { if (p && g) { var u = d(p, f); f.localMorphColour && u.morphAttributes.color && (g.onBeforeCompile = c(9).augmentMorphColor()); var y = new (c(12)).LineSegments(u, g); this.setMesh(y, f.localTimeEnabled, f.localMorphColour); } }, this.setWidth = (p) => { this.morph && this.morph.material && (this.morph.material.linewidth = p, this.morph.material.needsUpdate = !0); }, this.addLines = (p, g) => { if (p && 0 < p.length) { var f = this.addVertices(p), u = this.getMorph(); if (!u) { var y = new l.LineBasicMaterial({ color: g }); f.colorsNeedUpdate = !0, this.createLineSegment(f, y, { localTimeEnabled: !1, localMorphColour: !1 }); } this.region && (this.region.pickableUpdateRequired = !0); } }; }; h.prototype = Object.create(c(10).ZincObject.prototype), a.Lines = h; }, /* 25 */ /***/ (o, a, c) => { function l(g, f, u, y, v, m, w) { try { var S = g[m](w), T = S.value; } catch (M) { return void u(M); } S.done ? f(T) : Promise.resolve(T).then(y, v); } function d(g) { return function() { var f = this, u = arguments; return new Promise(function(y, v) { function m(T) { l(S, y, v, m, w, "next", T); } function w(T) { l(S, y, v, m, w, "throw", T); } var S = g.apply(f, u); m(void 0); }); }; } var h = c(4), p = function() { var g = this; c(26).Texture.call(this), this.isTextureArray = !0, this.loadFromImages = /* @__PURE__ */ function() { var f = d(function* (u) { var y = 1, v = 1, m = 0; if (u && u.length) { g.isLoading = !0; var w = new Image(); w.crossOrigin = "Anonymous"; for (var S, T = document.createElement("canvas"), M = 0, x = Array(u.length), _ = 0; _ < u.length; _++) S = yield g.imageToUint8Array(g, w, u[_], T), S && S.array && (y = S.width, v = S.height, x[m] = S.array, M += x[m].length, m++); var E = new Uint8Array(M); M = 0, x.forEach((L) => { E.set(L, M), M += L.length; }), g.impl = new h.DataTexture2DArray(E, y, v, m), g.size = { width: y, height: v, depth: m }, g.isLoading = !1, g.impl.needsUpdate = !0; } }); return function() { return f.apply(this, arguments); }; }(), this.getMaterial = (f) => { if (this.impl) { var u; if (!f) u = new h.MeshBasicMaterial({ color: new h.Color(1, 1, 1), transparent: !1, opacity: 1, map: this.impl, side: h.DoubleSide }); else if (f.vs && f.fs) { var y = !0; f.transparent && (y = f.transparent); var v = h.FrontSide; f.side && (v = f.side), u = new h.ShaderMaterial({ transparent: y, uniforms: f.uniforms, vertexShader: f.vs, fragmentShader: f.fs, side: v }), f.glslVersion && (u.glslVersion = f.glslVersion); } if (u) return u.needsUpdate = !0, u; } }; }; p.prototype = Object.create(c(26).Texture.prototype), a.TextureArray = p; }, /* 26 */ /***/ (o, a, c) => { function l(g, f, u, y, v, m, w) { try { var S = g[m](w), T = S.value; } catch (M) { return void u(M); } S.done ? f(T) : Promise.resolve(T).then(y, v); } function d(g) { return function() { var f = this, u = arguments; return new Promise(function(y, v) { function m(T) { l(S, y, v, m, w, "next", T); } function w(T) { l(S, y, v, m, w, "throw", T); } var S = g.apply(f, u); m(void 0); }); }; } var h = c(4), p = function() { this.isTexture = !0, this.impl = void 0, this.isLoading = !1, this.size = { width: 1, height: 1, depth: 0 }; }; p.prototype.loadImage = function(g, f) { return new Promise((u, y) => { g.onload = () => u(g), g.onerror = y, g.src = f; }); }, p.prototype.imageToUint8Array = /* @__PURE__ */ function() { var g = d(function* (f, u, y, v) { yield f.loadImage(u, y), v.width = u.width, v.height = u.height; var m = v.getContext("2d"); return m.drawImage(u, 0, 0), { array: new Uint8Array(m.getImageData(0, 0, v.width, v.height).data.buffer), width: v.width, height: v.height }; }); return function() { return g.apply(this, arguments); }; }(), p.prototype.loadFromImages = /* @__PURE__ */ function() { var g = d(function* () { }); return function() { return g.apply(this, arguments); }; }(), p.prototype.isReady = function() { return !(!this.impl || this.isLoading); }, p.prototype.getMaterial = function() { if (this.impl) return new h.MeshBasicMaterial({ color: new h.Color(1, 1, 1), transparent: !1, opacity: 1, map: this.impl, side: h.DoubleSide }); }, a.Texture = p; }, /* 27 */ /***/ (o, a, c) => { function l(v, m) { var w = Object.keys(v); if (Object.getOwnPropertySymbols) { var S = Object.getOwnPropertySymbols(v); m && (S = S.filter(function(T) { return Object.getOwnPropertyDescriptor(v, T).enumerable; })), w.push.apply(w, S); } return w; } function d(v) { for (var m, w = 1; w < arguments.length; w++) m = arguments[w] == null ? {} : arguments[w], w % 2 ? l(Object(m), !0).forEach(function(S) { h(v, S, m[S]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(v, Object.getOwnPropertyDescriptors(m)) : l(Object(m)).forEach(function(S) { Object.defineProperty(v, S, Object.getOwnPropertyDescriptor(m, S)); }); return v; } function h(v, m, w) { return m = p(m), m in v ? Object.defineProperty(v, m, { value: w, enumerable: !0, configurable: !0, writable: !0 }) : v[m] = w, v; } function p(v) { var m = g(v, "string"); return typeof m == "symbol" ? m : m + ""; } function g(v, m) { if (typeof v != "object" || !v) return v; var w = v[Symbol.toPrimitive]; if (w !== void 0) { var S = w.call(v, m || "default"); if (typeof S != "object") return S; throw new TypeError("@@toPrimitive must return a primitive value."); } return (m === "string" ? String : Number)(v); } var f = c(4), u = c(28), y = function(v) { c(29).TexturePrimitive.call(this, v), this.isTextureSlides = !0; var m = [], w = {}; this.morph = new f.Group(), this.group = this.morph, this.morph.userData = this; var S = !0; this.createSlides = (x) => { x.forEach((_) => this.createSlide(_)); }; var T = (x, _) => { var E = x.material, L = E.uniforms; switch (x.rotation.x = 0, x.rotation.y = 0, x.rotation.z = 0, x.position.x = 0, x.position.y = 0, x.position.z = 0, _.direction) { case "x": var R = S ? -Math.PI / 2 : Math.PI / 2; x.rotation.y = R, L.direction.value = 1, L.slide.value.set(_.value, 0, 0), x.position.x = _.value; break; case "y": x.rotation.x = Math.PI / 2, L.direction.value = 2, L.slide.value.set(0, _.value, 0), x.position.y = _.value; break; case "z": L.direction.value = 3, L.slide.value.set(0, 0, _.value), x.position.z = _.value; break; } E.needsUpdate = !0, this.boundingBoxUpdateRequired = !0; }; this.modifySlideSettings = (x) => { x && x.id && x.id in w && w[x.id] && T(w[x.id], x); }, this.createSlide = (x) => { if (this.texture && this.texture.isTextureArray && this.texture.isReady() && x && x.direction && x.value !== void 0) { var _ = new f.PlaneGeometry(1, 1); _.translate(0.5, 0.5, 0); var E = u.getUniforms(); E.diffuse.value = this.texture.impl, E.depth.value = this.texture.size.depth, E.flipY.value = S; var L = { fs: u.fs, vs: u.vs, uniforms: E, glslVersion: u.glslVersion, side: f.DoubleSide, transparent: !1 }, R = this.texture.getMaterial(L); R.needsUpdate = !0; var C = new f.Mesh(_, R); C.name = this.groupName, C.userData = this; var A = { value: x.value, direction: x.direction, id: C.id }; return m.push(A), T(C, A), w[C.id] = C, this.morph.add(C), this.boundingBoxUpdateRequired = !0, A; } }, this.getTextureSettings = () => [...m], this.getTextureSettingsWithId = (x) => { for (var _ = 0; _ < m.length; _++) if (x === m[_].id) return d({}, m[_]); }, this.getSlides = () => this.morph ? [...this.morph.children] : [], this.removeSlide = (x) => { x && this.removeSlideWithId(x.id); }, this.removeSlideWithId = (x) => { if (this.morph && x in w && w[x]) { if (this.morph.getObjectById(x)) { var _ = w[x]; this.morph.remove(_), _.clear(), _.geometry && _.geometry.dispose(), _.material && _.material.dispose(), this.boundingBoxUpdateRequired = !0; } var E = m.findIndex((L) => L.id === x); -1 < E && m.splice(E, 1); } }, this.dispose = () => { this.morph.children.forEach((x) => { x.geometry && x.geometry.dispose(), x.material && x.material.dispose(); }), c(29).TexturePrimitive.prototype.dispose.call(this), this.boundingBoxUpdateRequired = !0; }; var M = (x, _, E) => { switch (_.direction.value) { case 1: E.copy(_.slide.value), x.expandByPoint(E), E.setY(1), E.setZ(1), x.expandByPoint(E); break; case 2: E.copy(_.slide.value), x.expandByPoint(E), E.setX(1), E.setZ(1), x.expandByPoint(E); break; case 3: E.copy(_.slide.value), x.expandByPoint(E), E.setX(1), E.setY(1), x.expandByPoint(E); break; } }; this.getBoundingBox = () => { if (this.morph && this.morph.children && this.morph.visible && this.boundingBoxUpdateRequired) { this.cachedBoundingBox.makeEmpty(); var x = new f.Vector3(0, 0, 0); this.morph.children.forEach((_) => { M(this.cachedBoundingBox, _.material.uniforms, x); }), this.morph.updateMatrixWorld(!0, !0), this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld), this.boundingBoxUpdateRequired = !1; } return this.cachedBoundingBox; }, this.applyTransformation = (x, _, E) => { var L = new f.Matrix4(); L.set(x[0], x[1], x[2], 0, x[3], x[4], x[5], 0, x[6], x[7], x[8], 0, 0, 0, 0, 0); var R = new f.Quaternion().setFromRotationMatrix(L); this.morph.position.set(..._), this.morph.quaternion.copy(R), this.morph.scale.set(...E), this.morph.updateMatrix(), this.boundingBoxUpdateRequired = !0; }, this.initialise = (x, _) => { if (x) { var E = x.locations; E && 0 < E.length && (this.applyTransformation(E[0].orientation, E[0].position, E[0].scale), "flipY" in E[0] && (S = E[0].flipY)), this.createSlides(x.settings.slides), _ != null && typeof _ == "function" && _(this); } }; }; y.prototype = Object.create(c(29).TexturePrimitive.prototype), y.prototype.constructor = y, a.TextureSlides = y; }, /* 28 */ /***/ (o, a, c) => { var l = c(4), d = l.GLSL3, h = ` precision highp float; precision highp int; precision highp sampler2DArray; uniform sampler2DArray diffuse; in vec3 vUw; out vec4 outColor; void main() { vec4 color = texture( diffuse, vUw ); // lighten a bit outColor = vec4( color.rgb + .2, 1.0 ); } `, p = ` out vec3 vUw; uniform float depth; uniform vec3 slide; uniform int direction; uniform bool flipY; void main() { vec3 slidePos = position.xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( position.xyz, 1.0 ); if (direction == 1) slidePos = vec3(slide.x, position.y, position.x); if (direction == 2) slidePos = vec3(position.x, slide.y, position.y); if (direction == 3) slidePos = vec3(position.x, position.y, slide.z); if (flipY) slidePos.y = 1.0 - slidePos.y; vUw.xyz = vec3(slidePos.x, slidePos.y, slidePos.z * depth); } `, g = function() { return { diffuse: { value: void 0 }, depth: { value: 1 }, slide: { value: new l.Vector3(0, 0, 1) }, direction: { value: 1 }, flipY: { value: !0 } }; }; a.fs = h, a.vs = p, a.glslVersion = d, a.getUniforms = g; }, /* 29 */ /***/ (o, a, c) => { c(4); var l = c(5).resolveURL, d = function(h) { c(10).ZincObject.call(this), this.isTexturePrimitive = !0, this.texture = h, this.load = (p, g) => { if (p && p.images && p.images.source) { var f = new (c(25)).TextureArray(), u = []; p.images.source.forEach((v) => { u.push(l(v)); }); var y = this; f.loadFromImages(u).then(() => { y.texture = f, y.initialise(p, g); }); } }, this.initialise = (p, g) => { g != null && typeof g == "function" && g(this); }; }; d.prototype = Object.create(c(10).ZincObject.prototype), d.prototype.constructor = d, a.TexturePrimitive = d; }, /* 30 */ /***/ (o, a, c) => { var l = c(4), d = c(31); a.Renderer = function(h, p) { var g = h, f = p, u = void 0, y = new l.Clock(!1); this.playAnimation = !0; var v = 1e3, m = [], w = 0, S = [], T = 0, M = void 0, x = void 0, _ = void 0, E = void 0, L = [], R = [], C = new l.Group(), A = void 0, P = void 0, I = !1; this.getDrawingWidth = () => g ? g.clientWidth : A ? typeof A.clientWidth > "u" ? Math.round(A.width) : Math.round(A.clientWidth) : 0, this.getDrawingHeight = () => g ? g.clientHeight : A ? typeof A.clientHeight > "u" ? Math.round(A.height) : Math.round(A.clientHeight) : 0, this.onWindowResize = () => { u.onWindowResize(); var N = this.getDrawingWidth(), D = this.getDrawingHeight(); if (f != null) { var B; g ? (B = g.getBoundingClientRect(), f.setSize(N, D)) : A && (typeof A.getBoundingClientRect > "u" || (B = A.getBoundingClientRect(), A.width = N, A.height = D), f.setSize(N, D, !1)), B && (B.left, B.top); var U = new l.Vector2(); f.getSize(U), U.x, U.y, console.log("onWindowResize"); } }, this.initialiseVisualisation = (N) => { if (N = N || {}, N.antialias === void 0) { var D = !1; try { /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && (D = !0); } catch { D = !1; } N.antialias = !D; } N.canvas && (g = void 0, A = N.canvas), f = new l.WebGLRenderer(N), g !== void 0 && g.appendChild(f.domElement), f.setClearColor(16777215, 1), A && A.style && (A.style.height = "100%", A.style.width = "100%"), f.autoClear = !1; var B = this.createScene("default"); this.setCurrentScene(B); }, this.getCurrentScene = () => u, this.setCurrentScene = (N) => { if (N) { this.removeActiveScene(N); var D = u; u = N, D && D.setInteractiveControlEnable(!1), u.setInteractiveControlEnable(!0), u.setAdditionalScenesGroup(C), this.onWindowResize(); } }, this.getSceneByName = (N) => L[N], this.createScene = (N) => { if (L[N] == null) { var D; return D = A ? new (c(32)).Scene(A, f) : new (c(32)).Scene(g, f), L[N] = D, D.sceneName = N, D; } }, this.resetView = () => { u.resetView(); }, this.viewAll = () => { if (u) { var N = u.getBoundingBox(); if (N) { for (var D, B = 0; B < R.length; B++) D = R[B].getBoundingBox(), D && N.union(D); u.viewAllWithBoundingBox(N); } } }, this.loadModelsURL = (N, D, B, U, k, K) => { u.loadModelsURL(N, D, B, U, k, K); }, this.loadViewURL = (N) => { u.loadViewURL(N); }, this.loadFromViewURL = (N, D) => { u.loadFromViewURL(N, D); }, this.updateDirectionalLight = () => { u.updateDirectionalLight(); }; var b = () => { I ? (M = requestAnimationFrame(b), this.render()) : (cancelAnimationFrame(M), M = void 0); }; this.stopAnimate = () => { I && (y.stop(), I = !1); }, this.animate = () => { I || (y.start(), I = !0, b()); }, this.addPreRenderCallbackFunction = (N) => (++w, m[w] = N, w), this.removePreRenderCallbackFunction = (N) => { N in m && delete m[N]; }, this.addPostRenderCallbackFunction = (N) => (++T, S[T] = N, T), this.removePostRenderCallbackFunction = (N) => { N in S && delete S[N]; }, this.getPlayRate = () => v, this.setPlayRate = (N) => { v = N; }, this.getCurrentTime = () => u.getCurrentTime(), this.setMorphsTime = (N) => { u.setMorphsTime(N); }, this.getZincGeometryByID = (N) => u.getZincGeometryByID(N), this.addToScene = (N) => { u.addObject(N); }, this.addToOrthoScene = (N) => { if (_ == null && (_ = new l.Scene()), x == null) { var D = this.getDrawingWidth(), B = this.getDrawingHeight(); x = new l.OrthographicCamera(-D / 2, D / 2, B / 2, -B / 2, 1, 10), x.position.z = 10; } _.add(N); }; var O = (N) => (D) => { D.needsUpdate = !0; var B = new l.SpriteMaterial({ map: D }), U = B.map.image.width, k = B.map.image.height; N.material = B, N.scale.set(U, k, 1); var K = this.getDrawingWidth(), ie = this.getDrawingHeight(); N.position.set((K - U) / 2, (-ie + k) / 2, 1), this.addToOrthoScene(N); }; this.addLogo = () => { E = new l.Sprite(), l.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png", void 0, O(E)); }, this.render = () => { P || (g ? 0 < g.clientWidth && 0 < g.clientHeight && (P = new d(g, this.onWindowResize)) : A && 0 < A.width && 0 < A.height && (P = new d(A, this.onWindowResize))); var N = y.getDelta(); u.renderGeometries(v, N, this.playAnimation); for (var D, B = 0; B < R.length; B++) D = R[B], D.renderGeometries(v, N, this.playAnimation); for (var U in x != null && _ != null && (f.clearDepth(), f.render(_, x)), m) m.hasOwnProperty(U) && m[U].call(); for (var k in u.render(f), S) S.hasOwnProperty(k) && S[k].call(); }, this.getThreeJSRenderer = () => f, this.isSceneActive = (N) => { if (u === N) return !0; for (var D, B = 0; B < R.length; B++) if (D = R[B], D === N) return !0; return !1; }, this.addActiveScene = (N) => { this.isSceneActive(N) || (R.push(N), C.add(N.getThreeJSScene())); }, this.removeActiveScene = (N) => { for (var D, B = 0; B < R.length; B++) if (D = R[B], D === N) return R.splice(B, 1), void C.remove(N.getThreeJSScene()); }, this.clearAllActiveScene = () => { for (var N = 0; N < R.length; N++) C.remove(R[N].getThreeJSScene()); R.splice(0, R.length); }, this.dispose = () => { for (var N in I && cancelAnimationFrame(M), L) L.hasOwnProperty(N) && L[N].clearAll(); L = [], R = [], C = new l.Group(), this.stopAnimate(), m = [], w = 0, x = void 0, _ = void 0, E = void 0; var D = this.createScene("default"); this.setCurrentScene(D), P = void 0; }, this.transitionScene = (N, D) => { if (u) { var B = u.getZincCameraControls(), U = N.getBoundingBox(); if (U) { var k = U.min.distanceTo(U.max) / 2, K = (U.min.x + U.max.x) / 2, ie = (U.min.y + U.max.y) / 2, j = (U.min.z + U.max.z) / 2, G = B.getViewportFromCentreAndRadius(K, ie, j, k, 40, k * 4), W = B.getCurrentViewport(); B.cameraTransition(W, G, D), B.enableCameraTransition(); } } }, this.isWebGL2 = () => !!f && f.capabilities.isWebGL2; }; }, /* 31 */ /***/ (o) => { o.exports = nz(); }, /* 32 */ /***/ (o, a, c) => { var l = c(4), d = c(33).MarkerCluster, h = c(35).SceneLoader, p = c(41).SceneExporter, g = c(43).Viewport, f = c(5).createBufferGeometry, u = c(5).getCircularTexture, y = 0, v = function() { return "sc" + y++; }, m = function() { return { Duration: "6 secs", OriginalDuration: "-", TimeStamps: {} }; }, w = 6e3; a.Scene = function(S, T) { var M = this, x = S, _ = void 0, E = new h(this), L = void 0, R = {}, C = 0, A = {}, P = 0, I = new l.Scene(), b = new (c(44)).Region(void 0, this); I.add(b.getGroup()); var O = new l.Group(); I.add(O), this.directionalLight = void 0, this.ambient = void 0, this.camera = void 0; var N = 6e3, D = void 0; this.sceneName = void 0; var B = !1, U = void 0; this.autoClearFlag = !0, this.displayMarkers = !1, this.displayMinimap = !1, this.minimapScissor = { x_offset: 16, y_offset: 16, width: 128, height: 128, align: "top-left", updateRequired: !0 }; var k = { x: 0, y: 0 }, K = m(), ie = new l.Vector2(), j = []; this.forcePickableObjectsUpdate = !1, this.uuid = v(); var G = new d(this); G.disable(), I.add(G.group); var W = () => x ? typeof x.clientWidth > "u" ? x.width : x.clientWidth : 0, q = () => x ? typeof x.clientHeight > "u" ? x.height : x.clientHeight : 0; this.getDownloadProgress = () => E.getDownloadProgress(), this.onWindowResize = () => { var F = q(); this.camera.aspect = W() / F, this.camera.updateProjectionMatrix(), this.minimapScissor.updateRequired = !0, D.onResize(), D.calculateHeightPerPixelAtZeroDepth(F); }, this.resetView = () => { this.onWindowResize(), D.resetView(); }, this.changeZoomByScrollRateUnit = (F) => { D.changeZoomByScrollRateUnit(F); }; var Q = () => { this.camera = new l.PerspectiveCamera(40, W() / q(), 0, 10), this.ambient = new l.AmbientLight(16777215, 0.2), I.add(this.ambient), this.directionalLight = new l.DirectionalLight(16777215, 0.8), I.add(this.directionalLight), D = new (c(43)).CameraControls(this.camera, T.domElement, T, this), D.setDirectionalLight(this.directionalLight), D.resetView(), L = new (c(49)).Minimap(this); }; Q(), this.loadView = (F) => { var $ = new g(); return $.setFromObject(F), D.setCurrentCameraSettings($), !0; }, this.setupMultipleViews = (F, $) => { for (var [J, z] of Object.entries($)) { var V = new g(); V.setFromObject(z), D.addViewport(J, V); } D.setDefaultViewport(F); }, this.getBoundingBox = () => b.getBoundingBox(!0), this.viewAllWithBoundingBox = (F) => { if (F) { var $ = D.getViewportFromBoundingBox(F, 1); D.setCurrentCameraSettings($), D.calculateHeightPerPixelAtZeroDepth(q()), G.markerUpdateRequired = !0; } }, this.viewAll = () => { var F = this.getBoundingBox(); this.viewAllWithBoundingBox(F), G.markerUpdateRequired = !0; }, this.forEachGeometry = (F) => { b.forEachGeometry(F, !0); }, this.forEachGlyphset = (F) => { b.forEachGlyphset(F, !0); }, this.forEachPointset = (F) => { b.forEachPointset(F, !0); }, this.forEachLine = (F) => { b.forEachLine(F, !0); }, this.findGeometriesWithGroupName = (F) => b.findGeometriesWithGroupName(F, !0), this.findPointsetsWithGroupName = (F) => b.findPointsetsWithGroupName(F, !0), this.findGlyphsetsWithGroupName = (F) => b.findGlyphsetsWithGroupName(F, !0), this.findLinesWithGroupName = (F) => b.findLinesWithGroupName(F, !0), this.findObjectsWithGroupName = (F) => b.findObjectsWithGroupName(F, !0), this.findObjectsWithAnatomicalId = (F) => b.findObjectsWithAnatomicalId(F, !0), this.getBoundingBoxOfZincObjects = (F) => { for (var $, J = void 0, z = 0; z < F.length; z++) $ = F[z].getBoundingBox(), $ && (J ? J.union($) : J = $); return J; }, this.vectorToScreenXY = (F) => { F.project(this.camera); var $ = W(), J = q(), z = $ / 2, V = J / 2; return F.x = F.x * z + z, F.y = -(F.y * V) + V, F; }, this.getObjectsScreenXY = (F) => { if (F && 0 < F.length) { var $ = this.getBoundingBoxOfZincObjects(F), J = new l.Vector3(); return $.getCenter(J), this.vectorToScreenXY(J); } }, this.getNamedObjectsScreenXY = (F) => { var $ = this.findObjectsWithGroupName(F); return this.getObjectsScreenXY($); }, this.addZincObject = (F) => { F && (b.addZincObject(F), D && D.calculateMaxAllowedDistance(this)); }, this.loadGlyphsetURL = (F, $, J, z) => { E.loadGlyphsetURL(b, F, $, J, z); }, this.loadPointsetURL = (F, $, J, z, V) => { E.loadPointsetURL(b, F, $, J, z, V); }, this.loadLinesURL = (F, $, J, z, V) => { E.loadLinesURL(b, F, $, J, z, V); }, this.loadSTL = (F, $, J) => { E.loadSTL(b, F, $, J); }, this.loadOBJ = (F, $, J) => { E.loadOBJ(b, F, $, J); }, this.loadMetadataURL = (F, $, J) => { E.loadMetadataURL(b, F, $, J); }, this.loadModelsURL = (F, $, J, z, V, oe) => { E.loadModelsURL(b.urls, $, J, z, V, oe); }, this.loadViewURL = (F) => { E.loadViewURL(F); }, this.loadFromViewURL = (F, $) => { E.loadFromViewURL(F, $); }, this.loadGLTF = (F, $, J, z) => { E.loadGLTF(b, F, $, J, z); }, this.updateDirectionalLight = () => { D.updateDirectionalLight(); }, this.addObject = (F) => { I.add(F); }, this.removeObject = (F) => { I.remove(F); }, this.getCurrentTime = () => { if (_ != null) return _.getCurrentTime(N); var F = b.getCurrentTime(); return F === -1 ? 0 : F; }, this.setMorphsTime = (F) => { _ != null && _.setMorphTime(F, N), b.setMorphTime(F, !0); }, this.isTimeVarying = () => !!(_ && _.video && !_.video.error) || b.isTimeVarying(), this.renderGeometries = (F, $, J) => { var z = {}; if (z.camera = D, z.displayMarkers = this.displayMarkers, z.markerCluster = G, z.markersList = G.markers, z.ndcToBeUpdated = !1, J && (z.markerCluster.markerUpdateRequired = !0), !_) E.toBeDownloaded == 0 ? (z.ndcToBeUpdated = D.update($), z.ndcToBeUpdated && D.calculateHeightPerPixelAtZeroDepth(q()), b.renderGeometries(F, $, J, D, z, !0)) : D.update(0); else if (_.isReadyToPlay()) { J ? _.video.play() : _.video.pause(); var V = _.video.currentTime / _.getVideoDuration() * N; E.toBeDownloaded == 0 ? (D.setTime(V), z.ndcToBeUpdated = D.update(0), z.ndcToBeUpdated && D.calculateHeightPerPixelAtZeroDepth(q()), b.setMorphTime(V, !0), b.renderGeometries(0, 0, J, D, z, !0)) : D.update(0); } else myPlayRate = 0; }, this.getThreeJSScene = () => I, this.setVideoHandler = (F) => { _ || (_ = F); }, this.setAdditionalScenesGroup = (F) => { I.add(F); }; var ee = (F, $, J, z, V, oe, ue) => { var le = 0, ve = 0; return ve = F.includes("top") ? ue - V - J : F.includes("bottom") ? J : Math.floor((ue - V) / 2), le = F.includes("left") ? $ : F.includes("right") ? oe - $ - z : Math.floor((oe - z) / 2), { x: le, y: ve }; }, ne = (F) => { this.displayMinimap === !0 && (F.setScissorTest(!0), F.getSize(ie), this.minimapScissor.updateRequired && (k = ee(this.minimapScissor.align, this.minimapScissor.x_offset, this.minimapScissor.y_offset, this.minimapScissor.width, this.minimapScissor.height, ie.x, ie.y), this.minimapScissor.updateRequired = !1), F.setScissor(k.x, k.y, this.minimapScissor.width, this.minimapScissor.height), F.setViewport(k.x, k.y, this.minimapScissor.width, this.minimapScissor.height), L.updateCamera(), I.add(L.mask), F.render(I, L.camera), I.remove(L.mask), F.setScissorTest(!1), F.setViewport(0, 0, ie.x, ie.y)); }; this.render = (F) => { this.autoClearFlag && F.clear(), B && U ? U.render(I, this.camera) : (F.render(I, this.camera), ne(F)); }, this.setInteractiveControlEnable = (F) => { F == !0 ? D.enable() : D.disable(); }, this.getZincCameraControls = () => D, this.getThreeJSScene = () => I, this.setDuration = (F) => { b.setDuration(F), N = F, D.setPathDuration(F), E.duration = F; }, this.getDuration = () => N, this.setStereoEffectEnable = (F) => { F != !0 || U || (U = new c(43).StereoEffect(T)), T.setSize(W(), q()), this.camera.updateProjectionMatrix(), B = F; }, this.objectIsInScene = (F) => b.objectIsInRegion(F, !0), this.alignBoundingBoxToCameraView = (F, $) => { if (F) { var J = new l.Vector3(); F.getCenter(J); var z = this.getZincCameraControls().getCurrentViewport(), V = new l.Vector3(z.targetPosition[0], z.targetPosition[1], z.targetPosition[2]), oe = new l.Vector3(z.eyePosition[0], z.eyePosition[1], z.eyePosition[2]), ue = new l.Vector3(), le = new l.Vector3(); ue.subVectors(V, oe).normalize(), le.subVectors(V, J).normalize(); var ve = new l.Vector3(); ve.crossVectors(ue, le); var xe = ue.angleTo(le); 0 < $ ? (this.getZincCameraControls().rotateCameraTransition(ve, xe, $), this.getZincCameraControls().enableCameraTransition()) : this.getZincCameraControls().rotateAboutLookAtpoint(ve, xe), G.markerUpdateRequired = !0; } }, this.translateBoundingBoxToCameraView = (F, $, J) => { if (F) { var z = this.getZincCameraControls().getCurrentViewport(), V = this.getZincCameraControls().getViewportFromBoundingBox(F, $); 0 < J && (this.getZincCameraControls().cameraTransition(z, V, J), this.getZincCameraControls().enableCameraTransition()), G.markerUpdateRequired = !0; } }, this.alignObjectToCameraView = (F, $) => { if (this.objectIsInScene(F)) { var J = F.getBoundingBox(); this.alignBoundingBoxToCameraView(J, $); } }, this.setCameraTargetToObject = (F) => { if (this.objectIsInScene(F)) { var $ = new l.Vector3(), J = F.getBoundingBox(), z = this.getZincCameraControls().getCurrentViewport(); J.getCenter($); var V = new l.Vector3(z.targetPosition[0], z.targetPosition[1], z.targetPosition[2]), oe = new l.Vector3(z.eyePosition[0], z.eyePosition[1], z.eyePosition[2]), ue = new l.Vector3(), le = new l.Vector3(); ue.subVectors(oe, V), le.addVectors($, ue), z.eyePosition[0] = le.x, z.eyePosition[1] = le.y, z.eyePosition[2] = le.z, z.targetPosition[0] = $.x, z.targetPosition[1] = $.y, z.targetPosition[2] = $.z, this.getZincCameraControls().setCurrentCameraSettings(z), G.markerUpdateRequired = !0; } }, this.isStereoEffectEnable = () => B, this.removeZincObject = (F) => { b.removeZincObject(F), D && D.calculateMaxAllowedDistance(this), G.markerUpdateRequired = !0; }, this.updatePickableThreeJSObjects = () => { j.length = 0, G.isEnabled && j.push(G.group), b.getPickableThreeJSObjects(j, !0), this.forcePickableObjectsUpdate = !1; }, this.getPickableThreeJSObjects = () => ((this.forcePickableObjectsUpdate || b.checkPickableUpdateRequred(!0)) && this.updatePickableThreeJSObjects(), j), this.getNormalisedMinimapCoordinates = (F, $) => { if (this.displayMinimap) { var J = new l.Vector2(); F.getSize(J); var z = J.y - $.clientY; if (k.x + this.minimapScissor.width > $.clientX && $.clientX > k.x && k.y + this.minimapScissor.height > z && z > k.y) { var V = 2 * (($.clientX - k.x) / this.minimapScissor.width) - 1, oe = 2 * ((z - k.y) / this.minimapScissor.height) - 1; return { x: V, y: oe }; } } }, this.getMinimapDiffFromNormalised = (F, $) => L ? L.getDiffFromNormalised(F, $) : void 0, this.isWebGL2 = () => T.isWebGL2(), this.clearAll = () => { G.clear(), b.clear(!0), this.clearZincObjectAddedCallbacks(), this.clearZincObjectRemovedCallbacks(), E.toBeDwonloaded = 0, D && D.calculateMaxAllowedDistance(this), G.markerUpdateRequired = !0; }, this.addMetadataTimeStamp = (F, $) => { K.TimeStamps[F] = te($); }, this.getMetadataTag = (F) => K[F], this.getMetadata = () => K, this.setMetadataTag = (F, $) => { K[F] = $; }, this.removeMetadataTag = (F) => { delete K[F]; }, this.resetMetadata = () => { K = m(); }, this.resetDuration = () => { this.setDuration(w); }; var Y = (F) => [...F.years ? ["".concat(F.years, "years")] : [], ...F.months ? ["".concat(F.months, "months")] : [], ...F.weeks ? ["".concat(F.weeks, "weeks")] : [], ...F.days ? ["".concat(F.days, "days")] : [], ...F.hours ? ["".concat(F.hours, "hours")] : [], ...F.mins ? ["".concat(F.mins, "mins")] : [], ...F.secs ? ["".concat(F.secs, "secs")] : []].join(" "), te = (F) => F.years ? 31536e6 * F.years : 0 + F.months ? 2592e6 * F.months : 0 + F.weeks ? 6048e5 * F.weeks : 0 + F.days ? 864e5 * F.days : 0 + F.hours ? 36e5 * F.hours : 0 + F.mins ? 6e4 * F.mins : 0 + F.secs ? 1e3 * F.secs : 0; this.setDurationFromObject = (F) => { var $ = Y(F), J = te(F); this.setMetadataTag("Duration", $), this.setDuration(J); }, this.setOriginalDurationFromObject = (F) => { var $ = Y(F); this.setMetadataTag("OriginalDuration", $); }, this.exportGLTF = (F) => { var $ = new p(this); return $.exportGLTF(F); }, this.getRootRegion = () => b, this.createLines = (F, $, J, z) => { var V = b.findChildFromPath(F); return V === void 0 && (V = b.createChildFromPath(F)), V.createLines($, J, z); }, this.createPoints = (F, $, J, z, V) => { var oe = b.findChildFromPath(F); return oe === void 0 && (oe = b.createChildFromPath(F)), oe.createPoints($, J, z, V); }, this.addZincObjectAddedCallbacks = (F) => (++C, R[C] = F, C), this.addZincObjectRemovedCallbacks = (F) => (++P, A[P] = F, P), this.removeZincObjectAddedCallbacks = (F) => { F in C && delete R[F]; }, this.removeZincObjectRemovedCallbacks = (F) => { F in P && delete A[F]; }, this.clearZincObjectAddedCallbacks = () => { R = {}, C = 0; }, this.clearZincObjectRemovedCallbacks = () => { A = {}, P = 0; }, this.triggerObjectAddedCallback = (F) => { for (var $ in R) R.hasOwnProperty($) && R[$](F); }, this.triggerObjectRemovedCallback = (F) => { for (var $ in A) A.hasOwnProperty($) && A[$](F); }, this.addTemporaryPoints = (F, $) => { var J = f(F.length, F), z = new l.PointsMaterial({ alphaTest: 0.5, size: 15, color: $, sizeAttenuation: !1 }), V = u(); z.map = V; var oe = new (c(23)).Points(J, z); return O.add(oe), oe; }, this.addTemporaryLines = (F, $) => { var J = f(F.length, F), z = new l.LineBasicMaterial({ color: $ }), V = new (c(12)).LineSegments(J, z); return O.add(V), V; }, this.removeTemporaryPrimitive = (F) => { O.remove(F), F.geometry.dispose(), F.material.dispose(); }, this.clearTemporaryPrimitives = () => { var F = 0, $ = O.children; return $.forEach((J) => { J.geometry.dispose(), J.material.dispose(), F++; }), O.clear(), F; }, this.addBoundingBoxPrimitive = function(F, $, J, z, V) { var oe = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : void 0, ue = b.findChildFromPath(F); ue === void 0 && (ue = b.createChildFromPath(F)); var le = oe || M.getBoundingBox(), ve = new l.Vector3().subVectors(le.max, le.min), xe = new l.BoxGeometry(ve.x, ve.y, ve.z), Te = ue.createGeometryFromThreeJSGeometry($, xe, J, z, V, 1e4); return ve.addVectors(le.min, le.max).multiplyScalar(0.5), Te.setPosition(ve.x, ve.y, ve.z), Te; }, this.addSlicesPrimitive = function(F, $, J, z, V) { var oe = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : void 0; if ($ && 3 <= $.length && J && 3 <= J.length) { var ue = b.findChildFromPath(F); ue === void 0 && (ue = b.createChildFromPath(F)); var le = oe || M.getBoundingBox(), ve = new l.Vector3().subVectors(le.max, le.min), xe = [], Te = 0; return ["x", "y", "z"].forEach((de) => { var we; switch (de) { case "x": we = new l.PlaneGeometry(ve.z, ve.y), we.rotateY(Math.PI / 2); break; case "y": we = new l.PlaneGeometry(ve.x, ve.z), we.rotateX(Math.PI / 2); break; case "z": we = new l.PlaneGeometry(ve.x, ve.y); break; } var se = ue.createGeometryFromThreeJSGeometry($[Te], we, J[Te], z, V, 10001); xe.push(se), Te++; }), ve.addVectors(le.min, le.max).multiplyScalar(0.5), xe.forEach((de) => { de.setPosition(ve.x, ve.y, ve.z); }), xe; } }, this.enableMarkerCluster = (F) => { F ? (G.markerUpdateRequired = !0, G.enable()) : (G.markerUpdateRequired = !1, G.disable()), this.forcePickableObjectsUpdate = !0; }; }; }, /* 33 */ /***/ (o, a, c) => { function l(T, M) { var x = Object.keys(T); if (Object.getOwnPropertySymbols) { var _ = Object.getOwnPropertySymbols(T); M && (_ = _.filter(function(E) { return Object.getOwnPropertyDescriptor(T, E).enumerable; })), x.push.apply(x, _); } return x; } function d(T) { for (var M, x = 1; x < arguments.length; x++) M = arguments[x] == null ? {} : arguments[x], x % 2 ? l(Object(M), !0).forEach(function(_) { h(T, _, M[_]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(T, Object.getOwnPropertyDescriptors(M)) : l(Object(M)).forEach(function(_) { Object.defineProperty(T, _, Object.getOwnPropertyDescriptor(M, _)); }); return T; } function h(T, M, x) { return M = p(M), M in T ? Object.defineProperty(T, M, { value: x, enumerable: !0, configurable: !0, writable: !0 }) : T[M] = x, T; } function p(T) { var M = g(T, "string"); return typeof M == "symbol" ? M : M + ""; } function g(T, M) { if (typeof T != "object" || !T) return T; var x = T[Symbol.toPrimitive]; if (x !== void 0) { var _ = x.call(T, M || "default"); if (typeof _ != "object") return _; throw new TypeError("@@toPrimitive must return a primitive value."); } return (M === "string" ? String : Number)(T); } var f = c(4), u = new Image(128, 128); u.src = c(34); var y = new f.Texture(); y.image = u, y.needsUpdate = !0; var v = [0.02, 0.03, 1], m = new f.SpriteMaterial({ map: y, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), w = c(5).createNewSpriteText, S = function(T) { c(10).ZincObject.call(this), this.texture = y; var M = void 0; this.morph = new f.Group(), this.group = this.morph, this.isMarkerCluster = !0; var x = !0, _ = []; this.markers = {}; var E = new f.Vector2(), L = new f.Vector2(), R = Date.now(); this.setSpriteSize = (b) => { M.scale.set(0.015, 0.02, 1), M.scale.multiplyScalar(b); }, this.clear = () => { this.group.clear(), this.markers = {}; }, this.dispose = () => { this.clear(), this.morph && this.morph.clear(); }; var C = (b) => { var O = new f.Group(), N = new f.Sprite(m); return N.clusterIndex = b, N.center.set(0.5, 0), N.position.set(0, 0, 0), N.renderOrder = 1e4, N.scale.set(v[0], v[1], v[2]), N.userData = this, O.add(N), this.group.add(O), { group: O, marker: N, label: void 0, number: 0, min: [0, 0, 0], max: [1, 1, 1] }; }, A = (b, O, N) => { b.group.visible = !0, b.group.position.set(O.coords[0], O.coords[1], O.coords[2]), (b.label === void 0 || N !== b.number) && (b.label && (b.group.remove(b.label), b.label.material.map.dispose(), b.label.material.dispose()), b.label = w(N, 0.012, "black", "Asap", 120, 700), b.number = N, b.group.add(b.label)), b.min = O.min, b.max = O.max; }, P = (b) => { var O = 0; for (b.forEach((N) => { var D = N.members.length, B = 0; D === 1 ? N.members[0].setVisibility(!0) : (N.members.forEach((U) => { B += U.getNumber(), U.setVisibility(!1); }), !_[O] && _.push(C(O)), A(_[O], N, B), O++); }), O; O < _.length; O++) _[O].group.visible = !1; }, I = (b, O) => { var N = !0, D = { members: [], coords: [0, 0, 0], min: [0, 0, 0], max: [1, 1, 1] }, B = 0; for (var U in b) N ? (E.set(b[U].ndc.x, b[U].ndc.y), this._b1.setFromPoints([b[U].morph.position]), N = !1, D.members.push(b[U]), D.coords = [b[U].morph.position.x, b[U].morph.position.y, b[U].morph.position.z], O.push(D), delete b[U]) : (L.set(b[U].ndc.x, b[U].ndc.y), B = E.distanceTo(L), 0.1 > B && (D.members.push(b[U]), this._b1.expandByPoint(b[U].morph.position), delete b[U])); D.min = [this._b1.min.x, this._b1.min.y, this._b1.min.z], D.max = [this._b1.max.x, this._b1.max.y, this._b1.max.z], N != !0 && I(b, O); }; this.calculate = () => { if (x) { var b = Date.now(); if (500 < b - R) { var O = []; I(d({}, this.markers), O), P(O), R = Date.now(), this.markerUpdateRequired = !1; } } }, this.isEnabled = () => x, this.enable = () => { x = !0, this.morph.visible = !0; }, this.disable = () => { for (var b in x = !1, this.morph.visible = !1, this.markers) { var O; (O = this.markers[b]) !== null && O !== void 0 && O.isMarker && this.markers[b].isEnabled() && this.markers[b].setVisibility(!0); } }, this.zoomToCluster = (b) => !!(b !== void 0 && -1 < b && (this._v1.set(..._[b].min), this._v2.set(..._[b].max), Math.abs(0 < this._v1.distanceTo(this._v2)))) && (this._b1.set(this._v1, this._v2), T.translateBoundingBoxToCameraView(this._b1, 3, 300), this.markerUpdateRequired = !0, !0), this.clusterIsVisible = (b) => { if (b !== void 0 && -1 < b && _[b]) { var O; return (O = _[b].group) === null || O === void 0 ? void 0 : O.visible; } return !1; }; }; S.prototype = Object.create(c(10).ZincObject.prototype), a.MarkerCluster = S; }, /* 34 */ /***/ (o) => { o.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIHZpZXdCb3g9IjAgMCAzNjUgNTYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4KPGRlZnM+CjwvZGVmcz4KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDApIiBpZD0iODA4ZWQyODMtMjUyNC00NDBmLTg4YWUtM2JkYjQ3YmI1NzQ5IiAgPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii0xODIuNSIgeT0iLTI4MCIgcng9IjAiIHJ5PSIwIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgLz4KPC9nPgo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+CjxnIHN0eWxlPSIiICAgPgo8L2c+CjwvZz4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDk3LjUpIiAgPgo8ZyBzdHlsZT0iIiAgID4KPC9nPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDAuOTkgMCAwIDAuOTkgMTgyLjUgMjgwKSIgID4KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItNTQwIiB5PSItNTQwIiByeD0iMCIgcnk9IjAiIHdpZHRoPSIxMDgwIiBoZWlnaHQ9IjEwODAiIC8+CjwvZz4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxwYXRoIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwxNjUsMCk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHRyYW5zZm9ybT0iIHRyYW5zbGF0ZSgtMTgyLjksIC0yNzkuODUpIiBkPSJNIDE4Mi45IDU1MS43IEMgMTgyLjkgNTUxLjgwMDAwMDAwMDAwMDEgMTgzLjEgNTUyIDE4My4xIDU1MiBDIDE4My4xIDU1MiAzNTguMyAyODMgMzU4LjMgMTk0LjYgQyAzNTguMyA2NC41IDI2OS41IDcuOTAwMDAwMDAwMDAwMDA2IDE4Mi45IDcuNjk5OTk5OTk5OTk5OTg5IEMgOTYuMyA3LjkgNy41IDY0LjUgNy41IDE5NC42IEMgNy41IDI4MyAxODIuOCA1NTIgMTgyLjggNTUyIEMgMTgyLjggNTUyIDE4Mi45IDU1MS43IDE4Mi45IDU1MS43IHogTSAxMjIuMiAxODcuMiBDIDEyMi4yIDE1My42IDE0OS40IDEyNi4zOTk5OTk5OTk5OTk5OSAxODMgMTI2LjM5OTk5OTk5OTk5OTk5IEMgMjE2LjYgMTI2LjM5OTk5OTk5OTk5OTk5IDI0My44IDE1My42IDI0My44IDE4Ny4yIEMgMjQzLjggMjIwLjc5OTk5OTk5OTk5OTk4IDIxNi41IDI0OCAxODIuOSAyNDggQyAxNDkuNCAyNDggMTIyLjIgMjIwLjggMTIyLjIgMTg3LjIgeiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiAvPgo8L2c+CgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPgo8Y2lyY2xlIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgY3g9IjAiIGN5PSIwIiByPSIzNSIgLz4KPC9nPgo8L2c+CjwvZz4KPC9zdmc+"; }, /* 35 */ /***/ (o, a, c) => { var l = c(4), d = c(5).resolveURL, h = c(5).createNewURL, p = c(36).STLLoader, g = c(37).OBJLoader, f = c(38).PrimitivesLoader; a.SceneLoader = function(u) { var y = u; this.toBeDownloaded = 0, this.progressMap = {}; var v = !1, m = !1, w = new f(); this.getDownloadProgress = () => { var j = 0, G = 0, W = !1; for (var q in this.progressMap) { var Q = this.progressMap[q]; j += Q[1], G += Q[0], Q[1] == 0 && (W = !0); } return W && (j = 0), [j, G, m]; }, this.onProgress = (j) => (G) => { this.progressMap[j] = [G.loaded, G.total]; }, this.onError = (j) => (G) => { --this.toBeDownloaded, m = !0, console.error("There is an issue with one of the external resource: ".concat(G == null ? void 0 : G.responseURL, ".")), j && j(); }; var S = (j, G) => { var W = G.Default; if (G.Inline) y.setupMultipleViews(W, G.Entries); else { var q = [], Q = function(te) { j && (newURL = h(ne, j), q.push(new Promise((F, $) => { fetch(newURL).then((J) => J.json()).then((J) => F({ key: te, data: J })).catch((J) => $(J)); }))); }; for (var [ee, ne] of Object.entries(G.Entries)) Q(ee); Promise.all(q).then((Y) => { var te = {}; Y.forEach(($) => { te[$.key] = $.data; }), y.setupMultipleViews(W, te); var F = y.getZincCameraControls(); F && F.setCurrentViewport(W), v = !0; }); } }; this.loadViewURL = (j, G) => { this.toBeDownloaded += 1; var W = new XMLHttpRequest(); W.onreadystatechange = () => { if (W.readyState == 4) if (W.status == 200) { var Q = JSON.parse(W.responseText); y.setupMultipleViews("default", { default: Q }), y.resetView(), v = !0, --this.toBeDownloaded, G != null && typeof G == "function" && G(); } else this.onError(); }; var q = d(j); W.open("GET", q, !0), W.send(); }, this.loadModelsURL = (j, G, W, q, Q, ee, ne) => { var Y = G.length; this.toBeDownloaded += Y; for (var te = 0; te < Y; te++) { var F = G[te], $ = c(0).defaultMaterialColor, J = c(0).defaultOpacity; W != null && W[te] != null && ($ = !!W[te]), q != null && q[te] != null && (J = q[te]); var z = 0; Q != null && Q[te] != null && (z = !!Q[te]); var V = 0; ee != null && ee[te] != null && (V = !!ee[te]), w.load(d(F), P(j, $, J, z, V, void 0, void 0, void 0, void 0, ne), this.onProgress(F), this.onError(ne)); } }, this.loadFromViewURL = (j, G, W) => { var q = new XMLHttpRequest(); q.onreadystatechange = () => { if (q.readyState == 4 && q.status == 200) { var ee = JSON.parse(q.responseText); y.loadView(ee); for (var ne, Y = [], te = G + "_", F = 0; F < ee.numberOfResources; F++) ne = te + (F + 1) + ".json", Y.push(ne); this.loadModelsURL(j, Y, ee.colour, ee.opacity, ee.timeEnabled, ee.morphColour, W); } }; var Q = d(G + "_view.json"); q.open("GET", Q, !0), q.send(); }; var T = (j, G, W, q, Q, ee, ne, Y) => (te, F) => { var $ = new (c(24)).Lines(), J = void 0; F && F[0] && (J = new l.LineBasicMaterial({ color: F[0].color.clone() }), 1 > F[0].opacity && (J.transparent = !0), J.opacity = F[0].opacity, J.morphTargets = G, J.vertexColors = F[0].vertexColors); var z = { localTimeEnabled: G, localMorphColour: W }; if ($ && ($.createLineSegment(te, J, z), $.setName(q), $.anatomicalId = Q, $.setRenderOrder(ee), j.addZincObject($), $.setDuration(y.getDuration()), console.log(ne), ne && ne.levels)) for (var [V, oe] of Object.entries(ne.levels)) $.addLOD(w, V, oe.URL, oe.Index, ne.preload); --this.toBeDownloaded, te.dispose(), Y != null && typeof Y == "function" && Y($); }; this.loadLinesURL = (j, G, W, q, Q, ee, ne) => { var Y = 0; this.toBeDownloaded += 1; var te = !!(ne && ne.isInline) && ne.isInline, F = ne && ne.anatomicalId ? ne.anatomicalId : void 0, $ = ne && ne.renderOrder ? ne.renderOrder : void 0; W != null && (Y = !!W); var J = 0; if (q != null && (J = !!q), te) { var z = w.parse(G); T(j, Y, J, Q, F, $, ne.lod, ee)(z.geometry, z.materials); } else w.load(G, T(j, Y, J, Q, F, $, ne.lod, ee), this.onProgress(G), this.onError(ee), ne.loaderOptions); }; var M = (j, G, W, q, Q, ee) => { var ne = ee && ee.isInline ? ee.isInline : void 0, Y = ee && ee.anatomicalId ? ee.anatomicalId : void 0, te = ee && ee.displayLabels ? ee.displayLabels : void 0, F = ee && ee.renderOrder ? ee.renderOrder : void 0, $ = new (c(18)).Glyphset(); $.setDuration(y.getDuration()), $.groupName = q; var J = () => { --this.toBeDownloaded, Q != null && typeof Q == "function" && Q($); }; ++this.toBeDownloaded, ne ? $.load(G, W, J, ne, te) : $.load(G, d(W), J, ne, te), $.anatomicalId = Y, $.setRenderOrder(F), j.addZincObject($); }, x = (j, G, W, q, Q, ee) => () => { if (G.readyState == 4 && G.status == 200) { var ne = JSON.parse(G.responseText); M(j, ne, W, q, Q, ee); } }, _ = (j, G, W, q, Q, ee, ne) => (Y, te) => { var F = new (c(22)).Pointset(), $ = new l.PointsMaterial({ alphaTest: 0.5, size: 10, sizeAttenuation: !1 }); te && te[0] && (1 > te[0].opacity && ($.transparent = !0), $.opacity = te[0].opacity, $.color = te[0].color, $.morphTargets = G, $.vertexColors = te[0].vertexColors); var J = {}; J.localTimeEnabled = G, J.localMorphColour = W, F && (F.createMesh(Y, $, J), F.setName(q), F.anatomicalId = Q, j.addZincObject(F), F.setDuration(y.getDuration()), F.setRenderOrder(ee)), Y.dispose(), --this.toBeDownloaded, ne != null && typeof ne == "function" && ne(F); }; this.loadSTL = (j, G, W, q) => { this.toBeDownloaded += 1; var Q = c(0).defaultMaterialColor, ee = c(0).defaultOpacity, ne = new p(); ne.crossOrigin = "Anonymous", ne.load(d(G), P(j, Q, ee, !1, !1, W, void 0, void 0, void 0, q)); }, this.loadOBJ = (j, G, W, q) => { this.toBeDownloaded += 1; var Q = c(0).defaultMaterialColor, ee = c(0).defaultOpacity, ne = new g(); ne.crossOrigin = "Anonymous", ne.load(d(G), P(j, Q, ee, !1, !1, W, void 0, void 0, void 0, q)); }; var E = (j, G, W, q, Q, ee, ne) => { this.toBeDownloaded += 1; var Y = c(0).defaultMaterialColor, te = c(0).defaultOpacity, F = 0, $ = !!(ne && ne.isInline) && ne.isInline, J = ne && ne.fileFormat ? ne.fileFormat : void 0, z = ne && ne.anatomicalId ? ne.anatomicalId : void 0, V = ne && ne.renderOrder ? ne.renderOrder : void 0; W != null && (F = !!W); var oe = 0; q != null && (oe = !!q); var ue = w; if (J !== void 0) { if (J == "STL") ue = new p(); else if (J == "OBJ") return ue = new g(), ue.crossOrigin = "Anonymous", void ue.load(G, objloader(j, Y, te, F, oe, Q, z, ee), this.onProgress(G), this.onError, ne.loaderOptions); } if ($) { var le = w.parse(G); P(j, Y, te, F, oe, Q, z, V, ne, ee)(le.geometry, le.materials); } else ue.crossOrigin = "Anonymous", w.load(G, P(j, Y, te, F, oe, Q, z, V, ne, ee), this.onProgress(G), this.onError(ee), ne.loaderOptions); }, L = function(G, W, q) { var Q = 0; return (ee) => { if (++Q, ee && W != null && typeof W == "function") { W(ee); var ne = y.getZincCameraControls(); ne && ne.calculateMaxAllowedDistance(y); } Q == G && (v == !1 && y.viewAll(), q != null && typeof q == "function" && q()); }; }; this.loadPointsetURL = (j, G, W, q, Q, ee, ne) => { var Y = 0; this.toBeDownloaded += 1, W != null && (Y = !!W); var te = 0; q != null && (te = !!q); var F = !!(ne && ne.isInline) && ne.isInline, $ = ne && ne.anatomicalId ? ne.anatomicalId : void 0, J = ne && ne.renderOrder ? ne.renderOrder : void 0; if (F) { var z = w.parse(G); _(j, Y, te, Q, $, J, ee)(z.geometry, z.materials); } else w.load(G, _(j, Y, te, Q, $, J, ee), this.onProgress(G), this.onError(ee), ne.loaderOptions); }; var R = (j, G, W, q, Q, ee) => { var ne = ee && ee.isInline ? ee.isInline : void 0, Y = ee && ee.anatomicalId ? ee.anatomicalId : void 0, te = ee && ee.renderOrder ? ee.renderOrder : void 0, F = void 0; if (W) { if (G && W.images && W.images.source) for (var $, J = W.images.source, z = 0; z < J.length; z++) $ = h(J[z], G), W.images.source[z] = $; if (W.type === "slides" && (F = new (c(27)).TextureSlides()), F) { F.groupName = q; var V = () => { --this.toBeDownloaded, Q != null && typeof Q == "function" && Q(F); }; ++this.toBeDownloaded, F.load(W, V, ne), F.anatomicalId = Y, F.setRenderOrder(te), j.addZincObject(F); } } }, C = (j, G, W, q, Q) => () => { if (G.readyState == 4 && G.status == 200) { var ee = JSON.parse(G.responseText); R(j, G.responseURL, ee, W, q, Q); } }; this.loadTextureURL = (j, G, W, q, Q) => { var ee = !!(Q && Q.isInline) && Q.isInline; if (ee) R(j, void 0, G, W, q, Q); else { var ne = new XMLHttpRequest(); ne.onreadystatechange = C(j, ne, W, q, Q), ne.open("GET", d(G), !0), ne.send(); } }, this.loadGlyphsetURL = (j, G, W, q, Q, ee) => { var ne = !!(ee && ee.isInline) && ee.isInline; if (ne) M(j, G, W, q, Q, ee); else { var Y = new XMLHttpRequest(); Y.onreadystatechange = x(j, Y, W, q, Q, ee), Y.open("GET", d(G), !0), Y.send(); } }; var A = (j, G, W, q, Q, ee, ne, Y, te) => { var F = { colour: W, opacity: q, localTimeEnabled: Q, localMorphColour: ee }, $ = new (c(3)).Geometry(); return $.createMesh(G, Y, F), $.getMorph() ? ($.setName(te), j && j.addZincObject($), $.setDuration(y.getDuration()), $.videoHandler && y.setVideoHandler($.videoHandler), $) : void 0; }, P = (j, G, W, q, Q, ee, ne, Y, te, F) => ($, J) => { var z; J && J[0] && (z = J[0]); var V = A(j, $, G, W, q, Q, void 0, z, ee); if (V.anatomicalId = ne, V.setRenderOrder(Y), te.lod && te.lod.levels) for (var [oe, ue] of Object.entries(te.lod.levels)) V.addLOD(w, oe, ue.URL, ue.Index, te.lod.preload); --this.toBeDownloaded, $.dispose(), F != null && typeof F == "function" && F(V); }, I = (j) => { var G = /P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/, [, W, q, Q, ee, ne, Y, te] = j.match(G); return { years: W, months: q, weeks: Q, days: ee, hours: ne, mins: Y, secs: te }; }; this.loadSettings = (j) => { if (j) { if (j.Duration) { var G = I(j.Duration); y.setDurationFromObject(G); } if (j.OriginalDuration) { var W = I(j.OriginalDuration); y.setOriginalDurationFromObject(W); } if (j.TimeStamps) for (var q in j.TimeStamps) { var Q = I(j.TimeStamps[q]); y.addMetadataTimeStamp(q, Q); } } }; var b = (j, G, W, q, Q) => { if (W) { var ee = void 0, ne = !1; W.URL ? (ee = W.URL, G && (ee = h(ee, G))) : W.Inline && (ee = W.Inline.URL, ne = !0); var Y = {}; if (W.LOD && W.LOD.Levels) { Y.preload = !!W.LOD.Preload, Y.levels = {}; for (var [te, F] of Object.entries(W.LOD.Levels)) Y.levels[te] = {}, Y.levels[te].URL = h(F.URL, G), Y.levels[te].Index = F.Index; } var $ = W.GroupName; ($ === void 0 || $ === "") && ($ = "_Unnamed"); var J = { loaderOptions: { index: W.Index }, isInline: ne, fileFormat: W.FileFormat, anatomicalId: W.AnatomicalId, compression: W.compression, lod: Y, renderOrder: q }; switch (W.Type) { case "Surfaces": E(j, ee, W.MorphVertices, W.MorphColours, $, Q, J); break; case "Glyph": var z; ne ? z = W.Inline.GlyphGeometriesURL : (z = W.GlyphGeometriesURL, z = h(W.GlyphGeometriesURL, G)), W.DisplayLabels && (J.displayLabels = !0), this.loadGlyphsetURL(j, ee, z, $, Q, J); break; case "Points": this.loadPointsetURL(j, ee, W.MorphVertices, W.MorphColours, $, Q, J); break; case "Lines": this.loadLinesURL(j, ee, W.MorphVertices, W.MorphColours, $, Q, J); break; case "Texture": this.loadTextureURL(j, ee, $, Q, J); break; } } }, O = (j, G, W) => { if (G) { var q = void 0, Q = !1; switch (G.URL ? (q = G.URL, j && (q = h(G.URL, j))) : G.Inline && (q = G.Inline.URL, Q = !0), G.Type) { case "View": Q ? (y.setupMultipleViews("default", { default: q }), v = !0, W != null && typeof W == "function" && W()) : this.loadViewURL(q, W); break; case "Settings": this.loadSettings(G); break; } } }; this.loadGLTF = (j, G, W, q, Q) => { var ee = new (c(39)).GLTFToZincJSLoader(); ee.load(y, j, G, W, q, Q); }; var N = (j, G, W, q) => { if (W.Primitives && W.Primitives.forEach((Y) => { var te = 1; Y.Order && (te = Y.Order), b(j, G, Y, te, q); }), W.Transformation && j.setTransformation(W.Transformation), W.Children) for (var [Q, ee] of Object.entries(W.Children)) { var ne = j.findOrCreateChildFromPath(Q); ne && N(ne, G, ee, q); } }, D = (j, G) => { if (Array.isArray(j)) { for (var W = 0, q = 0; q < j.length; q++) j[q].Type && (G && j[q].Type === "View" || j[q].Type === "Surfaces" || j[q].Type === "Glyph" || j[q].Type === "Points" || j[q].Type === "Lines" || j[q].Type === "Texture") && W++; return W; } return 0; }, B = (j) => { var G = j.Primitives ? D(j.Primitives, !1) : 0; return j.Children && Object.values(j.Children).forEach((W) => { G += B(W); }), G; }, U = (j) => Array.isArray(j) ? D(j, !0) : typeof j == "object" && j !== null && j.Version === "2.0" ? B(j.Regions) : void 0, k = (j, G, W, q, Q) => { var ee = j; W.RegionPath && W.RegionPath !== "" && (ee = j.findOrCreateChildFromPath(W.RegionPath)), b(ee, G, W, 2 * q, Q); }, K = (j, G, W, q, Q) => { for (var ee = U(G), ne = new L(ee, q, Q), Y = 0; Y < G.length; Y++) O(W, G[Y], ne); for (var te = 0; te < G.length; te++) k(j, W, G[te], te, ne); }, ie = (j, G, W, q, Q) => { var ee = U(G), ne = new L(ee, q, Q); G.Settings && this.loadSettings(G.Settings), G.Views && S(W, G.Views), G.Regions && N(j, W, G.Regions, ne); }; this.loadMetadataURL = (j, G, W, q) => { var Q = new XMLHttpRequest(), ee = d(G); Q.onreadystatechange = () => { if (Q.readyState == 4 && Q.status == 200) { y.resetMetadata(), y.resetDuration(), v = !1; var ne = Q.responseURL; ne === void 0 && (ne = new URL(ee).href); var Y = JSON.parse(Q.responseText); Array.isArray(Y) ? K(j, Y, ne, W, q) : typeof Y == "object" && Y !== null && Y.Version == "2.0" && ie(j, Y, ne, W, q); } }, Q.open("GET", ee, !0), Q.send(); }; }; }, /* 36 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ STLLoader: () => ( /* binding */ d ) /* harmony export */ }); var l = c(4); class d extends l.Loader { constructor(p) { super(p); } load(p, g, f, u) { var y = this, v = new l.FileLoader(this.manager); v.setPath(this.path), v.setResponseType("arraybuffer"), v.setRequestHeader(this.requestHeader), v.setWithCredentials(this.withCredentials), v.load(p, function(m) { try { g(y.parse(m)); } catch (w) { u ? u(w) : console.error(w), y.manager.itemError(p); } }, f, u); } parse(p) { function g(u, y, v) { for (var m = 0, w = u.length; m < w; m++) if (u[m] !== y.getUint8(v + m, !1)) return !1; return !0; } var f = function(u) { if (typeof u == "string") { for (var y = new Uint8Array(u.length), v = 0; v < u.length; v++) y[v] = 255 & u.charCodeAt(v); return y.buffer || y; } return u; }(p); return function(u) { var y = new DataView(u), v = y.getUint32(80, !0); if (84 + v * 50 === y.byteLength) return !0; for (var m = [115, 111, 108, 105, 100], w = 0; 5 > w; w++) if (g(m, y, w)) return !1; return !0; }(f) ? function(u) { for (var y, v, m, w, S, T, M, x, _ = new DataView(u), E = _.getUint32(80, !0), L = !1, R = 0; R < 70; R++) _.getUint32(R, !1) == 1129270351 && _.getUint8(R + 4) == 82 && _.getUint8(R + 5) == 61 && (L = !0, w = new Float32Array(3 * (3 * E)), S = _.getUint8(R + 6) / 255, T = _.getUint8(R + 7) / 255, M = _.getUint8(R + 8) / 255, x = _.getUint8(R + 9) / 255); for (var C = new l.BufferGeometry(), A = new Float32Array(3 * (3 * E)), P = new Float32Array(3 * (3 * E)), I = 0; I < E; I++) { var b = 84 + I * 50, O = _.getFloat32(b, !0), N = _.getFloat32(b + 4, !0), D = _.getFloat32(b + 8, !0); if (L) { var B = _.getUint16(b + 48, !0); 32768 & B ? (y = S, v = T, m = M) : (y = (31 & B) / 31, v = (31 & B >> 5) / 31, m = (31 & B >> 10) / 31); } for (var U = 1; 3 >= U; U++) { var k = b + 12 * U, K = 3 * (3 * I) + 3 * (U - 1); A[K] = _.getFloat32(k, !0), A[K + 1] = _.getFloat32(k + 4, !0), A[K + 2] = _.getFloat32(k + 8, !0), P[K] = O, P[K + 1] = N, P[K + 2] = D, L && (w[K] = y, w[K + 1] = v, w[K + 2] = m); } } return C.setAttribute("position", new l.BufferAttribute(A, 3)), C.setAttribute("normal", new l.BufferAttribute(P, 3)), L && (C.setAttribute("color", new l.BufferAttribute(w, 3)), C.hasColors = !0, C.alpha = x), C; }(f) : function(u) { for (var y, v = new l.BufferGeometry(), m = /solid([\s\S]*?)endsolid/g, w = /facet([\s\S]*?)endfacet/g, S = 0, T = /[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source, M = new RegExp("vertex" + T + T + T, "g"), x = new RegExp("normal" + T + T + T, "g"), _ = [], E = [], L = new l.Vector3(), R = 0, C = 0, A = 0; (y = m.exec(u)) !== null; ) { C = A; for (var P = y[0]; (y = w.exec(P)) !== null; ) { for (var I = 0, b = 0, O = y[0]; (y = x.exec(O)) !== null; ) L.x = parseFloat(y[1]), L.y = parseFloat(y[2]), L.z = parseFloat(y[3]), b++; for (; (y = M.exec(O)) !== null; ) _.push(parseFloat(y[1]), parseFloat(y[2]), parseFloat(y[3])), E.push(L.x, L.y, L.z), I++, A++; b !== 1 && console.error("THREE.STLLoader: Something isn't right with the normal of face number " + S), I !== 3 && console.error("THREE.STLLoader: Something isn't right with the vertices of face number " + S), S++; } var N = C, D = A - C; v.addGroup(N, D, R), R++; } return v.setAttribute("position", new l.Float32BufferAttribute(_, 3)), v.setAttribute("normal", new l.Float32BufferAttribute(E, 3)), v; }(function(u) { return typeof u == "string" ? u : l.LoaderUtils.decodeText(new Uint8Array(u)); }(p)); } } }, /* 37 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ OBJLoader: () => ( /* binding */ S ) /* harmony export */ }); var l = c(4), d = /^[og]\s*(.+)?/, h = /^mtllib /, p = /^usemtl /, g = /^usemap /, f = new l.Vector3(), u = new l.Vector3(), y = new l.Vector3(), v = new l.Vector3(), m = new l.Vector3(); function w() { var T = { objects: [], object: {}, vertices: [], normals: [], colors: [], uvs: [], materials: {}, materialLibraries: [], startObject: function(x, _) { if (this.object && this.object.fromDeclaration === !1) return this.object.name = x, void (this.object.fromDeclaration = _ !== !1); var E = this.object && typeof this.object.currentMaterial == "function" ? this.object.currentMaterial() : void 0; if (this.object && typeof this.object._finalize == "function" && this.object._finalize(!0), this.object = { name: x || "", fromDeclaration: _ !== !1, geometry: { vertices: [], normals: [], colors: [], uvs: [], hasUVIndices: !1 }, materials: [], smooth: !0, startMaterial: function(C, A) { var P = this._finalize(!1); P && (P.inherited || 0 >= P.groupCount) && this.materials.splice(P.index, 1); var I = { index: this.materials.length, name: C || "", mtllib: Array.isArray(A) && 0 < A.length ? A[A.length - 1] : "", smooth: P === void 0 ? this.smooth : P.smooth, groupStart: P === void 0 ? 0 : P.groupEnd, groupEnd: -1, groupCount: -1, inherited: !1, clone: function(O) { var N = { index: typeof O == "number" ? O : this.index, name: this.name, mtllib: this.mtllib, smooth: this.smooth, groupStart: 0, groupEnd: -1, groupCount: -1, inherited: !1 }; return N.clone = this.clone.bind(N), N; } }; return this.materials.push(I), I; }, currentMaterial: function() { return 0 < this.materials.length ? this.materials[this.materials.length - 1] : void 0; }, _finalize: function(C) { var A = this.currentMaterial(); if (A && A.groupEnd === -1 && (A.groupEnd = this.geometry.vertices.length / 3, A.groupCount = A.groupEnd - A.groupStart, A.inherited = !1), C && 1 < this.materials.length) for (var P = this.materials.length - 1; 0 <= P; P--) 0 >= this.materials[P].groupCount && this.materials.splice(P, 1); return C && this.materials.length === 0 && this.materials.push({ name: "", smooth: this.smooth }), A; } }, E && E.name && typeof E.clone == "function") { var L = E.clone(0); L.inherited = !0, this.object.materials.push(L); } this.objects.push(this.object); }, finalize: function() { this.object && typeof this.object._finalize == "function" && this.object._finalize(!0); }, parseVertexIndex: function(x, _) { var E = parseInt(x, 10); return 3 * (0 <= E ? E - 1 : E + _ / 3); }, parseNormalIndex: function(x, _) { var E = parseInt(x, 10); return 3 * (0 <= E ? E - 1 : E + _ / 3); }, parseUVIndex: function(x, _) { var E = parseInt(x, 10); return 2 * (0 <= E ? E - 1 : E + _ / 2); }, addVertex: function(x, _, E) { var L = this.vertices, R = this.object.geometry.vertices; R.push(L[x + 0], L[x + 1], L[x + 2]), R.push(L[_ + 0], L[_ + 1], L[_ + 2]), R.push(L[E + 0], L[E + 1], L[E + 2]); }, addVertexPoint: function(x) { var _ = this.vertices, E = this.object.geometry.vertices; E.push(_[x + 0], _[x + 1], _[x + 2]); }, addVertexLine: function(x) { var _ = this.vertices, E = this.object.geometry.vertices; E.push(_[x + 0], _[x + 1], _[x + 2]); }, addNormal: function(x, _, E) { var L = this.normals, R = this.object.geometry.normals; R.push(L[x + 0], L[x + 1], L[x + 2]), R.push(L[_ + 0], L[_ + 1], L[_ + 2]), R.push(L[E + 0], L[E + 1], L[E + 2]); }, addFaceNormal: function(x, _, E) { var L = this.vertices, R = this.object.geometry.normals; f.fromArray(L, x), u.fromArray(L, _), y.fromArray(L, E), m.subVectors(y, u), v.subVectors(f, u), m.cross(v), m.normalize(), R.push(m.x, m.y, m.z), R.push(m.x, m.y, m.z), R.push(m.x, m.y, m.z); }, addColor: function(x, _, E) { var L = this.colors, R = this.object.geometry.colors; L[x] !== void 0 && R.push(L[x + 0], L[x + 1], L[x + 2]), L[_] !== void 0 && R.push(L[_ + 0], L[_ + 1], L[_ + 2]), L[E] !== void 0 && R.push(L[E + 0], L[E + 1], L[E + 2]); }, addUV: function(x, _, E) { var L = this.uvs, R = this.object.geometry.uvs; R.push(L[x + 0], L[x + 1]), R.push(L[_ + 0], L[_ + 1]), R.push(L[E + 0], L[E + 1]); }, addDefaultUV: function() { var x = this.object.geometry.uvs; x.push(0, 0), x.push(0, 0), x.push(0, 0); }, addUVLine: function(x) { var _ = this.uvs, E = this.object.geometry.uvs; E.push(_[x + 0], _[x + 1]); }, addFace: function(x, _, E, L, R, C, A, P, I) { var b = this.vertices.length, O = this.parseVertexIndex(x, b), N = this.parseVertexIndex(_, b), D = this.parseVertexIndex(E, b); if (this.addVertex(O, N, D), this.addColor(O, N, D), A !== void 0 && A !== "") { var B = this.normals.length; O = this.parseNormalIndex(A, B), N = this.parseNormalIndex(P, B), D = this.parseNormalIndex(I, B), this.addNormal(O, N, D); } else this.addFaceNormal(O, N, D); if (L !== void 0 && L !== "") { var U = this.uvs.length; O = this.parseUVIndex(L, U), N = this.parseUVIndex(R, U), D = this.parseUVIndex(C, U), this.addUV(O, N, D), this.object.geometry.hasUVIndices = !0; } else this.addDefaultUV(); }, addPointGeometry: function(x) { this.object.geometry.type = "Points"; for (var _, E = this.vertices.length, L = 0, R = x.length; L < R; L++) _ = this.parseVertexIndex(x[L], E), this.addVertexPoint(_), this.addColor(_); }, addLineGeometry: function(x, _) { this.object.geometry.type = "Line"; for (var E = this.vertices.length, L = this.uvs.length, R = 0, C = x.length; R < C; R++) this.addVertexLine(this.parseVertexIndex(x[R], E)); for (var A = 0, P = _.length; A < P; A++) this.addUVLine(this.parseUVIndex(_[A], L)); } }; return T.startObject("", !1), T; } class S extends l.Loader { constructor(M) { super(M), this.materials = null; } load(M, x, _, E) { var L = this, R = new l.FileLoader(this.manager); R.setPath(this.path), R.setRequestHeader(this.requestHeader), R.setWithCredentials(this.withCredentials), R.load(M, function(C) { try { x(L.parse(C)); } catch (A) { E ? E(A) : console.error(A), L.manager.itemError(M); } }, _, E); } setMaterials(M) { return this.materials = M, this; } parse(M) { var x = new w(); M.indexOf(`\r `) !== -1 && (M = M.replace(/\r\n/g, ` `)), M.indexOf(`\\ `) !== -1 && (M = M.replace(/\\\n/g, "")); for (var _ = M.split(` `), E = "", L = "", R = 0, C = [], A = typeof "".trimLeft == "function", P = 0, I = _.length; P < I; P++) if (E = _[P], E = A ? E.trimLeft() : E.trim(), R = E.length, R !== 0 && (L = E.charAt(0), L !== "#")) if (L === "v") { var b = E.split(/\s+/); switch (b[0]) { case "v": x.vertices.push(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3])), 7 <= b.length ? x.colors.push(parseFloat(b[4]), parseFloat(b[5]), parseFloat(b[6])) : x.colors.push(void 0, void 0, void 0); break; case "vn": x.normals.push(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3])); break; case "vt": x.uvs.push(parseFloat(b[1]), parseFloat(b[2])); } } else if (L === "f") { for (var O, N = E.substr(1).trim(), D = N.split(/\s+/), B = [], U = 0, k = D.length; U < k; U++) if (O = D[U], 0 < O.length) { var K = O.split("/"); B.push(K); } for (var ie = B[0], j = 1, G = B.length - 1; j < G; j++) { var W = B[j], q = B[j + 1]; x.addFace(ie[0], W[0], q[0], ie[1], W[1], q[1], ie[2], W[2], q[2]); } } else if (L === "l") { var Q = E.substring(1).trim().split(" "), ee = [], ne = []; if (E.indexOf("/") === -1) ee = Q; else for (var Y, te = 0, F = Q.length; te < F; te++) Y = Q[te].split("/"), Y[0] !== "" && ee.push(Y[0]), Y[1] !== "" && ne.push(Y[1]); x.addLineGeometry(ee, ne); } else if (L === "p") { var $ = E.substr(1).trim(), J = $.split(" "); x.addPointGeometry(J); } else if ((C = d.exec(E)) !== null) { var z = (" " + C[0].substr(1).trim()).substr(1); x.startObject(z); } else if (p.test(E)) x.object.startMaterial(E.substring(7).trim(), x.materialLibraries); else if (h.test(E)) x.materialLibraries.push(E.substring(7).trim()); else if (g.test(E)) console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'); else if (L === "s") { if (C = E.split(" "), 1 < C.length) { var V = C[1].trim().toLowerCase(); x.object.smooth = V !== "0" && V !== "off"; } else x.object.smooth = !0; var oe = x.object.currentMaterial(); oe && (oe.smooth = x.object.smooth); } else { if (E === "\0") continue; console.warn('THREE.OBJLoader: Unexpected line: "' + E + '"'); } x.finalize(); var ue = new l.Group(); ue.materialLibraries = [].concat(x.materialLibraries); var le = x.objects.length !== 1 || x.objects[0].geometry.vertices.length !== 0; if (le == !0) for (var ve = 0, xe = x.objects.length; ve < xe; ve++) { var Te = x.objects[ve], de = Te.geometry, we = Te.materials, se = de.type === "Line", Se = de.type === "Points", ge = !1; if (de.vertices.length !== 0) { var be = new l.BufferGeometry(); be.setAttribute("position", new l.Float32BufferAttribute(de.vertices, 3)), 0 < de.normals.length && be.setAttribute("normal", new l.Float32BufferAttribute(de.normals, 3)), 0 < de.colors.length && (ge = !0, be.setAttribute("color", new l.Float32BufferAttribute(de.colors, 3))), de.hasUVIndices === !0 && be.setAttribute("uv", new l.Float32BufferAttribute(de.uvs, 2)); for (var Ie = [], et = 0, mt = we.length; et < mt; et++) { var Ue = we[et], bt = Ue.name + "_" + Ue.smooth + "_" + ge, Ve = x.materials[bt]; if (this.materials !== null) { if (Ve = this.materials.create(Ue.name), se && Ve && !(Ve instanceof l.LineBasicMaterial)) { var lt = new l.LineBasicMaterial(); l.Material.prototype.copy.call(lt, Ve), lt.color.copy(Ve.color), Ve = lt; } else if (Se && Ve && !(Ve instanceof l.PointsMaterial)) { var tt = new l.PointsMaterial({ size: 10, sizeAttenuation: !1 }); l.Material.prototype.copy.call(tt, Ve), tt.color.copy(Ve.color), tt.map = Ve.map, Ve = tt; } } Ve === void 0 && (Ve = se ? new l.LineBasicMaterial() : Se ? new l.PointsMaterial({ size: 1, sizeAttenuation: !1 }) : new l.MeshPhongMaterial(), Ve.name = Ue.name, Ve.flatShading = !Ue.smooth, Ve.vertexColors = ge, x.materials[bt] = Ve), Ie.push(Ve); } var xt = void 0; if (1 < Ie.length) { for (var pt, Vt = 0, Nt = we.length; Vt < Nt; Vt++) pt = we[Vt], be.addGroup(pt.groupStart, pt.groupCount, Vt); xt = se ? new l.LineSegments(be, Ie) : Se ? new l.Points(be, Ie) : new l.Mesh(be, Ie); } else xt = se ? new l.LineSegments(be, Ie[0]) : Se ? new l.Points(be, Ie[0]) : new l.Mesh(be, Ie[0]); xt.name = Te.name, ue.add(xt); } } else if (0 < x.vertices.length) { var re = new l.PointsMaterial({ size: 1, sizeAttenuation: !1 }), Ee = new l.BufferGeometry(); Ee.setAttribute("position", new l.Float32BufferAttribute(x.vertices, 3)), 0 < x.colors.length && x.colors[0] !== void 0 && (Ee.setAttribute("color", new l.Float32BufferAttribute(x.colors, 3)), re.vertexColors = !0); var Ne = new l.Points(Ee, re); ue.add(Ne); } return ue; } } }, /* 38 */ /***/ (o, a, c) => { function l(S, T) { var M = Object.keys(S); if (Object.getOwnPropertySymbols) { var x = Object.getOwnPropertySymbols(S); T && (x = x.filter(function(_) { return Object.getOwnPropertyDescriptor(S, _).enumerable; })), M.push.apply(M, x); } return M; } function d(S) { for (var T, M = 1; M < arguments.length; M++) T = arguments[M] == null ? {} : arguments[M], M % 2 ? l(Object(T), !0).forEach(function(x) { h(S, x, T[x]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(S, Object.getOwnPropertyDescriptors(T)) : l(Object(T)).forEach(function(x) { Object.defineProperty(S, x, Object.getOwnPropertyDescriptor(T, x)); }); return S; } function h(S, T, M) { return T = p(T), T in S ? Object.defineProperty(S, T, { value: M, enumerable: !0, configurable: !0, writable: !0 }) : S[T] = M, S; } function p(S) { var T = g(S, "string"); return typeof T == "symbol" ? T : T + ""; } function g(S, T) { if (typeof S != "object" || !S) return S; var M = S[Symbol.toPrimitive]; if (M !== void 0) { var x = M.call(S, T || "default"); if (typeof x != "object") return x; throw new TypeError("@@toPrimitive must return a primitive value."); } return (T === "string" ? String : Number)(S); } var f = c(19).JSONLoader, u = c(4), y = u.FileLoader, v = (S) => { var T = (x, _) => { x.merge(_); }; if (S && 0 < S.length) { for (; 1 < S.length; ) { var M = S.splice(1, 1); T(S[0], M[0]); } return S[0]; } }, m = function(T, M, x) { var _ = new y(), E = new f(); _.crossOrigin = M; var L = T, R = x, C = void 0, A = !1, P = !1, I = void 0, b = [], O = (U) => { var k = C[U.index]; if (k) { var K = E.parse(k); U.onLoad(K.geometry, K.materials); } else N(U); }, N = (U) => { U.onError && (!I && (I = { responseURL: L }), U.onError(I)); }; this.downloadCompleted = (U) => { try { C = JSON.parse(U[0]), A = !1, P = !0, Array.isArray(C) ? b.forEach((k) => O(k)) : b.forEach((k) => N(k)); } catch { b.forEach((K) => N(K)); } }; var D = () => (U) => { I = U, P = !0, A = !1, b.forEach((k) => { N(k); }); }, B = () => (U) => { b.forEach((k) => { k.onProgress && k.onProgress(U); }); }; this.load = (U, k, K, ie) => { var j = { index: U, onLoad: k, onProgress: K, onError: ie }; P ? C ? O(j) : N(I) : A ? b.push(j) : (b.push(j), A = !0, _.load(L, R, B, D)); }; }, w = function(T, M) { var x = [], _ = T, E = M, L = 0; this.itemDownloaded = (R, C) => { if (x[R] = C, L++, L == _) { for (var A = x[0][1], P = x.map((O) => O[0]), I = v(P), b = 1; b < _; b++) x[R][0].dispose(), x[R][1].forEach((O) => O.dispose()); E(I, A); } }; }; a.PrimitivesLoader = function() { var S = 0, T = 20; this.crossOrigin = "Anonymous"; var M = new f(), x = [], _ = {}, E = (A, P, I, b, O) => { var N = A.length, D = new w(N, P), B = 0; A.forEach((U) => { var k = O ? d({}, O) : {}; k.msHandler = D, k.order = B, B++, R(U, P, I, b, k); }); }, L = (A, P, I, b, O) => { var N = O ? d({}, O) : {}, D = _[A]; if (!D) if (T > S) { var B = new C(void 0, this, N); ++S, D = new m(A, this.crossOrigin, B), _[A] = D; } else x.push({ url: A, onLoad: P, onProgress: I, onError: b, options: O }); D && (N.isHandler = D, D.load(O.index, P, I, b)); }, R = (A, P, I, b, O) => { if (O && O.index !== void 0) L(A, P, I, b, O); else if (T > S) { ++S; var N = new C(P, this, O), D = new C(b, this, O); M.crossOrigin = this.crossOrigin, M.load(A, N, I, D); } else x.push({ url: A, onLoad: P, onProgress: I, onError: b, options: O }); }; this.load = (A, P, I, b, O) => { Array.isArray(A) ? E(A, P, I, b, O) : R(A, P, I, b, O); }, this.loadFromWaitingList = () => { for (; T > S; ) { var A = x.shift(); if (A) this.load(A.url, A.onLoad, A.onProgress, A.onError, A.options); else return; } }, this.itemRemainingCheck = () => { if (x.length === 0 && S == 0) for (var A in _) _.hasOwnProperty(A) && delete _[A]; }; var C = function(P, I, b) { return function() { --S; for (var O = arguments.length, N = Array(O), D = 0; D < O; D++) N[D] = arguments[D]; b != null && b.msHandler ? b.msHandler.itemDownloaded(b.order, N) : b != null && b.isHandler ? b.isHandler.downloadCompleted(N) : P && P(...N), I.loadFromWaitingList(), I.itemRemainingCheck(); }; }; this.parse = (A) => M.parse(A); }; }, /* 39 */ /***/ (o, a, c) => { c(4); var l = c(40).GLTFLoader, d = function() { var h = this; this.parseGLTFObjects = (p, g, f, u) => { var y = g; if (f !== 0) { if (p.type !== "Object3D") { var v; if (p.type === "Mesh" ? v = new (c(3)).Geometry() : p.type === "LineSegments" ? v = new (c(24)).Lines() : p.type === "Points" && (v = new (c(22)).Pointset()), v) { var m = !1, w = !1; p.geometry && p.geometry.morphAttributes && (m = !!p.geometry.morphAttributes.position, w = !!p.geometry.morphAttributes.color), v.setMesh(p.clone(), m, w); var S = v.getMorph(); v.groupName = S.name, S.matrixAutoUpdate = !0, g.addZincObject(v), u != null && typeof u == "function" && u(v); } } else if (p.name !== "" && (g && (y = g.findOrCreateChildFromPath(p.name)), y)) { var T = y.getGroup(); T.position.copy(p.position), T.rotation.copy(p.rotation), T.quaternion.copy(p.quaternion), T.matrixAutoUpdate = !0; } } f++, p.children.forEach((M) => { h.parseGLTFObjects(M, y, f, u); }); }, this.setCamera = (p) => { p.viewAll(); var g = p.getZincCameraControls(), f = g.getCurrentViewport(); g.addViewport("default", f), g.setDefaultViewport("default"); }, this.load = (p, g, f, u, y) => { var v = f.substring(0, f.lastIndexOf("/") + 1), m = f.substring(f.lastIndexOf("/") + 1, f.length), w = new l().setPath(v); w.load(m, function(S) { console.log(S), h.parseGLTFObjects(S.scene, g, 0, u), h.setCamera(p), y != null && typeof y == "function" && y(); }); }; }; a.GLTFToZincJSLoader = d; }, /* 40 */ /***/ (o) => { o.exports = Tz; }, /* 41 */ /***/ (o, a, c) => { var l = c(42).GLTFExporter, d = function(h) { var p = h; this.exportGLTF = (g) => { var f = p.getRootRegion(), u = f.getAllObjects(!0), y = []; u.forEach((w) => { w.animationClip && y.push({ clip: w.animationClip[0], mesh: w.getMorph() }); }); var v = new l(), m = { binary: g, animations: y }; return new Promise((w) => { v.parse(p.getThreeJSScene(), function(S) { w(S); }, m); }); }; }; a.SceneExporter = d; }, /* 42 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ GLTFExporter: () => ( /* binding */ d ) /* harmony export */ }); var l = c(4); class d { constructor() { this.pluginCallbacks = [], this.register(function(b) { return new C(b); }), this.register(function(b) { return new A(b); }), this.register(function(b) { return new P(b); }); } register(b) { return this.pluginCallbacks.indexOf(b) === -1 && this.pluginCallbacks.push(b), this; } unregister(b) { return this.pluginCallbacks.indexOf(b) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(b), 1), this; } /** * Parse scenes and generate GLTF output * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes * @param {Function} onDone Callback on completed * @param {Object} options options */ parse(b, O, N) { for (var D = new R(), B = [], U = 0, k = this.pluginCallbacks.length; U < k; U++) B.push(this.pluginCallbacks[U](D)); D.setPlugins(B), D.write(b, O, N); } } var h = { POINTS: 0, LINES: 1, LINE_LOOP: 2, LINE_STRIP: 3, TRIANGLES: 4, TRIANGLE_STRIP: 5, TRIANGLE_FAN: 6, UNSIGNED_BYTE: 5121, UNSIGNED_SHORT: 5123, FLOAT: 5126, UNSIGNED_INT: 5125, ARRAY_BUFFER: 34962, ELEMENT_ARRAY_BUFFER: 34963, NEAREST: 9728, LINEAR: 9729, NEAREST_MIPMAP_NEAREST: 9984, LINEAR_MIPMAP_NEAREST: 9985, NEAREST_MIPMAP_LINEAR: 9986, LINEAR_MIPMAP_LINEAR: 9987, CLAMP_TO_EDGE: 33071, MIRRORED_REPEAT: 33648, REPEAT: 10497 }, p = {}; p[l.NearestFilter] = h.NEAREST, p[l.NearestMipmapNearestFilter] = h.NEAREST_MIPMAP_NEAREST, p[l.NearestMipmapLinearFilter] = h.NEAREST_MIPMAP_LINEAR, p[l.LinearFilter] = h.LINEAR, p[l.LinearMipmapNearestFilter] = h.LINEAR_MIPMAP_NEAREST, p[l.LinearMipmapLinearFilter] = h.LINEAR_MIPMAP_LINEAR, p[l.ClampToEdgeWrapping] = h.CLAMP_TO_EDGE, p[l.RepeatWrapping] = h.REPEAT, p[l.MirroredRepeatWrapping] = h.MIRRORED_REPEAT; var g = { scale: "scale", position: "translation", quaternion: "rotation", morphTargetInfluences: "weights" }, f = 12, u = 1179937895, y = 2, v = 8, m = 1313821514, w = 5130562; function S(I, b) { return I.length === b.length && I.every(function(O, N) { return O === b[N]; }); } function T(I) { if (window.TextEncoder !== void 0) return new TextEncoder().encode(I).buffer; for (var b, O = new Uint8Array(new ArrayBuffer(I.length)), N = 0, D = I.length; N < D; N++) b = I.charCodeAt(N), O[N] = 255 < b ? 32 : b; return O.buffer; } function M(I) { return S(I.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); } function x(I, b, O) { for (var N = { min: Array(I.itemSize).fill(Number.POSITIVE_INFINITY), max: Array(I.itemSize).fill(Number.NEGATIVE_INFINITY) }, D = b; D < b + O; D++) for (var B, U = 0; U < I.itemSize; U++) B = void 0, 4 < I.itemSize ? B = I.array[D * I.itemSize + U] : U === 0 ? B = I.getX(D) : U === 1 ? B = I.getY(D) : U === 2 ? B = I.getZ(D) : U == 3 && (B = I.getW(D)), N.min[U] = Math.min(N.min[U], B), N.max[U] = Math.max(N.max[U], B); return N; } function _(I) { return 4 * Math.ceil(I / 4); } function E(I) { var b = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : 0, O = _(I.byteLength); if (O !== I.byteLength) { var N = new Uint8Array(O); if (N.set(new Uint8Array(I)), b !== 0) for (var D = I.byteLength; D < O; D++) N[D] = b; return N.buffer; } return I; } var L = null; class R { constructor() { this.plugins = [], this.options = {}, this.pending = [], this.buffers = [], this.byteOffset = 0, this.buffers = [], this.nodeMap = /* @__PURE__ */ new Map(), this.skins = [], this.extensionsUsed = {}, this.uids = /* @__PURE__ */ new Map(), this.uid = 0, this.json = { asset: { version: "2.0", generator: "THREE.GLTFExporter" } }, this.cache = { meshes: /* @__PURE__ */ new Map(), attributes: /* @__PURE__ */ new Map(), attributesNormalized: /* @__PURE__ */ new Map(), materials: /* @__PURE__ */ new Map(), textures: /* @__PURE__ */ new Map(), images: /* @__PURE__ */ new Map() }; } setPlugins(b) { this.plugins = b; } /** * Parse scenes and generate GLTF output * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes * @param {Function} onDone Callback on completed * @param {Object} options options */ write(b, O, N) { this.options = Object.assign({}, { // default options binary: !1, trs: !1, onlyVisible: !0, truncateDrawRange: !0, embedImages: !0, maxTextureSize: 1 / 0, animations: [], includeCustomExtensions: !1 }, N), 0 < this.options.animations.length && (this.options.trs = !0), this.processInput(b); var D = this; Promise.all(this.pending).then(function() { var B = D.buffers, U = D.json, k = D.options, K = D.extensionsUsed, ie = new Blob(B, { type: "application/octet-stream" }), j = Object.keys(K); if (0 < j.length && (U.extensionsUsed = j), U.buffers && 0 < U.buffers.length && (U.buffers[0].byteLength = ie.size), k.binary === !0) { var G = new window.FileReader(); G.readAsArrayBuffer(ie), G.onloadend = function() { var q = E(G.result), Q = new DataView(new ArrayBuffer(v)); Q.setUint32(0, q.byteLength, !0), Q.setUint32(4, w, !0); var ee = E(T(JSON.stringify(U)), 32), ne = new DataView(new ArrayBuffer(v)); ne.setUint32(0, ee.byteLength, !0), ne.setUint32(4, m, !0); var Y = new ArrayBuffer(f), te = new DataView(Y); te.setUint32(0, u, !0), te.setUint32(4, y, !0); var F = f + ne.byteLength + ee.byteLength + Q.byteLength + q.byteLength; te.setUint32(8, F, !0); var $ = new Blob([Y, ne, ee, Q, q], { type: "application/octet-stream" }), J = new window.FileReader(); J.readAsArrayBuffer($), J.onloadend = function() { O(J.result); }; }; } else if (U.buffers && 0 < U.buffers.length) { var W = new window.FileReader(); W.readAsDataURL(ie), W.onloadend = function() { var q = W.result; U.buffers[0].uri = q, O(U); }; } else O(U); }); } /** * Serializes a userData. * * @param {THREE.Object3D|THREE.Material} object * @param {Object} objectDef */ serializeUserData(b, O) { if (!(b.userData && b.userData.isZincObject) && Object.keys(b.userData).length !== 0) { var N = this.options, D = this.extensionsUsed; try { var B = JSON.parse(JSON.stringify(b.userData)); if (N.includeCustomExtensions && B.gltfExtensions) { for (var U in O.extensions === void 0 && (O.extensions = {}), B.gltfExtensions) O.extensions[U] = B.gltfExtensions[U], D[U] = !0; delete B.gltfExtensions; } 0 < Object.keys(B).length && (O.extras = B); } catch (k) { console.warn("THREE.GLTFExporter: userData of '" + b.name + "' won't be serialized because of JSON.stringify error - " + k.message); } } } /** * Assign and return a temporal unique id for an object * especially which doesn't have .uuid * @param {Object} object * @return {Integer} */ getUID(b) { return this.uids.has(b) || this.uids.set(b, this.uid++), this.uids.get(b); } /** * Checks if normal attribute values are normalized. * * @param {BufferAttribute} normal * @returns {Boolean} */ isNormalizedNormalAttribute(b) { var O = this.cache; if (O.attributesNormalized.has(b)) return !1; for (var N = new l.Vector3(), D = 0, B = b.count; D < B; D++) if (5e-4 < Math.abs(N.fromBufferAttribute(b, D).length() - 1)) return !1; return !0; } /** * Creates normalized normal buffer attribute. * * @param {BufferAttribute} normal * @returns {BufferAttribute} * */ createNormalizedNormalAttribute(b) { var O = this.cache; if (O.attributesNormalized.has(b)) return O.attributesNormalized.get(b); for (var N = b.clone(), D = new l.Vector3(), B = 0, U = N.count; B < U; B++) D.fromBufferAttribute(N, B), D.x === 0 && D.y === 0 && D.z === 0 ? D.setX(1) : D.normalize(), N.setXYZ(B, D.x, D.y, D.z); return O.attributesNormalized.set(b, N), N; } /** * Applies a texture transform, if present, to the map definition. Requires * the KHR_texture_transform extension. * * @param {Object} mapDef * @param {THREE.Texture} texture */ applyTextureTransform(b, O) { var N = !1, D = {}; (O.offset.x !== 0 || O.offset.y !== 0) && (D.offset = O.offset.toArray(), N = !0), O.rotation !== 0 && (D.rotation = O.rotation, N = !0), (O.repeat.x !== 1 || O.repeat.y !== 1) && (D.scale = O.repeat.toArray(), N = !0), N && (b.extensions = b.extensions || {}, b.extensions.KHR_texture_transform = D, this.extensionsUsed.KHR_texture_transform = !0); } /** * Process a buffer to append to the default one. * @param {ArrayBuffer} buffer * @return {Integer} */ processBuffer(b) { var O = this.json, N = this.buffers; return O.buffers || (O.buffers = [{ byteLength: 0 }]), N.push(b), 0; } /** * Process and generate a BufferView * @param {BufferAttribute} attribute * @param {number} componentType * @param {number} start * @param {number} count * @param {number} target (Optional) Target usage of the BufferView * @return {Object} */ processBufferView(b, O, N, D, B) { var U = this.json; U.bufferViews || (U.bufferViews = []); for (var k = O === h.UNSIGNED_BYTE ? 1 : O === h.UNSIGNED_SHORT ? 2 : 4, K = _(D * b.itemSize * k), ie = new DataView(new ArrayBuffer(K)), j = 0, G = N; G < N + D; G++) for (var W, q = 0; q < b.itemSize; q++) W = void 0, 4 < b.itemSize ? W = b.array[G * b.itemSize + q] : q === 0 ? W = b.getX(G) : q === 1 ? W = b.getY(G) : q === 2 ? W = b.getZ(G) : q == 3 && (W = b.getW(G)), O === h.FLOAT ? ie.setFloat32(j, W, !0) : O === h.UNSIGNED_INT ? ie.setUint32(j, W, !0) : O === h.UNSIGNED_SHORT ? ie.setUint16(j, W, !0) : O === h.UNSIGNED_BYTE && ie.setUint8(j, W), j += k; var Q = { buffer: this.processBuffer(ie.buffer), byteOffset: this.byteOffset, byteLength: K }; B !== void 0 && (Q.target = B), B === h.ARRAY_BUFFER && (Q.byteStride = b.itemSize * k), this.byteOffset += K, U.bufferViews.push(Q); var ee = { id: U.bufferViews.length - 1, byteLength: 0 }; return ee; } /** * Process and generate a BufferView from an image Blob. * @param {Blob} blob * @return {Promise} */ processBufferViewImage(b) { var O = this, N = O.json; return N.bufferViews || (N.bufferViews = []), new Promise(function(D) { var B = new window.FileReader(); B.readAsArrayBuffer(b), B.onloadend = function() { var U = E(B.result), k = { buffer: O.processBuffer(U), byteOffset: O.byteOffset, byteLength: U.byteLength }; O.byteOffset += U.byteLength, D(N.bufferViews.push(k) - 1); }; }); } /** * Process attribute to generate an accessor * @param {BufferAttribute} attribute Attribute to process * @param {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range * @param {Integer} start (Optional) * @param {Integer} count (Optional) * @return {Integer|null} Index of the processed accessor on the "accessors" array */ processAccessor(b, O, N, D) { var B, U = this.options, k = this.json; if (b.array.constructor === Float32Array) B = h.FLOAT; else if (b.array.constructor === Uint32Array) B = h.UNSIGNED_INT; else if (b.array.constructor === Uint16Array) B = h.UNSIGNED_SHORT; else if (b.array.constructor === Uint8Array) B = h.UNSIGNED_BYTE; else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type."); if (N === void 0 && (N = 0), D === void 0 && (D = b.count), U.truncateDrawRange && O !== void 0 && O.index === null) { var K = N + D, ie = O.drawRange.count === 1 / 0 ? b.count : O.drawRange.start + O.drawRange.count; N = Math.max(N, O.drawRange.start), D = Math.min(K, ie) - N, 0 > D && (D = 0); } if (D === 0) return null; var j, G = x(b, N, D); O !== void 0 && (j = b === O.index ? h.ELEMENT_ARRAY_BUFFER : h.ARRAY_BUFFER); var W = this.processBufferView(b, B, N, D, j), q = { bufferView: W.id, byteOffset: W.byteOffset, componentType: B, count: D, max: G.max, min: G.min, type: { 1: "SCALAR", 2: "VEC2", 3: "VEC3", 4: "VEC4", 16: "MAT4" }[b.itemSize] }; return b.normalized === !0 && (q.normalized = !0), k.accessors || (k.accessors = []), k.accessors.push(q) - 1; } /** * Process image * @param {Image} image to process * @param {Integer} format of the image (e.g. RGBFormat, RGBAFormat etc) * @param {Boolean} flipY before writing out the image * @return {Integer} Index of the processed texture in the "images" array */ processImage(b, O, N) { var D = this, B = D.cache, U = D.json, k = D.options, K = D.pending; B.images.has(b) || B.images.set(b, {}); var ie = B.images.get(b), j = O === l.RGBAFormat ? "image/png" : "image/jpeg", G = j + ":flipY/" + N.toString(); if (ie[G] !== void 0) return ie[G]; U.images || (U.images = []); var W = { mimeType: j }; if (k.embedImages) { var q = L = L || document.createElement("canvas"); q.width = Math.min(b.width, k.maxTextureSize), q.height = Math.min(b.height, k.maxTextureSize); var Q = q.getContext("2d"); if (N === !0 && (Q.translate(0, q.height), Q.scale(1, -1)), typeof HTMLImageElement < "u" && b instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && b instanceof HTMLCanvasElement || typeof OffscreenCanvas < "u" && b instanceof OffscreenCanvas || typeof ImageBitmap < "u" && b instanceof ImageBitmap) Q.drawImage(b, 0, 0, q.width, q.height); else { O !== l.RGBAFormat && O !== l.RGBFormat && console.error("GLTFExporter: Only RGB and RGBA formats are supported."), (b.width > k.maxTextureSize || b.height > k.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", b); var ee = new Uint8ClampedArray(4 * (b.height * b.width)); if (O === l.RGBAFormat) for (var ne = 0; ne < ee.length; ne += 4) ee[ne + 0] = b.data[ne + 0], ee[ne + 1] = b.data[ne + 1], ee[ne + 2] = b.data[ne + 2], ee[ne + 3] = b.data[ne + 3]; else for (var Y = 0, te = 0; Y < ee.length; Y += 4, te += 3) ee[Y + 0] = b.data[te + 0], ee[Y + 1] = b.data[te + 1], ee[Y + 2] = b.data[te + 2], ee[Y + 3] = 255; Q.putImageData(new ImageData(ee, b.width, b.height), 0, 0); } k.binary === !0 ? K.push(new Promise(function($) { q.toBlob(function(J) { D.processBufferViewImage(J).then(function(z) { W.bufferView = z, $(); }); }, j); })) : W.uri = q.toDataURL(j); } else W.uri = b.src; var F = U.images.push(W) - 1; return ie[G] = F, F; } /** * Process sampler * @param {Texture} map Texture to process * @return {Integer} Index of the processed texture in the "samplers" array */ processSampler(b) { var O = this.json; O.samplers || (O.samplers = []); var N = { magFilter: p[b.magFilter], minFilter: p[b.minFilter], wrapS: p[b.wrapS], wrapT: p[b.wrapT] }; return O.samplers.push(N) - 1; } /** * Process texture * @param {Texture} map Map to process * @return {Integer} Index of the processed texture in the "textures" array */ processTexture(b) { var O = this.cache, N = this.json; if (O.textures.has(b)) return O.textures.get(b); N.textures || (N.textures = []); var D = { sampler: this.processSampler(b), source: this.processImage(b.image, b.format, b.flipY) }; b.name && (D.name = b.name), this._invokeAll(function(U) { U.writeTexture && U.writeTexture(b, D); }); var B = N.textures.push(D) - 1; return O.textures.set(b, B), B; } /** * Process material * @param {THREE.Material} material Material to process * @return {Integer|null} Index of the processed material in the "materials" array */ processMaterial(b) { var O = this.cache, N = this.json; if (O.materials.has(b)) return O.materials.get(b); if (b.isShaderMaterial) return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."), null; N.materials || (N.materials = []); var D = { pbrMetallicRoughness: {} }; b.isMeshStandardMaterial !== !0 && b.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."); var B = b.color.toArray().concat([b.opacity]); if (S(B, [1, 1, 1, 1]) || (D.pbrMetallicRoughness.baseColorFactor = B), b.isMeshStandardMaterial ? (D.pbrMetallicRoughness.metallicFactor = b.metalness, D.pbrMetallicRoughness.roughnessFactor = b.roughness) : (D.pbrMetallicRoughness.metallicFactor = 0.5, D.pbrMetallicRoughness.roughnessFactor = 0.5), b.metalnessMap || b.roughnessMap) if (b.metalnessMap === b.roughnessMap) { var U = { index: this.processTexture(b.metalnessMap) }; this.applyTextureTransform(U, b.metalnessMap), D.pbrMetallicRoughness.metallicRoughnessTexture = U; } else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture."); if (b.map) { var k = { index: this.processTexture(b.map) }; this.applyTextureTransform(k, b.map), D.pbrMetallicRoughness.baseColorTexture = k; } if (b.emissive) { var K = b.emissive.clone().multiplyScalar(b.emissiveIntensity), ie = Math.max(K.r, K.g, K.b); if (1 < ie && (K.multiplyScalar(1 / ie), console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")), 0 < ie && (D.emissiveFactor = K.toArray()), b.emissiveMap) { var j = { index: this.processTexture(b.emissiveMap) }; this.applyTextureTransform(j, b.emissiveMap), D.emissiveTexture = j; } } if (b.normalMap) { var G = { index: this.processTexture(b.normalMap) }; b.normalScale && b.normalScale.x !== -1 && (b.normalScale.x !== b.normalScale.y && console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."), G.scale = b.normalScale.x), this.applyTextureTransform(G, b.normalMap), D.normalTexture = G; } if (b.aoMap) { var W = { index: this.processTexture(b.aoMap), texCoord: 1 }; b.aoMapIntensity !== 1 && (W.strength = b.aoMapIntensity), this.applyTextureTransform(W, b.aoMap), D.occlusionTexture = W; } b.transparent ? D.alphaMode = "BLEND" : 0 < b.alphaTest && (D.alphaMode = "MASK", D.alphaCutoff = b.alphaTest), b.side === l.DoubleSide && (D.doubleSided = !0), b.name !== "" && (D.name = b.name), this.serializeUserData(b, D), this._invokeAll(function(Q) { Q.writeMaterial && Q.writeMaterial(b, D); }); var q = N.materials.push(D) - 1; return O.materials.set(b, q), q; } /** * Process mesh * @param {THREE.Mesh} mesh Mesh to process * @return {Integer|null} Index of the processed mesh in the "meshes" array */ processMesh(b) { var O = this.cache, N = this.json, D = [b.geometry.uuid]; if (Array.isArray(b.material)) for (var B = 0, U = b.material.length; B < U; B++) D.push(b.material[B].uuid); else D.push(b.material.uuid); var k = D.join(":"); if (O.meshes.has(k)) return O.meshes.get(k); var K, ie = b.geometry; if (K = b.isLineSegments ? h.LINES : b.isLineLoop ? h.LINE_LOOP : b.isLine ? h.LINE_STRIP : b.isPoints ? h.POINTS : b.material.wireframe ? h.LINES : h.TRIANGLES, ie.isBufferGeometry !== !0) throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry."); var j = {}, G = {}, W = [], q = [], Q = { uv: "TEXCOORD_0", uv2: "TEXCOORD_1", color: "COLOR_0", skinWeight: "WEIGHTS_0", skinIndex: "JOINTS_0" }, ee = ie.getAttribute("normal"); ee === void 0 || this.isNormalizedNormalAttribute(ee) || (console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."), ie.setAttribute("normal", this.createNormalizedNormalAttribute(ee))); var ne = null; for (var Y in ie.attributes) if (Y.substr(0, 5) !== "morph") { var te = ie.attributes[Y]; Y = Q[Y] || Y.toUpperCase(); var F = /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/; if (F.test(Y) || (Y = "_" + Y), O.attributes.has(this.getUID(te))) { G[Y] = O.attributes.get(this.getUID(te)); continue; } ne = null; var $ = te.array; Y !== "JOINTS_0" || $ instanceof Uint16Array || $ instanceof Uint8Array || (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), ne = new l.BufferAttribute(new Uint16Array($), te.itemSize, te.normalized)); var J = this.processAccessor(ne || te, ie); J !== null && (G[Y] = J, O.attributes.set(this.getUID(te), J)); } if (ee !== void 0 && ie.setAttribute("normal", ee), Object.keys(G).length === 0) return null; if (b.morphTargetInfluences !== void 0 && 0 < b.morphTargetInfluences.length) { var z = [], V = [], oe = {}; if (b.morphTargetDictionary !== void 0) for (var ue in b.morphTargetDictionary) oe[b.morphTargetDictionary[ue]] = ue; for (var le = 0; le < b.morphTargetInfluences.length; ++le) { var ve = {}, xe = !1; for (var Te in ie.morphAttributes) { if (Te != "position" && Te !== "normal" && Te !== "color") { xe || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), xe = !0); continue; } var de = ie.morphAttributes[Te][le], we = Te.toUpperCase(); Q[Te] && (we = Q[Te]); var se = ie.attributes[Te]; if (O.attributes.has(this.getUID(de))) { ve[we] = O.attributes.get(this.getUID(de)); continue; } var Se = se.clone(); if (!ie.morphTargetsRelative) if (se) for (var ge = 0, be = de.count; ge < be; ge++) se.count > ge && Se.setXYZ(ge, de.getX(ge) - se.getX(ge), de.getY(ge) - se.getY(ge), de.getZ(ge) - se.getZ(ge)); else for (var Ie = 0, et = de.count; Ie < et; Ie++) Se.setXYZ(Ie, 0, 0, 0); ve[we] = this.processAccessor(Se, ie), O.attributes.set(this.getUID(se), ve[we]); } q.push(ve), z.push(b.morphTargetInfluences[le]), b.morphTargetDictionary !== void 0 && V.push(oe[le]); } j.weights = z, 0 < V.length && (j.extras = {}, j.extras.targetNames = V); } var mt = Array.isArray(b.material); if (mt && ie.groups.length === 0) return null; for (var Ue, bt = mt ? b.material : [b.material], Ve = mt ? ie.groups : [{ materialIndex: 0, start: void 0, count: void 0 }], lt = 0, tt = Ve.length; lt < tt; lt++) { if (Ue = { mode: K, attributes: G }, this.serializeUserData(ie, Ue), 0 < q.length && (Ue.targets = q), ie.index !== null) { var xt = this.getUID(ie.index); (Ve[lt].start !== void 0 || Ve[lt].count !== void 0) && (xt += ":" + Ve[lt].start + ":" + Ve[lt].count), O.attributes.has(xt) ? Ue.indices = O.attributes.get(xt) : (Ue.indices = this.processAccessor(ie.index, ie, Ve[lt].start, Ve[lt].count), O.attributes.set(xt, Ue.indices)), Ue.indices === null && delete Ue.indices; } var pt = this.processMaterial(bt[Ve[lt].materialIndex]); pt !== null && (Ue.material = pt), W.push(Ue); } j.primitives = W, N.meshes || (N.meshes = []), this._invokeAll(function(Nt) { Nt.writeMesh && Nt.writeMesh(b, j); }); var Vt = N.meshes.push(j) - 1; return O.meshes.set(k, Vt), Vt; } /** * Process camera * @param {THREE.Camera} camera Camera to process * @return {Integer} Index of the processed mesh in the "camera" array */ processCamera(b) { var O = this.json; O.cameras || (O.cameras = []); var N = b.isOrthographicCamera, D = { type: N ? "orthographic" : "perspective" }; return N ? D.orthographic = { xmag: 2 * b.right, ymag: 2 * b.top, zfar: 0 >= b.far ? 1e-3 : b.far, znear: 0 > b.near ? 0 : b.near } : D.perspective = { aspectRatio: b.aspect, yfov: l.MathUtils.degToRad(b.fov), zfar: 0 >= b.far ? 1e-3 : b.far, znear: 0 > b.near ? 0 : b.near }, b.name !== "" && (D.name = b.type), O.cameras.push(D) - 1; } /** * Creates glTF animation entry from AnimationClip object. * * Status: * - Only properties listed in PATH_PROPERTIES may be animated. * * @param {THREE.AnimationClip} clip * @param {THREE.Object3D} root * @return {number|null} */ processAnimation(b, O) { var N = this.json, D = this.nodeMap; N.animations || (N.animations = []), b = d.Utils.mergeMorphTargetTracks(b.clone(), O); for (var B = b.tracks, U = [], k = [], K = 0; K < B.length; ++K) { var ie = B[K], j = l.PropertyBinding.parseTrackName(ie.name), G = l.PropertyBinding.findNode(O, j.nodeName), W = g[j.propertyName]; if (j.objectName === "bones" && (G.isSkinnedMesh === !0 ? G = G.skeleton.getBoneByName(j.objectIndex) : G = void 0), !G || !W) return console.warn('THREE.GLTFExporter: Could not export animation track "%s".', ie.name), null; var q = 1, Q = ie.values.length / ie.times.length; W === g.morphTargetInfluences && (Q /= G.morphTargetInfluences.length); var ee = void 0; ie.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (ee = "CUBICSPLINE", Q /= 3) : ie.getInterpolation() === l.InterpolateDiscrete ? ee = "STEP" : ee = "LINEAR", k.push({ input: this.processAccessor(new l.BufferAttribute(ie.times, q)), output: this.processAccessor(new l.BufferAttribute(ie.values, Q)), interpolation: ee }), U.push({ sampler: k.length - 1, target: { node: D.get(G), path: W } }); } return N.animations.push({ name: b.name || "clip_" + N.animations.length, samplers: k, channels: U }), N.animations.length - 1; } /** * @param {THREE.Object3D} object * @return {number|null} */ processSkin(b) { var O = this.json, N = this.nodeMap, D = O.nodes[N.get(b)], B = b.skeleton; if (B === void 0) return null; var U = b.skeleton.bones[0]; if (U === void 0) return null; for (var k = [], K = new Float32Array(16 * B.bones.length), ie = new l.Matrix4(), j = 0; j < B.bones.length; ++j) k.push(N.get(B.bones[j])), ie.copy(B.boneInverses[j]), ie.multiply(b.bindMatrix).toArray(K, 16 * j); O.skins === void 0 && (O.skins = []), O.skins.push({ inverseBindMatrices: this.processAccessor(new l.BufferAttribute(K, 16)), joints: k, skeleton: N.get(U) }); var G = D.skin = O.skins.length - 1; return G; } /** * Process Object3D node * @param {THREE.Object3D} node Object3D to processNode * @return {Integer} Index of the node in the nodes list */ processNode(b) { var O = this.json, N = this.options, D = this.nodeMap; O.nodes || (O.nodes = []); var B = {}; if (N.trs) { var U = b.quaternion.toArray(), k = b.position.toArray(), K = b.scale.toArray(); S(U, [0, 0, 0, 1]) || (B.rotation = U), S(k, [0, 0, 0]) || (B.translation = k), S(K, [1, 1, 1]) || (B.scale = K); } else b.matrixAutoUpdate && b.updateMatrix(), M(b.matrix) === !1 && (B.matrix = b.matrix.elements); if (b.name !== "" && (B.name = b.name + ""), this.serializeUserData(b, B), b.isMesh || b.isLine || b.isPoints) { var ie = this.processMesh(b); ie !== null && (B.mesh = ie); } else b.isCamera && (B.camera = this.processCamera(b)); if (b.isSkinnedMesh && this.skins.push(b), 0 < b.children.length) { for (var j, G = [], W = 0, q = b.children.length; W < q; W++) if (j = b.children[W], j.visible || N.onlyVisible === !1) { var Q = this.processNode(j); Q !== null && G.push(Q); } 0 < G.length && (B.children = G); } this._invokeAll(function(ne) { ne.writeNode && ne.writeNode(b, B); }); var ee = O.nodes.push(B) - 1; return D.set(b, ee), ee; } /** * Process Scene * @param {Scene} node Scene to process */ processScene(b) { var O = this.json, N = this.options; O.scenes || (O.scenes = [], O.scene = 0); var D = {}; b.name !== "" && (D.name = b.name), O.scenes.push(D); for (var B, U = [], k = 0, K = b.children.length; k < K; k++) if (B = b.children[k], B.visible || N.onlyVisible === !1) { var ie = this.processNode(B); ie !== null && U.push(ie); } 0 < U.length && (D.nodes = U), this.serializeUserData(b, D); } /** * Creates a Scene to hold a list of objects and parse it * @param {Array} objects List of objects to process */ processObjects(b) { var O = new l.Scene(); O.name = "AuxScene"; for (var N = 0; N < b.length; N++) O.children.push(b[N]); this.processScene(O); } /** * @param {THREE.Object3D|Array} input */ processInput(b) { var O = this.options; b = b instanceof Array ? b : [b], this._invokeAll(function(k) { k.beforeParse && k.beforeParse(b); }); for (var N = [], D = 0; D < b.length; D++) b[D] instanceof l.Scene ? this.processScene(b[D]) : N.push(b[D]); 0 < N.length && this.processObjects(N); for (var B = 0; B < this.skins.length; ++B) this.processSkin(this.skins[B]); for (var U = 0; U < O.animations.length; ++U) this.processAnimation(O.animations[U].clip, O.animations[U].mesh); this._invokeAll(function(k) { k.afterParse && k.afterParse(b); }); } _invokeAll(b) { for (var O = 0, N = this.plugins.length; O < N; O++) b(this.plugins[O]); } } class C { constructor(b) { this.writer = b, this.name = "KHR_lights_punctual"; } writeNode(b, O) { if (b.isLight) { if (!b.isDirectionalLight && !b.isPointLight && !b.isSpotLight) return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.", b); var N = this.writer, D = N.json, B = N.extensionsUsed, U = {}; b.name && (U.name = b.name), U.color = b.color.toArray(), U.intensity = b.intensity, b.isDirectionalLight ? U.type = "directional" : b.isPointLight ? (U.type = "point", 0 < b.distance && (U.range = b.distance)) : b.isSpotLight && (U.type = "spot", 0 < b.distance && (U.range = b.distance), U.spot = {}, U.spot.innerConeAngle = -1 * ((b.penumbra - 1) * b.angle), U.spot.outerConeAngle = b.angle), b.decay !== void 0 && b.decay !== 2 && console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."), b.target && (b.target.parent !== b || b.target.position.x !== 0 || b.target.position.y !== 0 || b.target.position.z !== -1) && console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."), B[this.name] || (D.extensions = D.extensions || {}, D.extensions[this.name] = { lights: [] }, B[this.name] = !0); var k = D.extensions[this.name].lights; k.push(U), O.extensions = O.extensions || {}, O.extensions[this.name] = { light: k.length - 1 }; } } } class A { constructor(b) { this.writer = b, this.name = "KHR_materials_unlit"; } writeMaterial(b, O) { if (b.isMeshBasicMaterial) { var N = this.writer, D = N.extensionsUsed; O.extensions = O.extensions || {}, O.extensions[this.name] = {}, D[this.name] = !0, O.pbrMetallicRoughness.metallicFactor = 0, O.pbrMetallicRoughness.roughnessFactor = 0.9; } } } class P { constructor(b) { this.writer = b, this.name = "KHR_materials_pbrSpecularGlossiness"; } writeMaterial(b, O) { if (b.isGLTFSpecularGlossinessMaterial) { var N = this.writer, D = N.extensionsUsed, B = {}; O.pbrMetallicRoughness.baseColorFactor && (B.diffuseFactor = O.pbrMetallicRoughness.baseColorFactor); var U = [1, 1, 1]; if (b.specular.toArray(U, 0), B.specularFactor = U, B.glossinessFactor = b.glossiness, O.pbrMetallicRoughness.baseColorTexture && (B.diffuseTexture = O.pbrMetallicRoughness.baseColorTexture), b.specularMap) { var k = { index: N.processTexture(b.specularMap) }; N.applyTextureTransform(k, b.specularMap), B.specularGlossinessTexture = k; } O.extensions = O.extensions || {}, O.extensions[this.name] = B, D[this.name] = !0; } } } d.Utils = { insertKeyframe: function(b, O) { var N, D = 1e-3, B = b.getValueSize(), U = new b.TimeBufferType(b.times.length + 1), k = new b.ValueBufferType(b.values.length + B), K = b.createInterpolant(new b.ValueBufferType(B)); if (b.times.length === 0) { U[0] = O; for (var ie = 0; ie < B; ie++) k[ie] = 0; N = 0; } else if (O < b.times[0]) { if (Math.abs(b.times[0] - O) < D) return 0; U[0] = O, U.set(b.times, 1), k.set(K.evaluate(O), 0), k.set(b.values, B), N = 0; } else if (O > b.times[b.times.length - 1]) { if (Math.abs(b.times[b.times.length - 1] - O) < D) return b.times.length - 1; U[U.length - 1] = O, U.set(b.times, 0), k.set(b.values, 0), k.set(K.evaluate(O), b.values.length), N = U.length - 1; } else for (var j = 0; j < b.times.length; j++) { if (Math.abs(b.times[j] - O) < D) return j; if (b.times[j] < O && b.times[j + 1] > O) { U.set(b.times.slice(0, j + 1), 0), U[j + 1] = O, U.set(b.times.slice(j + 1), j + 2), k.set(b.values.slice(0, (j + 1) * B), 0), k.set(K.evaluate(O), (j + 1) * B), k.set(b.values.slice((j + 1) * B), (j + 2) * B), N = j + 1; break; } } return b.times = U, b.values = k, N; }, mergeMorphTargetTracks: function(b, O) { for (var N = [], D = {}, B = b.tracks, U = 0; U < B.length; ++U) { var k = B[U], K = l.PropertyBinding.parseTrackName(k.name), ie = l.PropertyBinding.findNode(O, K.nodeName); if (K.propertyName !== "morphTargetInfluences" || K.propertyIndex === void 0) { N.push(k); continue; } if (k.createInterpolant !== k.InterpolantFactoryMethodDiscrete && k.createInterpolant !== k.InterpolantFactoryMethodLinear) { if (k.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation."); console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), k = k.clone(), k.setInterpolation(l.InterpolateLinear); } var j = ie.morphTargetInfluences.length, G = ie.morphTargetDictionary[K.propertyIndex]; if (G === void 0) throw new Error("THREE.GLTFExporter: Morph target name not found: " + K.propertyIndex); var W = void 0; if (D[ie.uuid] === void 0) { W = k.clone(); for (var q = new W.ValueBufferType(j * W.times.length), Q = 0; Q < W.times.length; Q++) q[Q * j + G] = W.values[Q]; W.name = (K.nodeName || "") + ".morphTargetInfluences", W.values = q, D[ie.uuid] = W, N.push(W); continue; } var ee = k.createInterpolant(new k.ValueBufferType(1)); W = D[ie.uuid]; for (var ne = 0; ne < W.times.length; ne++) W.values[ne * j + G] = ee.evaluate(W.times[ne]); for (var Y, te = 0; te < k.times.length; te++) Y = this.insertKeyframe(W, k.times[te]), W.values[Y * j + G] = k.values[te]; } return b.tracks = N, b; } }; }, /* 43 */ /***/ (o, a, c) => { var l = c(4), d = c(5).resolveURL, h = function() { this.nearPlane = 0.168248, this.farPlane = 6.82906, this.eyePosition = [0.5, -2.86496, 0.5], this.targetPosition = [0.5, 0.5, 0.5], this.upVector = [0, 0, 1]; var T = this; this.setFromObject = (M) => { var { nearPlane: x, farPlane: _, eyePosition: E, targetPosition: L, upVector: R } = M; T.nearPlane = x, T.farPlane = _, T.eyePosition = E, T.targetPosition = L, T.upVector = R; }; }, p = function(T, M, x, _) { var E = { NONE: -1, DEFAULT: 0, PATH: 1, SMOOTH_CAMERA_TRANSITION: 2, AUTO_TUMBLE: 3, ROTATE_TRANSITION: 4, MINIMAP: 5, SYNC_CONTROL: 6 }, L = { NONE: -1, ROTATE: 0, ZOOM: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_ZOOM: 4, TOUCH_PAN: 5, SCROLL: 6 }, R = { NONE: -1, FREE: 1, HORIZONTAL: 2, VERTICAL: 3 }, C = {}; C.MAIN = L.ROTATE, C.AUXILIARY = L.ZOOM, C.SECONDARY = L.PAN, this.cameraObject = T, this.domElement = M === void 0 ? document : M, this.renderer = x, this.scene = _, this.tumble_rate = 1.5, this.pointer_x = 0, this.pointer_y = 0, this.pointer_x_start = 0, this.pointer_y_start = 0, this.previous_pointer_x = 0, this.previous_pointer_y = 0, this.near_plane_fly_debt = 0, this.touchZoomDistanceStart = 0, this.touchZoomDistanceEnd = 0, this.directionalLight = 0, this.scrollRate = 50, this.pixelHeight = 1; var A = 6e3, P = !0, I = 0, b = void 0, O = void 0, N = !1, D = 500, B = void 0, U = "default", k = E.DEFAULT, K = void 0, ie = void 0, j = void 0, G = 0, W = R.FREE; this._state = L.NONE; var q; this.targetTouchId = -1; var Q = void 0, ee = new l.Vector3(), ne = new l.Vector3(), Y = new l.Vector3(), te = new l.Vector3(), F = new l.Vector3(), $ = new l.Vector3(), J = new l.Vector3(), z = new l.Vector3(), V = new l.Sphere(), oe = new l.Vector3(), ue = !1, le = void 0, ve = 0, xe = { default: new h() }; xe.default.nearPlane = 0.1, xe.default.farPlane = 2e3, xe.default.eyePosition = [0, 0, 0], xe.default.targetPosition = [0, 0, -1], xe.default.upVector = [0, 1, 0], this.cameraObject.target === void 0 && (this.cameraObject.target = new l.Vector3(...xe.default.targetPosition)), this.calculateMaxAllowedDistance = (re) => { var Ee = re.getBoundingBox(); if (Ee) { Ee.getBoundingSphere(V), ve = 6 * V.radius; var Ne = 0; this.cameraObject && (Ne = this.cameraObject.position.distanceTo(V.center)), ve = Ne > ve ? Ne : ve; } else ve = 0; }, this.addViewport = (re, Ee) => { re && Ee && (xe[re] = Ee); }, this.setDefaultViewport = (re) => !!(re && re in xe) && (U = re, !0), this.getDefaultViewport = () => U, this.getViewportOfName = (re) => xe[re], this.setCurrentViewport = (re) => re in xe && (this.setCurrentCameraSettings(xe[re]), !0), this.setRotationMode = (re) => { switch (re) { case "none": W = R.NONE; break; case "horizontal": W = R.HORIZONTAL; break; case "vertical": W = R.VERTICAL; break; case "free": default: W = R.FREE; } }, this.onResize = () => { Q && (Q = void 0), le && le.setCurrentCameraSettings(this.cameraObject, xe[U]); }, this.getVisibleHeightAtZDepth = (re) => { var Ee = this.cameraObject.position.distanceTo(this.cameraObject.target); re < Ee ? re -= Ee : re += Ee; var Ne = this.cameraObject.fov * Math.PI / 180; return 2 * Math.tan(Ne / 2) * Math.abs(re); }, this.calculateHeightPerPixelAtZeroDepth = (re) => { var Ee = this.getVisibleHeightAtZDepth(0); return this.pixelHeight = Ee / re, this.pixelHeight; }, this.getNDCFromDocumentCoords = (re, Ee, Ne) => { Ue(!1); var je = Ne || new l.Vector2(), rt = 2 * ((re - Q.left) / Q.width) - 1, gt = 2 * -((Ee - Q.top) / Q.height) + 1; return je.set(rt, gt); }, this.getRelativeCoordsFromNDC = (re, Ee, Ne) => { Ue(!1); var je = Ne || new l.Vector2(); return je.x = (re + 1) * Q.width / 2, je.y = (1 - Ee) * Q.height / 2, je; }, this.setMouseButtonAction = (re, Ee) => { C[re] = L[Ee]; }; var Te = () => { if (0 < ve) { var re = oe.distanceTo(V.center); return ve > re || this.cameraObject.position.distanceTo(V.center) > re; } return !0; }, de = (re) => { oe.copy(this.cameraObject.position).add(re), Te() && (this.cameraObject.target.add(re), this.cameraObject.position.add(re), this.updateDirectionalLight()); }, we = (re) => { Ue(!1); var Ee; if (k === E.DEFAULT && (Ee = this.scene.getNormalisedMinimapCoordinates(this.renderer, re)), !Ee) re.button == 0 ? re.ctrlKey ? this._state = C.AUXILIARY : re.shiftKey ? this._state = C.SECONDARY : this._state = C.MAIN : re.button == 1 ? (re.preventDefault(), this._state = C.AUXILIARY) : re.button == 2 && (this._state = C.SECONDARY), this.pointer_x = re.clientX - Q.left, this.pointer_y = re.clientY - Q.top, this.pointer_x_start = this.pointer_x, this.pointer_y_start = this.pointer_y, this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y; else { k = E.MINIMAP; var Ne = this.scene.getMinimapDiffFromNormalised(Ee.x, Ee.y); de(Ne); } }, se = (re) => { if (Ue(!1), Q) if (this.pointer_x = re.clientX - Q.left, this.pointer_y = re.clientY - Q.top, k === E.MINIMAP) { var Ee = this.scene.getNormalisedMinimapCoordinates(this.renderer, re); if (Ee) { var Ne = this.scene.getMinimapDiffFromNormalised(Ee.x, Ee.y); de(Ne); } } else this._state === L.NONE && q !== void 0 && q.move(this, re.clientX, re.clientY, this.renderer); }, Se = (re) => { this._state = L.NONE, k == E.MINIMAP && (k = E.DEFAULT), q !== void 0 && this.pointer_x_start == re.clientX - Q.left && this.pointer_y_start == re.clientY - Q.top && q.pick(this, re.clientX, re.clientY, this.renderer); }, ge = (re) => { this._state = L.NONE; }, be = (re) => { Ue(!1); var Ee = re.touches.length; if (Ee == 1) this._state = L.TOUCH_ROTATE, this.pointer_x = re.touches[0].clientX - Q.left, this.pointer_y = re.touches[0].clientY - Q.top, this.pointer_x_start = this.pointer_x, this.pointer_y_start = this.pointer_y, this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y; else if (Ee == 2) { this._state = L.TOUCH_ZOOM; var Ne = re.touches[0].clientX - re.touches[1].clientX, je = re.touches[0].clientY - re.touches[1].clientY; this.touchZoomDistanceEnd = this.touchZoomDistanceStart = Math.sqrt(Ne * Ne + je * je); } else Ee == 3 && (this._state = L.TOUCH_PAN, this.targetTouchId = re.touches[0].identifier, this.pointer_x = re.touches[0].clientX - Q.left, this.pointer_y = re.touches[0].clientY - Q.top, this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y); }, Ie = (re) => { re.preventDefault(), re.stopPropagation(); var Ee = re.touches.length; if (Ee == 1) this.pointer_x = re.touches[0].clientX - Q.left, this.pointer_y = re.touches[0].clientY - Q.top; else if (Ee == 2) { if (this._state === L.TOUCH_ZOOM) { var Ne = re.touches[0].clientX - re.touches[1].clientX, je = re.touches[0].clientY - re.touches[1].clientY; this.touchZoomDistanceEnd = Math.sqrt(Ne * Ne + je * je); } } else if (Ee == 3 && this._state === L.TOUCH_PAN) for (var rt = 0; 3 > rt; rt++) re.touches[rt].identifier == this.targetTouchId && (this.pointer_x = re.touches[0].clientX - Q.left, this.pointer_y = re.touches[0].clientY - Q.top); }, et = (re) => { var Ee = re.touches.length; this.touchZoomDistanceStart = this.touchZoomDistanceEnd = 0, this.targetTouchId = -1, this._state = L.NONE, Ee == 1 && q !== void 0 && this.pointer_x_start == re.touches[0].clientX - Q.left && this.pointer_y_start == re.touches[0].clientY - Q.top && q.pick(this.cameraObject, re.touches[0].clientX, re.touches[0].clientY, this.renderer); }, mt = () => { Ue(!0); }, Ue = (re) => { if (re || Q === void 0) { var Ee = new IntersectionObserver((Ne) => { for (var je of Ne) Q = je.boundingClientRect; Ee.disconnect(); }); Ee.observe(this.domElement); } }, bt = (re) => { Ue(!1), this._state = L.SCROLL; var Ee = 0; 0 < re.deltaY ? Ee = this.scrollRate : 0 > re.deltaY && (Ee = -1 * this.scrollRate), G += Ee, re.preventDefault(), re.stopImmediatePropagation(); }, Ve = () => { if (typeof this.cameraObject < "u") { var re = Q.height, Ee = this.cameraObject.position.distanceTo(this.cameraObject.target), Ne = 0; this.cameraObject.far > this.cameraObject.near && Ee >= this.cameraObject.near && Ee <= this.cameraObject.far && (Ne = (Ee - this.cameraObject.near) / (this.cameraObject.far - this.cameraObject.near)), ne.set(this.previous_pointer_x, re - this.previous_pointer_y, 0), Y.set(this.previous_pointer_x, re - this.previous_pointer_y, 1), te.set(this.pointer_x, re - this.pointer_y, 0), F.set(this.pointer_x, re - this.pointer_y, 1), ne.unproject(this.cameraObject), Y.unproject(this.cameraObject), te.unproject(this.cameraObject), F.unproject(this.cameraObject); var je = -2e-3; te.sub(ne).multiplyScalar(1 - Ne), F.sub(Y).multiplyScalar(Ne), te.add(F).multiplyScalar(je), de(te); } this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y; }; this.getVectorsFromRotateAboutLookAtPoints = (re, Ee) => { re.normalize(), J.copy(this.cameraObject.position).sub(this.cameraObject.target), z.copy(J), J.normalize(), 0.8 < Math.abs(J.dot(re)) && J.copy(this.cameraObject.up), ne.crossVectors(re, J).normalize(), Y.crossVectors(re, ne); var Ne = re.dot(z), je = ne.dot(z), rt = Y.dot(z), gt = re.dot(this.cameraObject.up), Tt = ne.dot(this.cameraObject.up), Lt = Y.dot(this.cameraObject.up), kt = Math.cos(Ee), Z = Math.sin(Ee); return te.set(kt * ne.x + Z * Y.x, kt * ne.y + Z * Y.y, kt * ne.z + Z * Y.z), F.set(kt * Y.x - Z * ne.x, kt * Y.y - Z * ne.y, kt * Y.z - Z * ne.z), J.copy(this.cameraObject.target), J.x = J.x + re.x * Ne + te.x * je + F.x * rt, J.y = J.y + re.y * Ne + te.y * je + F.y * rt, J.z = J.z + re.z * Ne + te.z * je + F.z * rt, ee.set(re.x * gt + te.x * Tt + F.x * Lt, re.y * gt + te.y * Tt + F.y * Lt, re.z * gt + te.z * Tt + F.z * Lt), { position: J, up: ee }; }, this.rotateAboutLookAtpoint = (re, Ee) => { var Ne = this.getVectorsFromRotateAboutLookAtPoints(re, Ee); this.cameraObject.position.copy(Ne.position), this.updateDirectionalLight(), this.cameraObject.up.copy(Ne.up); }; var lt = () => { if (typeof this.cameraObject < "u") { var re = Q.width, Ee = Q.height; if (0 < re && 0 < Ee) { var Ne = 0.25 * (re + Ee), je = 0, rt = 0; (W === R.FREE || W === R.HORIZONTAL) && (je = this.pointer_x - this.previous_pointer_x), (W === R.FREE || W === R.VERTICAL) && (rt = this.previous_pointer_y - this.pointer_y); var gt = Math.sqrt(je * je + rt * rt); if (0 < gt) { var Tt = 1 * -rt / gt, Lt = 1 * je / gt, kt = 0; W === R.FREE && Tt * (this.pointer_x - 0.5 * (re - 1)) + Lt * (0.5 * (Ee - 1) - this.pointer_y); var Z = Math.acos(kt / Ne) - 0.5 * Math.PI, ye = this.tumble_rate * gt / Ne; ee.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(), ne.copy(this.cameraObject.up).normalize(), Y.copy(ne).cross(ee).normalize().multiplyScalar(Tt), ne.multiplyScalar(Lt), $.addVectors(Y, ne).multiplyScalar(Math.cos(Z)), ee.multiplyScalar(Math.sin(Z)), $.add(ee), this.rotateAboutLookAtpoint($, -ye); } } } this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y; }, tt = () => { var re = 0; return this._state === L.ZOOM ? re = this.previous_pointer_y - this.pointer_y : this._state === L.SCROLL ? re = G : (re = -1 * (this.touchZoomDistanceEnd - this.touchZoomDistanceStart), this.touchZoomDistanceStart = this.touchZoomDistanceEnd), re; }; this.changeZoomByScrollRateUnit = (re) => { var Ee = re * this.scrollRate; this.changeZoomByValue(Ee); }, this.changeZoomByValue = (re) => { if (typeof this.cameraObject < "u") { var Ee = Q.height, Ne = this.cameraObject.position.clone(); Ne.sub(this.cameraObject.target); var je = Ne.length(), rt = 1.5 * re / Ee; if (0.01 < je + rt * je && (Ne.normalize(), oe.copy(this.cameraObject.position), oe.x += Ne.x * rt * je, oe.y += Ne.y * rt * je, oe.z += Ne.z * rt * je, Te())) { this.cameraObject.position.copy(oe), this.updateDirectionalLight(); var gt = 1e-5; if (gt * this.cameraObject.far < this.cameraObject.near + rt * je + this.near_plane_fly_debt) this.near_plane_fly_debt != 0 && (this.near_plane_fly_debt += rt * je, 0 < this.near_plane_fly_debt ? (this.cameraObject.near += this.near_plane_fly_debt, this.cameraObject.far += this.near_plane_fly_debt, this.near_plane_fly_debt = 0) : (this.cameraObject.near += rt * je, this.cameraObject.far += rt * je)); else { if (this.near_plane_fly_debt == 0) { var Tt = this.cameraObject.near - gt * this.cameraObject.far; this.cameraObject.near = gt * this.cameraObject.far, this.cameraObject.far -= Tt, this.near_plane_fly_debt -= gt * this.cameraObject.far; } this.near_plane_fly_debt += rt * je; } ue = !0; } } }; var xt = () => { var re = tt(); this.changeZoomByValue(re), this._state === L.ZOOM && (this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y), this._state === L.SCROLL && (G = 0, this._state = L.NONE); }; this.setDirectionalLight = (re) => { this.directionalLight = re; }, this.updateDirectionalLight = () => { this.directionalLight != 0 && this.directionalLight.position.set(this.cameraObject.position.x, this.cameraObject.position.y, this.cameraObject.position.z); }, this.enable = function() { P = !0, this.domElement && this.domElement.addEventListener && (this.domElement.addEventListener("mousedown", we, !1), this.domElement.addEventListener("mousemove", se, !1), this.domElement.addEventListener("mouseup", Se, !1), this.domElement.addEventListener("mouseleave", ge, !1), this.domElement.addEventListener("touchstart", be, !1), this.domElement.addEventListener("touchmove", Ie, !1), this.domElement.addEventListener("touchend", et, !1), this.domElement.addEventListener("wheel", bt, !1), this.domElement.addEventListener("contextmenu", (re) => { re.preventDefault(); }, !1), this.domElement.addEventListener("mouseenter", mt, !1)); }, this.disable = function() { P = !1, this.domElement && this.domElement.removeEventListener && (this.domElement.removeEventListener("mousedown", we, !1), this.domElement.removeEventListener("mousemove", se, !1), this.domElement.removeEventListener("mouseup", Se, !1), this.domElement.removeEventListener("mouseleave", ge, !1), this.domElement.removeEventListener("touchstart", be, !1), this.domElement.removeEventListener("touchmove", Ie, !1), this.domElement.removeEventListener("touchend", et, !1), this.domElement.removeEventListener("wheel", bt, !1), this.domElement.removeEventListener("mouseenter", mt, !1), this.domElement.removeEventListener("contextmenu", (re) => { re.preventDefault(); }, !1)); }, this.loadPath = (re) => { b = re.CameraPath, O = re.NumberOfPoints; }, this.loadPathURL = (re, Ee) => { var Ne = new XMLHttpRequest(); Ne.onreadystatechange = () => { if (Ne.readyState == 4 && Ne.status == 200) { var rt = JSON.parse(Ne.responseText); this.loadPath(rt), Ee != null && typeof Ee == "function" && Ee(); } }; var je = d(re); Ne.open("GET", je, !0), Ne.send(); }, this.setPathDuration = (re) => { A = re, K && K.setDuration(A), ie && ie.setDuration(A); }, this.getPlayRate = () => D, this.setPlayRate = (re) => { D = re; }; var pt = (re) => { var Ee = I + re; Ee > A && (Ee -= A), I = Ee; }; this.getTime = () => I, this.setTime = (re) => { I = re > A ? A : 0 > re ? 0 : re; }, this.getNumberOfTimeFrame = () => O, this.getCurrentTimeFrame = () => { if (2 < O) { var re = I / A * (O - 1), Ee = Math.floor(re), Ne = 1 - (re - Ee), je = Math.ceil(re); return Ee == je ? Ee == O - 1 ? [Ee - 1, je, 0] : [Ee, je + 1, 1] : [Ee, je, Ne]; } return O == 1 ? [0, 0, 0] : void 0; }, this.setCurrentTimeFrame = (re) => { 2 < O && (I = A * re / (O - 1), 0 > I && (I = 0), I > A && (I = A)); }; var Vt = (re) => { if (k === E.PATH && (pt(re), b)) { for (var Ee = this.getCurrentTimeFrame(), Ne = Ee[0], je = Ee[1], rt = Ee[2], gt = [b[3 * Ne], b[3 * Ne + 1], b[3 * Ne + 2]], Tt = [b[3 * je], b[3 * je + 1], b[3 * je + 2]], Lt = [], kt = 0; kt < gt.length; kt++) Lt.push(rt * gt[kt] + (1 - rt) * Tt[kt]); this.cameraObject.position.set(Lt[0], Lt[1], Lt[2]), this.cameraObject.target.set(Tt[0], Tt[1], Tt[2]), B && this.cameraObject.lookAt(this.cameraObject.target), N && (this.directionalLight.position.set(Lt[0], Lt[1], Lt[2]), this.directionalLight.target.position.set(Tt[0], Tt[1], Tt[2])); } }; this.calculatePathNow = () => { Vt(0); }; var Nt = () => { this._state === L.ROTATE || this._state === L.TOUCH_ROTATE ? lt() : this._state === L.PAN || this._state === L.TOUCH_PAN ? (Ve(), le.triggerCallback()) : (this._state === L.ZOOM || this._state === L.TOUCH_ZOOM || this._state === L.SCROLL) && (le.zoom(tt()), this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y, this._state === L.SCROLL && (this._state = L.NONE), G = 0, le.triggerCallback()); }; this.update = (re) => { var Ee = re * D, Ne = P, je = !0; return k === E.PATH ? Vt(Ee) : k === E.SMOOTH_CAMERA_TRANSITION && K ? (K.update(Ee), K.isTransitionCompleted() && (k = E.DEFAULT), Ne = !1) : k === E.ROTATE_CAMERA_TRANSITION && ie ? (ie.update(Ee), ie.isTransitionCompleted() && (k = E.DEFAULT), Ne = !1) : k === E.AUTO_TUMBLE && j ? j.update(Ee) : k === E.SYNC_CONTROL && le ? (Nt(), Ne = !1) : je = !1, Ne && (this._state !== L.NONE && (je = !0), this._state === L.ROTATE || this._state === L.TOUCH_ROTATE ? lt() : this._state === L.PAN || this._state === L.TOUCH_PAN ? Ve() : (this._state === L.ZOOM || this._state === L.TOUCH_ZOOM || this._state === L.SCROLL) && xt(), this._state !== L.NONE && k === E.AUTO_TUMBLE && j && j.stopOnCameraInput, this._state === L.SCROLL && (this._state = L.NONE)), B ? (je = !0, B.update()) : this.cameraObject.lookAt(this.cameraObject.target), je = je || ue, ue = !1, je; }, this.playPath = () => { k = E.PATH; }, this.stopPath = () => { k = E.DEFAULT; }, this.isPlayingPath = () => k === E.PATH, this.enableDirectionalLightUpdateWithPath = (re) => { N = re; }, this.enableDeviceOrientation = () => { B || (B = new w(this.cameraObject)); }, this.disableDeviceOrientation = () => { B && (B.dispose(), B = void 0); }, this.isDeviceOrientationEnabled = () => !!B, this.resetView = () => { var re = xe[U]; this.cameraObject.near = re.nearPlane, this.cameraObject.far = re.farPlane, this.cameraObject.position.set(re.eyePosition[0], re.eyePosition[1], re.eyePosition[2]), this.cameraObject.target.set(re.targetPosition[0], re.targetPosition[1], re.targetPosition[2]), this.cameraObject.up.set(re.upVector[0], re.upVector[1], re.upVector[2]), this.cameraObject.updateProjectionMatrix(), this.updateDirectionalLight(); }, this.setCurrentCameraSettings = (re) => { re.nearPlane && (this.cameraObject.near = re.nearPlane), re.farPlane && (this.cameraObject.far = re.farPlane), re.eyePosition && this.cameraObject.position.set(re.eyePosition[0], re.eyePosition[1], re.eyePosition[2]), re.targetPosition && this.cameraObject.target.set(re.targetPosition[0], re.targetPosition[1], re.targetPosition[2]), re.upVector && this.cameraObject.up.set(re.upVector[0], re.upVector[1], re.upVector[2]), this.cameraObject.updateProjectionMatrix(), this.updateDirectionalLight(), ue = !0; }, this.getViewportFromCentreAndRadius = (re, Ee, Ne, je, rt, gt) => { var Tt = this.cameraObject.position.x - this.cameraObject.target.x, Lt = this.cameraObject.position.y - this.cameraObject.target.y, kt = this.cameraObject.position.z - this.cameraObject.target.z, Z = 1 / Math.sqrt(Tt * Tt + Lt * Lt + kt * kt); Tt *= Z, Lt *= Z, kt *= Z; var ye = [re, Ee, Ne], me = je / Math.tan(rt * Math.PI / 360), Me = [re + Tt * me, Ee + Lt * me, Ne + kt * me], Oe = me + gt, he = 0, _e = 0.95; he = gt > _e * me ? (1 - _e) * me : me - gt; var Ce = new h(); return Ce.nearPlane = he, Ce.farPlane = Oe, Ce.eyePosition = Me, Ce.targetPosition = ye, Ce.upVector = [this.cameraObject.up.x, this.cameraObject.up.y, this.cameraObject.up.z], Ce; }, this.getViewportFromBoundingBox = (re, Ee) => { var Ne = re.min.distanceTo(re.max) / 2 * Ee, je = (re.min.x + re.max.x) / 2, rt = (re.min.y + re.max.y) / 2, gt = (re.min.z + re.max.z) / 2, Tt = 4, Lt = this.getViewportFromCentreAndRadius(je, rt, gt, Ne, 40, Ne * Tt); return Lt; }, this.getCurrentViewport = () => { var re = new h(); return re.nearPlane = this.cameraObject.near, re.farPlane = this.cameraObject.far, re.eyePosition[0] = this.cameraObject.position.x, re.eyePosition[1] = this.cameraObject.position.y, re.eyePosition[2] = this.cameraObject.position.z, re.targetPosition[0] = this.cameraObject.target.x, re.targetPosition[1] = this.cameraObject.target.y, re.targetPosition[2] = this.cameraObject.target.z, re.upVector[0] = this.cameraObject.up.x, re.upVector[1] = this.cameraObject.up.y, re.upVector[2] = this.cameraObject.up.z, re; }, this.getDefaultEyePosition = () => eyePosition, this.getDefaultTargetPosition = () => targetPosition, this.cameraTransition = (re, Ee, Ne) => { ie == null && (K = new g(re, Ee, this, Ne)); }, this.rotateCameraTransition = (re, Ee, Ne) => { K == null && (ie = new f(re, Ee, this, Ne)); }, this.enableCameraTransition = () => { K && (k = E.SMOOTH_CAMERA_TRANSITION), ie && (k = E.ROTATE_CAMERA_TRANSITION); }, this.pauseCameraTransition = () => { k = E.DEFAULT; }, this.stopCameraTransition = () => { k = E.DEFAULT, K = void 0, ie = void 0; }, this.isTransitioningCamera = () => k === E.SMOOTH_CAMERA_TRANSITION || k === E.ROTATE_CAMERA_TRANSITION, this.autoTumble = (re, Ee, Ne) => { j = new y(re, Ee, Ne, this); }, this.enableAutoTumble = () => { k = E.AUTO_TUMBLE; }, this.stopAutoTumble = () => { k = E.DEFAULT, j = void 0; }, this.updateAutoTumble = () => { j && (j.requireUpdate = !0); }, this.isAutoTumble = () => k === E.AUTO_TUMBLE, this.enableRaycaster = (re, Ee, Ne) => { q == null && (q = new u(re, this.scene, Ee, Ne, this.renderer)); }, this.disableRaycaster = () => { q.disable(), q = void 0; }, this.isSyncControl = () => currentMpde === E.SYNC_CONTROL, this.enableSyncControl = () => (k = E.SYNC_CONTROL, le || (le = new S()), le.setCurrentCameraSettings(this.cameraObject, xe[U]), le), this.disableSyncControl = () => { k = E.DEFAULT, this.cameraObject.zoom = 1, this.cameraObject.updateProjectionMatrix(); }, this.enable(); }, g = function(M, x, _, E) { var L = M.eyePosition, R = M.targetPosition, C = M.upVector, A = x.eyePosition, P = x.targetPosition, I = x.upVector, b = _, O = E, N = 0, D = !1; b.near = Math.min(M.nearPlane, x.nearPlane), b.far = Math.max(M.farPlane, x.farPlane), b.cameraObject.up.set(x.upVector[0], x.upVector[1], x.upVector[2]), this.setDuration = (k) => { O = k; }; var B = (k) => { var K = N + k; K > O && (K = O), N = K; }, U = () => { var k = N / O, K = [L[0] * (1 - k) + A[0] * k, L[1] * (1 - k) + A[1] * k, L[2] * (1 - k) + A[2] * k], ie = [R[0] * (1 - k) + P[0] * k, R[1] * (1 - k) + P[1] * k, R[2] * (1 - k) + P[2] * k]; C[0] * (1 - k) + I[0] * k, C[1] * (1 - k) + I[1] * k, C[2] * (1 - k) + I[2] * k, b.cameraObject.position.set(K[0], K[1], K[2]), b.cameraObject.target.set(ie[0], ie[1], ie[2]); }; this.update = (k) => { this.enabled === !1 || (B(k), U(), N == O && (D = !0)); }, this.isTransitionCompleted = () => D; }, f = function(M, x, _, E) { var L = M, R = x, C = _, A = E, P = 0, I = !1; this.setDuration = (O) => { A = O; }; var b = (O) => { var N = P, D = P + O; D > A && (D = A), P = D; var B = P - N, U = B / A, k = U * R; C.rotateAboutLookAtpoint(L, k); }; this.update = (O) => { this.enabled === !1 || (b(O), P == A && (I = !0)); }, this.isTransitionCompleted = () => I; }, u = function(M, x, _, E, L) { var R = M, C = x, A = L, P = _, I = E, b = new l.Raycaster(); b.params.Line.threshold = 0.1, b.params.Points.threshold = 1; var O = new l.Vector2(), N = !1, D = /* @__PURE__ */ new Date(), B = !1, U = 0, k = [], K = { zincCamera: void 0, x: -1, y: -1 }, ie = void 0; this.enable = () => { enable = !0; }, this.disable = () => { enable = !1; }, this.getIntersectsObject = (W) => { if (C !== R) { var q = R.getThreeJSScene(); A.render(q, W.cameraObject); } var Q = ie || R.getPickableThreeJSObjects(); return k.length = 0, b.intersectObjects(Q, !0, k); }, this.setPickableObjects = (W) => { W === void 0 ? ie = void 0 : (ie = [], W.forEach((q) => { q.getGroup() && q.getGroup().visible && ie.push(q.getGroup()); })); }, this.getIntersectsObjectWithOrigin = (W, q, Q) => (b.set(q, Q), this.getIntersectsObject(W)), this.getIntersectsObjectWithCamera = (W, q, Q) => (W.getNDCFromDocumentCoords(q, Q, O), b.setFromCamera(O, W.cameraObject), this.getIntersectsObject(W)), this.pick = (W, q, Q) => { if (A && R && W && P) { this.getIntersectsObjectWithCamera(W, q, Q); for (var ee, ne = k.length, Y = 0; Y < ne; Y++) if (ee = k[Y].object ? k[Y].object.userData : void 0, ee && ee.isMarkerCluster && ee.visible && ee.clusterIsVisible(k[Y].object.clusterIndex) && ee.zoomToCluster(k[Y].object.clusterIndex)) return; P(k, q, Q); } }; var j = (W, q, Q) => { if (A && R && W && I) { if (this.getIntersectsObjectWithCamera(W, q, Q), D.setTime(Date.now()), k.length === 0) { if (B) return; B = !0; } else B = !1; I(k, q, Q); } }; this.move = (W, q, Q) => { A && R && W && I && (R.displayMarkers ? j(W, q, Q) : (K.zincCamera = W, K.x = q, K.y = Q, !N && (U = D ? Date.now() - D.getTime() : 250, 250 <= U ? j(W, q, Q) : (N = !0, setTimeout(G(K), U))))); }; var G = (W) => function() { N = !1, j(W.zincCamera, W.x, W.y); }; }, y = function(M, x, _, E) { var L = new l.Vector3(), R = -x, C = E, A = M; this.stopOnCameraInput = _, this.requireUpdate = !0; var P = new l.Vector3(), I = new l.Vector3(), b = (O) => { var N = Math.sqrt(O[0] * O[0] + O[1] * O[1]), D = 4 * Math.abs(O[0]), B = 4 * Math.abs(O[1]), U = 0.25 * (D + B), k = -O[1] / N, K = O[0] / N, ie = k * O[0] + K * -O[1]; ie > U ? ie = U : ie < -U && (ie = -U); var j = Math.acos(ie / U) - 0.5 * Math.PI; L.copy(C.cameraObject.position).sub(C.cameraObject.target).normalize(), P.copy(C.cameraObject.up).normalize(), I.crossVectors(P, L).normalize().multiplyScalar(k), P.multiplyScalar(K), P.add(I).multiplyScalar(Math.cos(j)), L.multiplyScalar(Math.sin(j)).add(P); }; this.update = (O) => { this.enabled === !1 || (this.requireUpdate && (b(A), this.requireUpdate = !1), C.rotateAboutLookAtpoint(L, R * O / 1e3)); }; }, v = function() { this.type = "StereoCamera", this.aspect = 1, this.cameraL = new l.PerspectiveCamera(), this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new l.PerspectiveCamera(), this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = !1; }; Object.assign(v.prototype, { update: (() => { var T, M, x, _, E, L, R = new l.Matrix4(), C = new l.Matrix4(); return function(P) { var I = T !== P.focus || M !== P.fov || x !== P.aspect * this.aspect || _ !== P.near || E !== P.far || L !== P.zoom; if (I) { T = P.focus, M = P.fov, x = P.aspect * this.aspect, _ = P.near, E = P.far, L = P.zoom; var b, O, N = P.projectionMatrix.clone(), D = 0.064 / 2, B = D * _ / T, U = _ * Math.tan(0.5 * (l.Math.DEG2RAD * M)) / P.zoom; C.elements[12] = -D, R.elements[12] = D, b = -U * x + B, O = U * x + B, N.elements[0] = 2 * _ / (O - b), N.elements[8] = (O + b) / (O - b), this.cameraL.projectionMatrix.copy(N), b = -U * x - B, O = U * x - B, N.elements[0] = 2 * _ / (O - b), N.elements[8] = (O + b) / (O - b), this.cameraR.projectionMatrix.copy(N); } this.cameraL.matrixWorld.copy(P.matrixWorld).multiply(C), this.cameraR.matrixWorld.copy(P.matrixWorld).multiply(R); }; })() }); var m = function(M) { var x = new v(); x.aspect = 0.5, this.setSize = (_, E) => { M.setSize(_, E); }, this.render = (_, E) => { _.updateMatrixWorld(), E.parent === null && E.updateMatrixWorld(), x.update(E); var L = M.getSize(); M.setScissorTest(!0), M.clear(), M.setScissor(0, 0, L.width / 2, L.height), M.setViewport(0, 0, L.width / 2, L.height), M.render(_, x.cameraL), M.setScissor(L.width / 2, 0, L.width / 2, L.height), M.setViewport(L.width / 2, 0, L.width / 2, L.height), M.render(_, x.cameraR), M.setScissorTest(!1); }; }, w = function(M) { var x = this; this.object = M, this.object.rotation.reorder("YXZ"), this.enabled = !0, this.deviceOrientation = {}, this.screenOrientation = 0; var _ = (R) => { x.deviceOrientation = R; }, E = () => { typeof window < "u" && (x.screenOrientation = window.orientation || 0); }, L = (() => { var R = new l.Vector3(0, 0, 1), C = new l.Euler(), A = new l.Quaternion(), P = new l.Quaternion(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5)); return (I, b, O, N, D) => { var B = new l.Vector3(0, 0, 1); B.subVectors(I.target, I.position), C.set(O, b, -N, "YXZ"); var U = new l.Quaternion(); U.setFromEuler(C), U.multiply(P), U.multiply(A.setFromAxisAngle(R, -D)), B.applyQuaternion(U), B.addVectors(I.position, B), I.lookAt(B); }; })(); this.connect = () => { E(), typeof window < "u" && (window.addEventListener("orientationchange", E, !1), window.addEventListener("deviceorientation", _, !1)), x.enabled = !0; }, this.disconnect = () => { typeof window < "u" && (window.removeEventListener("orientationchange", E, !1), window.removeEventListener("deviceorientation", _, !1)), x.enabled = !1; }, this.update = () => { if (x.enabled !== !1) { var R = x.deviceOrientation.alpha ? l.Math.degToRad(x.deviceOrientation.alpha) : 0, C = x.deviceOrientation.beta ? l.Math.degToRad(x.deviceOrientation.beta) : 0, A = x.deviceOrientation.gamma ? l.Math.degToRad(x.deviceOrientation.gamma) : 0, P = x.screenOrientation ? l.Math.degToRad(x.screenOrientation) : 0; L(x.object, R, C, A, P); } }, this.dispose = function() { this.disconnect(); }, this.connect(); }, S = function() { var M = void 0, x = void 0, _ = void 0, E = new l.Vector3(), L = new l.Vector3(), R = new l.Vector3(), C = new l.Vector3(), A = void 0; this.setCurrentCameraSettings = (P, I) => { M = P.clone(), x = P, _ = I, M.near = _.nearPlane, _.farPlane && (M.far = _.farPlane), _.eyePosition && M.position.set(_.eyePosition[0], _.eyePosition[1], _.eyePosition[2]), _.upVector && M.up.set(_.upVector[0], _.upVector[1], _.upVector[2]), _.targetPosition && (M.target = new l.Vector3(_.targetPosition[0], _.targetPosition[1], _.targetPosition[2]), M.lookAt(M.target)), M.updateProjectionMatrix(), E.copy(M.position).project(M), L.copy(M.target).project(M); }, this.getCurrentPosition = () => (L.copy(x.target).project(M), [L.x, L.y]), this.zoom = (P) => { var I = 2e-3 * P, b = Math.max(x.zoom - I, 1); x.zoom = b, x.updateProjectionMatrix(); }, this.zoomToBox = (P, I) => { P.getCenter(R), R.project(M), this.setCenterZoom([R.x, R.y], I); }, this.getPanZoom = () => ({ target: this.getCurrentPosition(), zoom: x.zoom }), this.setCenterZoom = (P, I) => { R.set(P[0], P[1], L.z).unproject(M), C.copy(R).sub(x.target), x.target.copy(R), x.lookAt(x.target), x.position.add(C), x.zoom = I, x.updateProjectionMatrix(); }, this.setEventCallback = (P) => { (P === void 0 || typeof P == "function") && (A = P); }, this.triggerCallback = () => { A !== void 0 && typeof A == "function" && A(); }; }; a.Viewport = h, a.CameraControls = p, a.SmoothCameraTransition = g, a.RotateCameraTransition = f, a.RayCaster = u, a.CameraAutoTumble = y, a.StereoEffect = m, a.NDCCameraControl = S; }, /* 44 */ /***/ (o, a, c) => { var { Group: l, Matrix4: d } = c(4), h = c(22).Pointset; c(24).Lines; var p = c(45).Lines2, g = c(3).Geometry, f = c(4), u = 0, y = function() { return "re" + u++; }, v = function(m, w) { var S = m, T = new l(); T.matrixAutoUpdate = !1, T.userData = this; var M = [], x = "", _ = [], E = w, L = new d(), R = 3e3; L.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this.pickableUpdateRequired = !0, this.isRegion = !0, this.uuid = y(), this.hideAllPrimitives = () => { M.forEach((C) => C.hideAllPrimitives()), _.forEach((C) => C.setVisibility(!1)); }, this.showAllPrimitives = () => { M.forEach((C) => C.showAllPrimitives()), _.forEach((C) => C.setVisibility(!0)); }, this.setVisibility = (C) => { C != T.visible && (T.visible = C, this.pickableUpdateRequired = !0); }, this.getVisibility = () => T.visible, this.getGroup = () => T, this.setTransformation = (C) => { L.set(...C), T.matrix.copy(L), T.updateMatrixWorld(); }, this.setName = (C) => { C && C !== "" && (x = C); }, this.getName = () => x, this.getParent = () => S, this.getFullSeparatedPath = () => { var C = []; if (x !== "") { C.push(x); for (var A, P = S; P !== void 0; ) A = P.getName(), A !== "" && C.unshift(A), P = P.getParent(); } return C; }, this.getFullPath = () => { var C = this.getFullSeparatedPath(); if (0 < C.length) { var A = C.shift(); return C.forEach((P) => { A = A.concat("/", P); }), A; } return ""; }, this.createChild = (C) => { var A = new v(this, E); return A.setName(C), M.push(A), T.add(A.getGroup()), A; }, this.getChildWithName = (C) => { if (C) { for (var A = C.toLowerCase(), P = 0; P < M.length; P++) if (M[P].getName().toLowerCase() === A) return M[P]; } }, this.findChildFromSeparatedPath = (C) => { if (C && 0 < C.length && C[0] === "" && C.shift(), C && 0 < C.length) { var A = this.getChildWithName(C[0]); return A ? (C.shift(), A.findChildFromSeparatedPath(C)) : void 0; } return this; }, this.findChildFromPath = (C) => { var A = C.split("/"); return this.findChildFromSeparatedPath(A); }, this.createChildFromSeparatedPath = (C) => { if (0 < C.length && C[0] === "" && C.shift(), 0 < C.length) { var A = this.getChildWithName(C[0]); return A || (A = this.createChild(C[0])), C.shift(), A.createChildFromSeparatedPath(C); } return this; }, this.createChildFromPath = (C) => { var A = C.split("/"); return this.createChildFromSeparatedPath(A); }, this.findOrCreateChildFromPath = (C) => { var A = this.findChildFromPath(C); return A || (A = this.createChildFromPath(C)), A; }, this.addZincObject = (C) => { C && (C.setRegion(this), T.add(C.getGroup()), _.push(C), this.pickableUpdateRequired = !0, E && E.triggerObjectAddedCallback(C)); }, this.removeZincObject = (C) => { for (var A = 0; A < _.length; A++) if (C === _[A]) return T.remove(C.getGroup()), _.splice(A, 1), E && E.triggerObjectRemovedCallback(C), C.dispose(), void (this.pickableUpdateRequired = !0); }, this.checkPickableUpdateRequred = (C) => { if (this.pickableUpdateRequired) return !0; if (C) { for (var A = !1, P = 0; P < M.length; P++) if (A = M[P].checkPickableUpdateRequred(C), A) return !0; } return !1; }, this.getPickableThreeJSObjects = (C, A) => (T.visible && (_.forEach((P) => { if (P.getGroup() && P.getGroup().visible) { var I = P.marker; I && I.isEnabled() && C.push(I.getMorph()), C.push(P.getGroup()); } }), A && M.forEach((P) => { P.getPickableThreeJSObjects(C, A); }), this.pickableUpdateRequired = !1), C), this.setDuration = (C) => { R = C, _.forEach((A) => A.setDuration(C)), M.forEach((A) => A.setDuration(C)); }, this.getDuration = () => R, this.getBoundingBox = (C) => { var A, P; return _.forEach((I) => { P = I.getBoundingBox(), P && (A == null ? A = P.clone() : A.union(P)); }), C && M.forEach((I) => { P = I.getBoundingBox(C), P && (A == null ? A = P.clone() : A.union(P)); }), A; }, this.clear = (C) => { C && M.forEach((A) => A.clear(C)), _.forEach((A) => { T.remove(A.getGroup()), A.dispose(); }), M = [], _ = []; }, this.objectIsInRegion = (C, A) => { for (var P = 0; P < _.length; P++) if (C === _[P]) return !0; if (A) { for (var I = 0; I < M.length; I++) if (M[I].objectIsInRegion(C, A)) return !0; } return !1; }, this.forEachGeometry = (C, A) => { _.forEach((P) => { P.isGeometry && C(P); }), A && M.forEach((P) => P.forEachGeometry(C, A)); }, this.forEachGlyphset = (C, A) => { _.forEach((P) => { P.isGlyphset && C(P); }), A && M.forEach((P) => P.forEachGlyphset(C, A)); }, this.forEachPointset = (C, A) => { _.forEach((P) => { P.isPointset && C(P); }), A && M.forEach((P) => P.forEachPointset(C, A)); }, this.forEachLine = (C, A) => { _.forEach((P) => { P.isLines && C(P); }), A && M.forEach((P) => P.forEachLine(C, A)); }, this.findObjectsWithAnatomicalId = (C, A) => (_.forEach((P) => { P.anatomicalId === C && objectsArray.push(P); }), A && M.forEach((P) => { var I = P.findObjectsWithAnatomicalId(C, A); objectsArray.push(...I); }), objectsArray), this.findObjectsWithGroupName = (C, A) => { var P = []; return _.forEach((I) => { var b = I.groupName ? I.groupName.toLowerCase() : I.groupName, O = C && C.toLowerCase(); b === O && P.push(I); }), A && M.forEach((I) => { var b = I.findObjectsWithGroupName(C, A); P.push(...b); }), P; }, this.findGeometriesWithGroupName = (C, A) => { var P = this.findObjectsWithGroupName(C, A), I = P.filter((b) => b.isGeometry); return I; }, this.findPointsetsWithGroupName = (C, A) => { var P = this.findObjectsWithGroupName(C, A), I = P.filter((b) => b.isPointset); return I; }, this.findGlyphsetsWithGroupName = (C, A) => { var P = this.findObjectsWithGroupName(C, A), I = P.filter((b) => b.isGlyphset); return I; }, this.findLinesWithGroupName = (C, A) => { var P = this.findObjectsWithGroupName(C, A), I = P.filter((b) => b.isLines); return I; }, this.getAllObjects = (C) => { var A = [..._]; return C && M.forEach((P) => { var I = P.getAllObjects(C); A.push(...I); }), A; }, this.getChildRegions = (C) => { var A = [...M]; return C && M.forEach((P) => { var I = P.getChildRegions(C); A.push(...I); }), A; }, this.getCurrentTime = () => { if (_[0] != null) return _[0].getCurrentTime(); for (var C, A = 0; A < M.length; A++) if (C = M[A].getCurrentTime(), C !== -1) return C; return -1; }, this.setMorphTime = (C, A) => { _.forEach((P) => { P.setMorphTime(C); }), A && M.forEach((P) => { P.setMorphTime(C); }); }, this.isTimeVarying = () => { for (var C = 0; C < _.length; C++) if (_[C].isTimeVarying()) return !0; for (var A = 0; A < M.length; A++) if (M[A].isTimeVarying()) return !0; return !1; }, this.renderGeometries = (C, A, P, I, b, O) => { var N, D = this.getAllObjects(O); D.forEach((B) => { B.render(C * A, P, I, b); }), b && P === !1 && (N = b.markerCluster) !== null && N !== void 0 && N.markerUpdateRequired && b.markerCluster.calculate(); }, this.createPoints = (C, A, P, I) => { var b = !1, O = this.findObjectsWithGroupName(C, !1), N = O.findIndex((B) => B.isPointset), D = -1 < N ? O[N] : new h(); return D.addPoints(A, P, I), N === -1 ? (D.setName(C), this.addZincObject(D), b = !0) : this.pickableUpdateRequired = !0, { zincObject: D, isNew: b }; }, this.createLines = (C, A, P) => { var I = !1, b = this.findObjectsWithGroupName(C, !1), O = b.findIndex((D) => D.isLines), N = -1 < O ? b[O] : new p(); return N.addLines(A, P), O === -1 ? (N.setName(C), this.addZincObject(N), I = !0) : this.pickableUpdateRequired = !0, { zincObject: N, isNew: I }; }, this.createGeometryFromThreeJSGeometry = (C, A, P, I, b, O) => { var N = new g(), D = new f.MeshPhongMaterial({ color: P, morphTargets: !1, morphNormals: !1, transparent: !0, opacity: I, side: f.DoubleSide }); return N.createMesh(A, D, { localTimeEnabled: !1, localMorphColour: !1 }), N.getMorph() ? (N.setVisibility(!1), N.setName(C), N.setRenderOrder(O), this.addZincObject(N), N) : void 0; }; }; a.Region = v; }, /* 45 */ /***/ (o, a, c) => { c(4), c(5).toBufferGeometry; var l = c(46).LineSegments2, d = c(48).LineMaterial, h = c(47).LineSegmentsGeometry, p = function() { c(24).Lines.call(this), this.isLines2 = !0; var g = Array(300); this.createLineSegment = (f, u, y) => { if (f && u) { var v = new h(); v.setPositions(f), v.colorsNeedUpdate = !0; var m = new l(v, u); m.scale.set(1, 1, 1), m.computeLineDistances(), this.setMesh(m, y.localTimeEnabled, y.localMorphColour); } }, this.setWidth = (f) => { this.morph && this.morph.material && (this.morph.material.linewidth = f, this.morph.material.needsUpdate = !0); }, this.addVertices = function(f) { if (f && f.length) { var u = this.getMorph(); u || (this.drawRange = 0); var y = 3 * this.drawRange; if (f.forEach((v) => { g[y++] = v[0], g[y++] = v[1], g[y++] = v[2], this.drawRange++; }), !u) for (; 300 > y; ) g[y++] = f[0][0], g[y++] = f[0][1], g[y++] = f[0][2]; u && (u.geometry.setPositions(g), u.computeLineDistances(), this.boundingBoxUpdateRequired = !0); } return g; }, this.getVerticesByFaceIndex = function(f) { var u = 3 * (2 * f), y = this.getMorph(); if (y && 3 * this.drawRange > u) { var v = y.geometry.getAttribute("instanceStart"); return [[v.data.array[u], v.data.array[++u], v.data.array[++u]], [v.data.array[++u], v.data.array[++u], v.data.array[++u]]]; } return []; }, this.editVertices = function(f, u) { if (f && f.length) { var y = this.getMorph(), v = u + f.length - 1; if (!y || 0 > u || v >= this.drawRange) return; var m = 3 * u; for (f.forEach((w) => { g[m++] = w[0], g[m++] = w[1], g[m++] = w[2]; }), m = 3 * this.drawRange; 300 > m; ) g[m++] = f[0][0], g[m++] = f[0][1], g[m++] = f[0][2]; y.geometry.setPositions(g), y.computeLineDistances(), this.boundingBoxUpdateRequired = !0; } return g; }, this.addLines = (f, u) => { if (f && 0 < f.length) { this.addVertices(f); var y = this.getMorph(); if (!y) { var v = new d({ color: u, linewidth: 1, vertexColors: !1, worldUnits: !1 }); v.resolution.set(window.innerWidth, window.innerHeight), this.createLineSegment(g, v, { localTimeEnabled: !1, localMorphColour: !1 }); } this.region && (this.region.pickableUpdateRequired = !0); } }, this.render = () => { var f = this.getMorph().material; f.resolution.set(window.innerWidth, window.innerHeight); }; }; p.prototype = Object.create(c(24).Lines.prototype), p.prototype.constructor = p, a.Lines2 = p; }, /* 46 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ LineSegments2: () => ( /* binding */ _ ) /* harmony export */ }); var l = c(4), d = c(47), h = c(48), p = new l.Vector3(), g = new l.Vector3(), f = new l.Vector4(), u = new l.Vector4(), y = new l.Vector4(), v = new l.Vector3(), m = new l.Matrix4(), w = new l.Line3(), S = new l.Vector3(), T = new l.Box3(), M = new l.Sphere(), x = new l.Vector4(); class _ extends l.Mesh { constructor() { var L = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new d.LineSegmentsGeometry(), R = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new h.LineMaterial({ color: 16777215 * Math.random() }); super(L, R), this.type = "LineSegments2"; } // for backwards-compatability, but could be a method of LineSegmentsGeometry... computeLineDistances() { for (var L = this.geometry, R = L.attributes.instanceStart, C = L.attributes.instanceEnd, A = new Float32Array(2 * R.count), P = 0, I = 0, b = R.count; P < b; P++, I += 2) p.fromBufferAttribute(R, P), g.fromBufferAttribute(C, P), A[I] = I == 0 ? 0 : A[I - 1], A[I + 1] = A[I] + p.distanceTo(g); var O = new l.InstancedInterleavedBuffer(A, 2, 1); return L.setAttribute("instanceDistanceStart", new l.InterleavedBufferAttribute(O, 1, 0)), L.setAttribute("instanceDistanceEnd", new l.InterleavedBufferAttribute(O, 1, 1)), this; } raycast(L, R) { L.camera === null && console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.'); var C = L.params.Line2 === void 0 ? 0 : L.params.Line2.threshold || 0, A = L.ray, P = L.camera, I = P.projectionMatrix, b = this.matrixWorld, O = this.geometry, N = this.material, D = N.resolution, B = N.linewidth + C, U = O.attributes.instanceStart, k = O.attributes.instanceEnd, K = -P.near, ie = 2 * Math.max(B / D.width, B / D.height); O.boundingSphere === null && O.computeBoundingSphere(), M.copy(O.boundingSphere).applyMatrix4(b); var j = Math.max(P.near, M.distanceToPoint(A.origin)); x.set(0, 0, -j, 1).applyMatrix4(P.projectionMatrix), x.multiplyScalar(1 / x.w), x.applyMatrix4(P.projectionMatrixInverse); var G = 0.5 * Math.abs(ie / x.w); if (M.radius += G, L.ray.intersectsSphere(M) !== !1) { O.boundingBox === null && O.computeBoundingBox(), T.copy(O.boundingBox).applyMatrix4(b); var W = Math.max(P.near, T.distanceToPoint(A.origin)); x.set(0, 0, -W, 1).applyMatrix4(P.projectionMatrix), x.multiplyScalar(1 / x.w), x.applyMatrix4(P.projectionMatrixInverse); var q = 0.5 * Math.abs(ie / x.w); if (T.max.x += q, T.max.y += q, T.max.z += q, T.min.x -= q, T.min.y -= q, T.min.z -= q, L.ray.intersectsBox(T) !== !1) { A.at(1, y), y.w = 1, y.applyMatrix4(P.matrixWorldInverse), y.applyMatrix4(I), y.multiplyScalar(1 / y.w), y.x *= D.x / 2, y.y *= D.y / 2, y.z = 0, v.copy(y), m.multiplyMatrices(P.matrixWorldInverse, b); for (var Q = 0, ee = U.count; Q < ee; Q++) { f.fromBufferAttribute(U, Q), u.fromBufferAttribute(k, Q), f.w = 1, u.w = 1, f.applyMatrix4(m), u.applyMatrix4(m); var ne = f.z > K && u.z > K; if (!ne) { if (f.z > K) { var Y = f.z - u.z, te = (f.z - K) / Y; f.lerp(u, te); } else if (u.z > K) { var F = u.z - f.z, $ = (u.z - K) / F; u.lerp(f, $); } f.applyMatrix4(I), u.applyMatrix4(I), f.multiplyScalar(1 / f.w), u.multiplyScalar(1 / u.w), f.x *= D.x / 2, f.y *= D.y / 2, u.x *= D.x / 2, u.y *= D.y / 2, w.start.copy(f), w.start.z = 0, w.end.copy(u), w.end.z = 0; var J = w.closestPointToPointParameter(v, !0); w.at(J, S); var z = l.MathUtils.lerp(f.z, u.z, J), V = -1 <= z && 1 >= z, oe = v.distanceTo(S) < 0.5 * B; if (V && oe) { w.start.fromBufferAttribute(U, Q), w.end.fromBufferAttribute(k, Q), w.start.applyMatrix4(b), w.end.applyMatrix4(b); var ue = new l.Vector3(), le = new l.Vector3(); A.distanceSqToSegment(w.start, w.end, le, ue), R.push({ point: le, pointOnLine: ue, distance: A.origin.distanceTo(le), object: this, face: null, faceIndex: Q, uv: null, uv2: null }); } } } } } } } _.prototype.LineSegments2 = !0; }, /* 47 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ LineSegmentsGeometry: () => ( /* binding */ p ) /* harmony export */ }); var l = c(4), d = new l.Box3(), h = new l.Vector3(); class p extends l.InstancedBufferGeometry { constructor() { super(), this.type = "LineSegmentsGeometry", this.setIndex([0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5]), this.setAttribute("position", new l.Float32BufferAttribute([-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0], 3)), this.setAttribute("uv", new l.Float32BufferAttribute([-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2], 2)); } applyMatrix4(f) { var u = this.attributes.instanceStart, y = this.attributes.instanceEnd; return u !== void 0 && (u.applyMatrix4(f), y.applyMatrix4(f), u.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this; } setPositions(f) { var u; f instanceof Float32Array ? u = f : Array.isArray(f) && (u = new Float32Array(f)); var y = new l.InstancedInterleavedBuffer(u, 6, 1); return this.setAttribute("instanceStart", new l.InterleavedBufferAttribute(y, 3, 0)), this.setAttribute("instanceEnd", new l.InterleavedBufferAttribute(y, 3, 3)), this.computeBoundingBox(), this.computeBoundingSphere(), this; } setColors(f) { var u; f instanceof Float32Array ? u = f : Array.isArray(f) && (u = new Float32Array(f)); var y = new l.InstancedInterleavedBuffer(u, 6, 1); return this.setAttribute("instanceColorStart", new l.InterleavedBufferAttribute(y, 3, 0)), this.setAttribute("instanceColorEnd", new l.InterleavedBufferAttribute(y, 3, 3)), this; } fromWireframeGeometry(f) { return this.setPositions(f.attributes.position.array), this; } fromEdgesGeometry(f) { return this.setPositions(f.attributes.position.array), this; } fromMesh(f) { return this.fromWireframeGeometry(new l.WireframeGeometry(f.geometry)), this; } fromLineSegments(f) { var u = f.geometry; return u.isGeometry ? void console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.") : (u.isBufferGeometry && this.setPositions(u.attributes.position.array), this); } computeBoundingBox() { this.boundingBox === null && (this.boundingBox = new l.Box3()); var f = this.attributes.instanceStart, u = this.attributes.instanceEnd; f !== void 0 && u !== void 0 && (this.boundingBox.setFromBufferAttribute(f), d.setFromBufferAttribute(u), this.boundingBox.union(d)); } computeBoundingSphere() { this.boundingSphere === null && (this.boundingSphere = new l.Sphere()), this.boundingBox === null && this.computeBoundingBox(); var f = this.attributes.instanceStart, u = this.attributes.instanceEnd; if (f !== void 0 && u !== void 0) { var y = this.boundingSphere.center; this.boundingBox.getCenter(y); for (var v = 0, m = 0, w = f.count; m < w; m++) h.fromBufferAttribute(f, m), v = Math.max(v, y.distanceToSquared(h)), h.fromBufferAttribute(u, m), v = Math.max(v, y.distanceToSquared(h)); this.boundingSphere.radius = Math.sqrt(v), isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this); } } toJSON() { } applyMatrix(f) { return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."), this.applyMatrix4(f); } } p.prototype.isLineSegmentsGeometry = !0; }, /* 48 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ LineMaterial: () => ( /* binding */ d ) /* harmony export */ }); var l = c(4); l.UniformsLib.line = { linewidth: { value: 1 }, resolution: { value: new l.Vector2(1, 1) }, dashScale: { value: 1 }, dashSize: { value: 1 }, dashOffset: { value: 0 }, gapSize: { value: 1 }, // todo FIX - maybe change to totalSize opacity: { value: 1 } }, l.ShaderLib.line = { uniforms: l.UniformsUtils.merge([l.UniformsLib.common, l.UniformsLib.fog, l.UniformsLib.line]), vertexShader: ( /* glsl */ ` #include #include #include #include #include uniform float linewidth; uniform vec2 resolution; attribute vec3 instanceStart; attribute vec3 instanceEnd; attribute vec3 instanceColorStart; attribute vec3 instanceColorEnd; varying vec2 vUv; #ifdef USE_DASH uniform float dashScale; attribute float instanceDistanceStart; attribute float instanceDistanceEnd; varying float vLineDistance; #endif void trimSegment( const in vec4 start, inout vec4 end ) { // trim end segment so it terminates between the camera plane and the near plane // conservative estimate of the near plane float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column float nearEstimate = - 0.5 * b / a; float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); end.xyz = mix( start.xyz, end.xyz, alpha ); } void main() { #ifdef USE_COLOR vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; #endif #ifdef USE_DASH vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; #endif float aspect = resolution.x / resolution.y; vUv = uv; // camera space vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); // special case for perspective projection, and segments that terminate either in, or behind, the camera plane // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space // but we need to perform ndc-space calculations in the shader, so we must address this issue directly // perhaps there is a more elegant solution -- WestLangley bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column if ( perspective ) { if ( start.z < 0.0 && end.z >= 0.0 ) { trimSegment( start, end ); } else if ( end.z < 0.0 && start.z >= 0.0 ) { trimSegment( end, start ); } } // clip space vec4 clipStart = projectionMatrix * start; vec4 clipEnd = projectionMatrix * end; // ndc space vec2 ndcStart = clipStart.xy / clipStart.w; vec2 ndcEnd = clipEnd.xy / clipEnd.w; // direction vec2 dir = ndcEnd - ndcStart; // account for clip-space aspect ratio dir.x *= aspect; dir = normalize( dir ); // perpendicular to dir vec2 offset = vec2( dir.y, - dir.x ); // undo aspect ratio adjustment dir.x /= aspect; offset.x /= aspect; // sign flip if ( position.x < 0.0 ) offset *= - 1.0; // endcaps if ( position.y < 0.0 ) { offset += - dir; } else if ( position.y > 1.0 ) { offset += dir; } // adjust for linewidth offset *= linewidth; // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... offset /= resolution.y; // select end vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; // back to clip space offset *= clip.w; clip.xy += offset; gl_Position = clip; vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation #include #include #include }` ), fragmentShader: ( /* glsl */ ` uniform vec3 diffuse; uniform float opacity; #ifdef USE_DASH uniform float dashSize; uniform float dashOffset; uniform float gapSize; #endif varying float vLineDistance; #include #include #include #include #include varying vec2 vUv; void main() { #include #ifdef USE_DASH if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX #endif float alpha = opacity; #ifdef ALPHA_TO_COVERAGE // artifacts appear on some hardware if a derivative is taken within a conditional float a = vUv.x; float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; float len2 = a * a + b * b; float dlen = fwidth( len2 ); if ( abs( vUv.y ) > 1.0 ) { alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 ); } #else if ( abs( vUv.y ) > 1.0 ) { float a = vUv.x; float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; float len2 = a * a + b * b; if ( len2 > 1.0 ) discard; } #endif vec4 diffuseColor = vec4( diffuse, alpha ); #include #include gl_FragColor = vec4( diffuseColor.rgb, alpha ); #include #include #include #include }` ) }; class d extends l.ShaderMaterial { constructor(p) { super({ type: "LineMaterial", uniforms: l.UniformsUtils.clone(l.ShaderLib.line.uniforms), vertexShader: l.ShaderLib.line.vertexShader, fragmentShader: l.ShaderLib.line.fragmentShader, clipping: !0 // required for clipping support }), Object.defineProperties(this, { color: { enumerable: !0, get: function() { return this.uniforms.diffuse.value; }, set: function(f) { this.uniforms.diffuse.value = f; } }, linewidth: { enumerable: !0, get: function() { return this.uniforms.linewidth.value; }, set: function(f) { this.uniforms.linewidth.value = f; } }, dashed: { enumerable: !0, get: function() { return "USE_DASH" in this.defines; }, set(g) { !!g != "USE_DASH" in this.defines && (this.needsUpdate = !0), g === !0 ? this.defines.USE_DASH = "" : delete this.defines.USE_DASH; } }, dashScale: { enumerable: !0, get: function() { return this.uniforms.dashScale.value; }, set: function(f) { this.uniforms.dashScale.value = f; } }, dashSize: { enumerable: !0, get: function() { return this.uniforms.dashSize.value; }, set: function(f) { this.uniforms.dashSize.value = f; } }, dashOffset: { enumerable: !0, get: function() { return this.uniforms.dashOffset.value; }, set: function(f) { this.uniforms.dashOffset.value = f; } }, gapSize: { enumerable: !0, get: function() { return this.uniforms.gapSize.value; }, set: function(f) { this.uniforms.gapSize.value = f; } }, opacity: { enumerable: !0, get: function() { return this.uniforms.opacity.value; }, set: function(f) { this.uniforms.opacity.value = f; } }, resolution: { enumerable: !0, get: function() { return this.uniforms.resolution.value; }, set: function(f) { this.uniforms.resolution.value.copy(f); } }, alphaToCoverage: { enumerable: !0, get: function() { return "ALPHA_TO_COVERAGE" in this.defines; }, set: function(f) { !!f != "ALPHA_TO_COVERAGE" in this.defines && (this.needsUpdate = !0), f === !0 ? (this.defines.ALPHA_TO_COVERAGE = "", this.extensions.derivatives = !0) : (delete this.defines.ALPHA_TO_COVERAGE, this.extensions.derivatives = !1); } } }), this.setValues(p); } } d.prototype.isLineMaterial = !0; }, /* 49 */ /***/ (o, a, c) => { var l = c(4); a.Minimap = function(d) { var h = d; this.camera = new l.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, 0.01, 10), this.helper = void 0; var p = new l.BufferGeometry(), g = new Float32Array([-1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1]), f = new l.BufferAttribute(g, 3); p.setAttribute("position", f); var u = new l.MeshBasicMaterial({ color: 3355443, depthTest: !1, depthWrite: !1, opacity: 0.5, transparent: !0 }); this.mask = new l.Mesh(p, u); var y = new l.Box3(), v = new l.Vector3(); this.getDiffFromNormalised = (w, S) => { y.setFromBufferAttribute(f).getCenter(v); var T = v.clone().project(this.camera), M = new l.Vector3(w, S, T.z).unproject(this.camera); return M.sub(v); }; var m = (w, S) => { h.camera.near && (this.camera.near = h.camera.near), S.farPlane && (this.camera.far = S.farPlane), S.eyePosition && this.camera.position.set(S.eyePosition[0], S.eyePosition[1], S.eyePosition[2]), S.upVector && this.camera.up.set(S.upVector[0], S.upVector[1], S.upVector[2]), S.targetPosition && this.camera.lookAt(new l.Vector3(S.targetPosition[0], S.targetPosition[1], S.targetPosition[2])), this.camera.zoom = 1 / w, this.camera.updateProjectionMatrix(); }; this.getBoundary = () => { var w = new l.Vector3().copy(h.camera.target).project(h.camera), S = new l.Vector3(-1, -1, w.z).unproject(h.camera), T = new l.Vector3(1, -1, w.z).unproject(h.camera), M = new l.Vector3(1, 1, w.z).unproject(h.camera), x = new l.Vector3(-1, 1, w.z).unproject(h.camera); f.copyVector3sArray([S, T, M, M, x, S]), f.needsUpdate = !0; }, this.updateCamera = () => { this.getBoundary(); var w = h.getZincCameraControls(), S = h.getBoundingBox(); if (S) { var T = S.min.distanceTo(S.max), M = T / 2, x = (S.min.x + S.max.x) / 2, _ = (S.min.y + S.max.y) / 2, E = (S.min.z + S.max.z) / 2, L = w.getViewportFromCentreAndRadius(x, _, E, M, 40, M * 4); m(T, L); } }; }; }, /* 50 */ /***/ (o, a, c) => { var l = c(4), d = c(51)(l), h = c(3).Geometry, p = c(52), g = c(53).default, f = l.BufferGeometryLoader, u = function(y) { var v; y && y.isGeometry && (v = y); var m = void 0, w = void 0, S = !1, T = void 0, M = (R) => { var C = v.getMorph().material.clone(); C.morphTargets = !1; var A = new h(), P = new f(), I = P.parse(R), b = new l.Mesh(I.geometry, C); return A.geometry = b.geometry, b.userData = A, A.setMorph(b), A; }, x = (R) => { switch (R.data.action) { case "message": console.log(R.data.message); break; case "result": var C = new u(M(R.data.object)); T && T(C), T = void 0, S = !1; break; default: throw "Cannot handle specified action."; } }, _ = (R) => { if (p !== void 0 && (w = p( /*require.resolve*/ 54 )), !w) m = new (c(55)).GeometryCSGInternal(R); else if (R && R.isGeometry) { var C = R.getMorph(), A = C.geometry.clone().applyMatrix(C.matrix).toJSON(); w.addEventListener("message", function(P) { x(P); }), w.postMessage({ action: "initialise", object: A }); } }; this.getHostGeometry = () => { var R = new d(v.getMorph()); return new E(R); }, this.getGeometry = () => v; var E = (R) => { var C = v.getMorph().material.clone(); C.morphTargets = !1; var A = R.toMesh(C), P = new h(); return P.geometry = A.geometry, A.userData = P, P.setMorph(A), P; }; this.setCSG = (R) => { m.setCSG(R); }; var L = (R, C, A, P) => { if (S) P("On progress"); else { var I = R.getMorph(), b = I.geometry.clone().applyMatrix(I.matrix).toJSON(); T = A, S = !0, w.postMessage({ action: C, object: b }); } }; this.intersect = (R) => new g((C, A) => { if (w) L(R, "intersect", C, A); else { var P = m.intersect(R), I = new u(E(P)); I.setCSG(P), C(I); } }), this.subtract = (R) => new g((C, A) => { if (w) L(R, "intersect", C, A); else { var P = m.subtract(R), I = new u(E(P)); I.setCSG(P), C(I); } }), this.union = (R) => new g((C, A) => { if (w) L(R, "intersect", C, A); else { var P = m.union(R), I = new u(E(P)); I.setCSG(P), C(I); } }), this.terminateWorker = () => { w && w.terminate(); }, _(y); }; a.GeometryCSG = u; }, /* 51 */ /***/ (o) => { var a = 1e-5, c = 0, l = 1, d = 2, h = 3; o.exports = function(p) { var g = function(f) { var u, y, v, m, w, S, T, M = []; if (f.isBufferGeometry && (f = new p.Geometry().fromBufferGeometry(f)), f instanceof p.Geometry) this.matrix = new p.Matrix4(); else if (f.isMesh) f.updateMatrix(), this.matrix = f.matrix.clone(), f = f.geometry, f.isBufferGeometry && (f = new p.Geometry().fromBufferGeometry(f)), f.mergeVertices(), f.computeVertexNormals(!1); else { if (f instanceof g.Node) return this.tree = f, this.matrix = new p.Matrix4(), this; throw "ThreeBSP: Given geometry is unsupported"; } for (u = 0, y = f.faces.length; u < y; u++) v = f.faces[u], w = f.faceVertexUvs[0][u], T = new g.Polygon(), v instanceof p.Face3 ? (m = f.vertices[v.a], S = w ? new p.Vector2(w[0].x, w[0].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[0], S), m.applyMatrix4(this.matrix), T.vertices.push(m), m = f.vertices[v.b], S = w ? new p.Vector2(w[1].x, w[1].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], S), m.applyMatrix4(this.matrix), T.vertices.push(m), m = f.vertices[v.c], S = w ? new p.Vector2(w[2].x, w[2].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], S), m.applyMatrix4(this.matrix), T.vertices.push(m)) : (p.Face4, m = f.vertices[v.a], S = w ? new p.Vector2(w[0].x, w[0].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[0], S), m.applyMatrix4(this.matrix), T.vertices.push(m), m = f.vertices[v.b], S = w ? new p.Vector2(w[1].x, w[1].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[1], S), m.applyMatrix4(this.matrix), T.vertices.push(m), m = f.vertices[v.c], S = w ? new p.Vector2(w[2].x, w[2].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], S), m.applyMatrix4(this.matrix), T.vertices.push(m), m = f.vertices[v.d], S = w ? new p.Vector2(w[3].x, w[3].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[3], S), m.applyMatrix4(this.matrix), T.vertices.push(m)), T.calculateProperties(), M.push(T); this.tree = new g.Node(M); }; return g.prototype.subtract = function(f) { var u = this.tree.clone(), y = f.tree.clone(); return u.invert(), u.clipTo(y), y.clipTo(u), y.invert(), y.clipTo(u), y.invert(), u.build(y.allPolygons()), u.invert(), u = new g(u), u.matrix = this.matrix, u; }, g.prototype.union = function(f) { var u = this.tree.clone(), y = f.tree.clone(); return u.clipTo(y), y.clipTo(u), y.invert(), y.clipTo(u), y.invert(), u.build(y.allPolygons()), u = new g(u), u.matrix = this.matrix, u; }, g.prototype.intersect = function(f) { var u = this.tree.clone(), y = f.tree.clone(); return u.invert(), y.clipTo(u), y.invert(), u.clipTo(y), y.clipTo(u), u.build(y.allPolygons()), u.invert(), u = new g(u), u.matrix = this.matrix, u; }, g.prototype.toGeometry = function() { var f, u, y, v, m, w, S, T, M, x, _ = new p.Matrix4().getInverse(this.matrix), E = new p.Geometry(), L = this.tree.allPolygons(), R = L.length, C = {}; for (f = 0; f < R; f++) for (y = L[f], v = y.vertices.length, u = 2; u < v; u++) x = [], T = y.vertices[0], x.push(new p.Vector2(T.uv.x, T.uv.y)), T = new p.Vector3(T.x, T.y, T.z), T.applyMatrix4(_), typeof C[T.x + "," + T.y + "," + T.z] > "u" ? (E.vertices.push(T), m = C[T.x + "," + T.y + "," + T.z] = E.vertices.length - 1) : m = C[T.x + "," + T.y + "," + T.z], T = y.vertices[u - 1], x.push(new p.Vector2(T.uv.x, T.uv.y)), T = new p.Vector3(T.x, T.y, T.z), T.applyMatrix4(_), typeof C[T.x + "," + T.y + "," + T.z] > "u" ? (E.vertices.push(T), w = C[T.x + "," + T.y + "," + T.z] = E.vertices.length - 1) : w = C[T.x + "," + T.y + "," + T.z], T = y.vertices[u], x.push(new p.Vector2(T.uv.x, T.uv.y)), T = new p.Vector3(T.x, T.y, T.z), T.applyMatrix4(_), typeof C[T.x + "," + T.y + "," + T.z] > "u" ? (E.vertices.push(T), S = C[T.x + "," + T.y + "," + T.z] = E.vertices.length - 1) : S = C[T.x + "," + T.y + "," + T.z], M = new p.Face3(m, w, S, new p.Vector3(y.normal.x, y.normal.y, y.normal.z)), E.faces.push(M), E.faceVertexUvs[0].push(x); return E; }, g.prototype.toBufferGeometry = function() { var f = this.toGeometry(), u = new p.BufferGeometry().fromGeometry(f); return u; }, g.prototype.toMesh = function(f) { var u = this.toBufferGeometry(), y = new p.Mesh(u, f); return y.position.setFromMatrixPosition(this.matrix), y.rotation.setFromRotationMatrix(this.matrix), y; }, g.Polygon = function(f) { f instanceof Array || (f = []), this.vertices = f, 0 < f.length ? this.calculateProperties() : this.normal = this.w = void 0; }, g.Polygon.prototype.calculateProperties = function() { var f = this.vertices[0], u = this.vertices[1], y = this.vertices[2]; return this.normal = u.clone().subtract(f).cross(y.clone().subtract(f)).normalize(), this.w = this.normal.clone().dot(f), this; }, g.Polygon.prototype.clone = function() { var f, u, y = new g.Polygon(); for (f = 0, u = this.vertices.length; f < u; f++) y.vertices.push(this.vertices[f].clone()); return y.calculateProperties(), y; }, g.Polygon.prototype.flip = function() { var f, u = []; for (this.normal.multiplyScalar(-1), this.w *= -1, f = this.vertices.length - 1; 0 <= f; f--) u.push(this.vertices[f]); return this.vertices = u, this; }, g.Polygon.prototype.classifyVertex = function(f) { var u = this.normal.dot(f) - this.w; return u < -a ? d : u > a ? l : c; }, g.Polygon.prototype.classifySide = function(f) { var u, y, v, m = 0, w = 0, S = f.vertices.length; for (u = 0; u < S; u++) y = f.vertices[u], v = this.classifyVertex(y), v === l ? m++ : v === d && w++; return 0 < m && w === 0 ? l : m === 0 && 0 < w ? d : m === 0 && w === 0 ? c : h; }, g.Polygon.prototype.splitPolygon = function(f, u, y, v, m) { var w = this.classifySide(f); if (w === c) (0 < this.normal.dot(f.normal) ? u : y).push(f); else if (w === l) v.push(f); else if (w === d) m.push(f); else { var S, T, M, x, _, E, L, R, C, A = [], P = []; for (T = 0, S = f.vertices.length; T < S; T++) M = (T + 1) % S, E = f.vertices[T], L = f.vertices[M], x = this.classifyVertex(E), _ = this.classifyVertex(L), x != d && A.push(E), x != l && P.push(E), (x | _) == h && (R = (this.w - this.normal.dot(E)) / this.normal.dot(L.clone().subtract(E)), C = E.interpolate(L, R), A.push(C), P.push(C)); 3 <= A.length && v.push(new g.Polygon(A).calculateProperties()), 3 <= P.length && m.push(new g.Polygon(P).calculateProperties()); } }, g.Vertex = function(f, u, y, v, m) { this.x = f, this.y = u, this.z = y, this.normal = v || new p.Vector3(), this.uv = m || new p.Vector2(); }, g.Vertex.prototype.clone = function() { return new g.Vertex(this.x, this.y, this.z, this.normal.clone(), this.uv.clone()); }, g.Vertex.prototype.add = function(f) { return this.x += f.x, this.y += f.y, this.z += f.z, this; }, g.Vertex.prototype.subtract = function(f) { return this.x -= f.x, this.y -= f.y, this.z -= f.z, this; }, g.Vertex.prototype.multiplyScalar = function(f) { return this.x *= f, this.y *= f, this.z *= f, this; }, g.Vertex.prototype.cross = function(f) { var u = this.x, y = this.y, v = this.z; return this.x = y * f.z - v * f.y, this.y = v * f.x - u * f.z, this.z = u * f.y - y * f.x, this; }, g.Vertex.prototype.normalize = function() { var f = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); return this.x /= f, this.y /= f, this.z /= f, this; }, g.Vertex.prototype.dot = function(f) { return this.x * f.x + this.y * f.y + this.z * f.z; }, g.Vertex.prototype.lerp = function(f, u) { return this.add(f.clone().subtract(this).multiplyScalar(u)), this.normal.add(f.normal.clone().sub(this.normal).multiplyScalar(u)), this.uv.add(f.uv.clone().sub(this.uv).multiplyScalar(u)), this; }, g.Vertex.prototype.interpolate = function(f, u) { return this.clone().lerp(f, u); }, g.Vertex.prototype.applyMatrix4 = function(f) { var u = this.x, y = this.y, v = this.z, m = f.elements; return this.x = m[0] * u + m[4] * y + m[8] * v + m[12], this.y = m[1] * u + m[5] * y + m[9] * v + m[13], this.z = m[2] * u + m[6] * y + m[10] * v + m[14], this; }, g.Node = function(f) { var u, y, v = [], m = []; if (this.polygons = [], this.front = this.back = void 0, f instanceof Array && f.length !== 0) { for (this.divider = f[0].clone(), u = 0, y = f.length; u < y; u++) this.divider.splitPolygon(f[u], this.polygons, this.polygons, v, m); 0 < v.length && (this.front = new g.Node(v)), 0 < m.length && (this.back = new g.Node(m)); } }, g.Node.isConvex = function(f) { var u, y; for (u = 0; u < f.length; u++) for (y = 0; y < f.length; y++) if (u !== y && f[u].classifySide(f[y]) !== d) return !1; return !0; }, g.Node.prototype.build = function(f) { var u, y, v = [], m = []; for (this.divider || (this.divider = f[0].clone()), u = 0, y = f.length; u < y; u++) this.divider.splitPolygon(f[u], this.polygons, this.polygons, v, m); 0 < v.length && (!this.front && (this.front = new g.Node()), this.front.build(v)), 0 < m.length && (!this.back && (this.back = new g.Node()), this.back.build(m)); }, g.Node.prototype.allPolygons = function() { var f = this.polygons.slice(); return this.front && (f = f.concat(this.front.allPolygons())), this.back && (f = f.concat(this.back.allPolygons())), f; }, g.Node.prototype.clone = function() { var f = new g.Node(); return f.divider = this.divider.clone(), f.polygons = this.polygons.map(function(u) { return u.clone(); }), f.front = this.front && this.front.clone(), f.back = this.back && this.back.clone(), f; }, g.Node.prototype.invert = function() { var f, u, y; for (f = 0, u = this.polygons.length; f < u; f++) this.polygons[f].flip(); return this.divider.flip(), this.front && this.front.invert(), this.back && this.back.invert(), y = this.front, this.front = this.back, this.back = y, this; }, g.Node.prototype.clipPolygons = function(f) { var u, y, v, m; if (!this.divider) return f.slice(); for (v = [], m = [], u = 0, y = f.length; u < y; u++) this.divider.splitPolygon(f[u], v, m, v, m); return this.front && (v = this.front.clipPolygons(v)), m = this.back ? this.back.clipPolygons(m) : [], v.concat(m); }, g.Node.prototype.clipTo = function(f) { this.polygons = f.clipPolygons(this.polygons), this.front && this.front.clipTo(f), this.back && this.back.clipTo(f); }, g; }; }, /* 52 */ /***/ (o) => { o.exports = Ez(); }, /* 53 */ /***/ (o) => { o.exports = Nz; }, /* 54 */ /***/ (o, a, c) => { var l = c(3).Geometry, d = c(4), h = d.BufferGeometryLoader; o.exports = function(p) { var g = void 0, f = function(S) { var T = new h(), M = T.parse(S), x = new d.MeshPhongMaterial(), _ = new d.Mesh(M.geometry, x), E = new l(); return E.setMorph(_), E; }, u = function(S) { var T = f(S); g = new (c(55)).GeometryCSGInternal(T), p.postMessage({ action: "message", message: "Initialised" }); }, y = function(S) { if (g) { var T = f(S), M = g.intersect(T), x = M.toBufferGeometry().toJSON(); p.postMessage({ action: "result", object: x }); } }, v = function(S) { if (g) { var T = f(S), M = g.subtract(T), x = M.toBufferGeometry().toJSON(); p.postMessage({ action: "result", object: x }); } }, m = function(S) { if (g) { var T = f(S), M = g.union(T), x = M.toBufferGeometry().toJSON(); p.postMessage({ action: "result", object: x }); } }; p.addEventListener("message", function(w) { switch (w.data.action) { case "initialise": u(w.data.object); break; case "intersect": y(w.data.object); break; case "subtract": v(w.data.object); break; case "union": m(w.data.object); break; default: throw "Cannot handle specified action."; } }); }; }, /* 55 */ /***/ (o, a, c) => { var l = c(4), d = c(51)(l); c(3).Geometry, c(50).GeometryCSG; var h = function(p) { var g; p && p.isGeometry && (g = p); var f; this.setGeometry = (y) => { y && y.isGeometry && (g = y), f = void 0; }, this.setCSG = (y) => { f = y; }; var u = (y) => { if (g && g.morph && y && y.morph) { f === void 0 && (f = new d(g.morph)); var v = new d(y.morph); return v; } }; this.intersect = (y) => { var v = u(y); return f && v ? f.intersect(v) : void 0; }, this.subtract = (y) => { var v = u(y); return f && v ? f.subtract(v) : void 0; }, this.union = (y) => { var v = u(y); return f && v ? f.union(v) : void 0; }; }; a.GeometryCSGInternal = h; }, /* 56 */ /***/ (o, a, c) => { var l = c(4), d = c(51)(l); c(18).Glyphset; var h = function(p) { var g; p && p.isGlyphset && (g = p); var f = []; this.setGlyphset = (v) => { v && v.isGlyphset && (g = v), hostCSG = void 0; }, this.getGlyphset = () => g; var u = () => (v) => { var m = v.getMesh(), w = v.getLabel(); if (m) { var S = new d(m.geometry.clone().applyMatrix(m.matrix)), T = []; T.csg = S, T.label = w, m.material && (T.material = m.material.clone()), f.push(T); } }, y = (v) => { if (g && v && v.getMorph()) { f.length == 0 && g.forEachGlyph(u()); var m = new d(v.getMorph()); return m; } }; this.intersect = (v) => { var m = y(v); if (0 < f.length && m) { for (var w = new (c(18)).Glyphset(), S = 0; S < f.length; S++) { var T = f[S], M = T.csg.intersect(m), x = M.toMesh(); if (x && x.geometry && 0 < x.geometry.vertices.length) { T.material && (x.material = T.material, x.material.side = l.DoubleSide, x.material.clippingPlanes = null); var _ = w.addMeshAsGlyph(x, S + 1); _.setLabel(T.label); } } var E = new h(w); return E; } }; }; a.GlyphsetCSG = h; } /******/ ], i = {}; function r(o) { var a = i[o]; if (a !== void 0) return a.exports; var c = i[o] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; return t[o].call(c.exports, c, c.exports, r), c.exports; } r.n = (o) => { var a = o && o.__esModule ? ( /******/ () => o.default ) : ( /******/ () => o ); return r.d(a, { a }), a; }, r.d = (o, a) => { for (var c in a) r.o(a, c) && !r.o(o, c) && Object.defineProperty(o, c, { enumerable: !0, get: a[c] }); }, r.o = (o, a) => Object.prototype.hasOwnProperty.call(o, a), r.r = (o) => { typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(o, "__esModule", { value: !0 }); }; var s = r(0); return s; })() )); })(Dy); var Ur = Dy.exports; const Gc = /* @__PURE__ */ rL(Ur), $v = (n, e) => { if (n) { let t = ""; n.forEach((i) => { t = i.uuid, i.region && (t = i.region.uuid + "/" + t), i && i.getVisibility() && e.push(t); }); } return e; }, Yd = (n, e) => { const t = n[0] - e[0], i = n[1] - e[1], r = n[2] - e[2]; return Math.sqrt(t * t + i * i + r * r); }, Fz = (n) => { const e = n.zincObjects; if (e.length > 0 && e[0]) { const t = e[0]; if (t.isEditable && t.isLines2) { const i = n.identifiers[0].extraData.intersected; if (i && i.faceIndex > -1) { const r = t.getVerticesByFaceIndex(i.faceIndex), s = n.identifiers[0].extraData.intersected.pointOnLine; if (r.length > 1) { const o = Yd(r[0], [s.x, s.y, s.z]), a = Yd(r[1], [s.x, s.y, s.z]); return o > a ? { zincObject: t, faceIndex: i.faceIndex, vertexIndex: i.faceIndex * 2 + 1, point: r[0] } : { zincObject: t, faceIndex: i.faceIndex, vertexIndex: i.faceIndex * 2, point: r[1] }; } } } } }, Bz = (n) => { const e = n.zincObjects; if (e.length > 0 && e[0]) { const t = e[0]; if (t.isEditable) return t; } }, zz = (n, e, t) => { if (n != null && n.isEditable && (n != null && n.isPointset)) { let i = !1; for (let r = 0; r < 3 && !i; r++) t[r] !== 0 && (i = !0); if (i && e > -1) { const r = n.getVerticesByIndex(e); return r && (r[0] = r[0] + t[0], r[1] = r[1] + t[1], r[2] = r[2] + t[2]), n.editVertices([r], e), n.boundingBoxUpdateRequired = !0, !0; } } return !1; }, Pc = (n, e) => { if (n != null && n.isEditable && (n != null && n.isLines2) && e > -1) { const t = n.getVerticesByFaceIndex(e); if (t && t.length > 1) return Yd(t[1], t[0]); } return 0; }, Wh = (n, e, t, i) => { if (n && t !== 0 && n.isEditable && n.isLines2 && e > -1) { const r = n.getVerticesByFaceIndex(e); let s = [r[1][0] - r[0][0], r[1][1] - r[0][1], r[1][2] - r[0][2]]; const o = Math.sqrt(s[0] * s[0] + s[1] * s[1] + s[2] * s[2]); for (let a = 0; a < 3; a++) s[a] = s[a] / o * t, i ? r[1][a] = r[0][a] + s[a] : (r[0][a] = r[0][a] + s[a], r[1][a] = r[1][a] + s[a]); return n.editVertices(r, e * 2), n.boundingBoxUpdateRequired = !0, !0; } return !1; }, Uz = (n, e) => { const t = e.getBoundingBox(), i = new Ur.THREE.Vector3().subVectors(t.max, t.min), r = new Ur.THREE.BoxGeometry(i.x, i.y, i.z); i.addVectors(t.min, t.max).multiplyScalar(0.5); const s = r.getAttribute("position"), o = s.count, a = []; for (let c = 0; c < o; c++) a[c] = [ s.array[c * 3], s.array[c * 3 + 1], s.array[c * 3 + 2] ]; n.editVertices(a, 0), n.setPosition(i.x, i.y, i.z), r.dispose(); }, Pw = (n, e) => { let t = ""; n.isRegion && (t = `__r${n.regionPath}`), n.isPrimitives && (t = `${n.regionPath}/${n.label}`), e.push(t), n.children && n.children.forEach((i) => Pw(i, e)); }, Ao = (n, e, t, i) => { let r = n; const s = []; if (t && (r = n.findChildFromPath(t)), r) { const o = Array.isArray(e); let a = e; o || (a = [a]), a.forEach((c) => { const l = r.findObjectsWithGroupName(c, i); s.push(...l); }); } return s; }, Jd = (n, e, t) => { const i = n.findIndex((s) => s.uuid === e); let r; return i > -1 && (r = n[i], t && n.splice(i, 1)), r; }, Vz = (n, e) => { const t = []; if (n && e && e.length > 0) { const i = {}, r = {}, s = [n, ...n.getChildRegions(!0)]; let o, a, c; e.forEach((l) => { const d = l.split("/"); c = d[0], o = Jd(s, c, !1), o && (r[c] || (r[c] = o.getFullPath()), d[1] ? (i[c] || (i[c] = o.getAllObjects(!1)), a = Jd(i[c], d[1], !0), a && t.push(`${r[c]}/${a.groupName}`)) : t.push(`__r/${r[c]}`)); }); } return t; }, kz = (n) => { if (n) { const e = []; return n.forEach((i) => { i.isZincObject ? e.push(i) : i.isRegion && e.push(...i.getAllObjects(!0)); }), Object.values( e.reduce((i, r) => ({ ...i, [r.uuid]: r }), {}) ); } return []; }, Zv = (n, e) => { const t = { label: "Multiple selections", regionPath: "", objects: [] }; if (e && n) { const i = {}, r = n.getRootRegion(); e.length > 0 && (t.regionPath = e[0].data.region, t.label = e[0].data.group), e.forEach((s) => { s.data.region.includes(t.regionPath) || (t.regionPath = ""), t.label !== s.data.group && (t.label = "Multiple selections"); const o = r.findChildFromPath(s.data.region); i[o.uuid] || (i[o.uuid] = o.getAllObjects(!1)); const a = Jd(i[o.uuid], s.data.uuid); a && t.objects.push(a); }); } return t; }, Gz = (n) => { const e = n.getMorph(); let t = "position"; n.isLines2 && (t = "instanceStart"); const i = []; let r = 0; const s = e.geometry.getAttribute(t); for (let o = 0; o < n.drawRange; o++) i.push([ s.array[r++], s.array[r++], s.array[r++] ]); return i; }, Hz = (n, e, t, i, r) => { let s; if (n.isPointset ? s = "MultiPoint" : n.isLines2 && (s = "MultiLineString"), s) { const o = Gz(n); let a = e.slice(-1) === "/" ? e : e + "/"; a = a + t; const c = a, l = { resource: i, item: { id: c }, body: { evidence: [], comment: r }, feature: { id: c, properties: { drawn: !0, label: "Drawn annotation" }, geometry: { coordinates: o, type: s } } }; return r === "Deleted" && (l.feature = void 0), l; } }, Xv = (n, e, t, i, r, s, o) => { const a = Hz(t, i, r, s, o); if (a) return n && n.currentUser && (a.creator = { ...n.currentUser }, a.creator.orcid || (a.creator.orcid = "0000-0000-0000-0000"), n.addAnnotation(e, a).then((c) => { c.annotationId || console.log("There is a problem with the submission, please try again later"); }).catch(() => { console.log("There is a problem with the submission, please try again later"); })), a; }, Yv = async (n, e, t) => { const i = t; return await n.drawnFeatures(e, i); }, jh = (n, e) => { n && e.forEach((t) => { const i = t.geometry, r = decodeURIComponent(t.id), s = r.lastIndexOf("/"), o = r.substring(0, s), a = r.substring(s + 1); let c; i.type === "MultiPoint" ? c = n.createPoints( o, a, i.coordinates, a, 8942 ) : i.type === "MultiLineString" && (c = n.createLines( o, a, i.coordinates, 60962 )), c && (c.zincObject.isEditable = !0); }); }, wr = (n, e) => { const t = n.__vccOpts || n; for (const [i, r] of e) t[i] = r; return t; }, Wz = { name: "LinesControls", components: { Button: sa, Col: _i, Container: Wi, InputNumber: yr, Main: vr, Slider: ci, ElIconArrowLeft: jr, ElIconArrowRight: $r }, props: { createData: { type: Object } }, data: function() { return { adjust: 0, pAdjust: 0, lengthScale: 0, distance: 0, newDistance: 0, width: 1, currentIndex: 0, ElIconArrowLeft: In(jr), ElIconArrowRight: In($r), edited: !1, zincObject: void 0 }; }, watch: { "createData.faceIndex": { handler: function(n) { var e; (e = this.zincObject) != null && e.isLines2 && (this.currentIndex = n, this.distance = Pc(this.zincObject, this.currentIndex)); }, immediate: !0 } }, methods: { changeIndex: function(n) { n ? Pc(this.zincObject, this.currentIndex + 1) > 0 && (this.currentIndex++, this.reset()) : (this.currentIndex--, this.reset()); }, onLengthInput: function() { this.newDistance !== 0 ? (this.distance = this.newDistance, this.edited = Wh( this.zincObject, this.currentIndex, this.newDistance, !0 ) || this.edited) : this.newDistance = this.distance; }, onLengthSliding: function() { this.newDistance = Math.pow(10, this.lengthScale) * this.distance, this.edited = Wh( this.zincObject, this.currentIndex, this.newDistance, !0 ) || this.edited; }, onMoveSliding: function() { const n = (this.adjust - this.pAdjust) * this.distance; this.edited = Wh( this.zincObject, this.currentIndex, n, !1 ) || this.edited, this.pAdjust = this.adjust; }, reset: function() { this.adjust = 0, this.pAdjust = 0, this.lengthScale = 0, this.distance = Pc(this.zincObject, this.currentIndex), this.newDistance = this.distance, this.edited && (this.$emit("primitivesUpdated", this.zincObject), this.edited = !1); }, setObject: function(n) { this.currentIndex = -1, this.distance = 0, n.isLines2 ? (this.zincObject = Cn(n), this.width = this.zincObject.getMorph().material.linewidth, n.isEditable && (this.currentIndex = 0, this.distance = Pc(n, this.currentIndex))) : (this.zincObject = void 0, this.width = 10); }, modifyWidth: function() { this.zincObject.setWidth(this.width); } } }; function jz(n, e, t, i, r, s) { const o = _i, a = ci, c = yr, l = Hi, d = sa, h = vr, p = Wi; return pe(), He(p, { class: "lines-container" }, { default: fe(() => [ ae(h, { class: "slides-block" }, { default: fe(() => [ ae(l, null, { default: fe(() => [ ae(o, { offset: 0, span: 6 }, { default: fe(() => [ yt(" Width: ") ]), _: 1 }), ae(o, { offset: 0, span: 12 }, { default: fe(() => [ ae(a, { modelValue: n.width, "onUpdate:modelValue": e[0] || (e[0] = (g) => n.width = g), class: "my-slider", step: 1, min: 1, max: 100, "show-tooltip": !1, onInput: s.modifyWidth }, null, 8, ["modelValue", "onInput"]) ]), _: 1 }), ae(o, { offset: 0, span: 4 }, { default: fe(() => [ ae(c, { modelValue: n.width, "onUpdate:modelValue": e[1] || (e[1] = (g) => n.width = g), step: 1, min: 1, max: 100, controls: !1, class: "input-box number-input" }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }), n.currentIndex > -1 && n.distance > 0 ? (pe(), Re(Wt, { key: 0 }, [ ae(l, null, { default: fe(() => [ ae(o, { offset: 0, span: 4 }, { default: fe(() => [ ae(d, { size: "small", disabled: n.currentIndex === 0, icon: n.ElIconArrowLeft, onClick: e[2] || (e[2] = (g) => s.changeIndex(!1)) }, null, 8, ["disabled", "icon"]) ]), _: 1 }), ae(o, { offset: 4, span: 9 }, { default: fe(() => [ yt(" Editing Line " + wt(n.currentIndex + 1), 1) ]), _: 1 }), ae(o, { offset: 2, span: 2 }, { default: fe(() => [ ae(d, { size: "small", icon: n.ElIconArrowRight, onClick: e[3] || (e[3] = (g) => s.changeIndex(!0)) }, null, 8, ["icon"]) ]), _: 1 }) ]), _: 1 }), ae(l, null, { default: fe(() => [ ae(o, { offset: 0, span: 6 }, { default: fe(() => [ yt(" Move: ") ]), _: 1 }), ae(o, { offset: 0, span: 16 }, { default: fe(() => [ ae(a, { modelValue: n.adjust, "onUpdate:modelValue": e[4] || (e[4] = (g) => n.adjust = g), step: 0.01, min: -3, max: 3, "show-tooltip": !1, onInput: e[5] || (e[5] = (g) => s.onMoveSliding()), onChange: e[6] || (e[6] = (g) => s.reset()) }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }), ae(l, null, { default: fe(() => [ ae(o, { offset: 0, span: 6 }, { default: fe(() => [ yt(" Length: ") ]), _: 1 }), ae(o, { offset: 0, span: 10 }, { default: fe(() => [ ae(a, { modelValue: n.lengthScale, "onUpdate:modelValue": e[7] || (e[7] = (g) => n.lengthScale = g), step: 0.01, min: -1, max: 1, "show-tooltip": !1, onInput: e[8] || (e[8] = (g) => s.onLengthSliding()), onChange: e[9] || (e[9] = (g) => s.reset()) }, null, 8, ["modelValue"]) ]), _: 1 }), ae(o, { offset: 0, span: 6 }, { default: fe(() => [ ae(c, { modelValue: n.newDistance, "onUpdate:modelValue": e[10] || (e[10] = (g) => n.newDistance = g), controls: !1, class: "input-box number-input", onChange: s.onLengthInput }, null, 8, ["modelValue", "onChange"]) ]), _: 1 }) ]), _: 1 }) ], 64)) : Ge("", !0) ]), _: 1 }) ]), _: 1 }); } const Iw = /* @__PURE__ */ wr(Wz, [["render", jz], ["__scopeId", "data-v-6581aa67"]]), $z = { name: "PointsControls", components: { Col: _i, Container: Wi, InputNumber: yr, Main: vr, Select: oa, Slider: ci, Row: Hi, Option: aa, ElIconArrowLeft: jr, ElIconArrowRight: $r }, inject: ["boundingDims"], data: function() { return { attenuation: !1, size: 10, choices: [ { value: !0, label: "On" }, { value: !1, label: "off" } ], min: [0, 0, 0], max: [1, 1, 1], translation: [0, 0, 0], pTranslation: [0, 0, 0], currentIndex: -1, ElIconArrowLeft: In(jr), ElIconArrowRight: In($r), edited: !1, zincObject: void 0 }; }, watch: { boundingDims: { handler: function(n) { const e = n.size; this.min = [ -e[0] / 2, -e[1] / 2, -e[2] / 2 ], this.max = [ e[0] / 2, e[1] / 2, e[2] / 2 ]; }, immediate: !0, deep: !0 } }, methods: { changeIndex: function(n) { n ? this.zincObject.drawRange > this.currentIndex + 1 && (this.currentIndex++, this.reset()) : (this.currentIndex--, this.reset()); }, onMoveSliding: function() { const n = [ this.translation[0] - this.pTranslation[0], this.translation[1] - this.pTranslation[1], this.translation[2] - this.pTranslation[2] ]; this.edited = zz(this.zincObject, this.currentIndex, n) || this.edited; for (let e = 0; e < 3; e++) this.pTranslation[e] = this.translation[e]; }, reset: function() { this.translation = [0, 0, 0], this.pTranslation = [0, 0, 0], this.edited && (this.$emit("primitivesUpdated", this.zincObject), this.edited = !1); }, setObject: function(n) { this.currentIndex = -1, n.isPointset ? (this.zincObject = Cn(n), this.size = this.zincObject.morph.material.size, this.attenuation = this.zincObject.morph.material.sizeAttenuation, n.isEditable && this.zincObject.drawRange > 0 && (this.currentIndex = 0)) : (this.zincObject = void 0, this.size = 10, this.attenuation = !1); }, modifyAttenuation: function(n) { this.attenuation = n, this.zincObject.setSizeAttenuation(n); }, modifySize: function() { this.zincObject.setSize(this.size); } } }; function Zz(n, e, t, i, r, s) { const o = _i, a = ci, c = yr, l = Hi, d = aa, h = oa, p = sa, g = vr, f = Wi; return pe(), He(f, { class: "pointset-container" }, { default: fe(() => [ ae(g, { class: "slides-block" }, { default: fe(() => [ ae(l, null, { default: fe(() => [ ae(o, { offset: 0, span: 6 }, { default: fe(() => [ yt(" Size: ") ]), _: 1 }), ae(o, { offset: 0, span: 10 }, { default: fe(() => [ ae(a, { modelValue: n.size, "onUpdate:modelValue": e[0] || (e[0] = (u) => n.size = u), class: "my-slider", step: 1, min: 0, max: 100, "show-tooltip": !1, onInput: e[1] || (e[1] = (u) => s.modifySize()) }, null, 8, ["modelValue"]) ]), _: 1 }), ae(o, { offset: 0, span: 6 }, { default: fe(() => [ ae(c, { modelValue: n.size, "onUpdate:modelValue": e[2] || (e[2] = (u) => n.size = u), step: 1, min: 0, max: 100, controls: !1, class: "input-box number-input" }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }), ae(l, null, { default: fe(() => [ ae(o, { offset: 0, span: 16 }, { default: fe(() => [ yt(" Size attenuation: ") ]), _: 1 }), ae(o, { offset: 0, span: 5 }, { default: fe(() => [ ae(h, { teleported: !1, "model-value": n.attenuation, placeholder: "Select", class: "input-box", "popper-class": "viewer_dropdown", onChange: e[3] || (e[3] = (u) => s.modifyAttenuation(u, n.slide)) }, { default: fe(() => [ (pe(!0), Re(Wt, null, ri(n.choices, (u) => (pe(), He(d, { key: u.value, label: u.label, value: u.value }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["model-value"]) ]), _: 1 }) ]), _: 1 }), n.currentIndex > -1 ? (pe(), Re(Wt, { key: 0 }, [ ae(l, null, { default: fe(() => [ ae(o, { offset: 0, span: 4 }, { default: fe(() => [ ae(p, { size: "small", disabled: n.currentIndex === 0, icon: n.ElIconArrowLeft, onClick: e[4] || (e[4] = (u) => s.changeIndex(!1)) }, null, 8, ["disabled", "icon"]) ]), _: 1 }), ae(o, { offset: 4, span: 9 }, { default: fe(() => [ yt(" Editing Point " + wt(n.currentIndex + 1), 1) ]), _: 1 }), ae(o, { offset: 2, span: 2 }, { default: fe(() => [ ae(p, { size: "small", icon: n.ElIconArrowRight, onClick: e[5] || (e[5] = (u) => s.changeIndex(!0)) }, null, 8, ["icon"]) ]), _: 1 }) ]), _: 1 }), ae(l, null, { default: fe(() => [ ae(o, { offset: 0, span: 6 }, { default: fe(() => [ yt(" x: ") ]), _: 1 }), ae(o, { offset: 0, span: 16 }, { default: fe(() => [ ae(a, { modelValue: n.translation[0], "onUpdate:modelValue": e[6] || (e[6] = (u) => n.translation[0] = u), step: 0.01, min: n.min[0], max: n.max[0], "show-tooltip": !1, onInput: e[7] || (e[7] = (u) => s.onMoveSliding()), onChange: e[8] || (e[8] = (u) => s.reset()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), ae(l, null, { default: fe(() => [ ae(o, { offset: 0, span: 6 }, { default: fe(() => [ yt(" y: ") ]), _: 1 }), ae(o, { offset: 0, span: 16 }, { default: fe(() => [ ae(a, { modelValue: n.translation[1], "onUpdate:modelValue": e[9] || (e[9] = (u) => n.translation[1] = u), step: 0.01, min: n.min[1], max: n.max[1], "show-tooltip": !1, onInput: e[10] || (e[10] = (u) => s.onMoveSliding()), onChange: e[11] || (e[11] = (u) => s.reset()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), ae(l, null, { default: fe(() => [ ae(o, { offset: 0, span: 6 }, { default: fe(() => [ yt(" z: ") ]), _: 1 }), ae(o, { offset: 0, span: 16 }, { default: fe(() => [ ae(a, { modelValue: n.translation[2], "onUpdate:modelValue": e[12] || (e[12] = (u) => n.translation[2] = u), step: 0.01, min: n.min[2], max: n.max[2], "show-tooltip": !1, onInput: e[13] || (e[13] = (u) => s.onMoveSliding()), onChange: e[14] || (e[14] = (u) => s.reset()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }) ], 64)) : Ge("", !0) ]), _: 1 }) ]), _: 1 }); } const Ow = /* @__PURE__ */ wr($z, [["render", Zz], ["__scopeId", "data-v-d1de9c65"]]), Xz = { name: "TextureSlidesControls", components: { Col: _i, Container: Wi, Footer: Ty, Icon: Bt, InputNumber: yr, Main: vr, Row: Hi, Select: oa, Slider: ci, Option: aa, ElIconDelete: Xc, ElIconPlus: fu }, data: function() { return { settings: [], directions: [ { value: "x", label: "x" }, { value: "y", label: "y" }, { value: "z", label: "z" } ], zincObject: void 0 }; }, methods: { setObject: function(n) { n.isTextureSlides ? (this.zincObject = Cn(n), this.settings = this.zincObject.getTextureSettings()) : (this.zincObject = void 0, this.settings = []); }, addNewSlide: function() { const n = { direction: "x", value: 0 }, e = this.zincObject.createSlide(n); this.settings.push(e); }, modifyDirection: function(n, e) { e && (e.direction = n, this.zincObject.modifySlideSettings(e)); }, modifySlide: function(n) { n && this.zincObject.modifySlideSettings(n); }, removeSlide: function(n, e) { this.zincObject.removeSlideWithId(e.id), this.settings.splice(n, 1); } } }; function Yz(n, e, t, i, r, s) { const o = aa, a = oa, c = _i, l = ci, d = yr, h = Xc, p = Bt, g = Hi, f = vr, u = fu, y = Ty, v = Wi; return pe(), He(v, { class: "t-slides-container" }, { default: fe(() => [ ae(f, { class: "slides-block" }, { default: fe(() => [ (pe(!0), Re(Wt, null, ri(n.settings, (m, w) => (pe(), He(g, { key: m.id, class: "slide-row" }, { default: fe(() => [ ae(c, { offset: 0, span: 6 }, { default: fe(() => [ ae(a, { teleported: !1, "model-value": m.direction, placeholder: "Select", class: "input-box", "popper-class": "viewer_dropdown", onChange: (S) => s.modifyDirection(S, m) }, { default: fe(() => [ (pe(!0), Re(Wt, null, ri(n.directions, (S) => (pe(), He(o, { key: S.value, label: S.label, value: S.value }, null, 8, ["label", "value"]))), 128)) ]), _: 2 }, 1032, ["model-value", "onChange"]) ]), _: 2 }, 1024), ae(c, { offset: 0, span: 10 }, { default: fe(() => [ ae(l, { modelValue: m.value, "onUpdate:modelValue": (S) => m.value = S, class: "my-slider", step: 0.01, min: 0, max: 1, "show-tooltip": !1, onInput: (S) => s.modifySlide(m) }, null, 8, ["modelValue", "onUpdate:modelValue", "onInput"]) ]), _: 2 }, 1024), ae(c, { offset: 0, span: 6 }, { default: fe(() => [ ae(d, { modelValue: m.value, "onUpdate:modelValue": (S) => m.value = S, step: 0.01, min: 0, max: 1, controls: !1, class: "input-box number-input" }, null, 8, ["modelValue", "onUpdate:modelValue"]) ]), _: 2 }, 1024), ae(c, { offset: 0, span: 2 }, { default: fe(() => [ ae(p, { class: "delete-icon", onClick: (S) => s.removeSlide(w, m) }, { default: fe(() => [ ae(h) ]), _: 2 }, 1032, ["onClick"]) ]), _: 2 }, 1024) ]), _: 2 }, 1024))), 128)) ]), _: 1 }), ae(y, { height: "30px", class: "add-slides-text", onClick: s.addNewSlide }, { default: fe(() => [ ae(g, null, { default: fe(() => [ ae(c, { span: 2 }, { default: fe(() => [ ae(p, null, { default: fe(() => [ ae(u) ]), _: 1 }) ]), _: 1 }), ae(c, { span: 20 }, { default: fe(() => [ yt(" Add a new slide ") ]), _: 1 }) ]), _: 1 }) ]), _: 1 }, 8, ["onClick"]) ]), _: 1 }); } const Dw = /* @__PURE__ */ wr(Xz, [["render", Yz], ["__scopeId", "data-v-12185b7f"]]), Jz = { name: "TransformationControls", components: { Col: _i, Container: Wi, InputNumber: yr, Main: vr, Slider: ci }, inject: ["boundingDims"], data: function() { return { x: 0, y: 0, z: 0, scale: 1, min: [0, 0, 0], max: [1, 1, 1], zincObject: void 0 }; }, watch: { boundingDims: { handler: function(n) { const e = n.centre, t = n.size; this.min = [ e[0] - t[0], e[1] - t[1], e[2] - t[2] ], this.max = [ e[0] + t[0], e[1] + t[1], e[2] + t[2] ]; }, immediate: !0, deep: !0 } }, methods: { setObject: function(n) { if (n.isZincObject) { this.zincObject = Cn(n); const e = this.zincObject.getGroup(); e && e.position && (this.x = e.position.x, this.y = e.position.y, this.z = e.position.z, this.scale = e.scale.x); } else this.zincObject = void 0, this.x = 0, this.y = 0, this.z = 0, this.scale = 1; }, modifyPosition: function() { this.zincObject.setPosition(this.x, this.y, this.z); }, modifyScale: function() { this.zincObject.setScaleAll(this.scale); } } }; function qz(n, e, t, i, r, s) { const o = _i, a = ci, c = yr, l = Hi, d = vr, h = Wi; return pe(), He(h, { class: "transformation-container" }, { default: fe(() => [ ae(d, { class: "slides-block" }, { default: fe(() => [ ae(l, { class: "tool-row" }, { default: fe(() => [ ae(o, { offset: 0, span: 6 }, { default: fe(() => [ yt(" x: ") ]), _: 1 }), ae(o, { offset: 0, span: 10 }, { default: fe(() => [ ae(a, { modelValue: n.x, "onUpdate:modelValue": e[0] || (e[0] = (p) => n.x = p), step: 0.01, min: n.min[0], max: n.max[0], "show-tooltip": !1, onInput: e[1] || (e[1] = (p) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }), ae(o, { offset: 0, span: 6 }, { default: fe(() => [ ae(c, { modelValue: n.x, "onUpdate:modelValue": e[2] || (e[2] = (p) => n.x = p), step: 0.01, min: n.min[0], max: n.max[0], controls: !1, class: "input-box number-input", onChange: e[3] || (e[3] = (p) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), ae(l, { class: "tool-row" }, { default: fe(() => [ ae(o, { offset: 0, span: 6 }, { default: fe(() => [ yt(" y: ") ]), _: 1 }), ae(o, { offset: 0, span: 10 }, { default: fe(() => [ ae(a, { modelValue: n.y, "onUpdate:modelValue": e[4] || (e[4] = (p) => n.y = p), step: 0.01, min: n.min[1], max: n.max[1], "show-tooltip": !1, onInput: e[5] || (e[5] = (p) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }), ae(o, { offset: 0, span: 6 }, { default: fe(() => [ ae(c, { modelValue: n.y, "onUpdate:modelValue": e[6] || (e[6] = (p) => n.y = p), step: 0.01, min: n.min[1], max: n.max[1], controls: !1, class: "input-box number-input", onChange: e[7] || (e[7] = (p) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), ae(l, { class: "tool-row" }, { default: fe(() => [ ae(o, { offset: 0, span: 6 }, { default: fe(() => [ yt(" z: ") ]), _: 1 }), ae(o, { offset: 0, span: 10 }, { default: fe(() => [ ae(a, { modelValue: n.z, "onUpdate:modelValue": e[8] || (e[8] = (p) => n.z = p), step: 0.01, min: n.min[2], max: n.max[2], "show-tooltip": !1, onInput: e[9] || (e[9] = (p) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }), ae(o, { offset: 0, span: 6 }, { default: fe(() => [ ae(c, { modelValue: n.z, "onUpdate:modelValue": e[10] || (e[10] = (p) => n.z = p), step: 0.01, min: n.min[2], max: n.max[2], controls: !1, class: "input-box number-input", onChange: e[11] || (e[11] = (p) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), ae(l, { class: "tool-row" }, { default: fe(() => [ ae(o, { offset: 0, span: 6 }, { default: fe(() => [ yt(" Scale: ") ]), _: 1 }), ae(o, { offset: 0, span: 10 }, { default: fe(() => [ ae(a, { modelValue: n.scale, "onUpdate:modelValue": e[12] || (e[12] = (p) => n.scale = p), step: 0.01, min: 0, max: 5, "show-tooltip": !1, onInput: e[13] || (e[13] = (p) => s.modifyScale()) }, null, 8, ["modelValue"]) ]), _: 1 }), ae(o, { offset: 0, span: 6 }, { default: fe(() => [ ae(c, { modelValue: n.scale, "onUpdate:modelValue": e[14] || (e[14] = (p) => n.scale = p), step: 0.01, min: 0, max: 5, controls: !1, class: "input-box number-input", onChange: e[15] || (e[15] = (p) => s.modifyScale()) }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }) ]), _: 1 }) ]), _: 1 }); } const Nw = /* @__PURE__ */ wr(Jz, [["render", qz], ["__scopeId", "data-v-6b3997b7"]]), Kz = { name: "OpacityControls", components: { Container: Wi, Header: JL, Main: vr, Slider: ci }, props: { material: void 0, zincObject: void 0 }, data: function() { return { displayString: "100%" }; }, watch: { "material.opacity": function() { this.material && this.zincObject && this.zincObject.setAlpha(this.material.opacity); } }, methods: { formatTooltip(n) { return this.displayString = Math.floor(100 * n + 0.5) + "%", this.displayString; } } }, Qz = { class: "block" }, eU = { class: "display" }; function tU(n, e, t, i, r, s) { const o = ci, a = Wi; return t.material ? (pe(), He(a, { key: 0, class: "opacity-container" }, { default: fe(() => [ Be("div", Qz, [ Be("span", eU, wt(n.displayString), 1), ae(o, { modelValue: t.material.opacity, "onUpdate:modelValue": e[0] || (e[0] = (c) => t.material.opacity = c), class: "my-slider", step: 0.01, min: 0, max: 1, "format-tooltip": s.formatTooltip, "show-tooltip": !1 }, null, 8, ["modelValue", "format-tooltip"]) ]) ]), _: 1 })) : Ge("", !0); } const Fw = /* @__PURE__ */ wr(Kz, [["render", tU], ["__scopeId", "data-v-cbfc46a5"]]), nU = { name: "PrimitiveControls", components: { Collapse: by, CollapseItem: xy, LinesControls: Iw, OpacityControls: Fw, PointsControls: Ow, TextureSlidesControls: Dw, TransformationControls: Nw, ElIconArrowRight: $r }, props: { createData: { type: Object } }, data: function() { return { activeName: "oControls", material: void 0, isTextureSlides: !1, isPointset: !1, isLines: !1, drawerOpen: !0, zincObject: void 0, isEditable: !1, displayString: "100%" }; }, methods: { formatTooltip: function(n) { return this.displayString = Math.floor(100 * n + 0.5) + "%", this.displayString; }, toggleDrawer: function() { this.drawerOpen = !this.drawerOpen; }, setObject: function(n) { var e; n ? this.zincObject = Cn(n) : this.zincObject = void 0, this.isEditable = !!((e = this.zincObject) != null && e.isEditable), this.isPointset = !1, this.isTextureSlides = !1, this.isLines = !1, this.activeName = "trControls", n && (n.isTextureSlides ? (this.isTextureSlides = !0, this.$refs.tSlidesControls.setObject(n), this.activeName = "tsControls") : n.isPointset ? (this.isPointset = !0, this.$refs.pointsetControls.setObject(n), this.activeName = "pControls") : n.isLines2 && (this.isLines = !0, this.$refs.linesControls.setObject(n), this.activeName = "lControls"), n.isTextureSlides || this.$refs.transformationControls.setObject(n)), n && n.getMorph() ? this.material = n.getMorph().material : this.material = void 0; } } }; function iU(n, e, t, i, r, s) { const o = Fw, a = xy, c = Nw, l = Dw, d = Ow, h = Iw, p = by, g = $r, f = Bt; return Ft((pe(), Re("div", { class: Le(["primitive-controls", { open: n.drawerOpen, close: !n.drawerOpen }]) }, [ Be("div", { class: Le(["my-drawer", { open: n.drawerOpen, close: !n.drawerOpen }]) }, [ ae(p, { class: "collapse", modelValue: n.activeName, "onUpdate:modelValue": e[2] || (e[2] = (u) => n.activeName = u), accordion: "" }, { default: fe(() => [ Ft(ae(a, { title: "Opacity", name: "oControls" }, { default: fe(() => [ ae(o, { material: n.material, zincObject: n.zincObject, ref: "opacityControls" }, null, 8, ["material", "zincObject"]) ]), _: 1 }, 512), [ [xn, !n.isTextureSlides] ]), Ft(ae(a, { title: "Transformation", name: "trControls" }, { default: fe(() => [ ae(c, { class: "transformation-controls", ref: "transformationControls" }, null, 512) ]), _: 1 }, 512), [ [xn, !n.isEditable] ]), Ft(ae(a, { title: "Texture Slides", name: "tsControls" }, { default: fe(() => [ ae(l, { class: "texture-controls", ref: "tSlidesControls" }, null, 512) ]), _: 1 }, 512), [ [xn, n.isTextureSlides] ]), Ft(ae(a, { title: "Points", name: "pControls" }, { default: fe(() => [ ae(d, { class: "pointset-controls", ref: "pointsetControls", onPrimitivesUpdated: e[0] || (e[0] = (u) => n.$emit("primitivesUpdated", u)) }, null, 512) ]), _: 1 }, 512), [ [xn, n.isPointset] ]), Ft(ae(a, { title: "Lines", name: "lControls" }, { default: fe(() => [ ae(h, { class: "lines-controls", ref: "linesControls", createData: t.createData, onPrimitivesUpdated: e[1] || (e[1] = (u) => n.$emit("primitivesUpdated", u)) }, null, 8, ["createData"]) ]), _: 1 }, 512), [ [xn, n.isLines] ]) ]), _: 1 }, 8, ["modelValue"]) ], 2), Be("div", { class: Le(["drawer-button", { open: n.drawerOpen, close: !n.drawerOpen }]), onClick: e[3] || (e[3] = (...u) => s.toggleDrawer && s.toggleDrawer(...u)) }, [ ae(f, null, { default: fe(() => [ ae(g) ]), _: 1 }) ], 2) ], 2)), [ [xn, n.material || n.isTextureSlides] ]); } const Bw = /* @__PURE__ */ wr(nU, [["render", iU], ["__scopeId", "data-v-764a8efa"]]), rU = (n, e) => { const t = n.label.toUpperCase(), i = e.label.toUpperCase(); return t < i ? -1 : t > i ? 1 : 0; }, sU = { name: "ScaffoldTreeControls", components: { ElIconArrowLeft: jr, TreeControls: g1 }, props: { /** * Enable/disable colour picker */ showColourPicker: Boolean, isReady: Boolean }, data: function() { return { treeData: [ { label: "Root", regionPath: "", id: void 0, children: [] } ], active: [], hover: [], drawerOpen: !0, nodeNumbers: 0, module: void 0 }; }, computed: { treeDataEntry: function() { return this.treeData[0].children; } }, watch: { treeDataEntry: { deep: !0, handler: function(n) { this.isReady && this.setColourField(n); } } }, methods: { addTreeItem: function(n, e, t) { n.some((i) => i.label === e.label) || (Object.assign(e, { activeColour: this.getColour(e) }), n.push(e), n.sort((i, r) => rU(i, r)), this.nodeNumbers++, this.$nextTick(() => { !this.$refs.treeControls.$refs.regionTree.getCheckedKeys().includes(e.id) && t.getVisibility() && this.$refs.treeControls.$refs.regionTree.setChecked(e.id, !0); })); }, // find or create new region, region id is always prefixed with // '__r/' findOrCreateRegion: function(n, e, t) { if (this.module && this.module.scene && (this.treeData[0].id = this.module.scene.getRootRegion().uuid, this.treeData[0].isRegion = !0), e.length > 0) { const i = [...e]; let r = n.children.find( (a) => a.label == i[0] ); const s = t + "/" + e[0], o = this.module.scene.getRootRegion().findChildFromPath(s); return r || (r = { label: i[0], id: o.uuid, children: [], regionPath: s, isRegion: !0 }, this.addTreeItem(n.children, r, o), s === "/_helper" && this.$nextTick(() => { this.$refs.treeControls.$refs.regionTree.setChecked(r.id, !1); })), i.shift(), this.findOrCreateRegion(r, i, s); } else return n; }, /** * This is called when a new zinc object is read into the scene. */ zincObjectAdded: function(n) { const e = n.region; if (e) { const t = e.getFullSeparatedPath(), i = this.findOrCreateRegion(this.treeData[0], t, ""); if (n.groupName && i) { i.children || (i.children = []); const r = { label: n.groupName, id: e.uuid + "/" + n.uuid, isPrimitives: !0, regionPath: n.region.getFullPath(), isTextureSlides: !!n.isTextureSlides }; this.addTreeItem(i.children, r, n); } } }, zincObjectRemoved: function(n) { const e = n.groupName; if (n.region.findObjectsWithGroupName(e, !1).length === 0) { const i = n.region.getFullSeparatedPath(), r = this.findOrCreateRegion(this.treeData[0], i, ""); if (r.children) { for (let s = 0; s < r.children.length; s++) if (r.children[s].label === e) { r.children.splice(s, 1), this.nodeNumbers--; return; } } } }, checkChanged: function(n, e) { const t = n.isRegion, i = n.isPrimitives, r = e.checkedKeys.includes(n.id), s = this.module.scene.getRootRegion().findChildFromPath(n.regionPath); t && (r ? s.showAllPrimitives() : s.hideAllPrimitives()), i && s.findObjectsWithGroupName(n.label).forEach((a) => { a.setVisibility(r); }); }, updateActiveUI: function(n) { this.active.length = 0, $v(n, this.active); }, changeActiveByPrimitives: function(n, e) { n && n.length > 0 ? (this.updateActiveUI(n), this.$emit("object-selected", n, e)) : this.removeActive(e), this.removeHover(e); }, updateHoverUI: function(n) { this.hover.length = 0, $v(n, this.hover); }, changeHoverByPrimitives: function(n, e) { n && n.length > 0 ? (this.updateHoverUI(n), this.$emit("object-hovered", n, e)) : this.removeHover(e); }, /** * Select a region by its name. */ changeActiveByNames: function(n, e, t) { const i = this.module.scene.getRootRegion(), r = Ao( i, n, e, !0 ); this.changeActiveByPrimitives(r, t); }, /** * Hover a region by its name. */ changeHoverByNames: function(n, e, t) { const i = this.module.scene.getRootRegion(), r = Ao( i, n, e, !0 ); this.changeHoverByPrimitives(r, t); }, changeActiveByNode: function(n, e) { if (n.isPrimitives || n.isRegion) { const t = !!n.isRegion, i = this.getZincObjectsFromNode(n, t); this.changeActiveByPrimitives(i, e); } }, changeHoverByNode: function(n, e) { if (n.isPrimitives) { const t = this.getZincObjectsFromNode(n, !1); this.changeHoverByPrimitives(t, e); } }, /** * Unselect the current selected region. */ removeActive: function(n) { this.active = [], this.$emit("object-selected", [], n); }, /** * Unselect the current hover region. */ removeHover: function(n) { this.hover = [], this.$emit("object-hovered", [], n); }, /** * Reset the controls. */ clear: function() { this.active.length = 0, this.hover.length = 0, this.nodeNumbers = 0, this.$refs.treeControls.$refs.regionTree.updateKeyChildren( this.treeData[0].id, [] ), this.treeData[0].children.length = 0, this.treeData[0].id = void 0, this.$emit("object-selected", []); }, getColour: function(n) { if (n) { let t = this.getZincObjectsFromNode(n, !1)[0]; if (t) { let i = t.getColourHex(); if (i) return "#" + i; } } return "#FFFFFF"; }, getZincObjectsFromNode: function(n, e) { const t = this.module.scene.getRootRegion(); if (n.isPrimitives) return Ao( t, n.label, n.regionPath, e ); if (n.isRegion && n.regionPath) { let i = t.findChildFromPath(n.regionPath); if (i) return i.getAllObjects(e); } return []; }, //Set this right at the beginning. setModule: function(n) { this.module = Cn(n), this.nodeNumbers = 0, this.module.scene.getRootRegion().getAllObjects(!0).forEach((t) => { this.zincObjectAdded(t); }), this.module.addOrganPartAddedCallback(this.zincObjectAdded), this.module.addOrganPartRemovedCallback(this.zincObjectRemoved); }, setColourField: function(n, e = void 0) { n.filter((t) => e && !t.children ? t.id === e.id : !0).map((t) => { if (t.children) this.setColourField(t.children, e); else { const i = this.getColour(t); t.defaultColour || (t.defaultColour = i), t.activeColour = i; } }); }, setColour: function(n, e) { n && n.isPrimitives && this.getZincObjectsFromNode(n, !1).forEach((i) => { let s = (e || n.defaultColour).replace("#", "0x"); i.setColourHex(s), this.setColourField(this.treeData[0].children, n); }); }, visibilityToggle: function(n, e) { this.module.changeOrganPartsVisibility(n, e), e == !1 && (this.activeRegion === n && this.removeActive(!0), this.hoverRegion === n && this.removeHover(!0)); }, toggleDrawer: function() { this.drawerOpen = !this.drawerOpen, this.$emit("drawer-toggled", this.drawerOpen); }, //Set visibility using full paths and add found id to the ids list //and remove item from list if remove is set to true. setTreeVisibilityWithFullPaths: function(n, e, t, i) { let r = !1, s = ""; n.isRegion && (s = `__r${n.regionPath}`), n.isPrimitives && (s = `${n.regionPath}/${n.label}`); const o = e.indexOf(s); o > -1 && (r = !0, e.splice(o, 1), t.push(n.id)); const a = this.module.scene.getRootRegion().findChildFromPath(n.regionPath); s && s !== "__r" && n.isPrimitives && a.findObjectsWithGroupName(n.label).forEach((l) => l.setVisibility(r)), n.children && n.children.forEach((c) => { this.setTreeVisibilityWithFullPaths(c, e, t, !0); }); }, checkAllKeys: function() { const n = [], e = []; Pw(this.treeData[0], n), this.setTreeVisibilityWithFullPaths( this.treeData[0], n, e, !0 ), this.$refs.treeControls.$refs.regionTree.setCheckedKeys(e); }, getState: function() { let n = this.$refs.treeControls.$refs.regionTree.getCheckedKeys(); return n.length === this.nodeNumbers ? { checkAll: !0, version: "2.0" } : { checkedItems: Vz( this.module.scene.getRootRegion(), n ), version: "2.0" }; }, setState: function(n) { if (n) { if (n.checkAll) this.checkAllKeys(); else if (n.checkedItems) { let e = []; n.version !== "2.0" ? (e = n.checkedItems.map((i) => "/" + i), e.shift("__r/")) : e.push(...n.checkedItems); const t = []; this.setTreeVisibilityWithFullPaths( this.treeData[0], e, t, !0 ), this.$refs.treeControls.$refs.regionTree.setCheckedKeys(t); } } } } }, oU = { class: "traditional-container" }; function aU(n, e, t, i, r, s) { const o = Xn("TreeControls"), a = jr, c = Bt; return pe(), Re("div", { class: Le(["tree-controls", { open: n.drawerOpen, close: !n.drawerOpen }]) }, [ Be("div", oU, [ ae(o, { mapType: "scaffold", title: "Regions", isReady: t.isReady, treeData: s.treeDataEntry, active: n.active, hover: n.hover, showColourPicker: t.showColourPicker, onSetColour: s.setColour, onCheckChanged: s.checkChanged, onChangeActive: s.changeActiveByNode, onChangeHover: s.changeHoverByNode, ref: "treeControls" }, null, 8, ["isReady", "treeData", "active", "hover", "showColourPicker", "onSetColour", "onCheckChanged", "onChangeActive", "onChangeHover"]) ]), Be("div", { class: Le(["drawer-button", { open: n.drawerOpen, close: !n.drawerOpen }]), onClick: e[0] || (e[0] = (...l) => s.toggleDrawer && s.toggleDrawer(...l)) }, [ ae(c, null, { default: fe(() => [ ae(a) ]), _: 1 }) ], 2) ], 2); } const zw = /* @__PURE__ */ wr(sU, [["render", aU], ["__scopeId", "data-v-13a8c030"]]); var lU = !1; function Ic(n, e, t) { return Array.isArray(n) ? (n.length = Math.max(n.length, e), n.splice(e, 1, t), t) : (n[e] = t, t); } function $h(n, e) { if (Array.isArray(n)) { n.splice(e, 1); return; } delete n[e]; } /*! * pinia v2.2.1 * (c) 2024 Eduardo San Martin Morote * @license MIT */ let Na; const ru = (n) => Na = n, cU = process.env.NODE_ENV !== "production" ? Symbol("pinia") : ( /* istanbul ignore next */ Symbol() ); function Us(n) { return n && typeof n == "object" && Object.prototype.toString.call(n) === "[object Object]" && typeof n.toJSON != "function"; } var Wa; (function(n) { n.direct = "direct", n.patchObject = "patch object", n.patchFunction = "patch function"; })(Wa || (Wa = {})); const Fa = typeof window < "u"; function Uw(n, e) { for (const t in e) { const i = e[t]; if (!(t in n)) continue; const r = n[t]; Us(r) && Us(i) && !Ls(i) && !af(i) ? n[t] = Uw(r, i) : n[t] = i; } return n; } const Vw = () => { }; function Jv(n, e, t, i = Vw) { n.push(e); const r = () => { const s = n.indexOf(e); s > -1 && (n.splice(s, 1), i()); }; return !t && a0() && l0(r), r; } function vo(n, ...e) { n.slice().forEach((t) => { t(...e); }); } const uU = (n) => n(), qv = Symbol(), Zh = Symbol(); function qd(n, e) { n instanceof Map && e instanceof Map ? e.forEach((t, i) => n.set(i, t)) : n instanceof Set && e instanceof Set && e.forEach(n.add, n); for (const t in e) { if (!e.hasOwnProperty(t)) continue; const i = e[t], r = n[t]; Us(r) && Us(i) && n.hasOwnProperty(t) && !Ls(i) && !af(i) ? n[t] = qd(r, i) : n[t] = i; } return n; } const hU = process.env.NODE_ENV !== "production" ? Symbol("pinia:skipHydration") : ( /* istanbul ignore next */ Symbol() ); function dU(n) { return !Us(n) || !n.hasOwnProperty(hU); } const { assign: ni } = Object; function Kv(n) { return !!(Ls(n) && n.effect); } function Qv(n, e, t, i) { const { state: r, actions: s, getters: o } = e, a = t.state.value[n]; let c; function l() { !a && (process.env.NODE_ENV === "production" || !i) && (t.state.value[n] = r ? r() : {}); const d = process.env.NODE_ENV !== "production" && i ? ( // use ref() to unwrap refs inside state TODO: check if this is still necessary cr(Ae(r ? r() : {}).value) ) : cr(t.state.value[n]); return ni(d, s, Object.keys(o || {}).reduce((h, p) => (process.env.NODE_ENV !== "production" && p in d && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${p}" in store "${n}".`), h[p] = Cn(ce(() => { ru(t); const g = t._s.get(n); return o[p].call(g, g); })), h), {})); } return c = Kd(n, l, e, t, i, !0), c; } function Kd(n, e, t = {}, i, r, s) { let o; const a = ni({ actions: {} }, t); if (process.env.NODE_ENV !== "production" && !i._e.active) throw new Error("Pinia destroyed"); const c = { deep: !0 }; process.env.NODE_ENV !== "production" && !lU && (c.onTrigger = (L) => { l ? g = L : l == !1 && !x._hotUpdating && (Array.isArray(g) ? g.push(L) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.")); }); let l, d, h = [], p = [], g; const f = i.state.value[n]; !s && !f && (process.env.NODE_ENV === "production" || !r) && (i.state.value[n] = {}); const u = Ae({}); let y; function v(L) { let R; l = d = !1, process.env.NODE_ENV !== "production" && (g = []), typeof L == "function" ? (L(i.state.value[n]), R = { type: Wa.patchFunction, storeId: n, events: g }) : (qd(i.state.value[n], L), R = { type: Wa.patchObject, payload: L, storeId: n, events: g }); const C = y = Symbol(); Mt().then(() => { y === C && (l = !0); }), d = !0, vo(h, R, i.state.value[n]); } const m = s ? function() { const { state: R } = t, C = R ? R() : {}; this.$patch((A) => { ni(A, C); }); } : ( /* istanbul ignore next */ process.env.NODE_ENV !== "production" ? () => { throw new Error(`🍍: Store "${n}" is built using the setup syntax and does not implement $reset().`); } : Vw ); function w() { o.stop(), h = [], p = [], i._s.delete(n); } const S = (L, R = "") => { if (qv in L) return L[Zh] = R, L; const C = function() { ru(i); const A = Array.from(arguments), P = [], I = []; function b(D) { P.push(D); } function O(D) { I.push(D); } vo(p, { args: A, name: C[Zh], store: x, after: b, onError: O }); let N; try { N = L.apply(this && this.$id === n ? this : x, A); } catch (D) { throw vo(I, D), D; } return N instanceof Promise ? N.then((D) => (vo(P, D), D)).catch((D) => (vo(I, D), Promise.reject(D))) : (vo(P, N), N); }; return C[qv] = !0, C[Zh] = R, C; }, T = /* @__PURE__ */ Cn({ actions: {}, getters: {}, state: [], hotState: u }), M = { _p: i, // _s: scope, $id: n, $onAction: Jv.bind(null, p), $patch: v, $reset: m, $subscribe(L, R = {}) { const C = Jv(h, L, R.detached, () => A()), A = o.run(() => Ke(() => i.state.value[n], (P) => { (R.flush === "sync" ? d : l) && L({ storeId: n, type: Wa.direct, events: g }, P); }, ni({}, c, R))); return C; }, $dispose: w }, x = qn(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Fa ? ni( { _hmrPayload: T, _customProperties: Cn(/* @__PURE__ */ new Set()) // devtools custom properties }, M // must be added later // setupStore ) : M); i._s.set(n, x); const E = (i._a && i._a.runWithContext || uU)(() => i._e.run(() => (o = f1()).run(() => e({ action: S })))); for (const L in E) { const R = E[L]; if (Ls(R) && !Kv(R) || af(R)) process.env.NODE_ENV !== "production" && r ? Ic(u.value, L, Bn(E, L)) : s || (f && dU(R) && (Ls(R) ? R.value = f[L] : qd(R, f[L])), i.state.value[n][L] = R), process.env.NODE_ENV !== "production" && T.state.push(L); else if (typeof R == "function") { const C = process.env.NODE_ENV !== "production" && r ? R : S(R, L); E[L] = C, process.env.NODE_ENV !== "production" && (T.actions[L] = R), a.actions[L] = R; } else process.env.NODE_ENV !== "production" && Kv(R) && (T.getters[L] = s ? ( // @ts-expect-error t.getters[L] ) : R, Fa && (E._getters || // @ts-expect-error: same (E._getters = Cn([]))).push(L)); } if (ni(x, E), ni(of(x), E), Object.defineProperty(x, "$state", { get: () => process.env.NODE_ENV !== "production" && r ? u.value : i.state.value[n], set: (L) => { if (process.env.NODE_ENV !== "production" && r) throw new Error("cannot set hotState"); v((R) => { ni(R, L); }); } }), process.env.NODE_ENV !== "production" && (x._hotUpdate = Cn((L) => { x._hotUpdating = !0, L._hmrPayload.state.forEach((R) => { if (R in x.$state) { const C = L.$state[R], A = x.$state[R]; typeof C == "object" && Us(C) && Us(A) ? Uw(C, A) : L.$state[R] = A; } Ic(x, R, Bn(L.$state, R)); }), Object.keys(x.$state).forEach((R) => { R in L.$state || $h(x, R); }), l = !1, d = !1, i.state.value[n] = Bn(L._hmrPayload, "hotState"), d = !0, Mt().then(() => { l = !0; }); for (const R in L._hmrPayload.actions) { const C = L[R]; Ic(x, R, S(C, R)); } for (const R in L._hmrPayload.getters) { const C = L._hmrPayload.getters[R], A = s ? ( // special handling of options api ce(() => (ru(i), C.call(x, x))) ) : C; Ic(x, R, A); } Object.keys(x._hmrPayload.getters).forEach((R) => { R in L._hmrPayload.getters || $h(x, R); }), Object.keys(x._hmrPayload.actions).forEach((R) => { R in L._hmrPayload.actions || $h(x, R); }), x._hmrPayload = L._hmrPayload, x._getters = L._getters, x._hotUpdating = !1; })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Fa) { const L = { writable: !0, configurable: !0, // avoid warning on devtools trying to display this property enumerable: !1 }; ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((R) => { Object.defineProperty(x, R, ni({ value: x[R] }, L)); }); } return i._p.forEach((L) => { if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Fa) { const R = o.run(() => L({ store: x, app: i._a, pinia: i, options: a })); Object.keys(R || {}).forEach((C) => x._customProperties.add(C)), ni(x, R); } else ni(x, o.run(() => L({ store: x, app: i._a, pinia: i, options: a }))); }), process.env.NODE_ENV !== "production" && x.$state && typeof x.$state == "object" && typeof x.$state.constructor == "function" && !x.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be state: () => new MyClass() Found in store "${x.$id}".`), f && s && t.hydrate && t.hydrate(x.$state, f), l = !0, d = !0, x; } function fU(n, e, t) { let i, r; const s = typeof e == "function"; i = n, r = s ? t : e; function o(a, c) { const l = d1(); if (a = // in test mode, ignore the argument provided as we can always retrieve a // pinia instance with getActivePinia() (process.env.NODE_ENV === "test" && Na && Na._testing ? null : a) || (l ? ht(cU, null) : null), a && ru(a), process.env.NODE_ENV !== "production" && !Na) throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"? See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help. This will fail in production.`); a = Na, a._s.has(i) || (s ? Kd(i, e, r, a) : Qv(i, r, a), process.env.NODE_ENV !== "production" && (o._pinia = a)); const d = a._s.get(i); if (process.env.NODE_ENV !== "production" && c) { const h = "__hot:" + i, p = s ? Kd(h, e, r, a, !0) : Qv(h, ni({}, r), a, !0); c._hotUpdate(p), delete a.state.value[h], a._s.delete(h); } if (process.env.NODE_ENV !== "production" && Fa) { const h = cn(); if (h && h.proxy && // avoid adding stores that are just built for hot module replacement !c) { const p = h.proxy, g = "_pStores" in p ? p._pStores : p._pStores = {}; g[i] = d; } } return d; } return o.$id = i, o; } function kw(n, e) { return Array.isArray(e) ? e.reduce((t, i) => (t[i] = function() { return n(this.$pinia)[i]; }, t), {}) : Object.keys(e).reduce((t, i) => (t[i] = function() { const r = n(this.$pinia), s = e[i]; return typeof s == "function" ? s.call(this, r) : r[s]; }, t), {}); } const Gw = fU("main", { state: () => ({ userProfile: { token: "" } }), getters: { userToken(n) { return n.userProfile.token; } }, actions: { setUserToken(n) { this.userProfile.token = n; } } }), pU = { name: "ScaffoldTooltip", components: { Col: _i, CreateTooltipContent: v1, ElIconDelete: Xc, Icon: Bt, Popover: Mu, Row: Hi, Tooltip: y1 }, props: { createData: { type: Object, default: { toBeConfirmed: !1, points: [], shape: "", x: 0, y: 0 } }, label: { type: String, default: "" }, annotationDisplay: { type: Boolean, default: !1 }, region: { type: String, default: "" }, visible: { type: Boolean, default: !1 }, x: { type: Number, default: 200 }, y: { type: Number, default: 200 } }, inject: ["scaffoldUrl"], provide() { return { userApiKey: this.userToken }; }, data: function() { return { display: !1, annotationEntry: {}, ElIconDelete: In(Xc) }; }, computed: { ...kw(Gw, ["userToken"]), position: function() { let n = 40; return this.region && (n = 55), { left: this.x - 40 + "px", top: this.y - n + "px" }; } }, methods: { checkForDisplay: function() { if (this.visible && this.label && this.label !== "") { if (this.display = !0, this.annotationDisplay) { const n = this.region ? this.region + "/" : ""; this.annotationEntry = { featureId: n + this.label, resourceId: this.scaffoldUrl, resource: this.scaffoldUrl }; } } else this.display = !1, this.annotationEntry = {}; }, hideTriggered: function() { this.$emit("tooltip-hide"); } }, watch: { label: { handler: function() { this.checkForDisplay(); }, immediate: !0 }, visible: { handler: function() { this.checkForDisplay(); }, immediate: !0 }, annotationDisplay: { handler: function() { this.checkForDisplay(); }, immediate: !0 } } }, mU = { class: "tooltip-text" }, gU = { key: 0, class: "tooltip-text" }, vU = { key: 1, class: "delete-container" }; function yU(n, e, t, i, r, s) { const o = Xn("CreateTooltipContent"), a = Xn("Tooltip"), c = _i, l = sa, d = Hi, h = Mu; return pe(), Re("div", { style: Ot(s.position), class: "region-tooltip" }, [ ae(h, { ref: "tooltip", visible: t.visible, placement: "top", "show-arrow": !1, teleported: !1, trigger: "manual", "popper-class": "tooltip-popper non-selectable", "virtual-triggering": "", onHide: s.hideTriggered }, { default: fe(() => [ Be("div", mU, wt(t.label), 1), t.region ? (pe(), Re("div", gU, "Region: " + wt(t.region), 1)) : Ge("", !0), Ft(ae(o, { createData: t.createData, onConfirmCreate: e[0] || (e[0] = (p) => n.$emit("confirm-create", p)), onCancelCreate: e[1] || (e[1] = (p) => n.$emit("cancel-create")) }, null, 8, ["createData"]), [ [xn, t.createData.toBeConfirmed] ]), Ft(ae(a, { class: "p-tooltip", ref: "annotationTooltip", annotationDisplay: !0, annotationEntry: n.annotationEntry }, null, 8, ["annotationEntry"]), [ [xn, t.annotationDisplay && !t.createData.toBeConfirmed] ]), t.createData.toBeDeleted ? (pe(), Re("div", vU, [ ae(d, null, { default: fe(() => [ ae(c, { span: 10 }, { default: fe(() => [ yt("Delete this feature?") ]), _: 1 }), ae(c, { span: 7 }, { default: fe(() => [ ae(l, { class: "delete-button", icon: n.ElIconDelete, onClick: e[2] || (e[2] = (p) => n.$emit("confirm-delete")) }, { default: fe(() => [ yt(" Delete ") ]), _: 1 }, 8, ["icon"]) ]), _: 1 }), ae(c, { span: 6 }, { default: fe(() => [ ae(l, { class: "delete-button", onClick: e[3] || (e[3] = (p) => n.$emit("cancel-create")) }, { default: fe(() => [ yt(" Dismiss ") ]), _: 1 }) ]), _: 1 }) ]), _: 1 }) ])) : Ge("", !0) ]), _: 1 }, 8, ["visible", "onHide"]) ], 4); } const Hw = /* @__PURE__ */ wr(pU, [["render", yU], ["__scopeId", "data-v-e665391a"]]); /*! js-cookie v3.0.5 | MIT */ function Oc(n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var i in t) n[i] = t[i]; } return n; } var bU = { read: function(n) { return n[0] === '"' && (n = n.slice(1, -1)), n.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent); }, write: function(n) { return encodeURIComponent(n).replace( /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent ); } }; function Qd(n, e) { function t(r, s, o) { if (!(typeof document > "u")) { o = Oc({}, e, o), typeof o.expires == "number" && (o.expires = new Date(Date.now() + o.expires * 864e5)), o.expires && (o.expires = o.expires.toUTCString()), r = encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape); var a = ""; for (var c in o) o[c] && (a += "; " + c, o[c] !== !0 && (a += "=" + o[c].split(";")[0])); return document.cookie = r + "=" + n.write(s, r) + a; } } function i(r) { if (!(typeof document > "u" || arguments.length && !r)) { for (var s = document.cookie ? document.cookie.split("; ") : [], o = {}, a = 0; a < s.length; a++) { var c = s[a].split("="), l = c.slice(1).join("="); try { var d = decodeURIComponent(c[0]); if (o[d] = n.read(l, d), r === d) break; } catch { } } return r ? o[r] : o; } } return Object.create( { set: t, get: i, remove: function(r, s) { t( r, "", Oc({}, s, { expires: -1 }) ); }, withAttributes: function(r) { return Qd(this.converter, Oc({}, this.attributes, r)); }, withConverter: function(r) { return Qd(Oc({}, this.converter, r), this.attributes); } }, { attributes: { value: Object.freeze(e) }, converter: { value: Object.freeze(n) } } ); } var ef = Qd(bU, { path: "/" }), Ei = function(n, e, t, i, r) { if (i === "m") throw new TypeError("Private method is not writable"); if (i === "a" && !r) throw new TypeError("Private accessor was defined without a setter"); if (typeof e == "function" ? n !== e || !r : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return i === "a" ? r.call(n, t) : r ? r.value = t : e.set(n, t), t; }, Ht = function(n, e, t, i) { if (t === "a" && !i) throw new TypeError("Private accessor was defined without a getter"); if (typeof e == "function" ? n !== e || !i : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return t === "m" ? i : t === "a" ? i.call(n) : i ? i.value : e.get(n); }, Ki, ja, Ai, An, Dr; const xU = 1e4; class wU { /** * @param serverEndpoint The URL of a map annotation service. */ constructor(e) { Ki.add(this), ja.set(this, void 0), Ai.set(this, null), An.set( this, null /** * @param serverEndpoint The URL of a map annotation service. */ ), e.slice(-1) === "/" ? Ei(this, ja, e.slice(0, -1), "f") : Ei(this, ja, e, "f"); } /** * Get information about the logged-in SPARC user. * * Requires {@linkcode authenticate} to first be called. */ get currentUser() { return Ht(this, Ai, "f"); } /** * Get information about any error from the last call * to {@linkcode authenticate}. */ get currentError() { return Ht(this, An, "f"); } /** * Authenticate the logged-in SPARC user. * * @param userApiKey The Api token of the logged-in Pennsieve user * @return A Promise resolving to either data about a valid user * or a reason why the user is invalid. */ async authenticate(e) { Ei(this, An, null, "f"), Ei(this, Ai, null, "f"); const t = await Ht(this, Ki, "m", Dr).call(this, e, "authenticate"); return "error" in t ? (ef.remove("annotation-key"), Promise.resolve(Ht(this, An, "f"))) : (ef.set("annotation-key", t.session, { secure: !0, expires: 1 }), Ei(this, Ai, t.data, "f"), Promise.resolve(Ht(this, Ai, "f"))); } /** * Unauthenticate with the annotation service. * * @param userApiKey The Api token of the logged-in Pennsieve user * @return A Promise with data about the call. */ async unauthenticate(e) { Ei(this, An, null, "f"), Ei(this, Ai, null, "f"); const t = await Ht(this, Ki, "m", Dr).call(this, e, "unauthenticate"); return "success" in t ? Promise.resolve(t) : Promise.resolve(Ht(this, An, "f")); } /** * Get identifiers of all annotated items in a resource. * * @param userApiKey The Api token of the logged-in Pennsieve user * @param resourceId The resource's identifier * @param userId A user identifier (ORCID). Optional * @param participated Get items the user was involved in annotating or not. * Optional, default ``true`` * @return A Promise resolving to either a list of identifiers of annotated * items or a reason why identifiers couldn't be retrieved. */ async annotatedItemIds(e, t, i, r) { const s = { resource: t }; i !== void 0 && (s.user = i), r !== void 0 && (s.participated = r); const o = await Ht(this, Ki, "m", Dr).call(this, e, "items/", "GET", s); return "error" in o ? Promise.resolve(Ht(this, An, "f")) : Promise.resolve(o); } /** * Get all annotated features drawn on a resource. * * @param userApiKey The Api token of the logged-in Pennsieve user * @param resourceId The resource's identifier * @return A Promise resolving to either a list of annotated * features drawn on the resource or a reason why * features couldn't be retrieved. */ async drawnFeatures(e, t, i) { const r = { resource: t }; i !== void 0 && (r.items = i); const s = await Ht(this, Ki, "m", Dr).call(this, e, "features/", "GET", r); return "error" in s ? Promise.resolve(Ht(this, An, "f")) : Promise.resolve(s); } /** * Get all annotations about a specific item in a resource. * * @param userApiKey The Api token of the logged-in Pennsieve user * @param resourceId The resource's identifier * @param itemId The item's identifier within the resource * @return A Promise resolving to either a list of * annotations about the item or a reason * why annotations couldn't be retrieved. */ async itemAnnotations(e, t, i) { const r = await Ht(this, Ki, "m", Dr).call(this, e, "annotations/", "GET", { resource: t, item: i }); return "error" in r ? Promise.resolve(Ht(this, An, "f")) : Promise.resolve(r); } /** * Get details of a specific annotation. * * @param userApiKey The Api token of the logged-in Pennsieve user * @param annotationId The annotation's URI * @return A Promise resolving to either an annotation * with the given URI or a reason why the * annotation couldn't be retrieved. */ async annotation(e, t) { const i = await Ht(this, Ki, "m", Dr).call(this, e, "annotation/", "GET", { annotation: t }); return "error" in i ? Promise.resolve(Ht(this, An, "f")) : Promise.resolve(i); } /** * Add an annotation about a specific item in a resource. * * @param userApiKey The Api token of the logged-in Pennsieve user * @param annotation Annotation about the feature * @return A Promise resolving to either the resulting * full annotation or a reason why the * annotation couldn't be added */ async addAnnotation(e, t) { if (Ht(this, Ai, "f") && Ht(this, Ai, "f").canUpdate) { const i = Object.assign({ creator: Ht(this, Ai, "f"), created: (/* @__PURE__ */ new Date()).toISOString() }, t), r = await Ht(this, Ki, "m", Dr).call(this, e, "annotation/", "POST", { data: i }); if (!("error" in r)) return Promise.resolve(r); Ei(this, An, r, "f"); } else Ei(this, An, { error: "user cannot add annotation" }, "f"); return Promise.resolve(Ht(this, An, "f")); } } ja = /* @__PURE__ */ new WeakMap(), Ai = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), Ki = /* @__PURE__ */ new WeakSet(), Dr = async function(e, t, i = "GET", r = {}) { let s = !0; const o = new AbortController(); setTimeout(() => { s && (console.log("Annotation server timeout..."), o.abort()); }, xU); const a = { method: i, signal: o.signal }; let c = `${Ht(this, ja, "f")}/${t}`; const l = ef.get("annotation-key") || ""; if (i === "GET") { const h = []; for (const [p, g] of Object.entries(r)) h.push(`${p}=${encodeURIComponent(JSON.stringify(g))}`); h.push(`key=${encodeURIComponent(e)}`), h.push(`session=${encodeURIComponent(l)}`), c += "?" + h.join("&"), a.headers = { Accept: "application/json; charset=utf-8", "Cache-Control": "no-store" }; } else if (i === "POST") { const h = Object.assign({ key: e, session: l }, r); a.body = JSON.stringify(h), a.headers = { Accept: "application/json; charset=utf-8", "Content-Type": "application/json; charset=utf-8", "Cache-Control": "no-store" }; } const d = await fetch(c, a); return s = !1, d.ok ? Promise.resolve(await d.json()) : (Ei(this, An, { error: `${d.status} ${d.statusText}` }, "f"), Promise.resolve(Ht(this, An, "f"))); }; const ul = { ALL: 0, SELECTED: 1, HIGHLIGHTED: 2, MOVE: 3 }, MU = function(n, e, t) { this.eventType = n, this.identifiers = e, this.zincObjects = t; }, SU = function(n, e, t) { this.targetedID = []; const i = n, r = e; this.targetEventType = t; const s = this; t === void 0 && (this.targetEventType = ul.ALL), this.getEventType = function() { return t; }, this.notify = function(o, a, c, l) { if (o !== i && (s.targetEventType === ul.ALL || s.targetEventType === a)) { const d = new MU(a, c, l); r(d); } }; }, _U = function() { const n = []; this.publish = function(e, t, i, r) { for (let s = 0; s < n.length; s++) n[s].notify(e, t, i, r); }, this.subscribe = function(e, t, i) { if (typeof t == "function") { const r = new SU(e, t, i); return n.push(r), r; } }, this.unsubscribe = function(e) { for (let t = 0; t < n.length; t++) if (e === n[t]) { n.splice(t, 1); return; } }; }, e0 = { isWebGLAvailable: function() { try { var n = document.createElement("canvas"); return !!(window.WebGLRenderingContext && (n.getContext("webgl") || n.getContext("experimental-webgl"))); } catch { return !1; } }, isWebGL2Available: function() { try { var n = document.createElement("canvas"); return !!(window.WebGL2RenderingContext && n.getContext("webgl2")); } catch { return !1; } }, getWebGLErrorMessage: function() { return this.getErrorMessage(1); }, getWebGL2ErrorMessage: function() { return this.getErrorMessage(2); }, getErrorMessage: function(n) { var e = { 1: "WebGL", 2: "WebGL 2" }, t = { 1: window.WebGLRenderingContext, 2: window.WebGL2RenderingContext }, i = 'This module requires $1 support but your $0 does not seem to support it.', r = document.createElement("div"); return r.id = "webglmessage", r.style.fontFamily = "monospace", r.style.fontSize = "20px", r.style.fontWeight = "normal", r.style.textAlign = "center", r.style.background = "#fff", r.style.color = "#000", r.style.padding = "1.5em", r.style.width = "400px", r.style.margin = "5em auto 0", t[n] ? i = i.replace("$0", "graphics card") : i = i.replace("$0", "browser"), i = i.replace("$1", e[n]), r.innerHTML = i, r; } }, Bp = { ALL: 0, DESTROYED: 1, NAME_CHANGED: 2, SETTINGS_CHANGED: 3 }, ei = function() { this.typeName = "Base Module", this.instanceName = "default", this.onChangedCallbacks = [], this.eventNotifiers = []; }; ei.prototype.setName = function(n) { if (n && this.instanceName !== n) { this.instanceName = n; const e = this.onChangedCallbacks.slice(); for (let t = 0; t < e.length; t++) e[t](this, Bp.NAME_CHANGED); } }; ei.prototype.settingsChanged = function() { const n = this.onChangedCallbacks.slice(); for (let e = 0; e < n.length; e++) n[e](this, Bp.SETTINGS_CHANGED); }; ei.prototype.exportSettings = function() { const n = {}; return n.dialog = this.typeName, n.name = this.instanceName, n; }; ei.prototype.importSettings = function(n) { return n.dialog == this.typeName ? (this.setName(n.name), !0) : !1; }; ei.prototype.publishChanges = function(n, e, t) { for (let i = 0; i < this.eventNotifiers.length; i++) this.eventNotifiers[i].publish(this, e, n, t); }; ei.prototype.getName = function() { return this.instanceName; }; ei.prototype.destroy = function() { const n = this.onChangedCallbacks.slice(); for (let e = 0; e < n.length; e++) n[e](this, Bp.DESTROYED); delete this; }; ei.prototype.addChangedCallback = function(n) { this.onChangedCallbacks.includes(n) == !1 && this.onChangedCallbacks.push(n); }; ei.prototype.removeChangedCallback = function(n) { const e = this.onChangedCallbacks.indexOf(n); e > -1 && this.onChangedCallbacks.splice(e, 1); }; ei.prototype.addNotifier = function(n) { this.eventNotifiers.push(n); }; const Dc = (n, e, t) => { for (let i = 0; i < n.length; i++) if (n[i] && n[i].material && n[i].material.emissive) { let r = n[i].userData; r && r.isZincObject ? r.setEmissiveRGB(e) : n[i].material && n[i].material.emissive && n[i].material.emissive.setRGB(...e), t && n[i].material.depthFunc && (n[i].material.depthFunc = Ur.THREE.LessEqualDepth), n[i].children.forEach((s) => { const o = s.userData; o && o.isZincObject && s.material && s.material.emissive && s.material.emissive.setRGB(...e); }); } }, TU = function() { let n = [], e = []; this.highlightColour = [1, 0, 0], this.selectColour = [0, 1, 0], this.originalColour = [0, 0, 0]; const t = [], i = [], r = this, s = function(c, l) { if (c.length == 0 && l.length == 0) return !1; for (let d = 0; d < c.length; d++) { let h = !1; for (let p = 0; p < l.length; p++) c[d] === l[p] && (h = !0); if (!h) return !0; } for (let d = 0; d < l.length; d++) { let h = !1; for (let p = 0; p < c.length; p++) l[d] === c[p] && (h = !0); if (!h) return !0; } return !1; }, o = function(c, l) { if (t.length = 0, l.length == 0) return c; for (let d = 0; d < c.length; d++) { let h = !1; for (let p = 0; p < l.length; p++) c[d] === l[p] && (h = !0); h || t.push(c[d]); } return t; }; this.setHighlighted = function(c) { const l = [...n]; r.resetHighlighted(); const d = o(c, e), h = a(d); return Dc(h, r.highlightColour, !1), n = d, s(n, l); }, this.setSelected = function(c) { const l = [...e]; r.resetHighlighted(), r.resetSelected(); const d = a(c); return Dc(d, r.selectColour, !1), e = c, s(e, l); }; const a = function(c) { i.length = 0; for (let l = 0; l < c.length; l++) c[l].material && i.push(c[l]); return i; }; this.resetHighlighted = function() { const c = a(n); Dc(c, r.originalColour, !0), n = []; }, this.resetSelected = function() { const c = a(e); Dc(c, r.originalColour, !0), e = []; }, this.getSelected = function() { return e; }, this.reset = function() { r.resetSelected(), r.resetHighlighted(); }; }, zp = Gc.THREE, EU = function() { const n = document.createElement("div"); let e; if (n.style.height = "100%", e0.isWebGLAvailable()) e = new Gc.Renderer(n, window), Gc.defaultMaterialColor = 16777116, e.initialiseVisualisation(), e.playAnimation = !1; else { const t = e0.getWebGLErrorMessage(); n.appendChild(t); } return { Zinc: Gc, renderer: e, container: n }; }, $t = function() { ei.call(this), this.scene = void 0, this.rendererContainer = void 0, this.displayArea = void 0, this.graphicsHighlight = new TU(), this.selectObjectOnPick = !0, this.zincRenderer = null, this.selectedScreenCoordinates = new zp.Vector3(), this.selectedCenter = void 0, this.liveUpdatesObjects = void 0, this.ignorePreviousSelected = !1; }; $t.prototype = Object.create(ei.prototype); $t.prototype.getIntersectedObject = function(n) { if (n) { const e = n.map((i) => { if (i && i.object && i.object.userData) { if (i.object.userData.isMarker) return 1; if (i.object.name && i.object.userData.isZincObject) return 2; } return 0; }); let t = e.indexOf(1); return t = t > -1 ? t : e.indexOf(2), n[t]; } }; $t.prototype.getAnnotationsFromObjects = function(n) { const e = []; for (var t = 0; t < n.length; t++) { const i = n[t].userData; let r; if (i) { if (i.isGlyph || i.isGlyphset) { let s = i; i.isGlyph && (s = i.getGlyphset()), r = s.userData ? s.userData.annotation : void 0, r && r.data && (n[t].name && n[t].name != "" ? r.data.id = n[t].name : r.data.id = s.groupName); } else r = i.userData ? i.userData.annotation : void 0, r && r.data && (r.data.id = n[t].name); r && (r.data.zincObject = i); } r && e.push(r); } return e; }; $t.prototype.setHighlightedByObjects = function(n, e, t, i) { const r = this.graphicsHighlight.setHighlighted(n), s = this.objectsToZincObjects(n); if (i) { let o = ul.MOVE; r && (o = ul.HIGHLIGHTED); const a = this.getAnnotationsFromObjects(n); a.length > 0 && (a[0].coords = e, a[0].extraData = t), this.publishChanges(a, o, s); } return r; }; $t.prototype.setHighlightedByZincObjects = function(n, e, t, i) { let r = []; return n && n.forEach((s) => { s && s.getMorph() && r.push(s.getMorph()); }), this.setHighlightedByObjects(r, e, t, i); }; $t.prototype.setupLiveCoordinates = function(n) { if (this.liveUpdatesObjects = n, n && n.length > 0) { const e = this.scene.getBoundingBoxOfZincObjects(n); let t = new zp.Vector3(); e ? (e.getCenter(t), this.selectedCenter == null ? this.selectedCenter = t : this.selectedCenter.copy(t)) : this.selectedCenter = void 0; } else this.selectedCenter = void 0; }; $t.prototype.objectsToZincObjects = function(n) { const e = []; for (let t = 0; t < n.length; t++) { let i = n[t].userData; if (i) if (i.isGlyph || i.isGlyphset) { let r = i; i.isGlyph && (r = i.getGlyphset()), e.push(r); } else e.push(i); } return e; }; $t.prototype.setSelectedByObjects = function(n, e, t, i) { let r = !1; if (this.selectObjectOnPick ? r = this.graphicsHighlight.setSelected(n) : r = !0, r || this.ignorePreviousSelected) { const s = this.objectsToZincObjects(n); if (this.selectObjectOnPick && this.setupLiveCoordinates(s), i) { const o = ul.SELECTED, a = this.getAnnotationsFromObjects(n); a.length > 0 && (a[0].coords = e, a[0].extraData = t), this.publishChanges(a, o, s); } } return r; }; $t.prototype.setSelectedByZincObjects = function(n, e, t, i) { let r = []; return n && n.forEach((s) => { if (s) { const o = s.getMorph(); o && r.push(o); } }), this.setSelectedByObjects(r, e, t, i); }; $t.prototype.findObjectsByGroupName = function(n) { return this.scene.findObjectsWithGroupName(n); }; $t.prototype.setHighlightedByGroupName = function(n, e) { const t = this.findObjectsByGroupName(n); return this.setHighlightedByObjects(t, void 0, {}, e); }; $t.prototype.setSelectedByGroupName = function(n, e) { const t = this.findObjectsByGroupName(n); return this.setSelectedByObjects(t, void 0, {}, e); }; $t.prototype.changeBackgroundColour = function(n) { const e = new zp.Color(n); this.zincRenderer && this.zincRenderer.getThreeJSRenderer().setClearColor(e, 1); }; $t.prototype.resetView = function() { this.zincRenderer && this.zincRenderer.resetView(); }; $t.prototype.viewAll = function() { this.zincRenderer && this.zincRenderer.viewAll(); }; $t.prototype.playAnimation = function(n) { this.zincRenderer && (this.zincRenderer.playAnimation = n); }; $t.prototype.setPlayRate = function(n) { this.zincRenderer && this.zincRenderer.setPlayRate(n); }; $t.prototype.getPlayRate = function(n) { return this.zincRenderer ? this.zincRenderer.getPlayRate() : 0; }; $t.prototype.initialiseRenderer = function(n) { if (this.zincRenderer === void 0 || this.rendererContainer === void 0) { let e = EU(); this.Zinc = e.Zinc, this.zincRenderer = e.renderer, this.rendererContainer = e.container; } n && (this.displayArea = n, this.displayArea.appendChild(this.rendererContainer), this.zincRenderer && this.zincRenderer.animate()); }; $t.prototype.destroy = function() { this.zincRenderer && (this.zincRenderer.dispose(), this.zincRenderer.getThreeJSRenderer().dispose(), this.zincRenderer = void 0), ei.prototype.destroy.call(this); }; const AU = function() { this.type = "anatomical", this.data = void 0, this.isAnnotation = !0; }, CU = function() { this.currentName = "", this.currentSystem = "", this.currentPart = "", this.currentSpecies = "", this.metaURL = "", this.viewURL = "", this.timeVarying = !1, this.currentTime = 0; }, Ww = function(n) { $t.call(this); const e = this; let t; this.sceneData = new CU(); const i = new Array(), r = new Array(), s = new Array(), o = new Array(); let a; const c = n; this.NDCCameraControl = void 0, e.typeName = "Organ Viewer", this.getSceneData = function() { return e.sceneData; }, this.updateTime = function(_) { let E = 6e3; e.scene && (E = e.scene.getDuration()); const L = _ / 100 * E; e.sceneData.nerveMapIsActive || e.scene && e.scene.setMorphsTime(L), e.sceneData.currentTime = _; }; const l = function() { let _ = 3e3; e.scene && (_ = e.scene.getDuration()); const E = e.zincRenderer.getCurrentTime(); for (let L = 0; L < i.length; L++) i[L](E); !e.sceneData.nerveMapIsActive && t && t.setMorphsTime(E), e.sceneData.nerveMap && e.sceneData.nerveMap.additionalReader && e.sceneData.nerveMap.additionalReader.setTime(E / _), e.sceneData.currentTime = E / _ * 100; }; this.getCurrentTime = function() { return e.sceneData.currentTime; }, this.toggleSyncControl = (_, E) => { let L = this.scene.getZincCameraControls(); _ ? (L.resetView(), this.NDCCameraControl = L.enableSyncControl(), L.setRotationMode(E)) : (L.disableSyncControl(), this.NDCCameraControl = void 0, L.setRotationMode("free")); }, this.isSyncControl = () => this.NDCCameraControl !== void 0, this.setSyncControlZoomToBox = (_) => { this.NDCCameraControl && this.NDCCameraControl.zoomToBox(_, 2); }, this.setSyncControlCallback = (_) => { this.NDCCameraControl && this.NDCCameraControl.setEventCallback(_); }, this.setSyncControlCenterZoom = (_, E) => { this.NDCCameraControl && this.NDCCameraControl.setCenterZoom(_, E); }; const d = function() { if (e.zincRenderer.playAnimation && e.liveUpdatesObjects && e.setupLiveCoordinates(e.liveUpdatesObjects), e.selectedCenter) { const _ = new Ur.THREE.Vector3(); _.copy(e.selectedCenter); const E = e.scene.vectorToScreenXY(_); e.selectedScreenCoordinates.x = E.x, e.selectedScreenCoordinates.y = E.y; } }, h = function() { return function() { l(); }; }, p = function() { return function() { d(); }; }; this.addTimeChangedCallback = function(_) { i.push(_); }, this.setTexturePos = function(_) { e.sceneData.nerveMap && e.sceneData.nerveMap.additionalReader && e.sceneData.nerveMap.additionalReader.setSliderPos(_); }, this.addSceneChangedCallback = function(_) { r.push(_); }, this.addOrganPartAddedCallback = function(_) { s.push(_); }, this.addOrganPartRemovedCallback = function(_) { o.push(_); }, this.setFinishDownloadCallback = function(_) { a = _; }, this.unsetFinishDownloadCallback = function() { a = void 0; }, this.getNamedObjectsToScreenCoordinates = function(_, E) { const L = new Ur.THREE.Vector3(); L.setFromMatrixPosition(obj.matrixWorld); const R = width / 2, C = height / 2; return L.project(E), L.x = L.x * R + R, L.y = -(L.y * C) + C, L; }; const g = function(_) { let E, L; if (_ !== void 0) { let R = !1; _.object.userData && _.object.userData.isMarker ? (R = !0, L = _.object.userData.parent.getMorph()) : L = _.object; try { L.userData.userData.annotation.data.lastActionOnMarker = R; } finally { } if (L) if (L.name) E = L.name; else { const C = e.getAnnotationsFromObjects( [L] ); C && C[0] && (E = C[0].data.group); } } return { id: E, object: L }; }, f = function() { return function(_, E, L) { var I; const R = e.getIntersectedObject(_), C = g(R), A = { worldCoords: [ R ? R.point.x : 0, R ? R.point.y : 0, R ? R.point.z : 0 ], intersected: R, intersects: _ }, P = { x: E, y: L }; if (C.id) { A.threeID = (I = C.object) == null ? void 0 : I.id, C.object.userData.isGlyph ? C.object.name ? e.setSelectedByObjects( [C.object], P, A, !0 ) : e.setSelectedByZincObjects( C.object.userData.getGlyphset(), P, A, !0 ) : e.setSelectedByObjects([C.object], P, A, !0); return; } else e.setSelectedByObjects([], P, A, !0); }; }, u = function() { return function(_, E, L) { var I; const R = e.getIntersectedObject(_), C = g(R), A = { worldCoords: [ R ? R.point.x : 0, R ? R.point.y : 0, R ? R.point.z : 0 ] }, P = { x: E, y: L }; if (C.id) { A.threeID = (I = C.object) == null ? void 0 : I.id, e.displayArea.style.cursor = "pointer", e.setHighlightedByObjects([C.object], P, A, !0); return; } else e.displayArea.style.cursor = "auto", e.setHighlightedByObjects([], P, A, !0); }; }, y = function(_, E, L, R) { if (R == "all" || R == "geometries") { const C = _.findGeometriesWithGroupName(E); for (let A = 0; A < C.length; A++) C[A].setVisibility(L); } if (R == "all" || R == "glyphsets") { const C = _.findGlyphsetsWithGroupName(E); for (let A = 0; A < C.length; A++) C[A].setVisibility(L); } if (R == "all" || R == "pointsets") { const C = _.findPointsetsWithGroupName(E); for (let A = 0; A < C.length; A++) C[A].setVisibility(L); } if (R == "all" || R == "lines") { const C = _.findLinesWithGroupName(E); for (let A = 0; A < C.length; A++) C[A].setVisibility(L); } }; this.changeGeometriesVisibility = function(_, E) { y(e.scene, _, E, "geometries"); }, this.changeGlyphsetsVisibility = function(_, E) { y(e.scene, _, E, "glyphsets"); }, this.changeLinesVisibility = function(_, E) { y(e.scene, _, E, "lines"); }, this.changePointsetsVisibility = function(_, E) { y(e.scene, _, E, "pointsets"); }, this.changeOrganPartsVisibility = function(_, E, L) { let R = "all"; L !== void 0 && (R = L), y(e.scene, _, E, R); }, this.changeOrganPartsVisibilityCallback = function(_) { return function(E) { e.changeOrganPartsVisibility(_, E); }; }, this.changeBackgroundColour = function(_) { const E = new Ur.THREE.Color(_); e.zincRenderer && e.zincRenderer.getThreeJSRenderer().setClearColor(E, 1); }; const v = function(_, E, L, R) { for (let P = 0; P < s.length; P++) s[P](R, e.scene.isTimeVarying()); const C = new AU(), A = R.region.getFullPath(); C.data = { species: e.sceneData.currentSpecies, system: _, part: E, group: R.groupName, region: A, uuid: R.uuid, lastActionOnMarker: !1 }, R.userData.annotation = C; }, m = function(_, E, L, R) { for (let C = 0; C < o.length; C++) o[C](R); }, w = function(_, E, L) { return function(R) { v(_, E, L, R); }; }, S = function(_, E, L) { return function(R) { m(_, E, L, R); }; }, T = function() { return function() { e.settingsChanged(), e.sceneData.timeVarying = e.scene.isTimeVarying(), a && a(); }; }; this.updateFieldvisibility = function(_, E) { for (let L = 0; L < _.length; L++) if (E != L) { const R = _[L].PartName; e.changeOrganPartsVisibility(R, !1); } if (E > -1) { const L = _[E].PartName; if (e.scene.findGeometriesWithGroupName(L).length > 0 || e.scene.findGlyphsetsWithGroupName(L).length > 0) e.changeOrganPartsVisibility(L, !0); else { const R = getOrganDetails(_[E].SystemName, L); R != null && e.scene.loadMetadataURL(c.getOrgansDirectoryPrefix() + "/" + R.meta); } } }, this.getAvailableSpecies = function(_, E, L) { const R = new Array(); R.push("none"); const C = Object.keys(organsFileMap); for (index in C) { const A = C[index]; A != _ && organsFileMap[A].hasOwnProperty(E) && organsFileMap[A][E].hasOwnProperty(L) && R.push(A); } return R; }, this.getCentreAndSize = function() { const _ = new Ur.THREE.Vector3(), E = this.scene.getBoundingBox(); E.getCenter(_); const L = [_.x, _.y, _.z]; E.getSize(_); const R = [_.x, _.y, _.z]; return { centre: L, size: R }; }; const M = function(_, E, L, R) { e.sceneData.nerveMapIsActive = !1, e.sceneData.nerveMap = void 0, e.sceneData.metaURL = "", e.sceneData.viewURL = "", e.sceneData.currentSpecies = _, e.sceneData.currentSystem = E, e.sceneData.currentPart = L, e.sceneData.currentTime = 0, e.sceneData.timeVarying = !1; let C = ""; _ && (C = _ + "/"), E && (C = E + "/"), L && (C = L), e.sceneData.currentName = C; }; this.loadOrgansFromURL = function(_, E, L, R, C, A) { if (e.zincRenderer && R && e.sceneData.metaURL !== _) { M(E, L, R); const P = e.sceneData.currentName; let I = e.zincRenderer.getSceneByName(P); I ? A && I.clearAll() : I = e.zincRenderer.createScene(P), e.selectObjectOnPick = !0; for (let O = 0; O < r.length; O++) r[O](e.sceneData); C && C != "" ? (e.sceneData.viewURL = C, I.loadViewURL(e.sceneData.viewURL)) : e.sceneData.viewURL = void 0, e.sceneData.metaURL = _, I.addZincObjectAddedCallbacks(w(L, R, !1)), I.addZincObjectRemovedCallbacks(S(void 0, R, !1)), I.loadMetadataURL(_, void 0, T()), e.scene = I, e.zincRenderer.setCurrentScene(I), e.graphicsHighlight.reset(); const b = I.getZincCameraControls(); b.enableRaycaster(I, f(), u()), b.setMouseButtonAction("AUXILIARY", "ZOOM"), b.setMouseButtonAction("SECONDARY", "PAN"); } }, this.loadGLTFFromURL = function(_, E, L) { if (e.zincRenderer && E && e.sceneData.metaURL !== _) { M(void 0, void 0, E); const R = e.sceneData.currentName; let C = e.zincRenderer.getSceneByName(R); C ? L && C.clearAll() : C = e.zincRenderer.createScene(R); for (let P = 0; P < r.length; P++) r[P](e.sceneData); e.sceneData.viewURL = void 0, e.sceneData.metaURL = _, C.addZincObjectAddedCallbacks(w(void 0, E, !1)), C.addZincObjectRemovedCallbacks(S(void 0, E, !1)), C.loadGLTF(_, void 0, T()), e.scene = C, e.zincRenderer.setCurrentScene(C), e.graphicsHighlight.reset(); const A = C.getZincCameraControls(); A.enableRaycaster(C, f(), u()), A.setMouseButtonAction("AUXILIARY", "ZOOM"), A.setMouseButtonAction("SECONDARY", "PAN"); } }, this.alignCameraWithSelectedObject = function(_) { const E = e.graphicsHighlight.getSelected(); E && E[0] && E[0].userData && e.scene.alignObjectToCameraView(E[0].userData, _); }, this.exportSettings = function() { const _ = {}; return _.name = e.instanceName, e.sceneData.currentSystem && (_.system = e.sceneData.currentSystem), e.sceneData.currentSpecies && (_.species = e.sceneData.currentSpecies), e.sceneData.currentPart && (_.part = e.sceneData.currentPart), _.metaURL = e.sceneData.metaURL, e.sceneData.viewURL && (_.viewURL = e.sceneData.viewURL), _.dialog = "Organ Viewer", _; }, this.importSettings = function(_) { return _ && _.dialog == this.typeName ? (e.setName(_.name), _.metaURL !== void 0 && _.metaURL != "" ? e.loadOrgansFromURL( _.metaURL, _.species, _.system, _.part, _.viewURL, !0 ) : e.loadOrgans(_.species, _.system, _.part), !0) : !1; }, function() { e.initialiseRenderer(void 0), e.zincRenderer && (e.zincRenderer.addPreRenderCallbackFunction(h()), e.zincRenderer.addPostRenderCallbackFunction(p())); }(); }; Ww.prototype = Object.create($t.prototype); var Ct = function() { return Ct = Object.assign || function(e) { for (var t, i = 1, r = arguments.length; i < r; i++) { t = arguments[i]; for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && (e[s] = t[s]); } return e; }, Ct.apply(this, arguments); }; function LU(n, e, t, i) { function r(s) { return s instanceof t ? s : new t(function(o) { o(s); }); } return new (t || (t = Promise))(function(s, o) { function a(d) { try { l(i.next(d)); } catch (h) { o(h); } } function c(d) { try { l(i.throw(d)); } catch (h) { o(h); } } function l(d) { d.done ? s(d.value) : r(d.value).then(a, c); } l((i = i.apply(n, [])).next()); }); } function RU(n, e) { var t = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, i, r, s, o; return o = { next: a(0), throw: a(1), return: a(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() { return this; }), o; function a(l) { return function(d) { return c([l, d]); }; } function c(l) { if (i) throw new TypeError("Generator is already executing."); for (; o && (o = 0, l[0] && (t = 0)), t; ) try { if (i = 1, r && (s = l[0] & 2 ? r.return : l[0] ? r.throw || ((s = r.return) && s.call(r), 0) : r.next) && !(s = s.call(r, l[1])).done) return s; switch (r = 0, s && (l = [l[0] & 2, s.value]), l[0]) { case 0: case 1: s = l; break; case 4: return t.label++, { value: l[1], done: !1 }; case 5: t.label++, r = l[1], l = [0]; continue; case 7: l = t.ops.pop(), t.trys.pop(); continue; default: if (s = t.trys, !(s = s.length > 0 && s[s.length - 1]) && (l[0] === 6 || l[0] === 2)) { t = 0; continue; } if (l[0] === 3 && (!s || l[1] > s[0] && l[1] < s[3])) { t.label = l[1]; break; } if (l[0] === 6 && t.label < s[1]) { t.label = s[1], s = l; break; } if (s && t.label < s[2]) { t.label = s[2], t.ops.push(l); break; } s[2] && t.ops.pop(), t.trys.pop(); continue; } l = e.call(n, t); } catch (d) { l = [6, d], r = 0; } finally { i = s = 0; } if (l[0] & 5) throw l[1]; return { value: l[0] ? l[1] : void 0, done: !0 }; } } function st(n) { var e = typeof Symbol == "function" && Symbol.iterator, t = e && n[e], i = 0; if (t) return t.call(n); if (n && typeof n.length == "number") return { next: function() { return n && i >= n.length && (n = void 0), { value: n && n[i++], done: !n }; } }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } function Jt(n, e) { var t = typeof Symbol == "function" && n[Symbol.iterator]; if (!t) return n; var i = t.call(n), r, s = [], o; try { for (; (e === void 0 || e-- > 0) && !(r = i.next()).done; ) s.push(r.value); } catch (a) { o = { error: a }; } finally { try { r && !r.done && (t = i.return) && t.call(i); } finally { if (o) throw o.error; } } return s; } var PU = "ENTRIES", jw = "KEYS", $w = "VALUES", bn = "", Xh = ( /** @class */ function() { function n(e, t) { var i = e._tree, r = Array.from(i.keys()); this.set = e, this._type = t, this._path = r.length > 0 ? [{ node: i, keys: r }] : []; } return n.prototype.next = function() { var e = this.dive(); return this.backtrack(), e; }, n.prototype.dive = function() { if (this._path.length === 0) return { done: !0, value: void 0 }; var e = yo(this._path), t = e.node, i = e.keys; if (yo(i) === bn) return { done: !1, value: this.result() }; var r = t.get(yo(i)); return this._path.push({ node: r, keys: Array.from(r.keys()) }), this.dive(); }, n.prototype.backtrack = function() { if (this._path.length !== 0) { var e = yo(this._path).keys; e.pop(), !(e.length > 0) && (this._path.pop(), this.backtrack()); } }, n.prototype.key = function() { return this.set._prefix + this._path.map(function(e) { var t = e.keys; return yo(t); }).filter(function(e) { return e !== bn; }).join(""); }, n.prototype.value = function() { return yo(this._path).node.get(bn); }, n.prototype.result = function() { switch (this._type) { case $w: return this.value(); case jw: return this.key(); default: return [this.key(), this.value()]; } }, n.prototype[Symbol.iterator] = function() { return this; }, n; }() ), yo = function(n) { return n[n.length - 1]; }, IU = function(n, e, t) { var i = /* @__PURE__ */ new Map(); if (e === void 0) return i; for (var r = e.length + 1, s = r + t, o = new Uint8Array(s * r).fill(t + 1), a = 0; a < r; ++a) o[a] = a; for (var c = 1; c < s; ++c) o[c * r] = c; return Zw(n, e, t, i, o, 1, r, ""), i; }, Zw = function(n, e, t, i, r, s, o, a) { var c, l, d = s * o; try { e: for (var h = st(n.keys()), p = h.next(); !p.done; p = h.next()) { var g = p.value; if (g === bn) { var f = r[d - 1]; f <= t && i.set(a, [n.get(g), f]); } else { for (var u = s, y = 0; y < g.length; ++y, ++u) { for (var v = g[y], m = o * u, w = m - o, S = r[m], T = Math.max(0, u - t - 1), M = Math.min(o - 1, u + t), x = T; x < M; ++x) { var _ = v !== e[x], E = r[w + x] + +_, L = r[w + x + 1] + 1, R = r[m + x] + 1, C = r[m + x + 1] = Math.min(E, L, R); C < S && (S = C); } if (S > t) continue e; } Zw(n.get(g), e, t, i, r, u, o, a + g); } } } catch (A) { c = { error: A }; } finally { try { p && !p.done && (l = h.return) && l.call(h); } finally { if (c) throw c.error; } } }, Yh = ( /** @class */ function() { function n(e, t) { e === void 0 && (e = /* @__PURE__ */ new Map()), t === void 0 && (t = ""), this._size = void 0, this._tree = e, this._prefix = t; } return n.prototype.atPrefix = function(e) { var t, i; if (!e.startsWith(this._prefix)) throw new Error("Mismatched prefix"); var r = Jt(su(this._tree, e.slice(this._prefix.length)), 2), s = r[0], o = r[1]; if (s === void 0) { var a = Jt(Up(o), 2), c = a[0], l = a[1]; try { for (var d = st(c.keys()), h = d.next(); !h.done; h = d.next()) { var p = h.value; if (p !== bn && p.startsWith(l)) { var g = /* @__PURE__ */ new Map(); return g.set(p.slice(l.length), c.get(p)), new n(g, e); } } } catch (f) { t = { error: f }; } finally { try { h && !h.done && (i = d.return) && i.call(d); } finally { if (t) throw t.error; } } } return new n(s, e); }, n.prototype.clear = function() { this._size = void 0, this._tree.clear(); }, n.prototype.delete = function(e) { return this._size = void 0, OU(this._tree, e); }, n.prototype.entries = function() { return new Xh(this, PU); }, n.prototype.forEach = function(e) { var t, i; try { for (var r = st(this), s = r.next(); !s.done; s = r.next()) { var o = Jt(s.value, 2), a = o[0], c = o[1]; e(a, c, this); } } catch (l) { t = { error: l }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } }, n.prototype.fuzzyGet = function(e, t) { return IU(this._tree, e, t); }, n.prototype.get = function(e) { var t = tf(this._tree, e); return t !== void 0 ? t.get(bn) : void 0; }, n.prototype.has = function(e) { var t = tf(this._tree, e); return t !== void 0 && t.has(bn); }, n.prototype.keys = function() { return new Xh(this, jw); }, n.prototype.set = function(e, t) { if (typeof e != "string") throw new Error("key must be a string"); this._size = void 0; var i = Jh(this._tree, e); return i.set(bn, t), this; }, Object.defineProperty(n.prototype, "size", { /** * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size */ get: function() { if (this._size) return this._size; this._size = 0; for (var e = this.entries(); !e.next().done; ) this._size += 1; return this._size; }, enumerable: !1, configurable: !0 }), n.prototype.update = function(e, t) { if (typeof e != "string") throw new Error("key must be a string"); this._size = void 0; var i = Jh(this._tree, e); return i.set(bn, t(i.get(bn))), this; }, n.prototype.fetch = function(e, t) { if (typeof e != "string") throw new Error("key must be a string"); this._size = void 0; var i = Jh(this._tree, e), r = i.get(bn); return r === void 0 && i.set(bn, r = t()), r; }, n.prototype.values = function() { return new Xh(this, $w); }, n.prototype[Symbol.iterator] = function() { return this.entries(); }, n.from = function(e) { var t, i, r = new n(); try { for (var s = st(e), o = s.next(); !o.done; o = s.next()) { var a = Jt(o.value, 2), c = a[0], l = a[1]; r.set(c, l); } } catch (d) { t = { error: d }; } finally { try { o && !o.done && (i = s.return) && i.call(s); } finally { if (t) throw t.error; } } return r; }, n.fromObject = function(e) { return n.from(Object.entries(e)); }, n; }() ), su = function(n, e, t) { var i, r; if (t === void 0 && (t = []), e.length === 0 || n == null) return [n, t]; try { for (var s = st(n.keys()), o = s.next(); !o.done; o = s.next()) { var a = o.value; if (a !== bn && e.startsWith(a)) return t.push([n, a]), su(n.get(a), e.slice(a.length), t); } } catch (c) { i = { error: c }; } finally { try { o && !o.done && (r = s.return) && r.call(s); } finally { if (i) throw i.error; } } return t.push([n, e]), su(void 0, "", t); }, tf = function(n, e) { var t, i; if (e.length === 0 || n == null) return n; try { for (var r = st(n.keys()), s = r.next(); !s.done; s = r.next()) { var o = s.value; if (o !== bn && e.startsWith(o)) return tf(n.get(o), e.slice(o.length)); } } catch (a) { t = { error: a }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } }, Jh = function(n, e) { var t, i, r = e.length; e: for (var s = 0; n && s < r; ) { try { for (var o = (t = void 0, st(n.keys())), a = o.next(); !a.done; a = o.next()) { var c = a.value; if (c !== bn && e[s] === c[0]) { for (var l = Math.min(r - s, c.length), d = 1; d < l && e[s + d] === c[d]; ) ++d; var h = n.get(c); if (d === c.length) n = h; else { var p = /* @__PURE__ */ new Map(); p.set(c.slice(d), h), n.set(e.slice(s, s + d), p), n.delete(c), n = p; } s += d; continue e; } } } catch (f) { t = { error: f }; } finally { try { a && !a.done && (i = o.return) && i.call(o); } finally { if (t) throw t.error; } } var g = /* @__PURE__ */ new Map(); return n.set(e.slice(s), g), g; } return n; }, OU = function(n, e) { var t = Jt(su(n, e), 2), i = t[0], r = t[1]; if (i !== void 0) { if (i.delete(bn), i.size === 0) Xw(r); else if (i.size === 1) { var s = Jt(i.entries().next().value, 2), o = s[0], a = s[1]; Yw(r, o, a); } } }, Xw = function(n) { if (n.length !== 0) { var e = Jt(Up(n), 2), t = e[0], i = e[1]; if (t.delete(i), t.size === 0) Xw(n.slice(0, -1)); else if (t.size === 1) { var r = Jt(t.entries().next().value, 2), s = r[0], o = r[1]; s !== bn && Yw(n.slice(0, -1), s, o); } } }, Yw = function(n, e, t) { if (n.length !== 0) { var i = Jt(Up(n), 2), r = i[0], s = i[1]; r.set(s + e, t), r.delete(s); } }, Up = function(n) { return n[n.length - 1]; }, Oa, Vp = "or", Jw = "and", DU = "and_not", NU = ( /** @class */ function() { function n(e) { if ((e == null ? void 0 : e.fields) == null) throw new Error('MiniSearch: option "fields" must be provided'); var t = e.autoVacuum == null || e.autoVacuum === !0 ? Qh : e.autoVacuum; this._options = Ct(Ct(Ct({}, Kh), e), { autoVacuum: t, searchOptions: Ct(Ct({}, t0), e.searchOptions || {}), autoSuggestOptions: Ct(Ct({}, VU), e.autoSuggestOptions || {}) }), this._index = new Yh(), this._documentCount = 0, this._documentIds = /* @__PURE__ */ new Map(), this._idToShortId = /* @__PURE__ */ new Map(), this._fieldIds = {}, this._fieldLength = /* @__PURE__ */ new Map(), this._avgFieldLength = [], this._nextId = 0, this._storedFields = /* @__PURE__ */ new Map(), this._dirtCount = 0, this._currentVacuum = null, this._enqueuedVacuum = null, this._enqueuedVacuumConditions = rf, this.addFields(this._options.fields); } return n.prototype.add = function(e) { var t, i, r, s, o, a, c = this._options, l = c.extractField, d = c.tokenize, h = c.processTerm, p = c.fields, g = c.idField, f = l(e, g); if (f == null) throw new Error('MiniSearch: document does not have ID field "'.concat(g, '"')); if (this._idToShortId.has(f)) throw new Error("MiniSearch: duplicate ID ".concat(f)); var u = this.addDocumentId(f); this.saveStoredFields(u, e); try { for (var y = st(p), v = y.next(); !v.done; v = y.next()) { var m = v.value, w = l(e, m); if (w != null) { var S = d(w.toString(), m), T = this._fieldIds[m], M = new Set(S).size; this.addFieldLength(u, T, this._documentCount - 1, M); try { for (var x = (r = void 0, st(S)), _ = x.next(); !_.done; _ = x.next()) { var E = _.value, L = h(E, m); if (Array.isArray(L)) try { for (var R = (o = void 0, st(L)), C = R.next(); !C.done; C = R.next()) { var A = C.value; this.addTerm(T, u, A); } } catch (P) { o = { error: P }; } finally { try { C && !C.done && (a = R.return) && a.call(R); } finally { if (o) throw o.error; } } else L && this.addTerm(T, u, L); } } catch (P) { r = { error: P }; } finally { try { _ && !_.done && (s = x.return) && s.call(x); } finally { if (r) throw r.error; } } } } } catch (P) { t = { error: P }; } finally { try { v && !v.done && (i = y.return) && i.call(y); } finally { if (t) throw t.error; } } }, n.prototype.addAll = function(e) { var t, i; try { for (var r = st(e), s = r.next(); !s.done; s = r.next()) { var o = s.value; this.add(o); } } catch (a) { t = { error: a }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } }, n.prototype.addAllAsync = function(e, t) { var i = this; t === void 0 && (t = {}); var r = t.chunkSize, s = r === void 0 ? 10 : r, o = { chunk: [], promise: Promise.resolve() }, a = e.reduce(function(d, h, p) { var g = d.chunk, f = d.promise; return g.push(h), (p + 1) % s === 0 ? { chunk: [], promise: f.then(function() { return new Promise(function(u) { return setTimeout(u, 0); }); }).then(function() { return i.addAll(g); }) } : { chunk: g, promise: f }; }, o), c = a.chunk, l = a.promise; return l.then(function() { return i.addAll(c); }); }, n.prototype.remove = function(e) { var t, i, r, s, o, a, c = this._options, l = c.tokenize, d = c.processTerm, h = c.extractField, p = c.fields, g = c.idField, f = h(e, g); if (f == null) throw new Error('MiniSearch: document does not have ID field "'.concat(g, '"')); var u = this._idToShortId.get(f); if (u == null) throw new Error("MiniSearch: cannot remove document with ID ".concat(f, ": it is not in the index")); try { for (var y = st(p), v = y.next(); !v.done; v = y.next()) { var m = v.value, w = h(e, m); if (w != null) { var S = l(w.toString(), m), T = this._fieldIds[m], M = new Set(S).size; this.removeFieldLength(u, T, this._documentCount, M); try { for (var x = (r = void 0, st(S)), _ = x.next(); !_.done; _ = x.next()) { var E = _.value, L = d(E, m); if (Array.isArray(L)) try { for (var R = (o = void 0, st(L)), C = R.next(); !C.done; C = R.next()) { var A = C.value; this.removeTerm(T, u, A); } } catch (P) { o = { error: P }; } finally { try { C && !C.done && (a = R.return) && a.call(R); } finally { if (o) throw o.error; } } else L && this.removeTerm(T, u, L); } } catch (P) { r = { error: P }; } finally { try { _ && !_.done && (s = x.return) && s.call(x); } finally { if (r) throw r.error; } } } } } catch (P) { t = { error: P }; } finally { try { v && !v.done && (i = y.return) && i.call(y); } finally { if (t) throw t.error; } } this._storedFields.delete(u), this._documentIds.delete(u), this._idToShortId.delete(f), this._fieldLength.delete(u), this._documentCount -= 1; }, n.prototype.removeAll = function(e) { var t, i; if (e) try { for (var r = st(e), s = r.next(); !s.done; s = r.next()) { var o = s.value; this.remove(o); } } catch (a) { t = { error: a }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } else { if (arguments.length > 0) throw new Error("Expected documents to be present. Omit the argument to remove all documents."); this._index = new Yh(), this._documentCount = 0, this._documentIds = /* @__PURE__ */ new Map(), this._idToShortId = /* @__PURE__ */ new Map(), this._fieldLength = /* @__PURE__ */ new Map(), this._avgFieldLength = [], this._storedFields = /* @__PURE__ */ new Map(), this._nextId = 0; } }, n.prototype.discard = function(e) { var t = this, i = this._idToShortId.get(e); if (i == null) throw new Error("MiniSearch: cannot discard document with ID ".concat(e, ": it is not in the index")); this._idToShortId.delete(e), this._documentIds.delete(i), this._storedFields.delete(i), (this._fieldLength.get(i) || []).forEach(function(r, s) { t.removeFieldLength(i, s, t._documentCount, r); }), this._fieldLength.delete(i), this._documentCount -= 1, this._dirtCount += 1, this.maybeAutoVacuum(); }, n.prototype.maybeAutoVacuum = function() { if (this._options.autoVacuum !== !1) { var e = this._options.autoVacuum, t = e.minDirtFactor, i = e.minDirtCount, r = e.batchSize, s = e.batchWait; this.conditionalVacuum({ batchSize: r, batchWait: s }, { minDirtCount: i, minDirtFactor: t }); } }, n.prototype.discardAll = function(e) { var t, i, r = this._options.autoVacuum; try { this._options.autoVacuum = !1; try { for (var s = st(e), o = s.next(); !o.done; o = s.next()) { var a = o.value; this.discard(a); } } catch (c) { t = { error: c }; } finally { try { o && !o.done && (i = s.return) && i.call(s); } finally { if (t) throw t.error; } } } finally { this._options.autoVacuum = r; } this.maybeAutoVacuum(); }, n.prototype.replace = function(e) { var t = this._options, i = t.idField, r = t.extractField, s = r(e, i); this.discard(s), this.add(e); }, n.prototype.vacuum = function(e) { return e === void 0 && (e = {}), this.conditionalVacuum(e); }, n.prototype.conditionalVacuum = function(e, t) { var i = this; return this._currentVacuum ? (this._enqueuedVacuumConditions = this._enqueuedVacuumConditions && t, this._enqueuedVacuum != null ? this._enqueuedVacuum : (this._enqueuedVacuum = this._currentVacuum.then(function() { var r = i._enqueuedVacuumConditions; return i._enqueuedVacuumConditions = rf, i.performVacuuming(e, r); }), this._enqueuedVacuum)) : this.vacuumConditionsMet(t) === !1 ? Promise.resolve() : (this._currentVacuum = this.performVacuuming(e), this._currentVacuum); }, n.prototype.performVacuuming = function(e, t) { return LU(this, void 0, void 0, function() { var i, r, s, o, a, c, l, d, h, p, g, f, u, y, v, m, w, S, T, M, x, _, E, L, R; return RU(this, function(C) { switch (C.label) { case 0: if (i = this._dirtCount, !this.vacuumConditionsMet(t)) return [3, 10]; r = e.batchSize || nf.batchSize, s = e.batchWait || nf.batchWait, o = 1, C.label = 1; case 1: C.trys.push([1, 7, 8, 9]), a = st(this._index), c = a.next(), C.label = 2; case 2: if (c.done) return [3, 6]; l = Jt(c.value, 2), d = l[0], h = l[1]; try { for (p = (_ = void 0, st(h)), g = p.next(); !g.done; g = p.next()) { f = Jt(g.value, 2), u = f[0], y = f[1]; try { for (v = (L = void 0, st(y)), m = v.next(); !m.done; m = v.next()) w = Jt(m.value, 1), S = w[0], !this._documentIds.has(S) && (y.size <= 1 ? h.delete(u) : y.delete(S)); } catch (A) { L = { error: A }; } finally { try { m && !m.done && (R = v.return) && R.call(v); } finally { if (L) throw L.error; } } } } catch (A) { _ = { error: A }; } finally { try { g && !g.done && (E = p.return) && E.call(p); } finally { if (_) throw _.error; } } return this._index.get(d).size === 0 && this._index.delete(d), o % r !== 0 ? [3, 4] : [4, new Promise(function(A) { return setTimeout(A, s); })]; case 3: C.sent(), C.label = 4; case 4: o += 1, C.label = 5; case 5: return c = a.next(), [3, 2]; case 6: return [3, 9]; case 7: return T = C.sent(), M = { error: T }, [3, 9]; case 8: try { c && !c.done && (x = a.return) && x.call(a); } finally { if (M) throw M.error; } return [ 7 /*endfinally*/ ]; case 9: this._dirtCount -= i, C.label = 10; case 10: return [4, null]; case 11: return C.sent(), this._currentVacuum = this._enqueuedVacuum, this._enqueuedVacuum = null, [ 2 /*return*/ ]; } }); }); }, n.prototype.vacuumConditionsMet = function(e) { if (e == null) return !0; var t = e.minDirtCount, i = e.minDirtFactor; return t = t || Qh.minDirtCount, i = i || Qh.minDirtFactor, this.dirtCount >= t && this.dirtFactor >= i; }, Object.defineProperty(n.prototype, "isVacuuming", { /** * Is `true` if a vacuuming operation is ongoing, `false` otherwise */ get: function() { return this._currentVacuum != null; }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "dirtCount", { /** * The number of documents discarded since the most recent vacuuming */ get: function() { return this._dirtCount; }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "dirtFactor", { /** * A number between 0 and 1 giving an indication about the proportion of * documents that are discarded, and can therefore be cleaned up by vacuuming. * A value close to 0 means that the index is relatively clean, while a higher * value means that the index is relatively dirty, and vacuuming could release * memory. */ get: function() { return this._dirtCount / (1 + this._documentCount + this._dirtCount); }, enumerable: !1, configurable: !0 }), n.prototype.has = function(e) { return this._idToShortId.has(e); }, n.prototype.getStoredFields = function(e) { var t = this._idToShortId.get(e); if (t != null) return this._storedFields.get(t); }, n.prototype.search = function(e, t) { var i, r; t === void 0 && (t = {}); var s = this.executeQuery(e, t), o = []; try { for (var a = st(s), c = a.next(); !c.done; c = a.next()) { var l = Jt(c.value, 2), d = l[0], h = l[1], p = h.score, g = h.terms, f = h.match, u = g.length || 1, y = { id: this._documentIds.get(d), score: p * u, terms: Object.keys(f), queryTerms: g, match: f }; Object.assign(y, this._storedFields.get(d)), (t.filter == null || t.filter(y)) && o.push(y); } } catch (v) { i = { error: v }; } finally { try { c && !c.done && (r = a.return) && r.call(a); } finally { if (i) throw i.error; } } return e === n.wildcard && t.boostDocument == null && this._options.searchOptions.boostDocument == null || o.sort(i0), o; }, n.prototype.autoSuggest = function(e, t) { var i, r, s, o; t === void 0 && (t = {}), t = Ct(Ct({}, this._options.autoSuggestOptions), t); var a = /* @__PURE__ */ new Map(); try { for (var c = st(this.search(e, t)), l = c.next(); !l.done; l = c.next()) { var d = l.value, h = d.score, p = d.terms, g = p.join(" "), f = a.get(g); f != null ? (f.score += h, f.count += 1) : a.set(g, { score: h, terms: p, count: 1 }); } } catch (T) { i = { error: T }; } finally { try { l && !l.done && (r = c.return) && r.call(c); } finally { if (i) throw i.error; } } var u = []; try { for (var y = st(a), v = y.next(); !v.done; v = y.next()) { var m = Jt(v.value, 2), f = m[0], w = m[1], h = w.score, p = w.terms, S = w.count; u.push({ suggestion: f, terms: p, score: h / S }); } } catch (T) { s = { error: T }; } finally { try { v && !v.done && (o = y.return) && o.call(y); } finally { if (s) throw s.error; } } return u.sort(i0), u; }, Object.defineProperty(n.prototype, "documentCount", { /** * Total number of documents available to search */ get: function() { return this._documentCount; }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "termCount", { /** * Number of terms in the index */ get: function() { return this._index.size; }, enumerable: !1, configurable: !0 }), n.loadJSON = function(e, t) { if (t == null) throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index"); return this.loadJS(JSON.parse(e), t); }, n.getDefault = function(e) { if (Kh.hasOwnProperty(e)) return qh(Kh, e); throw new Error('MiniSearch: unknown option "'.concat(e, '"')); }, n.loadJS = function(e, t) { var i, r, s, o, a, c, l = e.index, d = e.documentCount, h = e.nextId, p = e.documentIds, g = e.fieldIds, f = e.fieldLength, u = e.averageFieldLength, y = e.storedFields, v = e.dirtCount, m = e.serializationVersion; if (m !== 1 && m !== 2) throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version"); var w = new n(t); w._documentCount = d, w._nextId = h, w._documentIds = Nc(p), w._idToShortId = /* @__PURE__ */ new Map(), w._fieldIds = g, w._fieldLength = Nc(f), w._avgFieldLength = u, w._storedFields = Nc(y), w._dirtCount = v || 0, w._index = new Yh(); try { for (var S = st(w._documentIds), T = S.next(); !T.done; T = S.next()) { var M = Jt(T.value, 2), x = M[0], _ = M[1]; w._idToShortId.set(_, x); } } catch (D) { i = { error: D }; } finally { try { T && !T.done && (r = S.return) && r.call(S); } finally { if (i) throw i.error; } } try { for (var E = st(l), L = E.next(); !L.done; L = E.next()) { var R = Jt(L.value, 2), C = R[0], A = R[1], P = /* @__PURE__ */ new Map(); try { for (var I = (a = void 0, st(Object.keys(A))), b = I.next(); !b.done; b = I.next()) { var O = b.value, N = A[O]; m === 1 && (N = N.ds), P.set(parseInt(O, 10), Nc(N)); } } catch (D) { a = { error: D }; } finally { try { b && !b.done && (c = I.return) && c.call(I); } finally { if (a) throw a.error; } } w._index.set(C, P); } } catch (D) { s = { error: D }; } finally { try { L && !L.done && (o = E.return) && o.call(E); } finally { if (s) throw s.error; } } return w; }, n.prototype.executeQuery = function(e, t) { var i = this; if (t === void 0 && (t = {}), e === n.wildcard) return this.executeWildcardQuery(t); if (typeof e != "string") { var r = Ct(Ct(Ct({}, t), e), { queries: void 0 }), s = e.queries.map(function(y) { return i.executeQuery(y, r); }); return this.combineResults(s, r.combineWith); } var o = this._options, a = o.tokenize, c = o.processTerm, l = o.searchOptions, d = Ct(Ct({ tokenize: a, processTerm: c }, l), t), h = d.tokenize, p = d.processTerm, g = h(e).flatMap(function(y) { return p(y); }).filter(function(y) { return !!y; }), f = g.map(UU(d)), u = f.map(function(y) { return i.executeQuerySpec(y, d); }); return this.combineResults(u, d.combineWith); }, n.prototype.executeQuerySpec = function(e, t) { var i, r, s, o, a = Ct(Ct({}, this._options.searchOptions), t), c = (a.fields || this._options.fields).reduce(function(O, N) { var D; return Ct(Ct({}, O), (D = {}, D[N] = qh(a.boost, N) || 1, D)); }, {}), l = a.boostDocument, d = a.weights, h = a.maxFuzzy, p = a.bm25, g = Ct(Ct({}, t0.weights), d), f = g.fuzzy, u = g.prefix, y = this._index.get(e.term), v = this.termResults(e.term, e.term, 1, y, c, l, p), m, w; if (e.prefix && (m = this._index.atPrefix(e.term)), e.fuzzy) { var S = e.fuzzy === !0 ? 0.2 : e.fuzzy, T = S < 1 ? Math.min(h, Math.round(e.term.length * S)) : S; T && (w = this._index.fuzzyGet(e.term, T)); } if (m) try { for (var M = st(m), x = M.next(); !x.done; x = M.next()) { var _ = Jt(x.value, 2), E = _[0], L = _[1], R = E.length - e.term.length; if (R) { w == null || w.delete(E); var C = u * E.length / (E.length + 0.3 * R); this.termResults(e.term, E, C, L, c, l, p, v); } } } catch (O) { i = { error: O }; } finally { try { x && !x.done && (r = M.return) && r.call(M); } finally { if (i) throw i.error; } } if (w) try { for (var A = st(w.keys()), P = A.next(); !P.done; P = A.next()) { var E = P.value, I = Jt(w.get(E), 2), b = I[0], R = I[1]; if (R) { var C = f * E.length / (E.length + R); this.termResults(e.term, E, C, b, c, l, p, v); } } } catch (O) { s = { error: O }; } finally { try { P && !P.done && (o = A.return) && o.call(A); } finally { if (s) throw s.error; } } return v; }, n.prototype.executeWildcardQuery = function(e) { var t, i, r = /* @__PURE__ */ new Map(), s = Ct(Ct({}, this._options.searchOptions), e); try { for (var o = st(this._documentIds), a = o.next(); !a.done; a = o.next()) { var c = Jt(a.value, 2), l = c[0], d = c[1], h = s.boostDocument ? s.boostDocument(d, "", this._storedFields.get(l)) : 1; r.set(l, { score: h, terms: [], match: {} }); } } catch (p) { t = { error: p }; } finally { try { a && !a.done && (i = o.return) && i.call(o); } finally { if (t) throw t.error; } } return r; }, n.prototype.combineResults = function(e, t) { if (t === void 0 && (t = Vp), e.length === 0) return /* @__PURE__ */ new Map(); var i = t.toLowerCase(); return e.reduce(FU[i]) || /* @__PURE__ */ new Map(); }, n.prototype.toJSON = function() { var e, t, i, r, s = []; try { for (var o = st(this._index), a = o.next(); !a.done; a = o.next()) { var c = Jt(a.value, 2), l = c[0], d = c[1], h = {}; try { for (var p = (i = void 0, st(d)), g = p.next(); !g.done; g = p.next()) { var f = Jt(g.value, 2), u = f[0], y = f[1]; h[u] = Object.fromEntries(y); } } catch (v) { i = { error: v }; } finally { try { g && !g.done && (r = p.return) && r.call(p); } finally { if (i) throw i.error; } } s.push([l, h]); } } catch (v) { e = { error: v }; } finally { try { a && !a.done && (t = o.return) && t.call(o); } finally { if (e) throw e.error; } } return { documentCount: this._documentCount, nextId: this._nextId, documentIds: Object.fromEntries(this._documentIds), fieldIds: this._fieldIds, fieldLength: Object.fromEntries(this._fieldLength), averageFieldLength: this._avgFieldLength, storedFields: Object.fromEntries(this._storedFields), dirtCount: this._dirtCount, index: s, serializationVersion: 2 }; }, n.prototype.termResults = function(e, t, i, r, s, o, a, c) { var l, d, h, p, g; if (c === void 0 && (c = /* @__PURE__ */ new Map()), r == null) return c; try { for (var f = st(Object.keys(s)), u = f.next(); !u.done; u = f.next()) { var y = u.value, v = s[y], m = this._fieldIds[y], w = r.get(m); if (w != null) { var S = w.size, T = this._avgFieldLength[m]; try { for (var M = (h = void 0, st(w.keys())), x = M.next(); !x.done; x = M.next()) { var _ = x.value; if (!this._documentIds.has(_)) { this.removeTerm(m, _, t), S -= 1; continue; } var E = o ? o(this._documentIds.get(_), t, this._storedFields.get(_)) : 1; if (E) { var L = w.get(_), R = this._fieldLength.get(_)[m], C = zU(L, S, this._documentCount, R, T, a), A = i * v * E * C, P = c.get(_); if (P) { P.score += A, kU(P.terms, e); var I = qh(P.match, t); I ? I.push(y) : P.match[t] = [y]; } else c.set(_, { score: A, terms: [e], match: (g = {}, g[t] = [y], g) }); } } } catch (b) { h = { error: b }; } finally { try { x && !x.done && (p = M.return) && p.call(M); } finally { if (h) throw h.error; } } } } } catch (b) { l = { error: b }; } finally { try { u && !u.done && (d = f.return) && d.call(f); } finally { if (l) throw l.error; } } return c; }, n.prototype.addTerm = function(e, t, i) { var r = this._index.fetch(i, r0), s = r.get(e); if (s == null) s = /* @__PURE__ */ new Map(), s.set(t, 1), r.set(e, s); else { var o = s.get(t); s.set(t, (o || 0) + 1); } }, n.prototype.removeTerm = function(e, t, i) { if (!this._index.has(i)) { this.warnDocumentChanged(t, e, i); return; } var r = this._index.fetch(i, r0), s = r.get(e); s == null || s.get(t) == null ? this.warnDocumentChanged(t, e, i) : s.get(t) <= 1 ? s.size <= 1 ? r.delete(e) : s.delete(t) : s.set(t, s.get(t) - 1), this._index.get(i).size === 0 && this._index.delete(i); }, n.prototype.warnDocumentChanged = function(e, t, i) { var r, s; try { for (var o = st(Object.keys(this._fieldIds)), a = o.next(); !a.done; a = o.next()) { var c = a.value; if (this._fieldIds[c] === t) { this._options.logger("warn", "MiniSearch: document with ID ".concat(this._documentIds.get(e), ' has changed before removal: term "').concat(i, '" was not present in field "').concat(c, '". Removing a document after it has changed can corrupt the index!'), "version_conflict"); return; } } } catch (l) { r = { error: l }; } finally { try { a && !a.done && (s = o.return) && s.call(o); } finally { if (r) throw r.error; } } }, n.prototype.addDocumentId = function(e) { var t = this._nextId; return this._idToShortId.set(e, t), this._documentIds.set(t, e), this._documentCount += 1, this._nextId += 1, t; }, n.prototype.addFields = function(e) { for (var t = 0; t < e.length; t++) this._fieldIds[e[t]] = t; }, n.prototype.addFieldLength = function(e, t, i, r) { var s = this._fieldLength.get(e); s == null && this._fieldLength.set(e, s = []), s[t] = r; var o = this._avgFieldLength[t] || 0, a = o * i + r; this._avgFieldLength[t] = a / (i + 1); }, n.prototype.removeFieldLength = function(e, t, i, r) { if (i === 1) { this._avgFieldLength[t] = 0; return; } var s = this._avgFieldLength[t] * i - r; this._avgFieldLength[t] = s / (i - 1); }, n.prototype.saveStoredFields = function(e, t) { var i, r, s = this._options, o = s.storeFields, a = s.extractField; if (!(o == null || o.length === 0)) { var c = this._storedFields.get(e); c == null && this._storedFields.set(e, c = {}); try { for (var l = st(o), d = l.next(); !d.done; d = l.next()) { var h = d.value, p = a(t, h); p !== void 0 && (c[h] = p); } } catch (g) { i = { error: g }; } finally { try { d && !d.done && (r = l.return) && r.call(l); } finally { if (i) throw i.error; } } } }, n.wildcard = Symbol("*"), n; }() ), qh = function(n, e) { return Object.prototype.hasOwnProperty.call(n, e) ? n[e] : void 0; }, FU = (Oa = {}, Oa[Vp] = function(n, e) { var t, i; try { for (var r = st(e.keys()), s = r.next(); !s.done; s = r.next()) { var o = s.value, a = n.get(o); if (a == null) n.set(o, e.get(o)); else { var c = e.get(o), l = c.score, d = c.terms, h = c.match; a.score = a.score + l, a.match = Object.assign(a.match, h), n0(a.terms, d); } } } catch (p) { t = { error: p }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } return n; }, Oa[Jw] = function(n, e) { var t, i, r = /* @__PURE__ */ new Map(); try { for (var s = st(e.keys()), o = s.next(); !o.done; o = s.next()) { var a = o.value, c = n.get(a); if (c != null) { var l = e.get(a), d = l.score, h = l.terms, p = l.match; n0(c.terms, h), r.set(a, { score: c.score + d, terms: c.terms, match: Object.assign(c.match, p) }); } } } catch (g) { t = { error: g }; } finally { try { o && !o.done && (i = s.return) && i.call(s); } finally { if (t) throw t.error; } } return r; }, Oa[DU] = function(n, e) { var t, i; try { for (var r = st(e.keys()), s = r.next(); !s.done; s = r.next()) { var o = s.value; n.delete(o); } } catch (a) { t = { error: a }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } return n; }, Oa), BU = { k: 1.2, b: 0.7, d: 0.5 }, zU = function(n, e, t, i, r, s) { var o = s.k, a = s.b, c = s.d, l = Math.log(1 + (t - e + 0.5) / (e + 0.5)); return l * (c + n * (o + 1) / (n + o * (1 - a + a * i / r))); }, UU = function(n) { return function(e, t, i) { var r = typeof n.fuzzy == "function" ? n.fuzzy(e, t, i) : n.fuzzy || !1, s = typeof n.prefix == "function" ? n.prefix(e, t, i) : n.prefix === !0; return { term: e, fuzzy: r, prefix: s }; }; }, Kh = { idField: "id", extractField: function(n, e) { return n[e]; }, tokenize: function(n) { return n.split(GU); }, processTerm: function(n) { return n.toLowerCase(); }, fields: void 0, searchOptions: void 0, storeFields: [], logger: function(n, e) { typeof (console == null ? void 0 : console[n]) == "function" && console[n](e); }, autoVacuum: !0 }, t0 = { combineWith: Vp, prefix: !1, fuzzy: !1, maxFuzzy: 6, boost: {}, weights: { fuzzy: 0.45, prefix: 0.375 }, bm25: BU }, VU = { combineWith: Jw, prefix: function(n, e, t) { return e === t.length - 1; } }, nf = { batchSize: 1e3, batchWait: 10 }, rf = { minDirtFactor: 0.1, minDirtCount: 20 }, Qh = Ct(Ct({}, nf), rf), kU = function(n, e) { n.includes(e) || n.push(e); }, n0 = function(n, e) { var t, i; try { for (var r = st(e), s = r.next(); !s.done; s = r.next()) { var o = s.value; n.includes(o) || n.push(o); } } catch (a) { t = { error: a }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } }, i0 = function(n, e) { var t = n.score, i = e.score; return i - t; }, r0 = function() { return /* @__PURE__ */ new Map(); }, Nc = function(n) { var e, t, i = /* @__PURE__ */ new Map(); try { for (var r = st(Object.keys(n)), s = r.next(); !s.done; s = r.next()) { var o = s.value; i.set(parseInt(o, 10), n[o]); } } catch (a) { e = { error: a }; } finally { try { s && !s.done && (t = r.return) && t.call(r); } finally { if (e) throw e.error; } } return i; }, GU = /[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u; class HU { constructor() { this._searchEngine = new NU({ fields: ["path", "name"], storeFields: ["path"], tokenize: (e, t) => e.split(/[\s/]+/) // indexing tokenizer }), this.idMaps = {}; } addZincObject(e, t) { const i = e.getRegion().getFullPath(); let r = e.groupName, s = i ? `${i}/${e.groupName}` : e.groupName; r = r.replaceAll('"', ""), s = s.replaceAll('"', ""); const o = { path: s, name: r, id: t }; this._searchEngine.add(o), this.idMaps[t] = { path: s, zincObject: e }; } removeZincObject(e, t) { const i = e.getRegion().getFullPath(); let r = e.groupName, s = i ? `${i}/${e.groupName}` : e.groupName; r = r.replaceAll('"', ""), s = s.replaceAll('"', ""); const o = { path: s, name: r, id: t }; this._searchEngine.remove(o), delete this.idMaps[t]; } addRegion(e, t) { let i = e.getFullPath(), r = e.getName(); i = i.replaceAll('"', ""), r = r.replaceAll('"', ""); const s = { path: i, name: r, id: t }; this._searchEngine.add(s), this.idMaps[t] = { path: i, zincObject: e }; } clearResults() { this._; } removeAll() { this._searchEngine.removeAll(), this.idMaps = {}; } auto_suggest(e) { let t = []; e.length > 2 && ["'", '"'].includes(e.slice(0, 1)) ? (e = e.replaceAll(e.slice(0, 1), ""), t = this._searchEngine.search(e, { prefix: !0, combineWith: "AND" })) : e.length > 1 && (t = this._searchEngine.search(e, { prefix: !0 })); const i = []; t.forEach((o) => { o.id in this.idMaps && i.push(this.idMaps[o.id].path); }); const r = [...new Set(i)], s = []; return r.forEach((o) => s.push({ suggestion: '"' + o + '"' })), s; } processResults(e, t) { const i = { regionPath: void 0, label: 'Search Results for "' }; return Array.isArray(t) ? i.label += ",".join(t) : i.label += t, i.label += '"', e.length === 1 && (e[0].isRegion ? i.regionPath = e[0].getFullPath() : e[0].isZincObject && (i.regionPath = e[0].getRegion().getFullPath(), i.label = e[0].groupName)), i.zincObjects = kz(e), i; } search(e) { let t; e.length > 2 && ["'", '"'].includes(e.slice(0, 1)) ? (e = e.replaceAll(e.slice(0, 1), ""), t = this._searchEngine.search(e, { prefix: !0, combineWith: "AND" })) : e.length > 1 && (t = this._searchEngine.search(e, { prefix: !0 })); const i = []; return t.forEach((r) => { r.id in this.idMaps && i.push(this.idMaps[r.id].zincObject); }), i; } searchTerms(e) { let t = []; return e.forEach((i) => { const r = this.search(i); t.push(...r); }), t; } searchAndProcessResult(e) { let t = []; return Array.isArray(e) ? t = this.searchTerms(e) : t = this.search(e), this.processResults(t, e); } } const WU = { name: "ScaffoldVuer", components: { Button: sa, Col: _i, Loading: SP, Option: aa, Popover: Mu, Row: Hi, Select: oa, Slider: ci, TabPane: Oy, Tabs: Iy, MapSvgIcon: x1, MapSvgSpriteColor: w1, PrimitiveControls: Bw, ScaffoldTooltip: Hw, ElIconWarningFilled: I0, ElIconArrowDown: vf, ElIconArrowLeft: jr, DrawToolbar: b1, ScaffoldTreeControls: zw }, setup(n) { let e = ht("$annotator"); return e || (e = Cn(new wU(`${n.flatmapAPI}annotator`)), gn("$annotator", e)), { annotator: e }; }, props: { /** * The option to show annotation information in sidebar */ annotationSidebar: { type: Boolean, default: !1 }, /** * URL of the zincjs metadata. This value will be ignored if a valid * state prop is also provided. * If the url needs to be updated with state present, please use * the setURL method. */ url: { type: String, default: "" }, /** * Show the colour control of set to true. */ showColourPicker: { type: Boolean, default: !1 }, /** * Flag to show/hide the UI. */ displayUI: { type: Boolean, default: !0 }, /** * Display all graphics at start. * * This setting only works when traditional is set to false. */ displayAtStartUp: { type: Boolean, default: !0 }, /** * Use for toggling the help tooltips. */ helpMode: { type: Boolean, default: !1 }, /** * The active item index of help mode. */ helpModeActiveItem: { type: Number, default: 0 }, /** * The option to use helpModeDialog. * On default, `false`, clicking help will show all tooltips. * If `true`, clicking help will show the help-mode-dialog. */ helpModeDialog: { type: Boolean, default: !1 }, /** * The last item of help mode. */ helpModeLastItem: { type: Boolean, default: !1 }, /** * The initial index number for help mode tooltips. * Set negative (e.g. -1) if there are other tooltips outside of `hoverVisibilities`. */ helpModeInitialIndex: { type: Number, default: 0 }, /** * Use for show/display beta warning icon. */ displayWarning: { type: Boolean, default: !0 }, /** * Warning message for the hovered over text * on the warning icon. */ warningMessage: { type: String, default: "Beta feature - under active development" }, displayLatestChanges: { type: Boolean, default: !1 }, latestChangesMessage: { type: String, default: "New feature - Local search is now available" }, /** * Show/hide pickable markers for regions. */ displayMarkers: { type: Boolean, default: !1 }, /** * Display adjacent markers with a cluster marker. */ markerCluster: { type: Boolean, default: !1 }, /** * GroupName to value pair. * The value can be a single number or and object in the following * form: * * { * number: Number, * imgURL: String * } * * When imgURL is specified, scaffoldvuer will attempt to render * the image in imgURL as marker instead. * */ markerLabels: { type: Object, default: function() { return {}; } }, /** * Show/hide minimap. */ displayMinimap: { type: Boolean, default: !1 }, /** * Format of the input URL */ format: { type: String, default: "metadata" }, /** * Settings for minimap position, size and alignment. */ minimapSettings: { type: Object, default: function() { return { x_offset: 16, y_offset: 16, width: 128, height: 128, align: "top-right" }; } }, /** * Flag to determine rather the open map UI icon and popup * should be shown or not. */ enableOpenMapUI: { type: Boolean, default: !1 }, /** * This array populate the the openMapOptions popup. * Each entry contains a pair of display and key. */ openMapOptions: { type: Array, default: function() { return [ { display: "Open AC Map", key: "AC" }, { display: "Open FC Map", key: "FC" }, { display: "Open 3D Human Map", key: "3D" } ]; } }, /** * State containing state of the scaffold. */ state: { type: Object, default: void 0 }, /** * Optional prop for the name of the region to focus on, * this option is ignored if state or viewURL is also provided. */ region: { type: String, default: "" }, /** * Optional prop for an URL of containing information of a viewport. * This option is ignored if state is also provided. * It will use the provided URL as base if a relative parth is provided. */ viewURL: { type: String, default: "" }, /** * Settings for turning on/off rendering */ render: { type: Boolean, default: !0 }, /** * Specify the endpoint of the flatmap server. * This is used by annotation service included in * third party flatmapvuer library. */ flatmapAPI: { type: String, default: "https://mapcore-demo.org/current/flatmap/v3/" }, /** * Enable local annotations */ enableLocalAnnotations: { type: Boolean, default: !1 } }, provide() { return { flatmapAPI: this.flatmapAPI, scaffoldUrl: this.url, boundingDims: this.boundingDims }; }, data: function() { return { annotator: void 0, createData: { drawingBox: !1, toBeConfirmed: !1, points: [], shape: "", x: 0, y: 0, editingIndex: -1, faceIndex: -1, toBeDeleted: !1 }, currentTime: 0, timeVarying: !1, isPlaying: !1, isReady: !1, /** * This is set when scene is transitioning. */ isTransitioning: !1, tooltipAppendToBody: !1, hoverVisibilities: [ { value: !1, ref: "zoomInPopover" }, // 0 { value: !1, ref: "zoomOutPopover" }, // 1 { value: !1, ref: "zoomFitPopover" }, // 2 { value: !1, ref: "openMapPopover" }, // 3 { value: !1, ref: "settingsPopover" }, // 4 { value: !1, ref: "sliderPopover" }, // 5 { value: !1, ref: "regionVisibilityPopover" }, // 6 { value: !1, ref: "warningPopover" }, // 7 { value: !1, ref: "whatsNewPopover" }, // 8 { value: !1, refs: "toolbarPopover", ref: "editPopover" }, // 9 { value: !1, refs: "toolbarPopover", ref: "pointPopover" }, // 10 { value: !1, refs: "toolbarPopover", ref: "lineStringPopover" }, // 11 { value: !1, refs: "toolbarPopover", ref: "deletePopover" } // 11 ], inHelp: !1, helpModeActiveIndex: this.helpModeInitialIndex, loading: !1, duration: 3e3, drawerOpen: !0, currentBackground: "white", availableBackground: ["white", "lightskyblue", "black"], minimisedSlider: !1, sliderPosition: "", timeMax: 100, orginalDuration: "", animateDuration: "6secs", playSpeed: [ { value: 0.1, label: "0.1x" }, { value: 0.5, label: "0.5x" }, { value: 1, label: "1x" }, { value: 2, label: "2x" }, { value: 5, label: "5x" }, { value: 10, label: "10x" } ], currentSpeed: 1, timeStamps: {}, defaultCheckedKeys: [], tData: { label: "", region: "", visible: !1, x: 200, y: 200, active: !1 }, fileFormat: "metadata", previousMarkerLabels: Cn({}), viewingMode: "Exploration", viewingModes: { Exploration: "View and explore detailed visualization of 3D scaffolds", Annotation: "View internal identifiers of features" }, openMapRef: void 0, backgroundIconRef: void 0, userInformation: void 0, toolbarOptions: [ "Delete", "Edit", "Point", "LineString" ], activeDrawTool: void 0, activeDrawMode: void 0, localAnnotationsList: Cn([]), boundingDims: { centre: [0, 0, 0], size: [1, 1, 1] }, lastSelected: Cn({ region: "", group: "", isSearch: !1 }) }; }, watch: { format: { handler: function(n) { this.fileFormat = n; }, immediate: !0 }, url: { handler: function(n) { (this.state === void 0 || this.state.url === void 0) && this.setURL(n); }, immediate: !0 }, region: { handler: function(n) { this.state || this.viewURL || this.setFocusedRegion(n); }, immediate: !0 }, state: { handler: function(n) { this.setState(n); }, immediate: !0, deep: !0 }, viewURL: { handler: function(n) { this.updateViewURL(n); }, immediate: !0 }, helpMode: function(n, e) { n !== e && this.setHelpMode(n); }, helpModeActiveItem: function() { this.helpMode && (this.helpModeActiveIndex += 1, this.setHelpMode(this.helpMode)); }, displayMarkers: function(n) { this.$module.scene.displayMarkers = n, this.$module.scene.forcePickableObjectsUpdate = !0; }, displayMinimap: function(n) { this.$module.scene.displayMinimap = n; }, currentTime: { handler: function() { this.$emit("timeChanged", this.currentTime); } }, duration: function() { this.$module.scene.setDuration(this.duration); }, minimapSettings: { deep: !0, handler: "updateMinimapScissor" }, render: function(n) { this.toggleRendering(n); }, markerCluster: { handler: function(n) { this.$module.scene.enableMarkerCluster(n); }, immediate: !0 }, markerLabels: function(n) { for (const [e, t] of Object.entries(this.previousMarkerLabels)) this.setMarkerModeForObjectsWithName(e, t, "off"); for (const [e, t] of Object.entries(n)) this.setMarkerModeForObjectsWithName(e, t, "on"); this.previousMarkerLabels = Cn({ ...n }); }, annotationDisplay: function(n) { if (this.annotationSidebar) if (n) { const t = { featureId: (this.tData.region ? this.tData.region + "/" : "") + this.tData.label, resourceId: this.url, resource: this.url }; this.$emit("annotation-open", { annotationEntry: t, commitCallback: this.commitAnnotationEvent }); } else (!this.createData.toBeConfirmed || !this.createData.toBeDeleted) && this.$emit("annotation-close"); } }, beforeCreate: function() { this.$module = new Ww(), this.selectedObjects = [], this.hoveredObjects = [], this.currentBackground = "white", this._currentURL = void 0, this.availableBackground = ["white", "black", "lightskyblue"], this.$_searchIndex = new HU(); }, mounted: function() { this.openMapRef = In(this.$refs.openMapRef), this.backgroundIconRef = In(this.$refs.backgroundIconRef), this.$refs.scaffoldTreeControls.setModule(this.$module); let n = new _U(); n.subscribe(this, this.eventNotifierCallback), this.$module.addNotifier(n), this.$module.addOrganPartAddedCallback(this.zincObjectAdded), this.$module.addOrganPartRemovedCallback(this.zincObjectRemoved), this.$module.initialiseRenderer(this.$refs.display), this.toggleRendering(this.render), this.ro = new ResizeObserver(this.adjustLayout).observe( this.$refs.scaffoldContainer ), this.helpTextWait = [], this.helpTextWait.length = this.hoverVisibilities.length, this.defaultRate = this.$module.getPlayRate(), this.$module.zincRenderer.addPreRenderCallbackFunction(() => { this.currentTime = this.$module.getCurrentTime(); }); }, beforeUnmount: function() { this.ro && this.ro.disconnect(), this.$module.destroy(), this.$module = void 0; }, computed: { ...kw(Gw, ["userToken"]), annotationDisplay: function() { return this.viewingMode === "Annotation" && this.tData.active === !0 && this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString"; } }, methods: { /** * @public * Call this to manually add a zinc object into the current scene. * This will subsequently trigger a zincObjectAdded * @arg {Object} "ZincObject object to be added" */ addZincObject: function(n) { this.$module.scene && this.$module.scene.addZincObject(n); }, /** * Internal only. * This is called when a new zinc object is read into the scene. */ zincObjectAdded: function(n) { this.loading = !1, this.$_searchIndex.addZincObject(n, n.uuid), this.timeVarying === !1 && n.isTimeVarying() && (this.timeVarying = !0), this.$emit("zinc-object-added", n); }, /** * Internal only. * Remove an entry matching region and group from * local annotation list. */ removeFromLocalAnnotationList: function(n, e) { for (let t = 0; t < this.localAnnotationsList.length; t++) { const i = this.localAnnotationsList[t]; if (i.region === n && i.group === e) { this.localAnnotationsList.splice(t, 1); return; } } }, /** * Internal only. * This is called when a zinc object is removed. */ zincObjectRemoved: function(n) { if (this.$module.scene) { const e = n.region.getFullPath(), t = n.groupName; n.region.findObjectsWithGroupName(t, !1).length === 0 && (this.$_searchIndex.removeZincObject(n, n.uuid), this.removeFromLocalAnnotationList(e, t)); } }, /** * Internal only. * Add regions to search index. */ addRegionsToSearchIndex: function() { this.$module.scene.getRootRegion().getChildRegions(!0).forEach((t) => { this.$_searchIndex.addRegion(t, t.uuid); }); }, /** * Internal only. * This is called when Change backgspeedround colour button * is pressed an causes the backgrouColornd colour to be changed * to one of the three preset colour: white, black and * lightskyblue. */ backgroundChangeCallback: function(n) { this.currentBackground = n, this.$module.zincRenderer.getThreeJSRenderer().setClearColor(this.currentBackground, 1); }, /** * Internal only. * This is called by captueeScreenshot and after the last render * loop, it download a screenshot of the current scene with no UI. */ captureScreenshotCallback: function() { this.$module.zincRenderer.removePostRenderCallbackFunction( this.captureID ); let n = this.$module.zincRenderer.getThreeJSRenderer().domElement.toDataURL("image/png"), e = document.createElement("a"); document.body.append(e), this.captureFilename ? e.download = this.captureFilename : e.download = "screenshot.png", e.href = n, e.click(), e.remove(); }, /** * @public * Function for capturing a screenshot of the current rendering. * * @arg {String} "filename given to the screenshot." */ captureScreenshot: function(n) { this.captureFilename = n, this.captureID = this.$module.zincRenderer.addPostRenderCallbackFunction( this.captureScreenshotCallback ); }, /** * @public * Function to clear current scene, the tree controls and the search index. */ clearScene: function() { this.$refs.scaffoldTreeControls && this.$refs.scaffoldTreeControls.clear(), this.$_searchIndex && this.$_searchIndex.removeAll(), this.$module.scene && this.$module.scene.clearAll(); }, /** * @public * Add and edit local annotations * @arg `region`, * @arg `group`, * @arg `zincObject`, * @arg `comment` */ addAndEditAnnotations: function(n, e, t, i) { const r = Xv( this.annotator, this.userToken, t, n, e, this.url, i ); if (this.enableLocalAnnotations) { r.group = e; let s = n; s.slice(-1) === "/" && (s = s.slice(0, -1)), r.region = s, this.removeFromLocalAnnotationList(s, e), this.localAnnotationsList.push(r); } this.$emit("userPrimitivesUpdated", { region: n, group: e, zincObject: t }); }, /** * @public * Callback for when primitives have been update using primitive controls. * This is only called from callback. * @arg `object` */ primitivesUpdated: function(n) { if (n.isZincObject && n.isEditable) { const e = n.groupName, t = n.region.getFullPath(); this.addAndEditAnnotations(t, e, n, "Position Updated"); } }, /** * @public * Confirm creation of new primitive. This is only called from callback. * @arg `payload` */ confirmCreate: function(n) { if (n) { let e; if (n.shape === "Point") e = this.$module.scene.createPoints( n.region, n.group, this.createData.points, n.group, 8942 ); else if (n.shape === "LineString") e = this.$module.scene.createLines( n.region, n.group, [this.createData.points[0], this.createData.points[1]], 60962 ); else if (n.editingIndex > -1 && this._editingZincObject) { this._editingZincObject.editVertices( [this.createData.points[1]], n.editingIndex ); const t = this._editingZincObject.region.getFullPath() + "/", i = this._editingZincObject.groupName; this.addAndEditAnnotations(t, i, this._editingZincObject, "Position Updated"); } e && (this.addAndEditAnnotations(n.region, n.group, e.zincObject, "Create"), e.zincObject.isEditable = !0, this.tData.region = n.region, this.tData.label = n.group, this.changeActiveByName([n.group], n.region, !1)); } this.cancelCreate(); }, /** * Internal only. * Cancel create workflows. Reset all relevant UIs and data. */ cancelCreate: function() { this.createData.points.length = 0, this.createData.toBeConfirmed = !1, this._editingZincObject = void 0, this.createData.editingIndex = -1, this.createData.faceIndex = -1, this.tData.visible = !1, this.createData.toBeDeleted = !1, this._tempLine && (this.$module.scene.removeTemporaryPrimitive(this._tempLine), this._tempLine = void 0), this._tempPoint && (this.$module.scene.removeTemporaryPrimitive(this._tempPoint), this._tempPoint = void 0), this.annotationSidebar && this.$emit("annotation-close"); }, /** * Internal only. * Confirm delete of user created primitive. * This is only called from callback. */ confirmDelete: function() { var n; if ((n = this._editingZincObject) != null && n.isEditable) { const e = this._editingZincObject.region.getFullPath() + "/", t = this._editingZincObject.groupName; Xv( this.annotator, this.userToken, this._editingZincObject, e, t, this.url, "Deleted" ) && this.$module.scene.getRootRegion().findChildFromPath(e).removeZincObject(this._editingZincObject); } this.cancelCreate(); }, /** * Internal only. * This is triggered when tooltip is hidden */ onTooltipHide: function() { this.createData.toBeConfirmed && !this.annotationSidebar && this.cancelCreate(); }, formatTooltip(n) { if (this.timeMax >= 1e3 && n) { let e = (n % 6e4 / 1e3).toFixed(2) + "s"; return (n > 6e4 ? (n / 6e4).toFixed(0) + "m " : "") + e; } return n ? n.toFixed(2) + " ms" : "0 ms"; }, /** * @public * Function to reset the view to default. * Also called when the associated button is pressed. */ fitWindow: function() { if (this.$module.scene) { let n = !1; this._boundingBoxGeo && (n = this._boundingBoxGeo.getVisibility(), this._boundingBoxGeo.setVisibility(!1)), this.$module.scene.viewAll(), this._boundingBoxGeo && (Uz(this._boundingBoxGeo, this.$module.scene), this._boundingBoxGeo.setVisibility(n)); } }, /** * @public * Function to zoom in. * Also called when the associated button is pressed. */ zoomIn: function() { this.$module.scene && this.$module.scene.changeZoomByScrollRateUnit(-1); }, /** * Function to zoom out. * Also called when the associated button is pressed. * * @public */ zoomOut: function() { this.$module.scene && this.$module.scene.changeZoomByScrollRateUnit(1); }, /** * Function to change the current play speed. * * @public * @arg `speed` */ speedChanged: function(n) { this.currentSpeed = n, this.$module.setPlayRate(this.defaultRate * this.currentSpeed); }, /** * Function used to stop the free spin * * @public */ stopFreeSpin: function() { this.$module.scene.getZincCameraControls().stopAutoTumble(), this.isTransitioning = !1; }, /** * Return a list of obejcts with the provided name. * @arg "Group name to search." * * @public */ findObjectsWithGroupName: function(n) { let e = []; return n && n != "" && this.$module.scene && (e = this.$module.scene.findObjectsWithGroupName(n)), e; }, /** * @public * Switch active drawing type * @arg {String} `type` * @arg {String} `icon` */ toggleDrawing: function(n, e) { this.createData.toBeDeleted = !1, n === "mode" ? (this.cancelCreate(), this.activeDrawMode = e, this.createData.shape = "", this.$module.selectObjectOnPick = !0) : n === "tool" && (this.activeDrawTool = e, this.createData.shape = this.activeDrawTool ? this.activeDrawTool : "", this.$module.selectObjectOnPick = !1); }, /** * Toggle the drawing box which aid the drawing * * @public */ toggleDrawingBox: function() { this.createData.drawingBox = !this.createData.drawingBox; }, /** * Find and and zoom into objects with the provided list of names. * @arg "List of names" * * @public */ viewRegion: function(n) { const e = this.$module.scene.getRootRegion(), t = Array.isArray(n) ? n : [n], i = Ao(e, t, "", !0); let r = this.$module.scene.getBoundingBoxOfZincObjects(i); if (r) { if (this.$module.isSyncControl()) this.$module.setSyncControlZoomToBox(r); else { const s = this.$module.scene.camera.far - this.$module.scene.camera.near; this.$module.scene.viewAllWithBoundingBox(r), this.$module.scene.camera.far = this.$module.scene.camera.near + s, this.$module.scene.camera.updateProjectionMatrix(); } return !0; } return !1; }, setFocusedRegion: function(n) { n && (this.isReady ? this.viewRegion(n) : this.$module.setFinishDownloadCallback( this.setURLFinishCallback({ region: n }) )); }, updateViewURL: function(n) { if (n) if (this.isReady) { const e = new URL(n, this.url); this.$module.scene.loadViewURL(e); } else this.$module.setFinishDownloadCallback( this.setURLFinishCallback({ viewURL: n }) ); }, createEditTemporaryLines: function(n) { const e = n[0].extraData.worldCoords; if (e && (this.createData.shape === "LineString" || this.createData.editingIndex > -1) && this.createData.points.length === 1) if (this.showRegionTooltipWithAnnotations(n, !0, !1), this.tData.x = 50, this.tData.y = 200, this._tempLine) { const t = this._tempLine.geometry.getAttribute("position"); t.setXYZ(1, e[0], e[1], e[2]), t.needsUpdate = !0; } else this._tempLine = this.$module.scene.addTemporaryLines( [this.createData.points[0], e], 65535 ); }, draw: function(n) { n && n.length > 0 && n[0].data.group && n[0].extraData.worldCoords && (this.createData.shape === "Point" ? this.drawPoint(n[0].extraData.worldCoords, n) : (this.createData.shape === "LineString" || this.createData.editingIndex > -1) && this.drawLine(n[0].extraData.worldCoords, n)); }, drawPoint: function(n, e) { this.createData.toBeConfirmed === !1 && (this.createData.points.length = 0, this.createData.points.push(n), this.createData.toBeConfirmed = !0, this.showRegionTooltipWithAnnotations(e, !0, !1), this.tData.x = 50, this.tData.y = 200, this._tempPoint = this.$module.scene.addTemporaryPoints([n], 16776960)); }, drawLine: function(n, e) { this.createData.toBeConfirmed === !1 && (this.createData.points.length === 1 ? (this.createData.points.push(n), this.createData.toBeConfirmed = !0, this.showRegionTooltipWithAnnotations(e, !0, !1), this.tData.x = 50, this.tData.y = 200) : (this._tempPoint = this.$module.scene.addTemporaryPoints([n], 16776960), this.createData.points.push(n))); }, /** * Return renderer information * * @public */ getRendererInfo: function() { if (this.$module.zincRenderer) return this.$module.zincRenderer.getThreeJSRenderer().info; }, /** * Function used to rotate the scene. * Also called when the associated button is pressed. * * @public */ freeSpin: function() { if (this.$module.scene) { let n = this.$module.scene.getZincCameraControls(); this.isTransitioning = !0, n.enableAutoTumble(), n.autoTumble([1, 0], Math.PI, !0), setTimeout(this.stopFreeSpin, 4e3); } }, activateAnnotationMode: function(n, e) { if (this.userInformation || this.enableLocalAnnotations) if (this.createData.toBeDeleted = !1, this.createData.shape !== "" || this.createData.editingIndex > -1) n.length > 0 && e.identifiers[0].coords && (this.createData.x = e.identifiers[0].coords.x, this.createData.y = e.identifiers[0].coords.y, this.draw(e.identifiers)); else { if (this.activeDrawMode === "Edit") { const t = Fz(e); t && this.activateEditingMode( t.zincObject, t.faceIndex, t.vertexIndex, t.point ); } else if (this.activeDrawMode === "Delete") { const t = Bz(e); t && (this.createData.toBeDeleted = !0, this._editingZincObject = t); } this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString" ? this.showRegionTooltipWithAnnotations(e.identifiers, !0, !1) : this.showRegionTooltipWithAnnotations(e.identifiers, !0, !0); } else this.showRegionTooltipWithAnnotations(e.identifiers, !0, !0); }, activateEditingMode: function(n, e, t, i) { this._editingZincObject = n, this.createData.faceIndex = e, this.createData.editingIndex = t, this.drawLine(i, void 0); }, /** * Callback when a region is selected/highlighted. * It will also update other controls. * */ eventNotifierCallback: function(n) { if (!(this.createData.toBeConfirmed || this.createData.toBeDeleted)) { const e = []; let t = []; (n.eventType == 1 || n.eventType == 2) && (n.identifiers.forEach((s) => { if (s) { let o = s.data.id ? s.data.id : s.data.group; e.push(o); } }), t = n.zincObjects); let i, r; if (n.identifiers.length > 0 && n.identifiers[0] && (i = n.identifiers[0].data.id ? n.identifiers[0].data.id : n.identifiers[0].data.group, n.identifiers[0].data.region && (r = n.identifiers[0].data.region)), n.eventType == 1) this.viewingMode === "Annotation" ? (this.tData.label = i, this.tData.region = r, this.activateAnnotationMode(e, n)) : (this.$refs.scaffoldTreeControls && (e.length > 0 ? (this.$refs.scaffoldTreeControls.updateActiveUI(t), this.updatePrimitiveControls(t)) : (this.hideRegionTooltip(), this.$refs.scaffoldTreeControls.removeActive(!1))), n.identifiers.length === 1 ? (this.lastSelected.isSearch = !1, this.lastSelected.region = r, this.lastSelected.group = n.identifiers[0].data.group) : n.identifiers.length === 0 && (this.lastSelected.isSearch = !1, this.lastSelected.region = "", this.lastSelected.group = ""), this.$emit("scaffold-selected", n.identifiers)); else if (n.eventType == 2) this.selectedObjects.length === 0 && (this.hideRegionTooltip(), this.$refs.scaffoldTreeControls && (e.length > 0 ? this.$refs.scaffoldTreeControls.updateHoverUI(t) : this.$refs.scaffoldTreeControls.removeHover(!0)), n.identifiers.length > 0 && n.identifiers[0] && n.identifiers[0].coords && (this.tData.active = !1, (this.viewingMode !== "Annotation" || !this.annotationSidebar) && (this.tData.visible = !0), this.tData.label = i, this.tData.region = r, this.tData.x = n.identifiers[0].coords.x, this.tData.y = n.identifiers[0].coords.y, this.createEditTemporaryLines(n.identifiers)), this.$emit("scaffold-highlighted", n.identifiers)); else if (n.eventType == 3 && n.identifiers.length > 0 && n.identifiers[0]) { if (n.identifiers[0].coords) { const s = this.$refs.scaffoldContainer.getBoundingClientRect(); this.tData.x = n.identifiers[0].coords.x - s.left, this.tData.y = n.identifiers[0].coords.y - s.top; } this.createEditTemporaryLines(n.identifiers); } } }, /** * Get the coordinates of the current selected region. * * @public */ getCoordinatesOfSelected: function() { if (this.selectedObjects && this.selectedObjects.length > 0) return this.$module.scene.getObjectsScreenXY(this.selectedObjects); }, /** * Return an object containing the window coordinates of the * current selected region which will be updated after each render * loop. * * @public */ getDynamicSelectedCoordinates: function() { return this.$module.selectedScreenCoordinates; }, /** * Callback when time is changed through the UI. */ timeChange: function(n) { let e = n / this.timeMax * 100; e != this.currentTime && this.$module.updateTime(e); }, /** * Update primitive controls UI with the specified objects * * @arg objects objects to be set for the selected */ updatePrimitiveControls: function(n) { this.selectedObjects = n, this.selectedObjects && this.selectedObjects.length > 0 ? this.$refs.primitiveControls.setObject(this.selectedObjects[0]) : this.$refs.primitiveControls.setObject(void 0); }, /** * A callback used by children components. Set the selected zinc object * * @arg Selected zinc objects * @arg Flag to determine if callback should be triggered when new selection * is made */ objectSelected: function(n, e) { this.updatePrimitiveControls(n), this.$module.setSelectedByZincObjects(n, void 0, {}, e); }, /** * A callback used by children components. Set the highlighted zinc object * * @arg Hovered zinc objects * @arg Flag to determine if callback should be triggered when new selection * is made */ objectHovered: function(n, e) { this.hoveredObjects = n, this.$module.setHighlightedByZincObjects(n, void 0, {}, e); }, /** * Set the selected by name. * * @param {} name Name of the group */ changeActiveByName: function(n, e, t) { const i = Array.isArray(n); if (n === void 0 || i && n.length === 0) this.$refs.scaffoldTreeControls.removeActive(t); else { let r = n; i || (r = [r]), this.$refs.scaffoldTreeControls.changeActiveByNames(r, e, t); } }, /** * Set the highlighted by name. * * @param {name} name Name of the group */ changeHighlightedByName: function(n, e, t) { const i = Array.isArray(n); if (n === void 0 || i && n.length === 0) this.$refs.scaffoldTreeControls.removeHover(t); else { let r = n; i || (r = [r]), this.$refs.scaffoldTreeControls.changeHoverByNames(r, e, t); } }, /** * @public * Start the animation. * * @arg "flag to turn the animation on/off" */ play: function(n) { this.$module.playAnimation(n), this.isPlaying = n; }, /** * @public * Function to toggle on/off overlay help. */ setHelpMode: function(n) { const e = this.hoverVisibilities.length, t = e - 1, i = this.hoverVisibilities[this.helpModeActiveIndex]; if (i) { const r = i == null ? void 0 : i.refs, s = i == null ? void 0 : i.ref; this.$refs[r || s] || (this.helpModeActiveIndex += 1); } n || (this.helpModeActiveIndex = this.helpModeInitialIndex), n && this.helpModeActiveIndex >= t && this.$emit("help-mode-last-item", !0), n && !this.helpModeDialog ? (this.inHelp = !0, this.hoverVisibilities.forEach((r) => { r.value = !0; })) : n && this.helpModeDialog && e > this.helpModeActiveIndex ? this.helpModeActiveIndex > -1 && setTimeout(() => { this.inHelp = !1, this.hoverVisibilities.forEach((r) => { r.value = !1; }), this.showHelpText(this.helpModeActiveIndex, 200); }, 300) : (this.inHelp = !1, this.hoverVisibilities.forEach((r) => { r.value = !1; })); }, /** * Callback function used by showRegionTooltip in the case when the tooltip * is out of view. */ displayTooltipOfObjectsCallback: function(n, e, t, i, r) { const s = this; return function() { s.$module.zincRenderer.removePostRenderCallbackFunction( s.$_regionTooltipCallback ), s.$_regionTooltipCallback = void 0, s.displayTooltipOfObjects(n, e, t, i, r); }; }, liveUpdateTooltipPosition: function() { this.$module.selectedCenter && (this.tData.x = this.$module.selectedScreenCoordinates.x, this.tData.y = this.$module.selectedScreenCoordinates.y); }, displayTooltipOfObjects: function(n, e, t, i, r) { if (e.length > 0) { let s = e[0].getClosestVertexDOMElementCoords( this.$module.scene ); if (s) return s.inView ? (n.includes("Search Results for") ? this.tData.active = !1 : this.tData.active = !0, this.tData.visible = !0, this.tData.label = n, this.tData.x = s.position.x, this.tData.y = s.position.y, this.tData.region = t, this.$_liveCoordinatesUpdated && this.$module.zincRenderer.removePostRenderCallbackFunction( this.$_liveCoordinatesUpdated ), r && (this.$module.setupLiveCoordinates(e), this.$_liveCoordinatesUpdated = this.$module.zincRenderer.addPostRenderCallbackFunction( this.liveUpdateTooltipPosition ))) : (this.hideRegionTooltip(), i && (this.$module.scene.viewAll(), this.$_regionTooltipCallback && this.$module.zincRenderer.removePostRenderCallbackFunction( this.$_regionTooltipCallback ), this.$_regionTooltipCallback = this.$module.zincRenderer.addPostRenderCallbackFunction( this.displayTooltipOfObjectsCallback( n, e, t, i, r ) ))), !0; } return this.hideRegionTooltip(), !1; }, /** * Display the tooltip used for displaying search result. * When resetView is set to true, it will * reset view if the tooltip is not in view. * Setting liveUpdates to true will update the tooltip location * at every rendering loop. */ showRegionTooltipWithObjects: function(n, e, t, i, r) { return n && e && e.length > 0 && this.$module.scene ? this.displayTooltipOfObjects( n, e, t, i, r ) : (this.hideRegionTooltip(), !1); }, /** * Display the tooltip. When resetView is set to true, it will * reset view if the tooltip is not in view. * Setting liveUpdates to true will update the tooltip location * at every rendering loop. */ showRegionTooltip: function(n, e, t) { if (n && this.$module.scene) { const i = this.$module.scene.getRootRegion(), s = Ao(i, [n], "", !0); let o; return s && s.length > 0 && (o = s[0].getRegion().getFullPath()), this.showRegionTooltipWithObjects( n, s, o, e, t ); } return this.hideRegionTooltip(), !1; }, /** * Display the tooltip using the list of annotations. * When resetView is set to true, it will * reset view if the tooltip is not in view. * Setting liveUpdates to true will update the tooltip location * at every rendering loop. */ showRegionTooltipWithAnnotations: function(n, e, t) { if (this.$module.scene) { const i = Zv(this.$module.scene, n); if (i && i.objects.length > 0) if (this.annotationSidebar) { const s = { featureId: (this.tData.region ? this.tData.region + "/" : "") + this.tData.label, resourceId: this.url, resource: this.url }; this.$emit("annotation-open", { annotationEntry: s, createData: this.createData, confirmCreate: this.confirmCreate, cancelCreate: this.cancelCreate, confirmDelete: this.confirmDelete }); return; } else return this.showRegionTooltipWithObjects( i.label, i.objects, i.regionPath, e, t ); } return this.hideRegionTooltip(), !1; }, /** * Callback on viewing mode change * Optional, can be used to update the view mode. */ changeViewingMode: function(n) { if (this.$module) { if (n && (this.viewingMode = n), this.viewingMode === "Annotation") { let e = !1; this.userInformation && (e = !0), this.userInformation = void 0, this.annotator.authenticate(this.userToken).then((t) => { t.name && t.email && t.canUpdate && (this.userInformation = t, e || (Yv(this.annotator, this.userToken, this.url).then((i) => { i && i.features && jh(this.$module.scene, i.features); }), Yv(this.annotator, this.userToken, encodeURIComponent(this.url)).then((i) => { i && i.features && jh(this.$module.scene, i.features); }))); }); } else this.viewingMode === "Exploration" && (this.activeDrawTool = void 0, this.activeDrawMode = void 0, this.createData.shape = ""); this.viewingMode === "Exploration" || this.viewingMode === "Annotation" && this.createData.shape === "" ? this.$module.selectObjectOnPick = !0 : this.$module.selectObjectOnPick = !1, this.cancelCreate(); } }, /** * @public * Hide the tooltip */ hideRegionTooltip: function() { this.$_liveCoordinatesUpdated && (this.$module.zincRenderer.removePostRenderCallbackFunction( this.$_liveCoordinatesUpdated ), this.$module.setupLiveCoordinates(void 0)), this.tData.active = !1, this.tData.visible = !1, this.tData.region = void 0; }, /** * Set the marker modes for objects with the provided name, mode can * be "on", "off" or "inherited". * Value can either be number or an object containing number and * imgURL. */ setMarkerModeForObjectsWithName: function(n, e, t) { if (n && this.$module.scene) { let i = e; typeof e == "number" && (i = { number: e, imgURL: void 0 }); const r = this.$module.scene.getRootRegion(); Ao(r, [n], "", !0).forEach((a) => a.setMarkerMode(t, i)); } }, /** * @public * Set the marker modes for objects specified by the list of annotations * @arg `annotations` * @arg `mode` */ setMarkerModeWithAnnotations: function(n, e) { if (this.$module.scene) { const t = Zv(this.$module.scene, n); t && t.objects.length > 0 && t.objects.forEach((i) => i.setMarkerMode(e)); } }, /** * This is called when mouse cursor enters supported elements * with help tootltips. */ showHelpText: function(n, e = 500) { this.inHelp || (clearTimeout(this.helpTextWait[n]), this.helpTextWait[n] = setTimeout(() => { this.hoverVisibilities[n].value = !0, this.$emit("shown-tooltip"); }, e)); }, /** * This is called when mouse cursor exits supported element.. */ hideHelpText: function(n, e = 500) { this.inHelp || (clearTimeout(this.helpTextWait[n]), this.helpTextWait[n] = setTimeout(() => { this.hoverVisibilities[n].value = !1; }, e)); }, /** * @public * * Search a object and display the tooltip * @arg "text to search across" * @arg "toggle the tooltip if this is set" */ search: function(n, e) { if (this.$_searchIndex) { if (n === void 0 || n === "" || Array.isArray(n) && n.length === 0) return this.lastSelected.region = "", this.lastSelected.group = "", this.lastSelected.isSearch = !0, this.objectSelected([], !0), !1; { this.lastSelected.region = "", this.lastSelected.group = n, this.lastSelected.isSearch = !0; const t = this.$_searchIndex.searchAndProcessResult(n), i = t.zincObjects; if (i.length > 0) { if (this.objectSelected(i, !0), e) for (let r = 0; r < i.length; r++) i[r] && i[r].groupName && this.showRegionTooltipWithObjects( t.label, i, t.regionPath, !0, !0 ); return !0; } else this.objectSelected([], !0); } } return !1; }, /** * @public * * Get the list of suggested terms based on the provided term. * This can be used for autocomplete. * @arg `term` */ fetchSuggestions: function(n) { return this.$_searchIndex === void 0 ? [] : this.$_searchIndex.auto_suggest(n); }, /** * Called when minimap settings has changed. Pass the * parameters to ZincJS and marked it for update. */ updateMinimapScissor: function() { Object.keys(this.minimapSettings).forEach((n) => { this.$module.scene.minimapScissor[n] = this.minimapSettings[n]; }), this.$module.scene.minimapScissor.updateRequired = !0; }, updateSettingsfromScene: function() { this.currentSpeed = 1, this.$module.setPlayRate(this.defaultRate), this.orginalDuration = this.$module.scene.getMetadataTag("OriginalDuration"), this.animateDuration = this.$module.scene.getMetadataTag("Duration"); let n = this.$module.scene.getMetadataTag("TimeStamps"); this.timeStamps = {}; for (const e in n) this.timeStamps[n[e]] = e; this.timeMax = this.$module.scene.getDuration(); }, restoreSettings: function(n) { if (n) { if (n.viewport) this.$module.scene.getZincCameraControls().setCurrentCameraSettings(n.viewport); else if (n.viewURL && n.viewURL !== "") { const t = new URL(n.viewURL, this.url); this.$module.scene.loadViewURL(t); } else n.region && n.region !== "" && this.viewRegion(n.region); n.visibility && this.$nextTick(() => { this.$refs.scaffoldTreeControls.setState(n.visibility); }), n.background && this.backgroundChangeCallback(n.background), n.viewingMode && this.changeViewingMode(n.viewingMode); const e = n.search; e && e.group && (e.isSearch ? this.search(e.group, !0) : this.changeActiveByName(e.group, e.region, !0)); } }, setURLFinishCallback: function(n) { return () => { this.localAnnotationsList.length = 0, this.updateSettingsfromScene(), this.$module.updateTime(0.01), this.$module.updateTime(0), this.$module.unsetFinishDownloadCallback(), this.addRegionsToSearchIndex(), this.$emit("on-ready"), this.setMarkers(), this._boundingBoxGeo = this.$module.scene.addBoundingBoxPrimitive( "_helper", "boundingBox", 4251856, 0.15 ), this._slides = this.$module.scene.addSlicesPrimitive( "_helper", ["x-plane", "y-plane", "z-plane"], [16733525, 5635925, 5592575], 0.5 ); const { centre: e, size: t } = this.$module.getCentreAndSize(); this.boundingDims.centre = e, this.boundingDims.size = t, this.$nextTick(() => this.restoreSettings(n)), this.isReady = !0; }; }, /** * Function used for getting the current states of the scene. This exported states * can be imported using the importStates method. * * @public */ getState: function() { let n = { format: this.fileFormat, url: this._currentURL, viewport: void 0, visibility: void 0, background: this.currentBackground, viewingMode: this.viewingMode }; if (this.$refs.scaffoldTreeControls && (n.visibility = this.$refs.scaffoldTreeControls.getState()), this.$module.scene) { let e = this.$module.scene.getZincCameraControls(); n.viewport = e.getCurrentViewport(); } return this.lastSelected && this.lastSelected.group && (n.search = { ...this.lastSelected }), n; }, /** * Function used for importing the states of the scene. This exported states * can be imported using the read states method. * * @public * @arg `state` */ setState: function(n) { n && (n.url && n.url !== this._currentURL ? this.setURLAndState(n.url, { fileFormat: n.fileFormat, viewport: n.viewport, visibility: n.visibility, background: n.background, viewingMode: this.viewingMode, search: n.search }) : (n.background || n.search || n.viewport || n.viewingMode || n.visibility) && (this.isReady && this.$module.scene ? this.restoreSettings(n) : this.$module.setFinishDownloadCallback( this.setURLFinishCallback({ background: n.background, viewingMode: n.viewingMode, viewport: n.viewport, visibility: n.visibility, search: n.search }) ))); }, /** * export current scene in GLTF. * @arg "Return in binary form when set to true" * * @public */ exportGLTF: function(n) { return this.$module.scene.exportGLTF(n); }, /** * Return a copy of the local annotations list. * This list is used for storing user created annotation * when enableLocalAnnotations is set to true. * * @public */ getLocalAnnotations: function() { return [...this.localAnnotationsList]; }, /** * Import local annotations. The annotations will only * be imported when enableLocalAnnotations is set to * true; * * @public * @arg {Array} `annotationsList` */ importLocalAnnotations: function(n) { if (this.enableLocalAnnotations) { n.forEach((t) => { const i = t.group, r = t.region; let s = r.slice(-1) === "/" ? r : r + "/"; const o = s.slice(0, -1); t.region = o, s = s + i; const a = s; t.item.id = a, t.feature.id = a; }); const e = n.map((t) => t.feature); jh(this.$module.scene, e), n.forEach((t) => { this.localAnnotationsList.push({ ...t }); }); } }, /** * Function used for reading in new scaffold metadata and a custom * viewport. This function will ignore the state prop and * read in the new url. * * @public * @arg `newValue` * @arg `state` */ setURLAndState: function(n, e) { n != this._currentURL && (e != null && e.format && (this.fileFormat = e.format), this._currentURL = n, this.$refs.scaffoldTreeControls && this.$refs.scaffoldTreeControls.clear(), this.loading = !0, this.timeVarying = !1, this.isReady = !1, this.$_searchIndex.removeAll(), this.hideRegionTooltip(), this.$module.setFinishDownloadCallback( this.setURLFinishCallback({ background: e == null ? void 0 : e.background, region: this.region, search: e == null ? void 0 : e.search, viewingMode: e == null ? void 0 : e.viewingMode, viewURL: this.viewURL, viewport: e == null ? void 0 : e.viewport, visibility: e == null ? void 0 : e.visibility }) ), this.fileFormat === "gltf" ? this.$module.loadGLTFFromURL(n, "scene", !0) : this.$module.loadOrgansFromURL( n, void 0, void 0, "scene", void 0, !0 ), this.$module && this.$module.scene && (this.$module.scene.displayMarkers = this.displayMarkers, this.$module.scene.forcePickableObjectsUpdate = !0, this.$module.scene.displayMinimap = this.displayMinimap, this.updateMinimapScissor())); }, /** * Function used for reading in new scaffold metadata. This function will ignore * the state prop and read in the new url. * * @public * @arg `newValue` */ setURL: function(n) { this.setURLAndState(n, void 0); }, /** * Callback when drawer is toggled. */ drawerToggled: function(n) { this.drawerOpen = n, this.adjustLayout(); }, /** * Callback using ResizeObserver. */ adjustLayout: function() { if (this.$refs.scaffoldContainer) { let n = this.$refs.scaffoldContainer.clientWidth; this.minimisedSlider = n < 812, this.minimisedSlider ? this.sliderPosition = this.drawerOpen ? "right" : "left" : this.sliderPosition = ""; } }, toggleRendering: function(n) { this.$module.zincRenderer && (n ? this.$module.zincRenderer.animate() : this.$module.zincRenderer.stopAnimate()); }, /** * @public * * Force the renderer to resize */ forceResize: function() { this.$module.zincRenderer && this.$module.zincRenderer.onWindowResize(); }, syncControlCallback: function() { const n = this.$module.NDCCameraControl.getPanZoom(); this.tData.visible && this.showRegionTooltip(this.tData.label, !0, !0), this.$emit("scaffold-navigated", n); }, /** * Rotate mode - "none", "horizontal", "vertical", "free" but * it will be ignored if flag is set to false. */ toggleSyncControl: function(n, e) { this.$module.toggleSyncControl(n, e), this.$module.setSyncControlCallback(this.syncControlCallback); }, /** * Set the markers for the scene. */ setMarkers: function() { for (const [n, e] of Object.entries(this.markerLabels)) this.setMarkerModeForObjectsWithName(n, e, "on"); } } }, kp = (n) => (p1("data-v-3a5a2c2d"), n = n(), m1(), n), jU = { ref: "scaffoldContainer", class: "scaffold-container", "element-loading-text": "Loading...", "element-loading-background": "rgba(0, 0, 0, 0.3)" }, $U = /* @__PURE__ */ kp(() => /* @__PURE__ */ Be("span", { class: "message-text" }, "Beta", -1)), ZU = /* @__PURE__ */ kp(() => /* @__PURE__ */ Be("span", { class: "message-text" }, "What's new?", -1)), XU = { class: "primitive-controls-box" }, YU = { class: "animation-data" }, JU = { class: "purple" }, qU = { class: "animation-data" }, KU = { class: "purple" }, QU = { class: "animation-data" }, e4 = { class: "bottom-right-control" }, t4 = /* @__PURE__ */ kp(() => /* @__PURE__ */ Be("div", null, [ /* @__PURE__ */ yt(" Fit to "), /* @__PURE__ */ Be("br"), /* @__PURE__ */ yt(" window ") ], -1)), n4 = { style: { "margin-bottom": "2px" } }, i4 = { key: 0, class: "viewing-mode-title" }, r4 = ["onClick"], s4 = ["onClick"]; function o4(n, e, t, i, r, s) { const o = Xn("map-svg-sprite-color"), a = Hw, c = Xn("DrawToolbar"), l = I0, d = Bt, h = Mu, p = zw, g = Bw, f = Xn("map-svg-icon"), u = ci, y = Hi, v = Oy, m = aa, w = oa, S = Iy, T = sa, M = vd; return Ft((pe(), Re("div", jU, [ ae(o), ae(a, { createData: n.createData, label: n.tData.label, region: n.tData.region, visible: n.tData.visible, x: n.tData.x, y: n.tData.y, annotationDisplay: s.annotationDisplay, onConfirmCreate: e[0] || (e[0] = (x) => s.confirmCreate(x)), onCancelCreate: e[1] || (e[1] = (x) => s.cancelCreate()), onConfirmDelete: e[2] || (e[2] = (x) => s.confirmDelete()), onTooltipHide: e[3] || (e[3] = (x) => s.onTooltipHide()) }, null, 8, ["createData", "label", "region", "visible", "x", "y", "annotationDisplay"]), Be("div", { id: "organsDisplayArea", ref: "display", tabindex: "-1", style: { height: "100%", width: "100%" }, onKeydown: e[4] || (e[4] = vi((...x) => s.backgroundChangeCallback && s.backgroundChangeCallback(...x), ["66"])) }, null, 544), Ft(Be("div", null, [ n.viewingMode === "Annotation" && (n.userInformation || t.enableLocalAnnotations) ? (pe(), He(c, { key: 0, toolbarOptions: n.toolbarOptions, activeDrawTool: n.activeDrawTool, activeDrawMode: n.activeDrawMode, hoverVisibilities: n.hoverVisibilities, onClickToolbar: s.toggleDrawing, onShowTooltip: s.showHelpText, onHideTooltip: s.hideHelpText, ref: "toolbarPopover" }, null, 8, ["toolbarOptions", "activeDrawTool", "activeDrawMode", "hoverVisibilities", "onClickToolbar", "onShowTooltip", "onHideTooltip"])) : Ge("", !0), t.displayWarning ? (pe(), He(h, { key: 1, ref: "warningPopover", visible: n.hoverVisibilities[7].value, content: t.warningMessage, placement: "right", width: "max-content", teleported: !1, "popper-class": "scaffold-popper message-popper right-popper non-selectable" }, { reference: fe(() => [ t.displayWarning ? (pe(), Re("div", { key: 0, class: "message-icon warning-icon", onMouseover: e[5] || (e[5] = (x) => s.showHelpText(7)), onMouseout: e[6] || (e[6] = (x) => s.hideHelpText(7)) }, [ ae(d, null, { default: fe(() => [ ae(l) ]), _: 1 }), $U ], 32)) : Ge("", !0) ]), _: 1 }, 8, ["visible", "content"])) : Ge("", !0), t.displayLatestChanges ? (pe(), He(h, { key: 2, visible: n.hoverVisibilities[8].value, content: t.latestChangesMessage, placement: "right", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper message-popper right-popper non-selectable", ref: "whatsNewPopover" }, { reference: fe(() => [ t.displayLatestChanges && t.latestChangesMessage ? (pe(), Re("div", { key: 0, class: "el-icon-warning message-icon latest-changesicon", onMouseover: e[7] || (e[7] = (x) => s.showHelpText(8)), onMouseout: e[8] || (e[8] = (x) => s.hideHelpText(8)) }, [ ae(d, null, { default: fe(() => [ ae(l) ]), _: 1 }), ZU ], 32)) : Ge("", !0) ]), _: 1 }, 8, ["visible", "content"])) : Ge("", !0), ae(h, { visible: n.hoverVisibilities[6].value, content: "Change region visibility", placement: "right", width: "max-content", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper right-popper non-selectable", ref: "regionVisibilityPopover" }, { reference: fe(() => [ ae(p, { ref: "scaffoldTreeControls", isReady: n.isReady, "show-colour-picker": t.showColourPicker, onObjectSelected: s.objectSelected, onObjectHovered: s.objectHovered, onDrawerToggled: s.drawerToggled }, null, 8, ["isReady", "show-colour-picker", "onObjectSelected", "onObjectHovered", "onDrawerToggled"]) ]), _: 1 }, 8, ["visible"]), Be("div", XU, [ ae(g, { ref: "primitiveControls", createData: n.createData, onPrimitivesUpdated: s.primitivesUpdated }, null, 8, ["createData", "onPrimitivesUpdated"]) ]), n.timeVarying ? (pe(), He(h, { key: 3, ref: "sliderPopover", width: "max-content", visible: n.hoverVisibilities[5].value, content: "Move the slider to animate the region", placement: "top", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper top-popper non-selectable" }, { reference: fe(() => [ n.timeVarying ? (pe(), Re("div", { key: 0, class: Le(["time-slider-container", [n.minimisedSlider ? "minimised" : "", n.sliderPosition]]) }, [ ae(S, { type: "card" }, { default: fe(() => [ ae(v, { label: "Animate scaffold" }, { default: fe(() => [ ae(y, { class: "tab-content" }, { default: fe(() => [ n.isPlaying ? (pe(), He(f, { key: 0, icon: "pause", class: "icon-button video-button", onClick: e[9] || (e[9] = (x) => s.play(!1)) })) : (pe(), He(f, { key: 1, icon: "play", class: "video-button icon-button", onClick: e[10] || (e[10] = (x) => s.play(!0)) })), ae(u, { min: 0, max: n.timeMax, "model-value": n.currentTime / 100 * n.timeMax, step: 0.1, "tooltip-class": "time-slider-tooltip", class: "slider", "format-tooltip": s.formatTooltip, marks: n.timeStamps, onInput: e[11] || (e[11] = (x) => s.timeChange(x)) }, null, 8, ["max", "model-value", "format-tooltip", "marks"]) ]), _: 1 }) ]), _: 1 }), ae(v, { label: "Animation data" }, { default: fe(() => [ ae(y, { class: "tab-content" }, { default: fe(() => [ Be("div", YU, [ yt(" Original duration: "), Be("div", JU, wt(n.orginalDuration), 1) ]), Be("div", qU, [ yt(" Animation duration: "), Be("div", KU, wt(n.animateDuration), 1) ]), Be("div", QU, [ yt(" Playback speed "), ae(w, { teleported: !0, "model-value": n.currentSpeed, placeholder: "Select", class: "scaffold-select-box speed", "popper-class": "scaffold_viewer_dropdown", onChange: e[12] || (e[12] = (x) => s.speedChanged(x)) }, { default: fe(() => [ (pe(!0), Re(Wt, null, ri(n.playSpeed, (x) => (pe(), He(m, { key: x.value, label: x.label, value: x.value }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["model-value"]) ]) ]), _: 1 }) ]), _: 1 }) ]), _: 1 }) ], 2)) : Ge("", !0) ]), _: 1 }, 8, ["visible"])) : Ge("", !0), Be("div", e4, [ ae(h, { visible: n.hoverVisibilities[0].value, content: "Zoom in", width: "max-content", placement: "left", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper left-popper non-selectable", ref: "zoomInPopover" }, { reference: fe(() => [ ae(f, { icon: "zoomIn", class: "icon-button zoomIn", onClick: e[13] || (e[13] = (x) => s.zoomIn()), onMouseover: e[14] || (e[14] = (x) => s.showHelpText(0)), onMouseout: e[15] || (e[15] = (x) => s.hideHelpText(0)) }) ]), _: 1 }, 8, ["visible"]), ae(h, { visible: n.hoverVisibilities[1].value, content: "Zoom out", placement: "top-end", width: "max-content", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper popper-zoomout non-selectable", ref: "zoomOutPopover" }, { reference: fe(() => [ ae(f, { icon: "zoomOut", class: "icon-button zoomOut", onClick: e[16] || (e[16] = (x) => s.zoomOut()), onMouseover: e[17] || (e[17] = (x) => s.showHelpText(1)), onMouseout: e[18] || (e[18] = (x) => s.hideHelpText(1)) }) ]), _: 1 }, 8, ["visible"]), ae(h, { visible: n.hoverVisibilities[2].value, placement: "top", teleported: !1, trigger: "manual", width: "max-content", "popper-class": "scaffold-popper non-selectable", ref: "zoomFitPopover" }, { reference: fe(() => [ ae(f, { icon: "fitWindow", class: "icon-button fitWindow", onClick: e[19] || (e[19] = (x) => s.fitWindow()), onMouseover: e[20] || (e[20] = (x) => s.showHelpText(2)), onMouseout: e[21] || (e[21] = (x) => s.hideHelpText(2)) }) ]), default: fe(() => [ t4 ]), _: 1 }, 8, ["visible"]) ]), n.openMapRef ? (pe(), He(h, { key: 4, ref: "open-map-popover", "virtual-ref": n.openMapRef, placement: "top-start", width: "128", teleported: !1, trigger: "click", "popper-class": "open-map-popper", "virtual-triggering": "" }, { default: fe(() => [ (pe(!0), Re(Wt, null, ri(t.openMapOptions, (x) => (pe(), He(y, { key: x.key }, { default: fe(() => [ ae(T, { type: "primary", plain: "", onClick: (_) => n.$emit("open-map", x.key) }, { default: fe(() => [ yt(wt(x.display), 1) ]), _: 2 }, 1032, ["onClick"]) ]), _: 2 }, 1024))), 128)) ]), _: 1 }, 8, ["virtual-ref"])) : Ge("", !0), ae(h, { ref: "backgroundPopover", "virtual-ref": n.backgroundIconRef, placement: "top-start", width: "128", teleported: !1, trigger: "click", "popper-class": "background-popper non-selectable h-auto", "virtual-triggering": "" }, { default: fe(() => [ Be("div", null, [ ae(y, { class: "backgroundText" }, { default: fe(() => [ yt("Viewing Mode") ]), _: 1 }), ae(y, { class: "backgroundControl" }, { default: fe(() => [ Be("div", n4, [ (pe(!0), Re(Wt, null, ri(n.viewingModes, (x, _, E) => (pe(), Re(Wt, { key: _ }, [ _ === n.viewingMode ? (pe(), Re("span", i4, [ Be("b", null, wt(_), 1) ])) : (pe(), Re("span", { key: 1, class: "viewing-mode-unselected", onClick: (L) => s.changeViewingMode(_) }, wt(_), 9, r4)) ], 64))), 128)) ]), ae(y, { class: "viewing-mode-description" }, { default: fe(() => [ yt(wt(n.viewingModes[n.viewingMode]), 1) ]), _: 1 }) ]), _: 1 }), ae(y, { class: "backgroundSpacer" }), ae(y, { class: "backgroundText" }, { default: fe(() => [ yt(" Change background ") ]), _: 1 }), ae(y, { class: "backgroundChooser" }, { default: fe(() => [ (pe(!0), Re(Wt, null, ri(n.availableBackground, (x) => (pe(), Re("div", { key: x, class: Le([ "backgroundChoice", x, x == n.currentBackground ? "active" : "" ]), onClick: (_) => s.backgroundChangeCallback(x) }, null, 10, s4))), 128)) ]), _: 1 }) ]) ]), _: 1 }, 8, ["virtual-ref"]), Be("div", { class: Le(["settings-group", { open: n.drawerOpen, close: !n.drawerOpen }]) }, [ ae(y, null, { default: fe(() => [ ae(h, { visible: n.hoverVisibilities[3].value, content: "Open new map", placement: "right", teleported: !1, trigger: "manual", width: "max-content", "popper-class": "scaffold-popper right-popper non-selectable", ref: "openMapPopover" }, { reference: fe(() => [ t.enableOpenMapUI && t.openMapOptions.length > 0 ? (pe(), He(f, { key: 0, ref: "openMapRef", icon: "openMap", class: "icon-button open-map-button", onMouseover: e[22] || (e[22] = (x) => s.showHelpText(3)), onMouseout: e[23] || (e[23] = (x) => s.hideHelpText(3)) }, null, 512)) : Ge("", !0) ]), _: 1 }, 8, ["visible"]) ]), _: 1 }), ae(y, null, { default: fe(() => [ ae(h, { visible: n.hoverVisibilities[4].value, content: "Change background color", placement: "right", width: "max-content", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper right-popper non-selectable", ref: "settingsPopover" }, { reference: fe(() => [ ae(f, { ref: "backgroundIconRef", icon: "changeBckgd", class: "icon-button", onMouseover: e[24] || (e[24] = (x) => s.showHelpText(4)), onMouseout: e[25] || (e[25] = (x) => s.hideHelpText(4)) }, null, 512) ]), _: 1 }, 8, ["visible"]) ]), _: 1 }) ], 2) ], 512), [ [xn, t.displayUI && !n.isTransitioning] ]) ])), [ [M, n.loading] ]); } const u4 = /* @__PURE__ */ wr(WU, [["render", o4], ["__scopeId", "data-v-3a5a2c2d"]]); export { u4 as ScaffoldVuer };