import { R as K1, U as Q1, w as ew, h as tw, q as iw, G as rw, _ as nw, K as ow, E as Wu } from "./index-DsKXfcyp.js"; import { C as aw } from "./ContentMixin-BDLOq1Mp.js"; import { ref as Ae, defineComponent as Ie, computed as ce, openBlock as fe, createElementBlock as Ce, mergeProps as Pr, unref as H, renderSlot as qe, useAttrs as sw, useSlots as au, shallowRef as Pi, watch as Je, nextTick as _t, onMounted as ni, toRef as ki, createCommentVNode as Ve, Fragment as Gt, normalizeClass as Le, createElementVNode as ke, createBlock as He, withCtx as pe, resolveDynamicComponent as Fi, withModifiers as ui, createVNode as se, toDisplayString as wt, normalizeStyle as It, provide as pi, reactive as Yi, onActivated as lw, onUpdated as rp, inject as ct, onBeforeUnmount as sr, withDirectives as Bt, cloneVNode as cw, Text as o0, Comment as uw, Transition as hl, vShow as yi, readonly as a0, onDeactivated as hw, toHandlers as dw, withKeys as gr, createTextVNode as yt, createSlots as pw, toRefs as cn, getCurrentInstance as si, h as ba, renderList as rr, onUnmounted as s0, markRaw as Ai, watchEffect as l0, warn as fw, onBeforeMount as mw, toRaw as np, getCurrentScope as c0, onScopeDispose as u0, isRef as Ro, isVNode as Qh, Teleport as gw, resolveComponent as Ri, resolveDirective as vw, toHandlerKey as yw, vModelText as bw, createApp as xw, hasInjectionContext as ww, effectScope as _w, isReactive as op, pushScopeId as Mw, popScopeId as Sw } from "vue"; const Kr = (i, e, { checkForDefaultPrevented: t = !0 } = {}) => (r) => { const n = i == null ? void 0 : i(r); if (t === !1 || !n) return e == null ? void 0 : e(r); }; var Tw = Object.defineProperty, Ew = Object.defineProperties, Aw = Object.getOwnPropertyDescriptors, Vf = Object.getOwnPropertySymbols, Cw = Object.prototype.hasOwnProperty, Lw = Object.prototype.propertyIsEnumerable, Hf = (i, e, t) => e in i ? Tw(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, Rw = (i, e) => { for (var t in e || (e = {})) Cw.call(e, t) && Hf(i, t, e[t]); if (Vf) for (var t of Vf(e)) Lw.call(e, t) && Hf(i, t, e[t]); return i; }, Ow = (i, e) => Ew(i, Aw(e)); function jf(i, e) { var t; const r = Pi(); return l0(() => { r.value = i(); }, Ow(Rw({}, e), { flush: (t = void 0) != null ? t : "sync" })), a0(r); } var Gf; const ii = typeof window < "u", Pw = (i) => typeof i == "string", h0 = () => { }, ed = ii && ((Gf = window == null ? void 0 : window.navigator) == null ? void 0 : Gf.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent); function d0(i) { return typeof i == "function" ? i() : H(i); } function Iw(i) { return i; } function su(i) { return c0() ? (u0(i), !0) : !1; } function Dw(i, e = !0) { si() ? ni(i) : e ? i() : _t(i); } function rn(i) { var e; const t = d0(i); return (e = t == null ? void 0 : t.$el) != null ? e : t; } const dl = ii ? window : void 0, Nw = ii ? window.document : void 0; function hi(...i) { let e, t, r, n; if (Pw(i[0]) || Array.isArray(i[0]) ? ([t, r, n] = i, e = dl) : [e, t, r, n] = i, !e) return h0; Array.isArray(t) || (t = [t]), Array.isArray(r) || (r = [r]); const o = [], a = () => { o.forEach((h) => h()), o.length = 0; }, s = (h, u, p, m) => (h.addEventListener(u, p, m), () => h.removeEventListener(u, p, m)), c = Je(() => [rn(e), d0(n)], ([h, u]) => { a(), h && o.push(...t.flatMap((p) => r.map((m) => s(h, p, m, u)))); }, { immediate: !0, flush: "post" }), l = () => { c(), a(); }; return su(l), l; } let Wf = !1; function Bw(i, e, t = {}) { const { window: r = dl, ignore: n = [], capture: o = !0, detectIframe: a = !1 } = t; if (!r) return; ed && !Wf && (Wf = !0, Array.from(r.document.body.children).forEach((h) => h.addEventListener("click", h0))); let s = !0; const c = (h) => n.some((u) => { if (typeof u == "string") return Array.from(r.document.querySelectorAll(u)).some((p) => p === h.target || h.composedPath().includes(p)); { const p = rn(u); return p && (h.target === p || h.composedPath().includes(p)); } }), l = [ hi(r, "click", (h) => { const u = rn(i); if (!(!u || u === h.target || h.composedPath().includes(u))) { if (h.detail === 0 && (s = !c(h)), !s) { s = !0; return; } e(h); } }, { passive: !0, capture: o }), hi(r, "pointerdown", (h) => { const u = rn(i); u && (s = !h.composedPath().includes(u) && !c(h)); }, { passive: !0 }), a && hi(r, "blur", (h) => { var u; const p = rn(i); ((u = r.document.activeElement) == null ? void 0 : u.tagName) === "IFRAME" && !(p != null && p.contains(r.document.activeElement)) && e(h); }) ].filter(Boolean); return () => l.forEach((h) => h()); } function p0(i, e = !1) { const t = Ae(), r = () => t.value = !!i(); return r(), Dw(r, e), t; } const $f = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, qf = "__vueuse_ssr_handlers__"; $f[qf] = $f[qf] || {}; function kw({ document: i = Nw } = {}) { if (!i) return Ae("visible"); const e = Ae(i.visibilityState); return hi(i, "visibilitychange", () => { e.value = i.visibilityState; }), e; } var Xf = Object.getOwnPropertySymbols, Fw = Object.prototype.hasOwnProperty, zw = Object.prototype.propertyIsEnumerable, Uw = (i, e) => { var t = {}; for (var r in i) Fw.call(i, r) && e.indexOf(r) < 0 && (t[r] = i[r]); if (i != null && Xf) for (var r of Xf(i)) e.indexOf(r) < 0 && zw.call(i, r) && (t[r] = i[r]); return t; }; function ir(i, e, t = {}) { const r = t, { window: n = dl } = r, o = Uw(r, ["window"]); let a; const s = p0(() => n && "ResizeObserver" in n), c = () => { a && (a.disconnect(), a = void 0); }, l = Je(() => rn(i), (u) => { c(), s.value && n && u && (a = new ResizeObserver(e), a.observe(u, o)); }, { immediate: !0, flush: "post" }), h = () => { c(), l(); }; return su(h), { isSupported: s, stop: h }; } var Zf = Object.getOwnPropertySymbols, Vw = Object.prototype.hasOwnProperty, Hw = Object.prototype.propertyIsEnumerable, jw = (i, e) => { var t = {}; for (var r in i) Vw.call(i, r) && e.indexOf(r) < 0 && (t[r] = i[r]); if (i != null && Zf) for (var r of Zf(i)) e.indexOf(r) < 0 && Hw.call(i, r) && (t[r] = i[r]); return t; }; function Gw(i, e, t = {}) { const r = t, { window: n = dl } = r, o = jw(r, ["window"]); let a; const s = p0(() => n && "MutationObserver" in n), c = () => { a && (a.disconnect(), a = void 0); }, l = Je(() => rn(i), (u) => { c(), s.value && n && u && (a = new MutationObserver(e), a.observe(u, o)); }, { immediate: !0 }), h = () => { c(), l(); }; return su(h), { isSupported: s, stop: h }; } var Yf; (function(i) { i.UP = "UP", i.RIGHT = "RIGHT", i.DOWN = "DOWN", i.LEFT = "LEFT", i.NONE = "NONE"; })(Yf || (Yf = {})); var Ww = Object.defineProperty, Jf = Object.getOwnPropertySymbols, $w = Object.prototype.hasOwnProperty, qw = Object.prototype.propertyIsEnumerable, Kf = (i, e, t) => e in i ? Ww(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, Xw = (i, e) => { for (var t in e || (e = {})) $w.call(e, t) && Kf(i, t, e[t]); if (Jf) for (var t of Jf(e)) qw.call(e, t) && Kf(i, t, e[t]); return i; }; const Zw = { 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] }; Xw({ linear: Iw }, Zw); function Yw({ window: i = dl } = {}) { if (!i) return Ae(!1); const e = Ae(i.document.hasFocus()); return hi(i, "blur", () => { e.value = !1; }), hi(i, "focus", () => { e.value = !0; }), e; } const Jw = () => ii && /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 $s = () => { }, Kw = Object.prototype.hasOwnProperty, Qf = (i, e) => Kw.call(i, e), zi = Array.isArray, Ci = (i) => typeof i == "function", Ii = (i) => typeof i == "string", Oi = (i) => i !== null && typeof i == "object", Qw = Object.prototype.toString, e_ = (i) => Qw.call(i), $u = (i) => e_(i).slice(8, -1), ap = (i) => { const e = /* @__PURE__ */ Object.create(null); return (t) => e[t] || (e[t] = i(t)); }, t_ = /-(\w)/g, i_ = ap( (i) => i.replace(t_, (e, t) => t ? t.toUpperCase() : "") ), r_ = /\B([A-Z])/g, n_ = ap( (i) => i.replace(r_, "-$1").toLowerCase() ), o_ = ap((i) => i.charAt(0).toUpperCase() + i.slice(1)); var f0 = typeof global == "object" && global && global.Object === Object && global, a_ = typeof self == "object" && self && self.Object === Object && self, Vr = f0 || a_ || Function("return this")(), Br = Vr.Symbol, m0 = Object.prototype, s_ = m0.hasOwnProperty, l_ = m0.toString, gs = Br ? Br.toStringTag : void 0; function c_(i) { var e = s_.call(i, gs), t = i[gs]; try { i[gs] = void 0; var r = !0; } catch { } var n = l_.call(i); return r && (e ? i[gs] = t : delete i[gs]), n; } var u_ = Object.prototype, h_ = u_.toString; function d_(i) { return h_.call(i); } var p_ = "[object Null]", f_ = "[object Undefined]", em = Br ? Br.toStringTag : void 0; function ts(i) { return i == null ? i === void 0 ? f_ : p_ : em && em in Object(i) ? c_(i) : d_(i); } function Ca(i) { return i != null && typeof i == "object"; } var m_ = "[object Symbol]"; function lu(i) { return typeof i == "symbol" || Ca(i) && ts(i) == m_; } function g_(i, e) { for (var t = -1, r = i == null ? 0 : i.length, n = Array(r); ++t < r; ) n[t] = e(i[t], t, i); return n; } var br = Array.isArray, v_ = 1 / 0, tm = Br ? Br.prototype : void 0, im = tm ? tm.toString : void 0; function g0(i) { if (typeof i == "string") return i; if (br(i)) return g_(i, g0) + ""; if (lu(i)) return im ? im.call(i) : ""; var e = i + ""; return e == "0" && 1 / i == -v_ ? "-0" : e; } var y_ = /\s/; function b_(i) { for (var e = i.length; e-- && y_.test(i.charAt(e)); ) ; return e; } var x_ = /^\s+/; function w_(i) { return i && i.slice(0, b_(i) + 1).replace(x_, ""); } function Gn(i) { var e = typeof i; return i != null && (e == "object" || e == "function"); } var rm = NaN, __ = /^[-+]0x[0-9a-f]+$/i, M_ = /^0b[01]+$/i, S_ = /^0o[0-7]+$/i, T_ = parseInt; function nm(i) { if (typeof i == "number") return i; if (lu(i)) return rm; if (Gn(i)) { var e = typeof i.valueOf == "function" ? i.valueOf() : i; i = Gn(e) ? e + "" : e; } if (typeof i != "string") return i === 0 ? i : +i; i = w_(i); var t = M_.test(i); return t || S_.test(i) ? T_(i.slice(2), t ? 2 : 8) : __.test(i) ? rm : +i; } function v0(i) { return i; } var E_ = "[object AsyncFunction]", A_ = "[object Function]", C_ = "[object GeneratorFunction]", L_ = "[object Proxy]"; function y0(i) { if (!Gn(i)) return !1; var e = ts(i); return e == A_ || e == C_ || e == E_ || e == L_; } var qu = Vr["__core-js_shared__"], om = function() { var i = /[^.]+$/.exec(qu && qu.keys && qu.keys.IE_PROTO || ""); return i ? "Symbol(src)_1." + i : ""; }(); function R_(i) { return !!om && om in i; } var O_ = Function.prototype, P_ = O_.toString; function Vo(i) { if (i != null) { try { return P_.call(i); } catch { } try { return i + ""; } catch { } } return ""; } var I_ = /[\\^$.*+?()[\]{}|]/g, D_ = /^\[object .+?Constructor\]$/, N_ = Function.prototype, B_ = Object.prototype, k_ = N_.toString, F_ = B_.hasOwnProperty, z_ = RegExp( "^" + k_.call(F_).replace(I_, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); function U_(i) { if (!Gn(i) || R_(i)) return !1; var e = y0(i) ? z_ : D_; return e.test(Vo(i)); } function V_(i, e) { return i == null ? void 0 : i[e]; } function Ho(i, e) { var t = V_(i, e); return U_(t) ? t : void 0; } var td = Ho(Vr, "WeakMap"); function H_(i, e, t) { switch (t.length) { case 0: return i.call(e); case 1: return i.call(e, t[0]); case 2: return i.call(e, t[0], t[1]); case 3: return i.call(e, t[0], t[1], t[2]); } return i.apply(e, t); } var j_ = 800, G_ = 16, W_ = Date.now; function $_(i) { var e = 0, t = 0; return function() { var r = W_(), n = G_ - (r - t); if (t = r, n > 0) { if (++e >= j_) return arguments[0]; } else e = 0; return i.apply(void 0, arguments); }; } function q_(i) { return function() { return i; }; } var jc = function() { try { var i = Ho(Object, "defineProperty"); return i({}, "", {}), i; } catch { } }(), X_ = jc ? function(i, e) { return jc(i, "toString", { configurable: !0, enumerable: !1, value: q_(e), writable: !0 }); } : v0, Z_ = $_(X_); function Y_(i, e, t, r) { i.length; for (var n = t + 1; n--; ) if (e(i[n], n, i)) return n; return -1; } var J_ = 9007199254740991, K_ = /^(?:0|[1-9]\d*)$/; function sp(i, e) { var t = typeof i; return e = e ?? J_, !!e && (t == "number" || t != "symbol" && K_.test(i)) && i > -1 && i % 1 == 0 && i < e; } function Q_(i, e, t) { e == "__proto__" && jc ? jc(i, e, { configurable: !0, enumerable: !0, value: t, writable: !0 }) : i[e] = t; } function lp(i, e) { return i === e || i !== i && e !== e; } var eM = Object.prototype, tM = eM.hasOwnProperty; function iM(i, e, t) { var r = i[e]; (!(tM.call(i, e) && lp(r, t)) || t === void 0 && !(e in i)) && Q_(i, e, t); } var am = Math.max; function rM(i, e, t) { return e = am(e === void 0 ? i.length - 1 : e, 0), function() { for (var r = arguments, n = -1, o = am(r.length - e, 0), a = Array(o); ++n < o; ) a[n] = r[e + n]; n = -1; for (var s = Array(e + 1); ++n < e; ) s[n] = r[n]; return s[e] = t(a), H_(i, this, s); }; } var nM = 9007199254740991; function cp(i) { return typeof i == "number" && i > -1 && i % 1 == 0 && i <= nM; } function oM(i) { return i != null && cp(i.length) && !y0(i); } var aM = Object.prototype; function sM(i) { var e = i && i.constructor, t = typeof e == "function" && e.prototype || aM; return i === t; } function lM(i, e) { for (var t = -1, r = Array(i); ++t < i; ) r[t] = e(t); return r; } var cM = "[object Arguments]"; function sm(i) { return Ca(i) && ts(i) == cM; } var b0 = Object.prototype, uM = b0.hasOwnProperty, hM = b0.propertyIsEnumerable, up = sm(/* @__PURE__ */ function() { return arguments; }()) ? sm : function(i) { return Ca(i) && uM.call(i, "callee") && !hM.call(i, "callee"); }; function dM() { return !1; } var x0 = typeof exports == "object" && exports && !exports.nodeType && exports, lm = x0 && typeof module == "object" && module && !module.nodeType && module, pM = lm && lm.exports === x0, cm = pM ? Vr.Buffer : void 0, fM = cm ? cm.isBuffer : void 0, id = fM || dM, mM = "[object Arguments]", gM = "[object Array]", vM = "[object Boolean]", yM = "[object Date]", bM = "[object Error]", xM = "[object Function]", wM = "[object Map]", _M = "[object Number]", MM = "[object Object]", SM = "[object RegExp]", TM = "[object Set]", EM = "[object String]", AM = "[object WeakMap]", CM = "[object ArrayBuffer]", LM = "[object DataView]", RM = "[object Float32Array]", OM = "[object Float64Array]", PM = "[object Int8Array]", IM = "[object Int16Array]", DM = "[object Int32Array]", NM = "[object Uint8Array]", BM = "[object Uint8ClampedArray]", kM = "[object Uint16Array]", FM = "[object Uint32Array]", Ot = {}; Ot[RM] = Ot[OM] = Ot[PM] = Ot[IM] = Ot[DM] = Ot[NM] = Ot[BM] = Ot[kM] = Ot[FM] = !0; Ot[mM] = Ot[gM] = Ot[CM] = Ot[vM] = Ot[LM] = Ot[yM] = Ot[bM] = Ot[xM] = Ot[wM] = Ot[_M] = Ot[MM] = Ot[SM] = Ot[TM] = Ot[EM] = Ot[AM] = !1; function zM(i) { return Ca(i) && cp(i.length) && !!Ot[ts(i)]; } function UM(i) { return function(e) { return i(e); }; } var w0 = typeof exports == "object" && exports && !exports.nodeType && exports, ks = w0 && typeof module == "object" && module && !module.nodeType && module, VM = ks && ks.exports === w0, Xu = VM && f0.process, um = function() { try { var i = ks && ks.require && ks.require("util").types; return i || Xu && Xu.binding && Xu.binding("util"); } catch { } }(), hm = um && um.isTypedArray, _0 = hm ? UM(hm) : zM, HM = Object.prototype, jM = HM.hasOwnProperty; function GM(i, e) { var t = br(i), r = !t && up(i), n = !t && !r && id(i), o = !t && !r && !n && _0(i), a = t || r || n || o, s = a ? lM(i.length, String) : [], c = s.length; for (var l in i) jM.call(i, l) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode. (l == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. n && (l == "offset" || l == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. o && (l == "buffer" || l == "byteLength" || l == "byteOffset") || // Skip index properties. sp(l, c))) && s.push(l); return s; } function WM(i, e) { return function(t) { return i(e(t)); }; } var $M = WM(Object.keys, Object), qM = Object.prototype, XM = qM.hasOwnProperty; function ZM(i) { if (!sM(i)) return $M(i); var e = []; for (var t in Object(i)) XM.call(i, t) && t != "constructor" && e.push(t); return e; } function M0(i) { return oM(i) ? GM(i) : ZM(i); } var YM = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, JM = /^\w*$/; function hp(i, e) { if (br(i)) return !1; var t = typeof i; return t == "number" || t == "symbol" || t == "boolean" || i == null || lu(i) ? !0 : JM.test(i) || !YM.test(i) || e != null && i in Object(e); } var qs = Ho(Object, "create"); function KM() { this.__data__ = qs ? qs(null) : {}, this.size = 0; } function QM(i) { var e = this.has(i) && delete this.__data__[i]; return this.size -= e ? 1 : 0, e; } var eS = "__lodash_hash_undefined__", tS = Object.prototype, iS = tS.hasOwnProperty; function rS(i) { var e = this.__data__; if (qs) { var t = e[i]; return t === eS ? void 0 : t; } return iS.call(e, i) ? e[i] : void 0; } var nS = Object.prototype, oS = nS.hasOwnProperty; function aS(i) { var e = this.__data__; return qs ? e[i] !== void 0 : oS.call(e, i); } var sS = "__lodash_hash_undefined__"; function lS(i, e) { var t = this.__data__; return this.size += this.has(i) ? 0 : 1, t[i] = qs && e === void 0 ? sS : e, this; } function Oo(i) { var e = -1, t = i == null ? 0 : i.length; for (this.clear(); ++e < t; ) { var r = i[e]; this.set(r[0], r[1]); } } Oo.prototype.clear = KM; Oo.prototype.delete = QM; Oo.prototype.get = rS; Oo.prototype.has = aS; Oo.prototype.set = lS; function cS() { this.__data__ = [], this.size = 0; } function cu(i, e) { for (var t = i.length; t--; ) if (lp(i[t][0], e)) return t; return -1; } var uS = Array.prototype, hS = uS.splice; function dS(i) { var e = this.__data__, t = cu(e, i); if (t < 0) return !1; var r = e.length - 1; return t == r ? e.pop() : hS.call(e, t, 1), --this.size, !0; } function pS(i) { var e = this.__data__, t = cu(e, i); return t < 0 ? void 0 : e[t][1]; } function fS(i) { return cu(this.__data__, i) > -1; } function mS(i, e) { var t = this.__data__, r = cu(t, i); return r < 0 ? (++this.size, t.push([i, e])) : t[r][1] = e, this; } function fn(i) { var e = -1, t = i == null ? 0 : i.length; for (this.clear(); ++e < t; ) { var r = i[e]; this.set(r[0], r[1]); } } fn.prototype.clear = cS; fn.prototype.delete = dS; fn.prototype.get = pS; fn.prototype.has = fS; fn.prototype.set = mS; var Xs = Ho(Vr, "Map"); function gS() { this.size = 0, this.__data__ = { hash: new Oo(), map: new (Xs || fn)(), string: new Oo() }; } function vS(i) { var e = typeof i; return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? i !== "__proto__" : i === null; } function uu(i, e) { var t = i.__data__; return vS(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map; } function yS(i) { var e = uu(this, i).delete(i); return this.size -= e ? 1 : 0, e; } function bS(i) { return uu(this, i).get(i); } function xS(i) { return uu(this, i).has(i); } function wS(i, e) { var t = uu(this, i), r = t.size; return t.set(i, e), this.size += t.size == r ? 0 : 1, this; } function mn(i) { var e = -1, t = i == null ? 0 : i.length; for (this.clear(); ++e < t; ) { var r = i[e]; this.set(r[0], r[1]); } } mn.prototype.clear = gS; mn.prototype.delete = yS; mn.prototype.get = bS; mn.prototype.has = xS; mn.prototype.set = wS; var _S = "Expected a function"; function dp(i, e) { if (typeof i != "function" || e != null && typeof e != "function") throw new TypeError(_S); var t = function() { var r = arguments, n = e ? e.apply(this, r) : r[0], o = t.cache; if (o.has(n)) return o.get(n); var a = i.apply(this, r); return t.cache = o.set(n, a) || o, a; }; return t.cache = new (dp.Cache || mn)(), t; } dp.Cache = mn; var MS = 500; function SS(i) { var e = dp(i, function(r) { return t.size === MS && t.clear(), r; }), t = e.cache; return e; } var TS = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, ES = /\\(\\)?/g, AS = SS(function(i) { var e = []; return i.charCodeAt(0) === 46 && e.push(""), i.replace(TS, function(t, r, n, o) { e.push(n ? o.replace(ES, "$1") : r || t); }), e; }); function CS(i) { return i == null ? "" : g0(i); } function hu(i, e) { return br(i) ? i : hp(i, e) ? [i] : AS(CS(i)); } var LS = 1 / 0; function pl(i) { if (typeof i == "string" || lu(i)) return i; var e = i + ""; return e == "0" && 1 / i == -LS ? "-0" : e; } function pp(i, e) { e = hu(e, i); for (var t = 0, r = e.length; i != null && t < r; ) i = i[pl(e[t++])]; return t && t == r ? i : void 0; } function Qr(i, e, t) { var r = i == null ? void 0 : pp(i, e); return r === void 0 ? t : r; } function S0(i, e) { for (var t = -1, r = e.length, n = i.length; ++t < r; ) i[n + t] = e[t]; return i; } var dm = Br ? Br.isConcatSpreadable : void 0; function RS(i) { return br(i) || up(i) || !!(dm && i && i[dm]); } function OS(i, e, t, r, n) { var o = -1, a = i.length; for (t || (t = RS), n || (n = []); ++o < a; ) { var s = i[o]; t(s) ? S0(n, s) : n[n.length] = s; } return n; } function PS(i) { var e = i == null ? 0 : i.length; return e ? OS(i) : []; } function IS(i) { return Z_(rM(i, void 0, PS), i + ""); } function Lr() { if (!arguments.length) return []; var i = arguments[0]; return br(i) ? i : [i]; } function DS() { this.__data__ = new fn(), this.size = 0; } function NS(i) { var e = this.__data__, t = e.delete(i); return this.size = e.size, t; } function BS(i) { return this.__data__.get(i); } function kS(i) { return this.__data__.has(i); } var FS = 200; function zS(i, e) { var t = this.__data__; if (t instanceof fn) { var r = t.__data__; if (!Xs || r.length < FS - 1) return r.push([i, e]), this.size = ++t.size, this; t = this.__data__ = new mn(r); } return t.set(i, e), this.size = t.size, this; } function nn(i) { var e = this.__data__ = new fn(i); this.size = e.size; } nn.prototype.clear = DS; nn.prototype.delete = NS; nn.prototype.get = BS; nn.prototype.has = kS; nn.prototype.set = zS; function US(i, e) { for (var t = -1, r = i == null ? 0 : i.length, n = 0, o = []; ++t < r; ) { var a = i[t]; e(a, t, i) && (o[n++] = a); } return o; } function VS() { return []; } var HS = Object.prototype, jS = HS.propertyIsEnumerable, pm = Object.getOwnPropertySymbols, GS = pm ? function(i) { return i == null ? [] : (i = Object(i), US(pm(i), function(e) { return jS.call(i, e); })); } : VS; function WS(i, e, t) { var r = e(i); return br(i) ? r : S0(r, t(i)); } function fm(i) { return WS(i, M0, GS); } var rd = Ho(Vr, "DataView"), nd = Ho(Vr, "Promise"), od = Ho(Vr, "Set"), mm = "[object Map]", $S = "[object Object]", gm = "[object Promise]", vm = "[object Set]", ym = "[object WeakMap]", bm = "[object DataView]", qS = Vo(rd), XS = Vo(Xs), ZS = Vo(nd), YS = Vo(od), JS = Vo(td), Nn = ts; (rd && Nn(new rd(new ArrayBuffer(1))) != bm || Xs && Nn(new Xs()) != mm || nd && Nn(nd.resolve()) != gm || od && Nn(new od()) != vm || td && Nn(new td()) != ym) && (Nn = function(i) { var e = ts(i), t = e == $S ? i.constructor : void 0, r = t ? Vo(t) : ""; if (r) switch (r) { case qS: return bm; case XS: return mm; case ZS: return gm; case YS: return vm; case JS: return ym; } return e; }); var xm = Vr.Uint8Array, KS = "__lodash_hash_undefined__"; function QS(i) { return this.__data__.set(i, KS), this; } function eT(i) { return this.__data__.has(i); } function Gc(i) { var e = -1, t = i == null ? 0 : i.length; for (this.__data__ = new mn(); ++e < t; ) this.add(i[e]); } Gc.prototype.add = Gc.prototype.push = QS; Gc.prototype.has = eT; function tT(i, e) { for (var t = -1, r = i == null ? 0 : i.length; ++t < r; ) if (e(i[t], t, i)) return !0; return !1; } function iT(i, e) { return i.has(e); } var rT = 1, nT = 2; function T0(i, e, t, r, n, o) { var a = t & rT, s = i.length, c = e.length; if (s != c && !(a && c > s)) return !1; var l = o.get(i), h = o.get(e); if (l && h) return l == e && h == i; var u = -1, p = !0, m = t & nT ? new Gc() : void 0; for (o.set(i, e), o.set(e, i); ++u < s; ) { var g = i[u], d = e[u]; if (r) var y = a ? r(d, g, u, e, i, o) : r(g, d, u, i, e, o); if (y !== void 0) { if (y) continue; p = !1; break; } if (m) { if (!tT(e, function(f, v) { if (!iT(m, v) && (g === f || n(g, f, t, r, o))) return m.push(v); })) { p = !1; break; } } else if (!(g === d || n(g, d, t, r, o))) { p = !1; break; } } return o.delete(i), o.delete(e), p; } function oT(i) { var e = -1, t = Array(i.size); return i.forEach(function(r, n) { t[++e] = [n, r]; }), t; } function aT(i) { var e = -1, t = Array(i.size); return i.forEach(function(r) { t[++e] = r; }), t; } var sT = 1, lT = 2, cT = "[object Boolean]", uT = "[object Date]", hT = "[object Error]", dT = "[object Map]", pT = "[object Number]", fT = "[object RegExp]", mT = "[object Set]", gT = "[object String]", vT = "[object Symbol]", yT = "[object ArrayBuffer]", bT = "[object DataView]", wm = Br ? Br.prototype : void 0, Zu = wm ? wm.valueOf : void 0; function xT(i, e, t, r, n, o, a) { switch (t) { case bT: if (i.byteLength != e.byteLength || i.byteOffset != e.byteOffset) return !1; i = i.buffer, e = e.buffer; case yT: return !(i.byteLength != e.byteLength || !o(new xm(i), new xm(e))); case cT: case uT: case pT: return lp(+i, +e); case hT: return i.name == e.name && i.message == e.message; case fT: case gT: return i == e + ""; case dT: var s = oT; case mT: var c = r & sT; if (s || (s = aT), i.size != e.size && !c) return !1; var l = a.get(i); if (l) return l == e; r |= lT, a.set(i, e); var h = T0(s(i), s(e), r, n, o, a); return a.delete(i), h; case vT: if (Zu) return Zu.call(i) == Zu.call(e); } return !1; } var wT = 1, _T = Object.prototype, MT = _T.hasOwnProperty; function ST(i, e, t, r, n, o) { var a = t & wT, s = fm(i), c = s.length, l = fm(e), h = l.length; if (c != h && !a) return !1; for (var u = c; u--; ) { var p = s[u]; if (!(a ? p in e : MT.call(e, p))) return !1; } var m = o.get(i), g = o.get(e); if (m && g) return m == e && g == i; var d = !0; o.set(i, e), o.set(e, i); for (var y = a; ++u < c; ) { p = s[u]; var f = i[p], v = e[p]; if (r) var _ = a ? r(v, f, p, e, i, o) : r(f, v, p, i, e, o); if (!(_ === void 0 ? f === v || n(f, v, t, r, o) : _)) { d = !1; break; } y || (y = p == "constructor"); } if (d && !y) { var M = i.constructor, T = e.constructor; M != T && "constructor" in i && "constructor" in e && !(typeof M == "function" && M instanceof M && typeof T == "function" && T instanceof T) && (d = !1); } return o.delete(i), o.delete(e), d; } var TT = 1, _m = "[object Arguments]", Mm = "[object Array]", Nl = "[object Object]", ET = Object.prototype, Sm = ET.hasOwnProperty; function AT(i, e, t, r, n, o) { var a = br(i), s = br(e), c = a ? Mm : Nn(i), l = s ? Mm : Nn(e); c = c == _m ? Nl : c, l = l == _m ? Nl : l; var h = c == Nl, u = l == Nl, p = c == l; if (p && id(i)) { if (!id(e)) return !1; a = !0, h = !1; } if (p && !h) return o || (o = new nn()), a || _0(i) ? T0(i, e, t, r, n, o) : xT(i, e, c, t, r, n, o); if (!(t & TT)) { var m = h && Sm.call(i, "__wrapped__"), g = u && Sm.call(e, "__wrapped__"); if (m || g) { var d = m ? i.value() : i, y = g ? e.value() : e; return o || (o = new nn()), n(d, y, t, r, o); } } return p ? (o || (o = new nn()), ST(i, e, t, r, n, o)) : !1; } function du(i, e, t, r, n) { return i === e ? !0 : i == null || e == null || !Ca(i) && !Ca(e) ? i !== i && e !== e : AT(i, e, t, r, du, n); } var CT = 1, LT = 2; function RT(i, e, t, r) { var n = t.length, o = n; if (i == null) return !o; for (i = Object(i); n--; ) { var a = t[n]; if (a[2] ? a[1] !== i[a[0]] : !(a[0] in i)) return !1; } for (; ++n < o; ) { a = t[n]; var s = a[0], c = i[s], l = a[1]; if (a[2]) { if (c === void 0 && !(s in i)) return !1; } else { var h = new nn(), u; if (!(u === void 0 ? du(l, c, CT | LT, r, h) : u)) return !1; } } return !0; } function E0(i) { return i === i && !Gn(i); } function OT(i) { for (var e = M0(i), t = e.length; t--; ) { var r = e[t], n = i[r]; e[t] = [r, n, E0(n)]; } return e; } function A0(i, e) { return function(t) { return t == null ? !1 : t[i] === e && (e !== void 0 || i in Object(t)); }; } function PT(i) { var e = OT(i); return e.length == 1 && e[0][2] ? A0(e[0][0], e[0][1]) : function(t) { return t === i || RT(t, i, e); }; } function IT(i, e) { return i != null && e in Object(i); } function DT(i, e, t) { e = hu(e, i); for (var r = -1, n = e.length, o = !1; ++r < n; ) { var a = pl(e[r]); if (!(o = i != null && t(i, a))) break; i = i[a]; } return o || ++r != n ? o : (n = i == null ? 0 : i.length, !!n && cp(n) && sp(a, n) && (br(i) || up(i))); } function C0(i, e) { return i != null && DT(i, e, IT); } var NT = 1, BT = 2; function kT(i, e) { return hp(i) && E0(e) ? A0(pl(i), e) : function(t) { var r = Qr(t, i); return r === void 0 && r === e ? C0(t, i) : du(e, r, NT | BT); }; } function FT(i) { return function(e) { return e == null ? void 0 : e[i]; }; } function zT(i) { return function(e) { return pp(e, i); }; } function UT(i) { return hp(i) ? FT(pl(i)) : zT(i); } function VT(i) { return typeof i == "function" ? i : i == null ? v0 : typeof i == "object" ? br(i) ? kT(i[0], i[1]) : PT(i) : UT(i); } var Yu = function() { return Vr.Date.now(); }, HT = "Expected a function", jT = Math.max, GT = Math.min; function ad(i, e, t) { var r, n, o, a, s, c, l = 0, h = !1, u = !1, p = !0; if (typeof i != "function") throw new TypeError(HT); e = nm(e) || 0, Gn(t) && (h = !!t.leading, u = "maxWait" in t, o = u ? jT(nm(t.maxWait) || 0, e) : o, p = "trailing" in t ? !!t.trailing : p); function m(w) { var b = r, E = n; return r = n = void 0, l = w, a = i.apply(E, b), a; } function g(w) { return l = w, s = setTimeout(f, e), h ? m(w) : a; } function d(w) { var b = w - c, E = w - l, S = e - b; return u ? GT(S, o - E) : S; } function y(w) { var b = w - c, E = w - l; return c === void 0 || b >= e || b < 0 || u && E >= o; } function f() { var w = Yu(); if (y(w)) return v(w); s = setTimeout(f, d(w)); } function v(w) { return s = void 0, p && r ? m(w) : (r = n = void 0, a); } function _() { s !== void 0 && clearTimeout(s), l = 0, r = c = n = s = void 0; } function M() { return s === void 0 ? a : v(Yu()); } function T() { var w = Yu(), b = y(w); if (r = arguments, n = this, c = w, b) { if (s === void 0) return g(c); if (u) return clearTimeout(s), s = setTimeout(f, e), m(c); } return s === void 0 && (s = setTimeout(f, e)), a; } return T.cancel = _, T.flush = M, T; } function WT(i, e, t) { var r = i == null ? 0 : i.length; if (!r) return -1; var n = r - 1; return Y_(i, VT(e), n); } function Wc(i) { for (var e = -1, t = i == null ? 0 : i.length, r = {}; ++e < t; ) { var n = i[e]; r[n[0]] = n[1]; } return r; } function sd(i, e) { return du(i, e); } function on(i) { return i == null; } function $T(i) { return i === void 0; } function qT(i, e, t, r) { if (!Gn(i)) return i; e = hu(e, i); for (var n = -1, o = e.length, a = o - 1, s = i; s != null && ++n < o; ) { var c = pl(e[n]), l = t; if (c === "__proto__" || c === "constructor" || c === "prototype") return i; if (n != a) { var h = s[c]; l = void 0, l === void 0 && (l = Gn(h) ? h : sp(e[n + 1]) ? [] : {}); } iM(s, c, l), s = s[c]; } return i; } function XT(i, e, t) { for (var r = -1, n = e.length, o = {}; ++r < n; ) { var a = e[r], s = pp(i, a); t(s, a) && qT(o, hu(a, i), s); } return o; } function ZT(i, e) { return XT(i, e, function(t, r) { return C0(i, r); }); } var YT = IS(function(i, e) { return i == null ? {} : ZT(i, e); }); const vr = (i) => i === void 0, fp = (i) => typeof i == "boolean", Mt = (i) => typeof i == "number", Mo = (i) => typeof Element > "u" ? !1 : i instanceof Element, JT = (i) => Ii(i) ? !Number.isNaN(Number(i)) : !1, KT = (i = "") => i.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"), kn = (i) => o_(i), Tm = (i) => Object.keys(i); class L0 extends Error { constructor(e) { super(e), this.name = "ElementPlusError"; } } function is(i, e) { throw new L0(`[${i}] ${e}`); } function Qt(i, e) { if (process.env.NODE_ENV !== "production") { const t = Ii(i) ? new L0(`[${i}] ${e}`) : i; console.warn(t); } } const QT = "utils/dom/style", R0 = (i = "") => i.split(" ").filter((e) => !!e.trim()), Em = (i, e) => { !i || !e.trim() || i.classList.add(...R0(e)); }, $c = (i, e) => { !i || !e.trim() || i.classList.remove(...R0(e)); }, vs = (i, e) => { var t; if (!ii || !i || !e) return ""; let r = i_(e); r === "float" && (r = "cssFloat"); try { const n = i.style[r]; if (n) return n; const o = (t = document.defaultView) == null ? void 0 : t.getComputedStyle(i, ""); return o ? o[r] : ""; } catch { return i.style[r]; } }; function qc(i, e = "px") { if (!i) return ""; if (Mt(i) || JT(i)) return `${i}${e}`; if (Ii(i)) return i; Qt(QT, "binding value must be a string or number"); } function eE(i, e) { if (!ii) return; if (!e) { i.scrollTop = 0; return; } const t = []; let r = e.offsetParent; for (; r !== null && i !== r && i.contains(r); ) t.push(r), r = r.offsetParent; const n = e.offsetTop + t.reduce((c, l) => c + l.offsetTop, 0), o = n + e.offsetHeight, a = i.scrollTop, s = a + i.clientHeight; n < a ? i.scrollTop = n : o > s && (i.scrollTop = o - i.clientHeight); } /*! Element Plus Icons Vue v2.3.1 */ var tE = /* @__PURE__ */ Ie({ name: "ArrowDown", __name: "arrow-down", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }) ])); } }), mp = tE, iE = /* @__PURE__ */ Ie({ name: "ArrowLeft", __name: "arrow-left", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }) ])); } }), Wn = iE, rE = /* @__PURE__ */ Ie({ name: "ArrowRight", __name: "arrow-right", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }) ])); } }), $n = rE, nE = /* @__PURE__ */ Ie({ name: "ArrowUp", __name: "arrow-up", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }) ])); } }), oE = nE, aE = /* @__PURE__ */ Ie({ name: "CircleCheck", __name: "circle-check", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }), ke("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" }) ])); } }), sE = aE, lE = /* @__PURE__ */ Ie({ name: "CircleClose", __name: "circle-close", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }), ke("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" }) ])); } }), gp = lE, cE = /* @__PURE__ */ Ie({ name: "Close", __name: "close", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }) ])); } }), ld = cE, uE = /* @__PURE__ */ Ie({ name: "Delete", __name: "delete", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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 = uE, hE = /* @__PURE__ */ Ie({ name: "Hide", __name: "hide", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }), ke("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" }) ])); } }), dE = hE, pE = /* @__PURE__ */ Ie({ name: "Loading", __name: "loading", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }) ])); } }), O0 = pE, fE = /* @__PURE__ */ Ie({ name: "Minus", __name: "minus", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("path", { fill: "currentColor", d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64" }) ])); } }), mE = fE, gE = /* @__PURE__ */ Ie({ name: "Plus", __name: "plus", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }) ])); } }), pu = gE, vE = /* @__PURE__ */ Ie({ name: "View", __name: "view", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }) ])); } }), yE = vE, bE = /* @__PURE__ */ Ie({ name: "WarningFilled", __name: "warning-filled", setup(i) { return (e, t) => (fe(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ ke("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" }) ])); } }), P0 = bE; const I0 = "__epPropKey", Xe = (i) => i, xE = (i) => Oi(i) && !!i[I0], fu = (i, e) => { if (!Oi(i) || xE(i)) return i; const { values: t, required: r, default: n, type: o, validator: a } = i, s = { type: o, required: !!r, validator: t || a ? (c) => { let l = !1, h = []; if (t && (h = Array.from(t), Qf(i, "default") && h.push(n), l || (l = h.includes(c))), a && (l || (l = a(c))), !l && h.length > 0) { const u = [...new Set(h)].map((p) => JSON.stringify(p)).join(", "); fw(`Invalid prop: validation failed${e ? ` for prop "${e}"` : ""}. Expected one of [${u}], got value ${JSON.stringify(c)}.`); } return l; } : void 0, [I0]: !0 }; return Qf(i, "default") && (s.default = n), s; }, ht = (i) => Wc(Object.entries(i).map(([e, t]) => [ e, fu(t, e) ])), qn = Xe([ String, Object, Function ]), D0 = { validating: O0, success: sE, error: gp }, fi = (i, e) => { if (i.install = (t) => { for (const r of [i, ...Object.values(e ?? {})]) t.component(r.name, r); }, e) for (const [t, r] of Object.entries(e)) i[t] = r; return i; }, wE = (i, e) => (i.install = (t) => { t.directive(e, i); }, i), gn = (i) => (i.install = $s, i), Ir = { 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", Qn = "change", So = "input", N0 = ["", "default", "small", "large"], Bc = (i) => { const e = zi(i) ? i : [i], t = []; return e.forEach((r) => { var n; zi(r) ? t.push(...Bc(r)) : Qh(r) && zi(r.children) ? t.push(...Bc(r.children)) : (t.push(r), Qh(r) && (n = r.component) != null && n.subTree && t.push(...Bc(r.component.subTree))); }), t; }, _E = (i) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(i), en = (i) => i, ME = ["class", "style"], SE = /^on[A-Z]/, TE = (i = {}) => { const { excludeListeners: e = !1, excludeKeys: t } = i, r = ce(() => ((t == null ? void 0 : t.value) || []).concat(ME)), n = si(); return n ? ce(() => { var o; return Wc(Object.entries((o = n.proxy) == null ? void 0 : o.$attrs).filter(([a]) => !r.value.includes(a) && !(e && SE.test(a)))); }) : (Qt("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"), ce(() => ({}))); }, EE = ({ from: i, replacement: e, scope: t, version: r, ref: n, type: o = "API" }, a) => { Je(() => H(a), (s) => { s && Qt(t, `[${o}] ${i} is about to be deprecated in version ${r}, please use ${e} instead. For more detail, please visit: ${n} `); }, { immediate: !0 }); }; var AE = { 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 CE = (i) => (e, t) => LE(e, t, H(i)), LE = (i, e, t) => Qr(t, i, i).replace(/\{(\w+)\}/g, (r, n) => { var o; return `${(o = e == null ? void 0 : e[n]) != null ? o : `{${n}}`}`; }), RE = (i) => { const e = ce(() => H(i).name), t = Ro(i) ? i : Ae(i); return { lang: e, locale: t, t: CE(i) }; }, B0 = Symbol("localeContextKey"), mu = (i) => { const e = i || ct(B0, Ae()); return RE(ce(() => e.value || AE)); }, kc = "el", OE = "is-", lo = (i, e, t, r, n) => { let o = `${i}-${e}`; return t && (o += `-${t}`), r && (o += `__${r}`), n && (o += `--${n}`), o; }, k0 = Symbol("namespaceContextKey"), vp = (i) => { const e = i || (si() ? ct(k0, Ae(kc)) : Ae(kc)); return ce(() => H(e) || kc); }, it = (i, e) => { const t = vp(e); return { namespace: t, b: (r = "") => lo(t.value, i, r, "", ""), e: (r) => r ? lo(t.value, i, "", r, "") : "", m: (r) => r ? lo(t.value, i, "", "", r) : "", be: (r, n) => r && n ? lo(t.value, i, r, n, "") : "", em: (r, n) => r && n ? lo(t.value, i, "", r, n) : "", bm: (r, n) => r && n ? lo(t.value, i, r, "", n) : "", bem: (r, n, o) => r && n && o ? lo(t.value, i, r, n, o) : "", is: (r, ...n) => { const o = n.length >= 1 ? n[0] : !0; return r && o ? `${OE}${r}` : ""; }, cssVar: (r) => { const n = {}; for (const o in r) r[o] && (n[`--${t.value}-${o}`] = r[o]); return n; }, cssVarName: (r) => `--${t.value}-${r}`, cssVarBlock: (r) => { const n = {}; for (const o in r) r[o] && (n[`--${t.value}-${i}-${o}`] = r[o]); return n; }, cssVarBlockName: (r) => `--${t.value}-${i}-${r}` }; }, PE = fu({ type: Xe(Boolean), default: null }), IE = fu({ type: Xe(Function) }), DE = (i) => { const e = `update:${i}`, t = `onUpdate:${i}`, r = [e], n = { [i]: PE, [t]: IE }; return { useModelToggle: ({ indicator: o, toggleReason: a, shouldHideWhenRouteChanges: s, shouldProceed: c, onShow: l, onHide: h }) => { const u = si(), { emit: p } = u, m = u.props, g = ce(() => Ci(m[t])), d = ce(() => m[i] === null), y = (w) => { o.value !== !0 && (o.value = !0, a && (a.value = w), Ci(l) && l(w)); }, f = (w) => { o.value !== !1 && (o.value = !1, a && (a.value = w), Ci(h) && h(w)); }, v = (w) => { if (m.disabled === !0 || Ci(c) && !c()) return; const b = g.value && ii; b && p(e, !0), (d.value || !b) && y(w); }, _ = (w) => { if (m.disabled === !0 || !ii) return; const b = g.value && ii; b && p(e, !1), (d.value || !b) && f(w); }, M = (w) => { fp(w) && (m.disabled && w ? g.value && p(e, !1) : o.value !== w && (w ? y() : f())); }, T = () => { o.value ? _() : v(); }; return Je(() => m[i], M), s && u.appContext.config.globalProperties.$route !== void 0 && Je(() => ({ ...u.proxy.$route }), () => { s.value && o.value && _(); }), ni(() => { M(m[i]); }), { hide: _, show: v, toggle: T, hasUpdateHandler: g }; }, useModelToggleProps: n, useModelToggleEmits: r }; }, F0 = (i) => { const e = si(); return ce(() => { var t, r; return (r = (t = e == null ? void 0 : e.proxy) == null ? void 0 : t.$props) == null ? void 0 : r[i]; }); }; var Vi = "top", or = "bottom", ar = "right", Hi = "left", yp = "auto", fl = [Vi, or, ar, Hi], La = "start", Zs = "end", NE = "clippingParents", z0 = "viewport", ys = "popper", BE = "reference", Am = fl.reduce(function(i, e) { return i.concat([e + "-" + La, e + "-" + Zs]); }, []), rs = [].concat(fl, [yp]).reduce(function(i, e) { return i.concat([e, e + "-" + La, e + "-" + Zs]); }, []), kE = "beforeRead", FE = "read", zE = "afterRead", UE = "beforeMain", VE = "main", HE = "afterMain", jE = "beforeWrite", GE = "write", WE = "afterWrite", $E = [kE, FE, zE, UE, VE, HE, jE, GE, WE]; function kr(i) { return i ? (i.nodeName || "").toLowerCase() : null; } function _r(i) { if (i == null) return window; if (i.toString() !== "[object Window]") { var e = i.ownerDocument; return e && e.defaultView || window; } return i; } function Ra(i) { var e = _r(i).Element; return i instanceof e || i instanceof Element; } function nr(i) { var e = _r(i).HTMLElement; return i instanceof e || i instanceof HTMLElement; } function bp(i) { if (typeof ShadowRoot > "u") return !1; var e = _r(i).ShadowRoot; return i instanceof e || i instanceof ShadowRoot; } function qE(i) { var e = i.state; Object.keys(e.elements).forEach(function(t) { var r = e.styles[t] || {}, n = e.attributes[t] || {}, o = e.elements[t]; !nr(o) || !kr(o) || (Object.assign(o.style, r), Object.keys(n).forEach(function(a) { var s = n[a]; s === !1 ? o.removeAttribute(a) : o.setAttribute(a, s === !0 ? "" : s); })); }); } function XE(i) { var e = i.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(r) { var n = e.elements[r], o = e.attributes[r] || {}, a = Object.keys(e.styles.hasOwnProperty(r) ? e.styles[r] : t[r]), s = a.reduce(function(c, l) { return c[l] = "", c; }, {}); !nr(n) || !kr(n) || (Object.assign(n.style, s), Object.keys(o).forEach(function(c) { n.removeAttribute(c); })); }); }; } var U0 = { name: "applyStyles", enabled: !0, phase: "write", fn: qE, effect: XE, requires: ["computeStyles"] }; function Dr(i) { return i.split("-")[0]; } var To = Math.max, Zc = Math.min, Oa = Math.round; function Pa(i, e) { e === void 0 && (e = !1); var t = i.getBoundingClientRect(), r = 1, n = 1; if (nr(i) && e) { var o = i.offsetHeight, a = i.offsetWidth; a > 0 && (r = Oa(t.width) / a || 1), o > 0 && (n = Oa(t.height) / o || 1); } return { width: t.width / r, height: t.height / n, top: t.top / n, right: t.right / r, bottom: t.bottom / n, left: t.left / r, x: t.left / r, y: t.top / n }; } function xp(i) { var e = Pa(i), t = i.offsetWidth, r = i.offsetHeight; return Math.abs(e.width - t) <= 1 && (t = e.width), Math.abs(e.height - r) <= 1 && (r = e.height), { x: i.offsetLeft, y: i.offsetTop, width: t, height: r }; } function V0(i, e) { var t = e.getRootNode && e.getRootNode(); if (i.contains(e)) return !0; if (t && bp(t)) { var r = e; do { if (r && i.isSameNode(r)) return !0; r = r.parentNode || r.host; } while (r); } return !1; } function un(i) { return _r(i).getComputedStyle(i); } function ZE(i) { return ["table", "td", "th"].indexOf(kr(i)) >= 0; } function eo(i) { return ((Ra(i) ? i.ownerDocument : i.document) || window.document).documentElement; } function gu(i) { return kr(i) === "html" ? i : i.assignedSlot || i.parentNode || (bp(i) ? i.host : null) || eo(i); } function Cm(i) { return !nr(i) || un(i).position === "fixed" ? null : i.offsetParent; } function YE(i) { var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, t = navigator.userAgent.indexOf("Trident") !== -1; if (t && nr(i)) { var r = un(i); if (r.position === "fixed") return null; } var n = gu(i); for (bp(n) && (n = n.host); nr(n) && ["html", "body"].indexOf(kr(n)) < 0; ) { var o = un(n); if (o.transform !== "none" || o.perspective !== "none" || o.contain === "paint" || ["transform", "perspective"].indexOf(o.willChange) !== -1 || e && o.willChange === "filter" || e && o.filter && o.filter !== "none") return n; n = n.parentNode; } return null; } function ml(i) { for (var e = _r(i), t = Cm(i); t && ZE(t) && un(t).position === "static"; ) t = Cm(t); return t && (kr(t) === "html" || kr(t) === "body" && un(t).position === "static") ? e : t || YE(i) || e; } function wp(i) { return ["top", "bottom"].indexOf(i) >= 0 ? "x" : "y"; } function Fs(i, e, t) { return To(i, Zc(e, t)); } function JE(i, e, t) { var r = Fs(i, e, t); return r > t ? t : r; } function H0() { return { top: 0, right: 0, bottom: 0, left: 0 }; } function j0(i) { return Object.assign({}, H0(), i); } function G0(i, e) { return e.reduce(function(t, r) { return t[r] = i, t; }, {}); } var KE = function(i, e) { return i = typeof i == "function" ? i(Object.assign({}, e.rects, { placement: e.placement })) : i, j0(typeof i != "number" ? i : G0(i, fl)); }; function QE(i) { var e, t = i.state, r = i.name, n = i.options, o = t.elements.arrow, a = t.modifiersData.popperOffsets, s = Dr(t.placement), c = wp(s), l = [Hi, ar].indexOf(s) >= 0, h = l ? "height" : "width"; if (!(!o || !a)) { var u = KE(n.padding, t), p = xp(o), m = c === "y" ? Vi : Hi, g = c === "y" ? or : ar, d = t.rects.reference[h] + t.rects.reference[c] - a[c] - t.rects.popper[h], y = a[c] - t.rects.reference[c], f = ml(o), v = f ? c === "y" ? f.clientHeight || 0 : f.clientWidth || 0 : 0, _ = d / 2 - y / 2, M = u[m], T = v - p[h] - u[g], w = v / 2 - p[h] / 2 + _, b = Fs(M, w, T), E = c; t.modifiersData[r] = (e = {}, e[E] = b, e.centerOffset = b - w, e); } } function eA(i) { var e = i.state, t = i.options, r = t.element, n = r === void 0 ? "[data-popper-arrow]" : r; n != null && (typeof n == "string" && (n = e.elements.popper.querySelector(n), !n) || !V0(e.elements.popper, n) || (e.elements.arrow = n)); } var tA = { name: "arrow", enabled: !0, phase: "main", fn: QE, effect: eA, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] }; function Ia(i) { return i.split("-")[1]; } var iA = { top: "auto", right: "auto", bottom: "auto", left: "auto" }; function rA(i) { var e = i.x, t = i.y, r = window, n = r.devicePixelRatio || 1; return { x: Oa(e * n) / n || 0, y: Oa(t * n) / n || 0 }; } function Lm(i) { var e, t = i.popper, r = i.popperRect, n = i.placement, o = i.variation, a = i.offsets, s = i.position, c = i.gpuAcceleration, l = i.adaptive, h = i.roundOffsets, u = i.isFixed, p = a.x, m = p === void 0 ? 0 : p, g = a.y, d = g === void 0 ? 0 : g, y = typeof h == "function" ? h({ x: m, y: d }) : { x: m, y: d }; m = y.x, d = y.y; var f = a.hasOwnProperty("x"), v = a.hasOwnProperty("y"), _ = Hi, M = Vi, T = window; if (l) { var w = ml(t), b = "clientHeight", E = "clientWidth"; if (w === _r(t) && (w = eo(t), un(w).position !== "static" && s === "absolute" && (b = "scrollHeight", E = "scrollWidth")), w = w, n === Vi || (n === Hi || n === ar) && o === Zs) { M = or; var S = u && w === T && T.visualViewport ? T.visualViewport.height : w[b]; d -= S - r.height, d *= c ? 1 : -1; } if (n === Hi || (n === Vi || n === or) && o === Zs) { _ = ar; var C = u && w === T && T.visualViewport ? T.visualViewport.width : w[E]; m -= C - r.width, m *= c ? 1 : -1; } } var R = Object.assign({ position: s }, l && iA), L = h === !0 ? rA({ x: m, y: d }) : { x: m, y: d }; if (m = L.x, d = L.y, c) { var A; return Object.assign({}, R, (A = {}, A[M] = v ? "0" : "", A[_] = f ? "0" : "", A.transform = (T.devicePixelRatio || 1) <= 1 ? "translate(" + m + "px, " + d + "px)" : "translate3d(" + m + "px, " + d + "px, 0)", A)); } return Object.assign({}, R, (e = {}, e[M] = v ? d + "px" : "", e[_] = f ? m + "px" : "", e.transform = "", e)); } function nA(i) { var e = i.state, t = i.options, r = t.gpuAcceleration, n = r === void 0 ? !0 : r, o = t.adaptive, a = o === void 0 ? !0 : o, s = t.roundOffsets, c = s === void 0 ? !0 : s, l = { placement: Dr(e.placement), variation: Ia(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: n, isFixed: e.options.strategy === "fixed" }; e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, Lm(Object.assign({}, l, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: a, roundOffsets: c })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, Lm(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 W0 = { name: "computeStyles", enabled: !0, phase: "beforeWrite", fn: nA, data: {} }, Bl = { passive: !0 }; function oA(i) { var e = i.state, t = i.instance, r = i.options, n = r.scroll, o = n === void 0 ? !0 : n, a = r.resize, s = a === void 0 ? !0 : a, c = _r(e.elements.popper), l = [].concat(e.scrollParents.reference, e.scrollParents.popper); return o && l.forEach(function(h) { h.addEventListener("scroll", t.update, Bl); }), s && c.addEventListener("resize", t.update, Bl), function() { o && l.forEach(function(h) { h.removeEventListener("scroll", t.update, Bl); }), s && c.removeEventListener("resize", t.update, Bl); }; } var $0 = { name: "eventListeners", enabled: !0, phase: "write", fn: function() { }, effect: oA, data: {} }, aA = { left: "right", right: "left", bottom: "top", top: "bottom" }; function Fc(i) { return i.replace(/left|right|bottom|top/g, function(e) { return aA[e]; }); } var sA = { start: "end", end: "start" }; function Rm(i) { return i.replace(/start|end/g, function(e) { return sA[e]; }); } function _p(i) { var e = _r(i), t = e.pageXOffset, r = e.pageYOffset; return { scrollLeft: t, scrollTop: r }; } function Mp(i) { return Pa(eo(i)).left + _p(i).scrollLeft; } function lA(i) { var e = _r(i), t = eo(i), r = e.visualViewport, n = t.clientWidth, o = t.clientHeight, a = 0, s = 0; return r && (n = r.width, o = r.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (a = r.offsetLeft, s = r.offsetTop)), { width: n, height: o, x: a + Mp(i), y: s }; } function cA(i) { var e, t = eo(i), r = _p(i), n = (e = i.ownerDocument) == null ? void 0 : e.body, o = To(t.scrollWidth, t.clientWidth, n ? n.scrollWidth : 0, n ? n.clientWidth : 0), a = To(t.scrollHeight, t.clientHeight, n ? n.scrollHeight : 0, n ? n.clientHeight : 0), s = -r.scrollLeft + Mp(i), c = -r.scrollTop; return un(n || t).direction === "rtl" && (s += To(t.clientWidth, n ? n.clientWidth : 0) - o), { width: o, height: a, x: s, y: c }; } function Sp(i) { var e = un(i), t = e.overflow, r = e.overflowX, n = e.overflowY; return /auto|scroll|overlay|hidden/.test(t + n + r); } function q0(i) { return ["html", "body", "#document"].indexOf(kr(i)) >= 0 ? i.ownerDocument.body : nr(i) && Sp(i) ? i : q0(gu(i)); } function zs(i, e) { var t; e === void 0 && (e = []); var r = q0(i), n = r === ((t = i.ownerDocument) == null ? void 0 : t.body), o = _r(r), a = n ? [o].concat(o.visualViewport || [], Sp(r) ? r : []) : r, s = e.concat(a); return n ? s : s.concat(zs(gu(a))); } function cd(i) { return Object.assign({}, i, { left: i.x, top: i.y, right: i.x + i.width, bottom: i.y + i.height }); } function uA(i) { var e = Pa(i); return e.top = e.top + i.clientTop, e.left = e.left + i.clientLeft, e.bottom = e.top + i.clientHeight, e.right = e.left + i.clientWidth, e.width = i.clientWidth, e.height = i.clientHeight, e.x = e.left, e.y = e.top, e; } function Om(i, e) { return e === z0 ? cd(lA(i)) : Ra(e) ? uA(e) : cd(cA(eo(i))); } function hA(i) { var e = zs(gu(i)), t = ["absolute", "fixed"].indexOf(un(i).position) >= 0, r = t && nr(i) ? ml(i) : i; return Ra(r) ? e.filter(function(n) { return Ra(n) && V0(n, r) && kr(n) !== "body"; }) : []; } function dA(i, e, t) { var r = e === "clippingParents" ? hA(i) : [].concat(e), n = [].concat(r, [t]), o = n[0], a = n.reduce(function(s, c) { var l = Om(i, c); return s.top = To(l.top, s.top), s.right = Zc(l.right, s.right), s.bottom = Zc(l.bottom, s.bottom), s.left = To(l.left, s.left), s; }, Om(i, o)); return a.width = a.right - a.left, a.height = a.bottom - a.top, a.x = a.left, a.y = a.top, a; } function X0(i) { var e = i.reference, t = i.element, r = i.placement, n = r ? Dr(r) : null, o = r ? Ia(r) : null, a = e.x + e.width / 2 - t.width / 2, s = e.y + e.height / 2 - t.height / 2, c; switch (n) { case Vi: c = { x: a, y: e.y - t.height }; break; case or: c = { x: a, y: e.y + e.height }; break; case ar: c = { x: e.x + e.width, y: s }; break; case Hi: c = { x: e.x - t.width, y: s }; break; default: c = { x: e.x, y: e.y }; } var l = n ? wp(n) : null; if (l != null) { var h = l === "y" ? "height" : "width"; switch (o) { case La: c[l] = c[l] - (e[h] / 2 - t[h] / 2); break; case Zs: c[l] = c[l] + (e[h] / 2 - t[h] / 2); break; } } return c; } function Ys(i, e) { e === void 0 && (e = {}); var t = e, r = t.placement, n = r === void 0 ? i.placement : r, o = t.boundary, a = o === void 0 ? NE : o, s = t.rootBoundary, c = s === void 0 ? z0 : s, l = t.elementContext, h = l === void 0 ? ys : l, u = t.altBoundary, p = u === void 0 ? !1 : u, m = t.padding, g = m === void 0 ? 0 : m, d = j0(typeof g != "number" ? g : G0(g, fl)), y = h === ys ? BE : ys, f = i.rects.popper, v = i.elements[p ? y : h], _ = dA(Ra(v) ? v : v.contextElement || eo(i.elements.popper), a, c), M = Pa(i.elements.reference), T = X0({ reference: M, element: f, strategy: "absolute", placement: n }), w = cd(Object.assign({}, f, T)), b = h === ys ? w : M, E = { top: _.top - b.top + d.top, bottom: b.bottom - _.bottom + d.bottom, left: _.left - b.left + d.left, right: b.right - _.right + d.right }, S = i.modifiersData.offset; if (h === ys && S) { var C = S[n]; Object.keys(E).forEach(function(R) { var L = [ar, or].indexOf(R) >= 0 ? 1 : -1, A = [Vi, or].indexOf(R) >= 0 ? "y" : "x"; E[R] += C[A] * L; }); } return E; } function pA(i, e) { e === void 0 && (e = {}); var t = e, r = t.placement, n = t.boundary, o = t.rootBoundary, a = t.padding, s = t.flipVariations, c = t.allowedAutoPlacements, l = c === void 0 ? rs : c, h = Ia(r), u = h ? s ? Am : Am.filter(function(g) { return Ia(g) === h; }) : fl, p = u.filter(function(g) { return l.indexOf(g) >= 0; }); p.length === 0 && (p = u); var m = p.reduce(function(g, d) { return g[d] = Ys(i, { placement: d, boundary: n, rootBoundary: o, padding: a })[Dr(d)], g; }, {}); return Object.keys(m).sort(function(g, d) { return m[g] - m[d]; }); } function fA(i) { if (Dr(i) === yp) return []; var e = Fc(i); return [Rm(i), e, Rm(e)]; } function mA(i) { var e = i.state, t = i.options, r = i.name; if (!e.modifiersData[r]._skip) { for (var n = t.mainAxis, o = n === void 0 ? !0 : n, a = t.altAxis, s = a === void 0 ? !0 : a, c = t.fallbackPlacements, l = t.padding, h = t.boundary, u = t.rootBoundary, p = t.altBoundary, m = t.flipVariations, g = m === void 0 ? !0 : m, d = t.allowedAutoPlacements, y = e.options.placement, f = Dr(y), v = f === y, _ = c || (v || !g ? [Fc(y)] : fA(y)), M = [y].concat(_).reduce(function(ne, q) { return ne.concat(Dr(q) === yp ? pA(e, { placement: q, boundary: h, rootBoundary: u, padding: l, flipVariations: g, allowedAutoPlacements: d }) : q); }, []), T = e.rects.reference, w = e.rects.popper, b = /* @__PURE__ */ new Map(), E = !0, S = M[0], C = 0; C < M.length; C++) { var R = M[C], L = Dr(R), A = Ia(R) === La, P = [Vi, or].indexOf(L) >= 0, O = P ? "width" : "height", x = Ys(e, { placement: R, boundary: h, rootBoundary: u, altBoundary: p, padding: l }), I = P ? A ? ar : Hi : A ? or : Vi; T[O] > w[O] && (I = Fc(I)); var N = Fc(I), D = []; if (o && D.push(x[L] <= 0), s && D.push(x[I] <= 0, x[N] <= 0), D.every(function(ne) { return ne; })) { S = R, E = !1; break; } b.set(R, D); } if (E) for (var k = g ? 3 : 1, F = function(ne) { var q = M.find(function(z) { var j = b.get(z); if (j) return j.slice(0, ne).every(function(Q) { return Q; }); }); if (q) return S = q, "break"; }, W = k; W > 0; W--) { var K = F(W); if (K === "break") break; } e.placement !== S && (e.modifiersData[r]._skip = !0, e.placement = S, e.reset = !0); } } var gA = { name: "flip", enabled: !0, phase: "main", fn: mA, requiresIfExists: ["offset"], data: { _skip: !1 } }; function Pm(i, e, t) { return t === void 0 && (t = { x: 0, y: 0 }), { top: i.top - e.height - t.y, right: i.right - e.width + t.x, bottom: i.bottom - e.height + t.y, left: i.left - e.width - t.x }; } function Im(i) { return [Vi, ar, or, Hi].some(function(e) { return i[e] >= 0; }); } function vA(i) { var e = i.state, t = i.name, r = e.rects.reference, n = e.rects.popper, o = e.modifiersData.preventOverflow, a = Ys(e, { elementContext: "reference" }), s = Ys(e, { altBoundary: !0 }), c = Pm(a, r), l = Pm(s, n, o), h = Im(c), u = Im(l); e.modifiersData[t] = { referenceClippingOffsets: c, popperEscapeOffsets: l, isReferenceHidden: h, hasPopperEscaped: u }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": h, "data-popper-escaped": u }); } var yA = { name: "hide", enabled: !0, phase: "main", requiresIfExists: ["preventOverflow"], fn: vA }; function bA(i, e, t) { var r = Dr(i), n = [Hi, Vi].indexOf(r) >= 0 ? -1 : 1, o = typeof t == "function" ? t(Object.assign({}, e, { placement: i })) : t, a = o[0], s = o[1]; return a = a || 0, s = (s || 0) * n, [Hi, ar].indexOf(r) >= 0 ? { x: s, y: a } : { x: a, y: s }; } function xA(i) { var e = i.state, t = i.options, r = i.name, n = t.offset, o = n === void 0 ? [0, 0] : n, a = rs.reduce(function(h, u) { return h[u] = bA(u, e.rects, o), h; }, {}), s = a[e.placement], c = s.x, l = s.y; e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += c, e.modifiersData.popperOffsets.y += l), e.modifiersData[r] = a; } var wA = { name: "offset", enabled: !0, phase: "main", requires: ["popperOffsets"], fn: xA }; function _A(i) { var e = i.state, t = i.name; e.modifiersData[t] = X0({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement }); } var Z0 = { name: "popperOffsets", enabled: !0, phase: "read", fn: _A, data: {} }; function MA(i) { return i === "x" ? "y" : "x"; } function SA(i) { var e = i.state, t = i.options, r = i.name, n = t.mainAxis, o = n === void 0 ? !0 : n, a = t.altAxis, s = a === void 0 ? !1 : a, c = t.boundary, l = t.rootBoundary, h = t.altBoundary, u = t.padding, p = t.tether, m = p === void 0 ? !0 : p, g = t.tetherOffset, d = g === void 0 ? 0 : g, y = Ys(e, { boundary: c, rootBoundary: l, padding: u, altBoundary: h }), f = Dr(e.placement), v = Ia(e.placement), _ = !v, M = wp(f), T = MA(M), w = e.modifiersData.popperOffsets, b = e.rects.reference, E = e.rects.popper, S = typeof d == "function" ? d(Object.assign({}, e.rects, { placement: e.placement })) : d, C = typeof S == "number" ? { mainAxis: S, altAxis: S } : Object.assign({ mainAxis: 0, altAxis: 0 }, S), R = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, L = { x: 0, y: 0 }; if (w) { if (o) { var A, P = M === "y" ? Vi : Hi, O = M === "y" ? or : ar, x = M === "y" ? "height" : "width", I = w[M], N = I + y[P], D = I - y[O], k = m ? -E[x] / 2 : 0, F = v === La ? b[x] : E[x], W = v === La ? -E[x] : -b[x], K = e.elements.arrow, ne = m && K ? xp(K) : { width: 0, height: 0 }, q = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : H0(), z = q[P], j = q[O], Q = Fs(0, b[x], ne[x]), Y = _ ? b[x] / 2 - k - Q - z - C.mainAxis : F - Q - z - C.mainAxis, ee = _ ? -b[x] / 2 + k + Q + j + C.mainAxis : W + Q + j + C.mainAxis, G = e.elements.arrow && ml(e.elements.arrow), J = G ? M === "y" ? G.clientTop || 0 : G.clientLeft || 0 : 0, re = (A = R == null ? void 0 : R[M]) != null ? A : 0, B = I + Y - re - J, $ = I + ee - re, te = Fs(m ? Zc(N, B) : N, I, m ? To(D, $) : D); w[M] = te, L[M] = te - I; } if (s) { var U, V = M === "x" ? Vi : Hi, ae = M === "x" ? or : ar, ue = w[T], de = T === "y" ? "height" : "width", ve = ue + y[V], ye = ue - y[ae], le = [Vi, Hi].indexOf(f) !== -1, Se = (U = R == null ? void 0 : R[T]) != null ? U : 0, Te = le ? ve : ue - b[de] - E[de] - Se + C.altAxis, oe = le ? ue + b[de] + E[de] - Se - C.altAxis : ye, Me = m && le ? JE(Te, ue, oe) : Fs(m ? Te : ve, ue, m ? oe : ye); w[T] = Me, L[T] = Me - ue; } e.modifiersData[r] = L; } } var TA = { name: "preventOverflow", enabled: !0, phase: "main", fn: SA, requiresIfExists: ["offset"] }; function EA(i) { return { scrollLeft: i.scrollLeft, scrollTop: i.scrollTop }; } function AA(i) { return i === _r(i) || !nr(i) ? _p(i) : EA(i); } function CA(i) { var e = i.getBoundingClientRect(), t = Oa(e.width) / i.offsetWidth || 1, r = Oa(e.height) / i.offsetHeight || 1; return t !== 1 || r !== 1; } function LA(i, e, t) { t === void 0 && (t = !1); var r = nr(e), n = nr(e) && CA(e), o = eo(e), a = Pa(i, n), s = { scrollLeft: 0, scrollTop: 0 }, c = { x: 0, y: 0 }; return (r || !r && !t) && ((kr(e) !== "body" || Sp(o)) && (s = AA(e)), nr(e) ? (c = Pa(e, !0), c.x += e.clientLeft, c.y += e.clientTop) : o && (c.x = Mp(o))), { x: a.left + s.scrollLeft - c.x, y: a.top + s.scrollTop - c.y, width: a.width, height: a.height }; } function RA(i) { var e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = []; i.forEach(function(o) { e.set(o.name, o); }); function n(o) { t.add(o.name); var a = [].concat(o.requires || [], o.requiresIfExists || []); a.forEach(function(s) { if (!t.has(s)) { var c = e.get(s); c && n(c); } }), r.push(o); } return i.forEach(function(o) { t.has(o.name) || n(o); }), r; } function OA(i) { var e = RA(i); return $E.reduce(function(t, r) { return t.concat(e.filter(function(n) { return n.phase === r; })); }, []); } function PA(i) { var e; return function() { return e || (e = new Promise(function(t) { Promise.resolve().then(function() { e = void 0, t(i()); }); })), e; }; } function IA(i) { var e = i.reduce(function(t, r) { var n = t[r.name]; return t[r.name] = n ? Object.assign({}, n, r, { options: Object.assign({}, n.options, r.options), data: Object.assign({}, n.data, r.data) }) : r, t; }, {}); return Object.keys(e).map(function(t) { return e[t]; }); } var Dm = { placement: "bottom", modifiers: [], strategy: "absolute" }; function Nm() { for (var i = arguments.length, e = new Array(i), t = 0; t < i; t++) e[t] = arguments[t]; return !e.some(function(r) { return !(r && typeof r.getBoundingClientRect == "function"); }); } function Tp(i) { i === void 0 && (i = {}); var e = i, t = e.defaultModifiers, r = t === void 0 ? [] : t, n = e.defaultOptions, o = n === void 0 ? Dm : n; return function(a, s, c) { c === void 0 && (c = o); var l = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, Dm, o), modifiersData: {}, elements: { reference: a, popper: s }, attributes: {}, styles: {} }, h = [], u = !1, p = { state: l, setOptions: function(d) { var y = typeof d == "function" ? d(l.options) : d; g(), l.options = Object.assign({}, o, l.options, y), l.scrollParents = { reference: Ra(a) ? zs(a) : a.contextElement ? zs(a.contextElement) : [], popper: zs(s) }; var f = OA(IA([].concat(r, l.options.modifiers))); return l.orderedModifiers = f.filter(function(v) { return v.enabled; }), m(), p.update(); }, forceUpdate: function() { if (!u) { var d = l.elements, y = d.reference, f = d.popper; if (Nm(y, f)) { l.rects = { reference: LA(y, ml(f), l.options.strategy === "fixed"), popper: xp(f) }, l.reset = !1, l.placement = l.options.placement, l.orderedModifiers.forEach(function(E) { return l.modifiersData[E.name] = Object.assign({}, E.data); }); for (var v = 0; v < l.orderedModifiers.length; v++) { if (l.reset === !0) { l.reset = !1, v = -1; continue; } var _ = l.orderedModifiers[v], M = _.fn, T = _.options, w = T === void 0 ? {} : T, b = _.name; typeof M == "function" && (l = M({ state: l, options: w, name: b, instance: p }) || l); } } } }, update: PA(function() { return new Promise(function(d) { p.forceUpdate(), d(l); }); }), destroy: function() { g(), u = !0; } }; if (!Nm(a, s)) return p; p.setOptions(c).then(function(d) { !u && c.onFirstUpdate && c.onFirstUpdate(d); }); function m() { l.orderedModifiers.forEach(function(d) { var y = d.name, f = d.options, v = f === void 0 ? {} : f, _ = d.effect; if (typeof _ == "function") { var M = _({ state: l, name: y, instance: p, options: v }), T = function() { }; h.push(M || T); } }); } function g() { h.forEach(function(d) { return d(); }), h = []; } return p; }; } Tp(); var DA = [$0, Z0, W0, U0]; Tp({ defaultModifiers: DA }); var NA = [$0, Z0, W0, U0, wA, gA, TA, tA, yA], BA = Tp({ defaultModifiers: NA }); const kA = (i, e, t = {}) => { const r = { name: "updateState", enabled: !0, phase: "write", fn: ({ state: c }) => { const l = FA(c); Object.assign(a.value, l); }, requires: ["computeStyles"] }, n = ce(() => { const { onFirstUpdate: c, placement: l, strategy: h, modifiers: u } = H(t); return { onFirstUpdate: c, placement: l || "bottom", strategy: h || "absolute", modifiers: [ ...u || [], r, { name: "applyStyles", enabled: !1 } ] }; }), o = Pi(), a = Ae({ styles: { popper: { position: H(n).strategy, left: "0", top: "0" }, arrow: { position: "absolute" } }, attributes: {} }), s = () => { o.value && (o.value.destroy(), o.value = void 0); }; return Je(n, (c) => { const l = H(o); l && l.setOptions(c); }, { deep: !0 }), Je([i, e], ([c, l]) => { s(), !(!c || !l) && (o.value = BA(c, l, H(n))); }), sr(() => { s(); }), { state: ce(() => { var c; return { ...((c = H(o)) == null ? void 0 : c.state) || {} }; }), styles: ce(() => H(a).styles), attributes: ce(() => H(a).attributes), update: () => { var c; return (c = H(o)) == null ? void 0 : c.update(); }, forceUpdate: () => { var c; return (c = H(o)) == null ? void 0 : c.forceUpdate(); }, instanceRef: ce(() => H(o)) }; }; function FA(i) { const e = Object.keys(i.elements), t = Wc(e.map((n) => [n, i.styles[n] || {}])), r = Wc(e.map((n) => [n, i.attributes[n]])); return { styles: t, attributes: r }; } function Bm() { let i; const e = (r, n) => { t(), i = window.setTimeout(r, n); }, t = () => window.clearTimeout(i); return su(() => t()), { registerTimeout: e, cancelTimeout: t }; } const ud = { prefix: Math.floor(Math.random() * 1e4), current: 0 }, zA = Symbol("elIdInjection"), Ep = () => si() ? ct(zA, ud) : ud, vu = (i) => { const e = Ep(); !ii && e === ud && Qt("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 = vp(); return ce(() => H(i) || `${t.value}-id-${e.prefix}-${e.current++}`); }; let xa = []; const km = (i) => { const e = i; e.key === Ir.esc && xa.forEach((t) => t(e)); }, UA = (i) => { ni(() => { xa.length === 0 && document.addEventListener("keydown", km), ii && xa.push(i); }), sr(() => { xa = xa.filter((e) => e !== i), xa.length === 0 && ii && document.removeEventListener("keydown", km); }); }; let Fm; const Y0 = () => { const i = vp(), e = Ep(), t = ce(() => `${i.value}-popper-container-${e.prefix}`), r = ce(() => `#${t.value}`); return { id: t, selector: r }; }, VA = (i) => { const e = document.createElement("div"); return e.id = i, document.body.appendChild(e), e; }, HA = () => { const { id: i, selector: e } = Y0(); return mw(() => { ii && (process.env.NODE_ENV === "test" || !Fm || !document.body.querySelector(e.value)) && (Fm = VA(i.value)); }), { id: i, selector: e }; }, jA = ht({ showAfter: { type: Number, default: 0 }, hideAfter: { type: Number, default: 200 }, autoClose: { type: Number, default: 0 } }), GA = ({ showAfter: i, hideAfter: e, autoClose: t, open: r, close: n }) => { const { registerTimeout: o } = Bm(), { registerTimeout: a, cancelTimeout: s } = Bm(); return { onOpen: (c) => { o(() => { r(c); const l = H(t); Mt(l) && l > 0 && a(() => { n(c); }, l); }, H(i)); }, onClose: (c) => { s(), o(() => { n(c); }, H(e)); } }; }, J0 = Symbol("elForwardRef"), WA = (i) => { pi(J0, { setForwardRef: (e) => { i.value = e; } }); }, $A = (i) => ({ mounted(e) { i(e); }, updated(e) { i(e); }, unmounted() { i(null); } }), zm = { current: 0 }, Um = Ae(0), K0 = 2e3, Vm = Symbol("elZIndexContextKey"), Q0 = Symbol("zIndexContextKey"), ey = (i) => { const e = si() ? ct(Vm, zm) : zm, t = i || (si() ? ct(Q0, void 0) : void 0), r = ce(() => { const a = H(t); return Mt(a) ? a : K0; }), n = ce(() => r.value + Um.value), o = () => (e.current++, Um.value = e.current, n.value); return !ii && !ct(Vm) && Qt("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: r, currentZIndex: n, nextZIndex: o }; }; function qA(i) { let e; function t() { if (i.value == null) return; const { selectionStart: n, selectionEnd: o, value: a } = i.value; if (n == null || o == null) return; const s = a.slice(0, Math.max(0, n)), c = a.slice(Math.max(0, o)); e = { selectionStart: n, selectionEnd: o, value: a, beforeTxt: s, afterTxt: c }; } function r() { if (i.value == null || e == null) return; const { value: n } = i.value, { beforeTxt: o, afterTxt: a, selectionStart: s } = e; if (o == null || a == null || s == null) return; let c = n.length; if (n.endsWith(a)) c = n.length - a.length; else if (n.startsWith(o)) c = o.length; else { const l = o[s - 1], h = n.indexOf(l, s - 1); h !== -1 && (c = h + 1); } i.value.setSelectionRange(c, c); } return [t, r]; } const XA = (i, e, t) => Bc(i.subTree).filter((r) => { var n; return Qh(r) && ((n = r.type) == null ? void 0 : n.name) === e && !!r.component; }).map((r) => r.component.uid).map((r) => t[r]).filter((r) => !!r), ZA = (i, e) => { const t = {}, r = Pi([]); return { children: r, addChild: (n) => { t[n.uid] = n, r.value = XA(i, e, t); }, removeChild: (n) => { delete t[n], r.value = r.value.filter((o) => o.uid !== n); } }; }, Da = fu({ type: String, values: N0, required: !1 }), ty = Symbol("size"), YA = () => { const i = ct(ty, {}); return ce(() => H(i.size) || ""); }; function iy(i, { beforeFocus: e, afterFocus: t, beforeBlur: r, afterBlur: n } = {}) { const o = si(), { emit: a } = o, s = Pi(), c = Ae(!1), l = (p) => { Ci(e) && e(p) || c.value || (c.value = !0, a("focus", p), t == null || t()); }, h = (p) => { var m; Ci(r) && r(p) || p.relatedTarget && (m = s.value) != null && m.contains(p.relatedTarget) || (c.value = !1, a("blur", p), n == null || n()); }, u = () => { var p, m; (p = s.value) != null && p.contains(document.activeElement) && s.value !== document.activeElement || (m = i.value) == null || m.focus(); }; return Je(s, (p) => { p && p.setAttribute("tabindex", "-1"); }), hi(s, "focus", l, !0), hi(s, "blur", h, !0), hi(s, "click", u, !0), process.env.NODE_ENV === "test" && ni(() => { const p = Mo(i.value) ? i.value : document.querySelector("input,textarea"); p && (hi(p, "focus", l, !0), hi(p, "blur", h, !0)); }), { isFocused: c, wrapperRef: s, handleFocus: l, handleBlur: h }; } function ry({ afterComposition: i, emit: e }) { const t = Ae(!1), r = (a) => { e == null || e("compositionstart", a), t.value = !0; }, n = (a) => { var s; e == null || e("compositionupdate", a); const c = (s = a.target) == null ? void 0 : s.value, l = c[c.length - 1] || ""; t.value = !_E(l); }, o = (a) => { e == null || e("compositionend", a), t.value && (t.value = !1, _t(() => i(a))); }; return { isComposing: t, handleComposition: (a) => { a.type === "compositionend" ? o(a) : n(a); }, handleCompositionStart: r, handleCompositionUpdate: n, handleCompositionEnd: o }; } const ny = Symbol("emptyValuesContextKey"), JA = "use-empty-values", KA = ["", void 0, null], QA = void 0, e2 = ht({ emptyValues: Array, valueOnClear: { type: [String, Number, Boolean, Function], default: void 0, validator: (i) => Ci(i) ? !i() : !i } }), t2 = (i, e) => { const t = si() ? ct(ny, Ae({})) : Ae({}), r = ce(() => i.emptyValues || t.value.emptyValues || KA), n = ce(() => Ci(i.valueOnClear) ? i.valueOnClear() : i.valueOnClear !== void 0 ? i.valueOnClear : Ci(t.value.valueOnClear) ? t.value.valueOnClear() : t.value.valueOnClear !== void 0 ? t.value.valueOnClear : QA), o = (a) => r.value.includes(a); return r.value.includes(n.value) || Qt(JA, "value-on-clear should be a value of empty-values"), { emptyValues: r, valueOnClear: n, isEmptyValue: o }; }, i2 = ht({ ariaLabel: String, ariaOrientation: { type: String, values: ["horizontal", "vertical", "undefined"] }, ariaControls: String }), jo = (i) => YT(i2, i), oy = Symbol(), Yc = Ae(); function Ap(i, e = void 0) { const t = si() ? ct(oy, Yc) : Yc; return i ? ce(() => { var r, n; return (n = (r = t.value) == null ? void 0 : r[i]) != null ? n : e; }) : t; } function r2(i, e) { const t = Ap(), r = it(i, ce(() => { var s; return ((s = t.value) == null ? void 0 : s.namespace) || kc; })), n = mu(ce(() => { var s; return (s = t.value) == null ? void 0 : s.locale; })), o = ey(ce(() => { var s; return ((s = t.value) == null ? void 0 : s.zIndex) || K0; })), a = ce(() => { var s; return H(e) || ((s = t.value) == null ? void 0 : s.size) || ""; }); return n2(ce(() => H(t) || {})), { ns: r, locale: n, zIndex: o, size: a }; } const n2 = (i, e, t = !1) => { var r; const n = !!si(), o = n ? Ap() : void 0, a = (r = void 0) != null ? r : n ? pi : void 0; if (!a) { Qt("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup()."); return; } const s = ce(() => { const c = H(i); return o != null && o.value ? o2(o.value, c) : c; }); return a(oy, s), a(B0, ce(() => s.value.locale)), a(k0, ce(() => s.value.namespace)), a(Q0, ce(() => s.value.zIndex)), a(ty, { size: ce(() => s.value.size || "") }), a(ny, ce(() => ({ emptyValues: s.value.emptyValues, valueOnClear: s.value.valueOnClear }))), (t || !Yc.value) && (Yc.value = s.value), s; }, o2 = (i, e) => { const t = [.../* @__PURE__ */ new Set([...Tm(i), ...Tm(e)])], r = {}; for (const n of t) r[n] = e[n] !== void 0 ? e[n] : i[n]; return r; }; var at = (i, e) => { const t = i.__vccOpts || i; for (const [r, n] of e) t[r] = n; return t; }; const a2 = ht({ size: { type: Xe([Number, String]) }, color: { type: String } }), s2 = Ie({ name: "ElIcon", inheritAttrs: !1 }), l2 = /* @__PURE__ */ Ie({ ...s2, props: a2, setup(i) { const e = i, t = it("icon"), r = ce(() => { const { size: n, color: o } = e; return !n && !o ? {} : { fontSize: vr(n) ? void 0 : qc(n), "--color": o }; }); return (n, o) => (fe(), Ce("i", Pr({ class: H(t).b(), style: H(r) }, n.$attrs), [ qe(n.$slots, "default") ], 16)); } }); var c2 = /* @__PURE__ */ at(l2, [["__file", "icon.vue"]]); const kt = fi(c2), Cp = Symbol("formContextKey"), Jc = Symbol("formItemContextKey"), ns = (i, e = {}) => { const t = Ae(void 0), r = e.prop ? t : F0("size"), n = e.global ? t : YA(), o = e.form ? { size: void 0 } : ct(Cp, void 0), a = e.formItem ? { size: void 0 } : ct(Jc, void 0); return ce(() => r.value || H(i) || (a == null ? void 0 : a.size) || (o == null ? void 0 : o.size) || n.value || ""); }, yu = (i) => { const e = F0("disabled"), t = ct(Cp, void 0); return ce(() => e.value || H(i) || (t == null ? void 0 : t.disabled) || !1); }, gl = () => { const i = ct(Cp, void 0), e = ct(Jc, void 0); return { form: i, formItem: e }; }, Lp = (i, { formItemContext: e, disableIdGeneration: t, disableIdManagement: r }) => { t || (t = Ae(!1)), r || (r = Ae(!1)); const n = Ae(); let o; const a = ce(() => { var s; return !!(!(i.label || i.ariaLabel) && e && e.inputIds && ((s = e.inputIds) == null ? void 0 : s.length) <= 1); }); return ni(() => { o = Je([ki(i, "id"), t], ([s, c]) => { const l = s ?? (c ? void 0 : vu().value); l !== n.value && (e != null && e.removeInputId && (n.value && e.removeInputId(n.value), !(r != null && r.value) && !c && l && e.addInputId(l)), n.value = l); }, { immediate: !0 }); }), s0(() => { o && o(), e != null && e.removeInputId && n.value && e.removeInputId(n.value); }), { isLabeledByFormItem: a, inputId: n }; }; let cr; const u2 = ` height:0 !important; visibility:hidden !important; ${Jw() ? "" : "overflow:hidden !important;"} position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important; `, h2 = [ "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 d2(i) { const e = window.getComputedStyle(i), t = e.getPropertyValue("box-sizing"), r = Number.parseFloat(e.getPropertyValue("padding-bottom")) + Number.parseFloat(e.getPropertyValue("padding-top")), n = Number.parseFloat(e.getPropertyValue("border-bottom-width")) + Number.parseFloat(e.getPropertyValue("border-top-width")); return { contextStyle: h2.map((o) => `${o}:${e.getPropertyValue(o)}`).join(";"), paddingSize: r, borderSize: n, boxSizing: t }; } function Hm(i, e = 1, t) { var r; cr || (cr = document.createElement("textarea"), document.body.appendChild(cr)); const { paddingSize: n, borderSize: o, boxSizing: a, contextStyle: s } = d2(i); cr.setAttribute("style", `${s};${u2}`), cr.value = i.value || i.placeholder || ""; let c = cr.scrollHeight; const l = {}; a === "border-box" ? c = c + o : a === "content-box" && (c = c - n), cr.value = ""; const h = cr.scrollHeight - n; if (Mt(e)) { let u = h * e; a === "border-box" && (u = u + n + o), c = Math.max(u, c), l.minHeight = `${u}px`; } if (Mt(t)) { let u = h * t; a === "border-box" && (u = u + n + o), c = Math.min(u, c); } return l.height = `${c}px`, (r = cr.parentNode) == null || r.removeChild(cr), cr = void 0, l; } const p2 = ht({ id: { type: String, default: void 0 }, size: Da, disabled: Boolean, modelValue: { type: Xe([ 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: Xe([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: qn }, prefixIcon: { type: qn }, containerRole: { type: String, default: void 0 }, tabindex: { type: [String, Number], default: 0 }, validateEvent: { type: Boolean, default: !0 }, inputStyle: { type: Xe([Object, Array, String]), default: () => en({}) }, autofocus: Boolean, rows: { type: Number, default: 2 }, ...jo(["ariaLabel"]) }), f2 = { [Dt]: (i) => Ii(i), input: (i) => Ii(i), change: (i) => Ii(i), focus: (i) => i instanceof FocusEvent, blur: (i) => i instanceof FocusEvent, clear: () => !0, mouseleave: (i) => i instanceof MouseEvent, mouseenter: (i) => i instanceof MouseEvent, keydown: (i) => i instanceof Event, compositionstart: (i) => i instanceof CompositionEvent, compositionupdate: (i) => i instanceof CompositionEvent, compositionend: (i) => i instanceof CompositionEvent }, m2 = Ie({ name: "ElInput", inheritAttrs: !1 }), g2 = /* @__PURE__ */ Ie({ ...m2, props: p2, emits: f2, setup(i, { expose: e, emit: t }) { const r = i, n = sw(), o = au(), a = ce(() => { const le = {}; return r.containerRole === "combobox" && (le["aria-haspopup"] = n["aria-haspopup"], le["aria-owns"] = n["aria-owns"], le["aria-expanded"] = n["aria-expanded"]), le; }), s = ce(() => [ r.type === "textarea" ? y.b() : d.b(), d.m(m.value), d.is("disabled", g.value), d.is("exceed", K.value), { [d.b("group")]: o.prepend || o.append, [d.m("prefix")]: o.prefix || r.prefixIcon, [d.m("suffix")]: o.suffix || r.suffixIcon || r.clearable || r.showPassword, [d.bm("suffix", "password-clear")]: D.value && k.value, [d.b("hidden")]: r.type === "hidden" }, n.class ]), c = ce(() => [ d.e("wrapper"), d.is("focus", S.value) ]), l = TE({ excludeKeys: ce(() => Object.keys(a.value)) }), { form: h, formItem: u } = gl(), { inputId: p } = Lp(r, { formItemContext: u }), m = ns(), g = yu(), d = it("input"), y = it("textarea"), f = Pi(), v = Pi(), _ = Ae(!1), M = Ae(!1), T = Ae(), w = Pi(r.inputStyle), b = ce(() => f.value || v.value), { wrapperRef: E, isFocused: S, handleFocus: C, handleBlur: R } = iy(b, { beforeFocus() { return g.value; }, afterBlur() { var le; r.validateEvent && ((le = u == null ? void 0 : u.validate) == null || le.call(u, "blur").catch((Se) => Qt(Se))); } }), L = ce(() => { var le; return (le = h == null ? void 0 : h.statusIcon) != null ? le : !1; }), A = ce(() => (u == null ? void 0 : u.validateState) || ""), P = ce(() => A.value && D0[A.value]), O = ce(() => M.value ? yE : dE), x = ce(() => [ n.style ]), I = ce(() => [ r.inputStyle, w.value, { resize: r.resize } ]), N = ce(() => on(r.modelValue) ? "" : String(r.modelValue)), D = ce(() => r.clearable && !g.value && !r.readonly && !!N.value && (S.value || _.value)), k = ce(() => r.showPassword && !g.value && !r.readonly && !!N.value && (!!N.value || S.value)), F = ce(() => r.showWordLimit && !!r.maxlength && (r.type === "text" || r.type === "textarea") && !g.value && !r.readonly && !r.showPassword), W = ce(() => N.value.length), K = ce(() => !!F.value && W.value > Number(r.maxlength)), ne = ce(() => !!o.suffix || !!r.suffixIcon || D.value || r.showPassword || F.value || !!A.value && L.value), [q, z] = qA(f); ir(v, (le) => { if (Q(), !F.value || r.resize !== "both") return; const Se = le[0], { width: Te } = Se.contentRect; T.value = { right: `calc(100% - ${Te + 15 + 6}px)` }; }); const j = () => { const { type: le, autosize: Se } = r; if (!(!ii || le !== "textarea" || !v.value)) if (Se) { const Te = Oi(Se) ? Se.minRows : void 0, oe = Oi(Se) ? Se.maxRows : void 0, Me = Hm(v.value, Te, oe); w.value = { overflowY: "hidden", ...Me }, _t(() => { v.value.offsetHeight, w.value = Me; }); } else w.value = { minHeight: Hm(v.value).minHeight }; }, Q = /* @__PURE__ */ ((le) => { let Se = !1; return () => { var Te; Se || !r.autosize || ((Te = v.value) == null ? void 0 : Te.offsetParent) === null || (le(), Se = !0); }; })(j), Y = () => { const le = b.value, Se = r.formatter ? r.formatter(N.value) : N.value; !le || le.value === Se || (le.value = Se); }, ee = async (le) => { q(); let { value: Se } = le.target; if (r.formatter && (Se = r.parser ? r.parser(Se) : Se), !J.value) { if (Se === N.value) { Y(); return; } t(Dt, Se), t("input", Se), await _t(), Y(), z(); } }, G = (le) => { t("change", le.target.value); }, { isComposing: J, handleCompositionStart: re, handleCompositionUpdate: B, handleCompositionEnd: $ } = ry({ emit: t, afterComposition: ee }), te = () => { M.value = !M.value, U(); }, U = async () => { var le; await _t(), (le = b.value) == null || le.focus(); }, V = () => { var le; return (le = b.value) == null ? void 0 : le.blur(); }, ae = (le) => { _.value = !1, t("mouseleave", le); }, ue = (le) => { _.value = !0, t("mouseenter", le); }, de = (le) => { t("keydown", le); }, ve = () => { var le; (le = b.value) == null || le.select(); }, ye = () => { t(Dt, ""), t("change", ""), t("clear"), t("input", ""); }; return Je(() => r.modelValue, () => { var le; _t(() => j()), r.validateEvent && ((le = u == null ? void 0 : u.validate) == null || le.call(u, "change").catch((Se) => Qt(Se))); }), Je(N, () => Y()), Je(() => r.type, async () => { await _t(), Y(), j(); }), ni(() => { !r.formatter && r.parser && Qt("ElInput", "If you set the parser, you also need to set the formatter."), Y(), _t(j); }), e({ input: f, textarea: v, ref: b, textareaStyle: I, autosize: ki(r, "autosize"), isComposing: J, focus: U, blur: V, select: ve, clear: ye, resizeTextarea: j }), (le, Se) => (fe(), Ce("div", Pr(H(a), { class: [ H(s), { [H(d).bm("group", "append")]: le.$slots.append, [H(d).bm("group", "prepend")]: le.$slots.prepend } ], style: H(x), role: le.containerRole, onMouseenter: ue, onMouseleave: ae }), [ Ve(" input "), le.type !== "textarea" ? (fe(), Ce(Gt, { key: 0 }, [ Ve(" prepend slot "), le.$slots.prepend ? (fe(), Ce("div", { key: 0, class: Le(H(d).be("group", "prepend")) }, [ qe(le.$slots, "prepend") ], 2)) : Ve("v-if", !0), ke("div", { ref_key: "wrapperRef", ref: E, class: Le(H(c)) }, [ Ve(" prefix slot "), le.$slots.prefix || le.prefixIcon ? (fe(), Ce("span", { key: 0, class: Le(H(d).e("prefix")) }, [ ke("span", { class: Le(H(d).e("prefix-inner")) }, [ qe(le.$slots, "prefix"), le.prefixIcon ? (fe(), He(H(kt), { key: 0, class: Le(H(d).e("icon")) }, { default: pe(() => [ (fe(), He(Fi(le.prefixIcon))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0) ], 2) ], 2)) : Ve("v-if", !0), ke("input", Pr({ id: H(p), ref_key: "input", ref: f, class: H(d).e("inner") }, H(l), { minlength: le.minlength, maxlength: le.maxlength, type: le.showPassword ? M.value ? "text" : "password" : le.type, disabled: H(g), readonly: le.readonly, autocomplete: le.autocomplete, tabindex: le.tabindex, "aria-label": le.ariaLabel, placeholder: le.placeholder, style: le.inputStyle, form: le.form, autofocus: le.autofocus, onCompositionstart: H(re), onCompositionupdate: H(B), onCompositionend: H($), onInput: ee, onChange: G, onKeydown: de }), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "onCompositionstart", "onCompositionupdate", "onCompositionend"]), Ve(" suffix slot "), H(ne) ? (fe(), Ce("span", { key: 1, class: Le(H(d).e("suffix")) }, [ ke("span", { class: Le(H(d).e("suffix-inner")) }, [ !H(D) || !H(k) || !H(F) ? (fe(), Ce(Gt, { key: 0 }, [ qe(le.$slots, "suffix"), le.suffixIcon ? (fe(), He(H(kt), { key: 0, class: Le(H(d).e("icon")) }, { default: pe(() => [ (fe(), He(Fi(le.suffixIcon))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0) ], 64)) : Ve("v-if", !0), H(D) ? (fe(), He(H(kt), { key: 1, class: Le([H(d).e("icon"), H(d).e("clear")]), onMousedown: ui(H($s), ["prevent"]), onClick: ye }, { default: pe(() => [ se(H(gp)) ]), _: 1 }, 8, ["class", "onMousedown"])) : Ve("v-if", !0), H(k) ? (fe(), He(H(kt), { key: 2, class: Le([H(d).e("icon"), H(d).e("password")]), onClick: te }, { default: pe(() => [ (fe(), He(Fi(H(O)))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0), H(F) ? (fe(), Ce("span", { key: 3, class: Le(H(d).e("count")) }, [ ke("span", { class: Le(H(d).e("count-inner")) }, wt(H(W)) + " / " + wt(le.maxlength), 3) ], 2)) : Ve("v-if", !0), H(A) && H(P) && H(L) ? (fe(), He(H(kt), { key: 4, class: Le([ H(d).e("icon"), H(d).e("validateIcon"), H(d).is("loading", H(A) === "validating") ]) }, { default: pe(() => [ (fe(), He(Fi(H(P)))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0) ], 2) ], 2)) : Ve("v-if", !0) ], 2), Ve(" append slot "), le.$slots.append ? (fe(), Ce("div", { key: 1, class: Le(H(d).be("group", "append")) }, [ qe(le.$slots, "append") ], 2)) : Ve("v-if", !0) ], 64)) : (fe(), Ce(Gt, { key: 1 }, [ Ve(" textarea "), ke("textarea", Pr({ id: H(p), ref_key: "textarea", ref: v, class: [H(y).e("inner"), H(d).is("focus", H(S))] }, H(l), { minlength: le.minlength, maxlength: le.maxlength, tabindex: le.tabindex, disabled: H(g), readonly: le.readonly, autocomplete: le.autocomplete, style: H(I), "aria-label": le.ariaLabel, placeholder: le.placeholder, form: le.form, autofocus: le.autofocus, rows: le.rows, onCompositionstart: H(re), onCompositionupdate: H(B), onCompositionend: H($), onInput: ee, onFocus: H(C), onBlur: H(R), onChange: G, onKeydown: de }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]), H(F) ? (fe(), Ce("span", { key: 0, style: It(T.value), class: Le(H(d).e("count")) }, wt(H(W)) + " / " + wt(le.maxlength), 7)) : Ve("v-if", !0) ], 64)) ], 16, ["role"])); } }); var v2 = /* @__PURE__ */ at(g2, [["__file", "input.vue"]]); const y2 = fi(v2), Yo = 4, b2 = { 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" } }, x2 = ({ move: i, size: e, bar: t }) => ({ [t.size]: e, transform: `translate${t.axis}(${i}%)` }), Rp = Symbol("scrollbarContextKey"), w2 = ht({ vertical: Boolean, size: String, move: Number, ratio: { type: Number, required: !0 }, always: Boolean }), _2 = "Thumb", M2 = /* @__PURE__ */ Ie({ __name: "thumb", props: w2, setup(i) { const e = i, t = ct(Rp), r = it("scrollbar"); t || is(_2, "can not inject scrollbar context"); const n = Ae(), o = Ae(), a = Ae({}), s = Ae(!1); let c = !1, l = !1, h = ii ? document.onselectstart : null; const u = ce(() => b2[e.vertical ? "vertical" : "horizontal"]), p = ce(() => x2({ size: e.size, move: e.move, bar: u.value })), m = ce(() => n.value[u.value.offset] ** 2 / t.wrapElement[u.value.scrollSize] / e.ratio / o.value[u.value.offset]), g = (w) => { var b; if (w.stopPropagation(), w.ctrlKey || [1, 2].includes(w.button)) return; (b = window.getSelection()) == null || b.removeAllRanges(), y(w); const E = w.currentTarget; E && (a.value[u.value.axis] = E[u.value.offset] - (w[u.value.client] - E.getBoundingClientRect()[u.value.direction])); }, d = (w) => { if (!o.value || !n.value || !t.wrapElement) return; const b = Math.abs(w.target.getBoundingClientRect()[u.value.direction] - w[u.value.client]), E = o.value[u.value.offset] / 2, S = (b - E) * 100 * m.value / n.value[u.value.offset]; t.wrapElement[u.value.scroll] = S * t.wrapElement[u.value.scrollSize] / 100; }, y = (w) => { w.stopImmediatePropagation(), c = !0, document.addEventListener("mousemove", f), document.addEventListener("mouseup", v), h = document.onselectstart, document.onselectstart = () => !1; }, f = (w) => { if (!n.value || !o.value || c === !1) return; const b = a.value[u.value.axis]; if (!b) return; const E = (n.value.getBoundingClientRect()[u.value.direction] - w[u.value.client]) * -1, S = o.value[u.value.offset] - b, C = (E - S) * 100 * m.value / n.value[u.value.offset]; t.wrapElement[u.value.scroll] = C * t.wrapElement[u.value.scrollSize] / 100; }, v = () => { c = !1, a.value[u.value.axis] = 0, document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", v), T(), l && (s.value = !1); }, _ = () => { l = !1, s.value = !!e.size; }, M = () => { l = !0, s.value = c; }; sr(() => { T(), document.removeEventListener("mouseup", v); }); const T = () => { document.onselectstart !== h && (document.onselectstart = h); }; return hi(ki(t, "scrollbarElement"), "mousemove", _), hi(ki(t, "scrollbarElement"), "mouseleave", M), (w, b) => (fe(), He(hl, { name: H(r).b("fade"), persisted: "" }, { default: pe(() => [ Bt(ke("div", { ref_key: "instance", ref: n, class: Le([H(r).e("bar"), H(r).is(H(u).key)]), onMousedown: d }, [ ke("div", { ref_key: "thumb", ref: o, class: Le(H(r).e("thumb")), style: It(H(p)), onMousedown: g }, null, 38) ], 34), [ [yi, w.always || s.value] ]) ]), _: 1 }, 8, ["name"])); } }); var jm = /* @__PURE__ */ at(M2, [["__file", "thumb.vue"]]); const S2 = ht({ always: { type: Boolean, default: !0 }, minSize: { type: Number, required: !0 } }), T2 = /* @__PURE__ */ Ie({ __name: "bar", props: S2, setup(i, { expose: e }) { const t = i, r = ct(Rp), n = Ae(0), o = Ae(0), a = Ae(""), s = Ae(""), c = Ae(1), l = Ae(1); return e({ handleScroll: (h) => { if (h) { const u = h.offsetHeight - Yo, p = h.offsetWidth - Yo; o.value = h.scrollTop * 100 / u * c.value, n.value = h.scrollLeft * 100 / p * l.value; } }, update: () => { const h = r == null ? void 0 : r.wrapElement; if (!h) return; const u = h.offsetHeight - Yo, p = h.offsetWidth - Yo, m = u ** 2 / h.scrollHeight, g = p ** 2 / h.scrollWidth, d = Math.max(m, t.minSize), y = Math.max(g, t.minSize); c.value = m / (u - m) / (d / (u - d)), l.value = g / (p - g) / (y / (p - y)), s.value = d + Yo < u ? `${d}px` : "", a.value = y + Yo < p ? `${y}px` : ""; } }), (h, u) => (fe(), Ce(Gt, null, [ se(jm, { move: n.value, ratio: l.value, size: a.value, always: h.always }, null, 8, ["move", "ratio", "size", "always"]), se(jm, { move: o.value, ratio: c.value, size: s.value, vertical: "", always: h.always }, null, 8, ["move", "ratio", "size", "always"]) ], 64)); } }); var E2 = /* @__PURE__ */ at(T2, [["__file", "bar.vue"]]); const A2 = ht({ height: { type: [String, Number], default: "" }, maxHeight: { type: [String, Number], default: "" }, native: { type: Boolean, default: !1 }, wrapStyle: { type: Xe([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, ...jo(["ariaLabel", "ariaOrientation"]) }), C2 = { scroll: ({ scrollTop: i, scrollLeft: e }) => [i, e].every(Mt) }, hd = "ElScrollbar", L2 = Ie({ name: hd }), R2 = /* @__PURE__ */ Ie({ ...L2, props: A2, emits: C2, setup(i, { expose: e, emit: t }) { const r = i, n = it("scrollbar"); let o, a, s = 0, c = 0; const l = Ae(), h = Ae(), u = Ae(), p = Ae(), m = ce(() => { const T = {}; return r.height && (T.height = qc(r.height)), r.maxHeight && (T.maxHeight = qc(r.maxHeight)), [r.wrapStyle, T]; }), g = ce(() => [ r.wrapClass, n.e("wrap"), { [n.em("wrap", "hidden-default")]: !r.native } ]), d = ce(() => [n.e("view"), r.viewClass]), y = () => { var T; h.value && ((T = p.value) == null || T.handleScroll(h.value), s = h.value.scrollTop, c = h.value.scrollLeft, t("scroll", { scrollTop: h.value.scrollTop, scrollLeft: h.value.scrollLeft })); }; function f(T, w) { Oi(T) ? h.value.scrollTo(T) : Mt(T) && Mt(w) && h.value.scrollTo(T, w); } const v = (T) => { if (!Mt(T)) { Qt(hd, "value must be a number"); return; } h.value.scrollTop = T; }, _ = (T) => { if (!Mt(T)) { Qt(hd, "value must be a number"); return; } h.value.scrollLeft = T; }, M = () => { var T; (T = p.value) == null || T.update(); }; return Je(() => r.noresize, (T) => { T ? (o == null || o(), a == null || a()) : ({ stop: o } = ir(u, M), a = hi("resize", M)); }, { immediate: !0 }), Je(() => [r.maxHeight, r.height], () => { r.native || _t(() => { var T; M(), h.value && ((T = p.value) == null || T.handleScroll(h.value)); }); }), pi(Rp, Yi({ scrollbarElement: l, wrapElement: h })), lw(() => { h.value && (h.value.scrollTop = s, h.value.scrollLeft = c); }), ni(() => { r.native || _t(() => { M(); }); }), rp(() => M()), e({ wrapRef: h, update: M, scrollTo: f, setScrollTop: v, setScrollLeft: _, handleScroll: y }), (T, w) => (fe(), Ce("div", { ref_key: "scrollbarRef", ref: l, class: Le(H(n).b()) }, [ ke("div", { ref_key: "wrapRef", ref: h, class: Le(H(g)), style: It(H(m)), tabindex: T.tabindex, onScroll: y }, [ (fe(), He(Fi(T.tag), { id: T.id, ref_key: "resizeRef", ref: u, class: Le(H(d)), style: It(T.viewStyle), role: T.role, "aria-label": T.ariaLabel, "aria-orientation": T.ariaOrientation }, { default: pe(() => [ qe(T.$slots, "default") ]), _: 3 }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"])) ], 46, ["tabindex"]), T.native ? Ve("v-if", !0) : (fe(), He(E2, { key: 0, ref_key: "barRef", ref: p, always: T.always, "min-size": T.minSize }, null, 8, ["always", "min-size"])) ], 2)); } }); var O2 = /* @__PURE__ */ at(R2, [["__file", "scrollbar.vue"]]); const P2 = fi(O2), Op = Symbol("popper"), ay = Symbol("popperContent"), I2 = [ "dialog", "grid", "group", "listbox", "menu", "navigation", "tooltip", "tree" ], sy = ht({ role: { type: String, values: I2, default: "tooltip" } }), D2 = Ie({ name: "ElPopper", inheritAttrs: !1 }), N2 = /* @__PURE__ */ Ie({ ...D2, props: sy, setup(i, { expose: e }) { const t = i, r = Ae(), n = Ae(), o = Ae(), a = Ae(), s = ce(() => t.role), c = { triggerRef: r, popperInstanceRef: n, contentRef: o, referenceRef: a, role: s }; return e(c), pi(Op, c), (l, h) => qe(l.$slots, "default"); } }); var B2 = /* @__PURE__ */ at(N2, [["__file", "popper.vue"]]); const ly = ht({ arrowOffset: { type: Number, default: 5 } }), k2 = Ie({ name: "ElPopperArrow", inheritAttrs: !1 }), F2 = /* @__PURE__ */ Ie({ ...k2, props: ly, setup(i, { expose: e }) { const t = i, r = it("popper"), { arrowOffset: n, arrowRef: o, arrowStyle: a } = ct(ay, void 0); return Je(() => t.arrowOffset, (s) => { n.value = s; }), sr(() => { o.value = void 0; }), e({ arrowRef: o }), (s, c) => (fe(), Ce("span", { ref_key: "arrowRef", ref: o, class: Le(H(r).e("arrow")), style: It(H(a)), "data-popper-arrow": "" }, null, 6)); } }); var z2 = /* @__PURE__ */ at(F2, [["__file", "arrow.vue"]]); const Ju = "ElOnlyChild", U2 = Ie({ name: Ju, setup(i, { slots: e, attrs: t }) { var r; const n = ct(J0), o = $A((r = n == null ? void 0 : n.setForwardRef) != null ? r : $s); return () => { var a; const s = (a = e.default) == null ? void 0 : a.call(e, t); if (!s) return null; if (s.length > 1) return Qt(Ju, "requires exact only one valid child."), null; const c = cy(s); return c ? Bt(cw(c, t), [[o]]) : (Qt(Ju, "no valid child node found"), null); }; } }); function cy(i) { if (!i) return null; const e = i; for (const t of e) { if (Oi(t)) switch (t.type) { case uw: continue; case o0: case "svg": return Gm(t); case Gt: return cy(t.children); default: return t; } return Gm(t); } return null; } function Gm(i) { const e = it("only-child"); return se("span", { class: e.e("content") }, [i]); } const uy = ht({ virtualRef: { type: Xe(Object) }, virtualTriggering: Boolean, onMouseenter: { type: Xe(Function) }, onMouseleave: { type: Xe(Function) }, onClick: { type: Xe(Function) }, onKeydown: { type: Xe(Function) }, onFocus: { type: Xe(Function) }, onBlur: { type: Xe(Function) }, onContextmenu: { type: Xe(Function) }, id: String, open: Boolean }), V2 = Ie({ name: "ElPopperTrigger", inheritAttrs: !1 }), H2 = /* @__PURE__ */ Ie({ ...V2, props: uy, setup(i, { expose: e }) { const t = i, { role: r, triggerRef: n } = ct(Op, void 0); WA(n); const o = ce(() => s.value ? t.id : void 0), a = ce(() => { if (r && r.value === "tooltip") return t.open && t.id ? t.id : void 0; }), s = ce(() => { if (r && r.value !== "tooltip") return r.value; }), c = ce(() => s.value ? `${t.open}` : void 0); let l; const h = [ "onMouseenter", "onMouseleave", "onClick", "onKeydown", "onFocus", "onBlur", "onContextmenu" ]; return ni(() => { Je(() => t.virtualRef, (u) => { u && (n.value = rn(u)); }, { immediate: !0 }), Je(n, (u, p) => { l == null || l(), l = void 0, Mo(u) && (h.forEach((m) => { var g; const d = t[m]; d && (u.addEventListener(m.slice(2).toLowerCase(), d), (g = p == null ? void 0 : p.removeEventListener) == null || g.call(p, m.slice(2).toLowerCase(), d)); }), l = Je([o, a, s, c], (m) => { [ "aria-controls", "aria-describedby", "aria-haspopup", "aria-expanded" ].forEach((g, d) => { on(m[d]) ? u.removeAttribute(g) : u.setAttribute(g, m[d]); }); }, { immediate: !0 })), Mo(p) && [ "aria-controls", "aria-describedby", "aria-haspopup", "aria-expanded" ].forEach((m) => p.removeAttribute(m)); }, { immediate: !0 }); }), sr(() => { if (l == null || l(), l = void 0, n.value && Mo(n.value)) { const u = n.value; h.forEach((p) => { const m = t[p]; m && u.removeEventListener(p.slice(2).toLowerCase(), m); }), n.value = void 0; } }), e({ triggerRef: n }), (u, p) => u.virtualTriggering ? Ve("v-if", !0) : (fe(), He(H(U2), Pr({ key: 0 }, u.$attrs, { "aria-controls": H(o), "aria-describedby": H(a), "aria-expanded": H(c), "aria-haspopup": H(s) }), { default: pe(() => [ qe(u.$slots, "default") ]), _: 3 }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])); } }); var j2 = /* @__PURE__ */ at(H2, [["__file", "trigger.vue"]]); const Ku = "focus-trap.focus-after-trapped", Qu = "focus-trap.focus-after-released", G2 = "focus-trap.focusout-prevented", Wm = { cancelable: !0, bubbles: !1 }, W2 = { cancelable: !0, bubbles: !1 }, $m = "focusAfterTrapped", qm = "focusAfterReleased", $2 = Symbol("elFocusTrap"), Pp = Ae(), bu = Ae(0), Ip = Ae(0); let kl = 0; const hy = (i) => { const e = [], t = document.createTreeWalker(i, NodeFilter.SHOW_ELEMENT, { acceptNode: (r) => { const n = r.tagName === "INPUT" && r.type === "hidden"; return r.disabled || r.hidden || n ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 || r === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } }); for (; t.nextNode(); ) e.push(t.currentNode); return e; }, Xm = (i, e) => { for (const t of i) if (!q2(t, e)) return t; }, q2 = (i, e) => { if (process.env.NODE_ENV === "test") return !1; if (getComputedStyle(i).visibility === "hidden") return !0; for (; i; ) { if (e && i === e) return !1; if (getComputedStyle(i).display === "none") return !0; i = i.parentElement; } return !1; }, X2 = (i) => { const e = hy(i), t = Xm(e, i), r = Xm(e.reverse(), i); return [t, r]; }, Z2 = (i) => i instanceof HTMLInputElement && "select" in i, Pn = (i, e) => { if (i && i.focus) { const t = document.activeElement; i.focus({ preventScroll: !0 }), Ip.value = window.performance.now(), i !== t && Z2(i) && e && i.select(); } }; function Zm(i, e) { const t = [...i], r = i.indexOf(e); return r !== -1 && t.splice(r, 1), t; } const Y2 = () => { let i = []; return { push: (e) => { const t = i[0]; t && e !== t && t.pause(), i = Zm(i, e), i.unshift(e); }, remove: (e) => { var t, r; i = Zm(i, e), (r = (t = i[0]) == null ? void 0 : t.resume) == null || r.call(t); } }; }, J2 = (i, e = !1) => { const t = document.activeElement; for (const r of i) if (Pn(r, e), document.activeElement !== t) return; }, Ym = Y2(), K2 = () => bu.value > Ip.value, Fl = () => { Pp.value = "pointer", bu.value = window.performance.now(); }, Jm = () => { Pp.value = "keyboard", bu.value = window.performance.now(); }, Q2 = () => (ni(() => { kl === 0 && (document.addEventListener("mousedown", Fl), document.addEventListener("touchstart", Fl), document.addEventListener("keydown", Jm)), kl++; }), sr(() => { kl--, kl <= 0 && (document.removeEventListener("mousedown", Fl), document.removeEventListener("touchstart", Fl), document.removeEventListener("keydown", Jm)); }), { focusReason: Pp, lastUserFocusTimestamp: bu, lastAutomatedFocusTimestamp: Ip }), zl = (i) => new CustomEvent(G2, { ...W2, detail: i }), eC = Ie({ name: "ElFocusTrap", inheritAttrs: !1, props: { loop: Boolean, trapped: Boolean, focusTrapEl: Object, focusStartEl: { type: [Object, String], default: "first" } }, emits: [ $m, qm, "focusin", "focusout", "focusout-prevented", "release-requested" ], setup(i, { emit: e }) { const t = Ae(); let r, n; const { focusReason: o } = Q2(); UA((g) => { i.trapped && !a.paused && e("release-requested", g); }); const a = { paused: !1, pause() { this.paused = !0; }, resume() { this.paused = !1; } }, s = (g) => { if (!i.loop && !i.trapped || a.paused) return; const { key: d, altKey: y, ctrlKey: f, metaKey: v, currentTarget: _, shiftKey: M } = g, { loop: T } = i, w = d === Ir.tab && !y && !f && !v, b = document.activeElement; if (w && b) { const E = _, [S, C] = X2(E); if (S && C) { if (!M && b === C) { const R = zl({ focusReason: o.value }); e("focusout-prevented", R), R.defaultPrevented || (g.preventDefault(), T && Pn(S, !0)); } else if (M && [S, E].includes(b)) { const R = zl({ focusReason: o.value }); e("focusout-prevented", R), R.defaultPrevented || (g.preventDefault(), T && Pn(C, !0)); } } else if (b === E) { const R = zl({ focusReason: o.value }); e("focusout-prevented", R), R.defaultPrevented || g.preventDefault(); } } }; pi($2, { focusTrapRef: t, onKeydown: s }), Je(() => i.focusTrapEl, (g) => { g && (t.value = g); }, { immediate: !0 }), Je([t], ([g], [d]) => { g && (g.addEventListener("keydown", s), g.addEventListener("focusin", h), g.addEventListener("focusout", u)), d && (d.removeEventListener("keydown", s), d.removeEventListener("focusin", h), d.removeEventListener("focusout", u)); }); const c = (g) => { e($m, g); }, l = (g) => e(qm, g), h = (g) => { const d = H(t); if (!d) return; const y = g.target, f = g.relatedTarget, v = y && d.contains(y); i.trapped || f && d.contains(f) || (r = f), v && e("focusin", g), !a.paused && i.trapped && (v ? n = y : Pn(n, !0)); }, u = (g) => { const d = H(t); if (!(a.paused || !d)) if (i.trapped) { const y = g.relatedTarget; !on(y) && !d.contains(y) && setTimeout(() => { if (!a.paused && i.trapped) { const f = zl({ focusReason: o.value }); e("focusout-prevented", f), f.defaultPrevented || Pn(n, !0); } }, 0); } else { const y = g.target; y && d.contains(y) || e("focusout", g); } }; async function p() { await _t(); const g = H(t); if (g) { Ym.push(a); const d = g.contains(document.activeElement) ? r : document.activeElement; if (r = d, !g.contains(d)) { const y = new Event(Ku, Wm); g.addEventListener(Ku, c), g.dispatchEvent(y), y.defaultPrevented || _t(() => { let f = i.focusStartEl; Ii(f) || (Pn(f), document.activeElement !== f && (f = "first")), f === "first" && J2(hy(g), !0), (document.activeElement === d || f === "container") && Pn(g); }); } } } function m() { const g = H(t); if (g) { g.removeEventListener(Ku, c); const d = new CustomEvent(Qu, { ...Wm, detail: { focusReason: o.value } }); g.addEventListener(Qu, l), g.dispatchEvent(d), !d.defaultPrevented && (o.value == "keyboard" || !K2() || g.contains(document.activeElement)) && Pn(r ?? document.body), g.removeEventListener(Qu, l), Ym.remove(a); } } return ni(() => { i.trapped && p(), Je(() => i.trapped, (g) => { g ? p() : m(); }); }), sr(() => { i.trapped && m(), t.value && (t.value.removeEventListener("keydown", s), t.value.removeEventListener("focusin", h), t.value.removeEventListener("focusout", u), t.value = void 0); }), { onKeydown: s }; } }); function tC(i, e, t, r, n, o) { return qe(i.$slots, "default", { handleKeydown: i.onKeydown }); } var iC = /* @__PURE__ */ at(eC, [["render", tC], ["__file", "focus-trap.vue"]]); const rC = ["fixed", "absolute"], nC = ht({ boundariesPadding: { type: Number, default: 0 }, fallbackPlacements: { type: Xe(Array), default: void 0 }, gpuAcceleration: { type: Boolean, default: !0 }, offset: { type: Number, default: 12 }, placement: { type: String, values: rs, default: "bottom" }, popperOptions: { type: Xe(Object), default: () => ({}) }, strategy: { type: String, values: rC, default: "absolute" } }), dy = ht({ ...nC, id: String, style: { type: Xe([String, Array, Object]) }, className: { type: Xe([String, Array, Object]) }, effect: { type: Xe(String), default: "dark" }, visible: Boolean, enterable: { type: Boolean, default: !0 }, pure: Boolean, focusOnShow: { type: Boolean, default: !1 }, trapping: { type: Boolean, default: !1 }, popperClass: { type: Xe([String, Array, Object]) }, popperStyle: { type: Xe([String, Array, Object]) }, referenceEl: { type: Xe(Object) }, triggerTargetEl: { type: Xe(Object) }, stopPopperMouseEvent: { type: Boolean, default: !0 }, virtualTriggering: Boolean, zIndex: Number, ...jo(["ariaLabel"]) }), oC = { mouseenter: (i) => i instanceof MouseEvent, mouseleave: (i) => i instanceof MouseEvent, focus: () => !0, blur: () => !0, close: () => !0 }, aC = (i, e = []) => { const { placement: t, strategy: r, popperOptions: n } = i, o = { placement: t, strategy: r, ...n, modifiers: [...lC(i), ...e] }; return cC(o, n == null ? void 0 : n.modifiers), o; }, sC = (i) => { if (ii) return rn(i); }; function lC(i) { const { offset: e, gpuAcceleration: t, fallbackPlacements: r } = i; 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: r } }, { name: "computeStyles", options: { gpuAcceleration: t } } ]; } function cC(i, e) { e && (i.modifiers = [...i.modifiers, ...e ?? []]); } const uC = 0, hC = (i) => { const { popperInstanceRef: e, contentRef: t, triggerRef: r, role: n } = ct(Op, void 0), o = Ae(), a = Ae(), s = ce(() => ({ name: "eventListeners", enabled: !!i.visible })), c = ce(() => { var f; const v = H(o), _ = (f = H(a)) != null ? f : uC; return { name: "arrow", enabled: !$T(v), options: { element: v, padding: _ } }; }), l = ce(() => ({ onFirstUpdate: () => { g(); }, ...aC(i, [ H(c), H(s) ]) })), h = ce(() => sC(i.referenceEl) || H(r)), { attributes: u, state: p, styles: m, update: g, forceUpdate: d, instanceRef: y } = kA(h, t, l); return Je(y, (f) => e.value = f), ni(() => { Je(() => { var f; return (f = H(h)) == null ? void 0 : f.getBoundingClientRect(); }, () => { g(); }); }), { attributes: u, arrowRef: o, contentRef: t, instanceRef: y, state: p, styles: m, role: n, forceUpdate: d, update: g }; }, dC = (i, { attributes: e, styles: t, role: r }) => { const { nextZIndex: n } = ey(), o = it("popper"), a = ce(() => H(e).popper), s = Ae(Mt(i.zIndex) ? i.zIndex : n()), c = ce(() => [ o.b(), o.is("pure", i.pure), o.is(i.effect), i.popperClass ]), l = ce(() => [ { zIndex: H(s) }, H(t).popper, i.popperStyle || {} ]), h = ce(() => r.value === "dialog" ? "false" : void 0), u = ce(() => H(t).arrow || {}); return { ariaModal: h, arrowStyle: u, contentAttrs: a, contentClass: c, contentStyle: l, contentZIndex: s, updateZIndex: () => { s.value = Mt(i.zIndex) ? i.zIndex : n(); } }; }, pC = (i, e) => { const t = Ae(!1), r = Ae(); return { focusStartRef: r, trapped: t, onFocusAfterReleased: (n) => { var o; ((o = n.detail) == null ? void 0 : o.focusReason) !== "pointer" && (r.value = "first", e("blur")); }, onFocusAfterTrapped: () => { e("focus"); }, onFocusInTrap: (n) => { i.visible && !t.value && (n.target && (r.value = n.target), t.value = !0); }, onFocusoutPrevented: (n) => { i.trapping || (n.detail.focusReason === "pointer" && n.preventDefault(), t.value = !1); }, onReleaseRequested: () => { t.value = !1, e("close"); } }; }, fC = Ie({ name: "ElPopperContent" }), mC = /* @__PURE__ */ Ie({ ...fC, props: dy, emits: oC, setup(i, { expose: e, emit: t }) { const r = i, { focusStartRef: n, trapped: o, onFocusAfterReleased: a, onFocusAfterTrapped: s, onFocusInTrap: c, onFocusoutPrevented: l, onReleaseRequested: h } = pC(r, t), { attributes: u, arrowRef: p, contentRef: m, styles: g, instanceRef: d, role: y, update: f } = hC(r), { ariaModal: v, arrowStyle: _, contentAttrs: M, contentClass: T, contentStyle: w, updateZIndex: b } = dC(r, { styles: g, attributes: u, role: y }), E = ct(Jc, void 0), S = Ae(); pi(ay, { arrowStyle: _, arrowRef: p, arrowOffset: S }), E && pi(Jc, { ...E, addInputId: $s, removeInputId: $s }); let C; const R = (A = !0) => { f(), A && b(); }, L = () => { R(!1), r.visible && r.focusOnShow ? o.value = !0 : r.visible === !1 && (o.value = !1); }; return ni(() => { Je(() => r.triggerTargetEl, (A, P) => { C == null || C(), C = void 0; const O = H(A || m.value), x = H(P || m.value); Mo(O) && (C = Je([y, () => r.ariaLabel, v, () => r.id], (I) => { ["role", "aria-label", "aria-modal", "id"].forEach((N, D) => { on(I[D]) ? O.removeAttribute(N) : O.setAttribute(N, I[D]); }); }, { immediate: !0 })), x !== O && Mo(x) && ["role", "aria-label", "aria-modal", "id"].forEach((I) => { x.removeAttribute(I); }); }, { immediate: !0 }), Je(() => r.visible, L, { immediate: !0 }); }), sr(() => { C == null || C(), C = void 0; }), e({ popperContentRef: m, popperInstanceRef: d, updatePopper: R, contentStyle: w }), (A, P) => (fe(), Ce("div", Pr({ ref_key: "contentRef", ref: m }, H(M), { style: H(w), class: H(T), tabindex: "-1", onMouseenter: (O) => A.$emit("mouseenter", O), onMouseleave: (O) => A.$emit("mouseleave", O) }), [ se(H(iC), { trapped: H(o), "trap-on-focus-in": !0, "focus-trap-el": H(m), "focus-start-el": H(n), onFocusAfterTrapped: H(s), onFocusAfterReleased: H(a), onFocusin: H(c), onFocusoutPrevented: H(l), onReleaseRequested: H(h) }, { default: pe(() => [ qe(A.$slots, "default") ]), _: 3 }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"]) ], 16, ["onMouseenter", "onMouseleave"])); } }); var gC = /* @__PURE__ */ at(mC, [["__file", "content.vue"]]); const vC = fi(B2), Dp = Symbol("elTooltip"), qi = ht({ ...jA, ...dy, appendTo: { type: Xe([String, Object]) }, content: { type: String, default: "" }, rawContent: Boolean, persistent: Boolean, visible: { type: Xe(Boolean), default: null }, transition: String, teleported: { type: Boolean, default: !0 }, disabled: Boolean, ...jo(["ariaLabel"]) }), Js = ht({ ...uy, disabled: Boolean, trigger: { type: Xe([String, Array]), default: "hover" }, triggerKeys: { type: Xe(Array), default: () => [Ir.enter, Ir.space] } }), { useModelToggleProps: yC, useModelToggleEmits: bC, useModelToggle: xC } = DE("visible"), wC = ht({ ...sy, ...yC, ...qi, ...Js, ...ly, showArrow: { type: Boolean, default: !0 } }), _C = [ ...bC, "before-show", "before-hide", "show", "hide", "open", "close" ], MC = (i, e) => zi(i) ? i.includes(e) : i === e, Jo = (i, e, t) => (r) => { MC(H(i), e) && t(r); }, SC = Ie({ name: "ElTooltipTrigger" }), TC = /* @__PURE__ */ Ie({ ...SC, props: Js, setup(i, { expose: e }) { const t = i, r = it("tooltip"), { controlled: n, id: o, open: a, onOpen: s, onClose: c, onToggle: l } = ct(Dp, void 0), h = Ae(null), u = () => { if (H(n) || t.disabled) return !0; }, p = ki(t, "trigger"), m = Kr(u, Jo(p, "hover", s)), g = Kr(u, Jo(p, "hover", c)), d = Kr(u, Jo(p, "click", (M) => { M.button === 0 && l(M); })), y = Kr(u, Jo(p, "focus", s)), f = Kr(u, Jo(p, "focus", c)), v = Kr(u, Jo(p, "contextmenu", (M) => { M.preventDefault(), l(M); })), _ = Kr(u, (M) => { const { code: T } = M; t.triggerKeys.includes(T) && (M.preventDefault(), l(M)); }); return e({ triggerRef: h }), (M, T) => (fe(), He(H(j2), { id: H(o), "virtual-ref": M.virtualRef, open: H(a), "virtual-triggering": M.virtualTriggering, class: Le(H(r).e("trigger")), onBlur: H(f), onClick: H(d), onContextmenu: H(v), onFocus: H(y), onMouseenter: H(m), onMouseleave: H(g), onKeydown: H(_) }, { default: pe(() => [ qe(M.$slots, "default") ]), _: 3 }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"])); } }); var EC = /* @__PURE__ */ at(TC, [["__file", "trigger.vue"]]); const AC = ht({ to: { type: Xe([String, Object]), required: !0 }, disabled: Boolean }), CC = /* @__PURE__ */ Ie({ __name: "teleport", props: AC, setup(i) { return (e, t) => e.disabled ? qe(e.$slots, "default", { key: 0 }) : (fe(), He(gw, { key: 1, to: e.to }, [ qe(e.$slots, "default") ], 8, ["to"])); } }); var LC = /* @__PURE__ */ at(CC, [["__file", "teleport.vue"]]); const RC = fi(LC), OC = Ie({ name: "ElTooltipContent", inheritAttrs: !1 }), PC = /* @__PURE__ */ Ie({ ...OC, props: qi, setup(i, { expose: e }) { const t = i, { selector: r } = Y0(), n = it("tooltip"), o = Ae(null); let a; const { controlled: s, id: c, open: l, trigger: h, onClose: u, onOpen: p, onShow: m, onHide: g, onBeforeShow: d, onBeforeHide: y } = ct(Dp, void 0), f = ce(() => t.transition || `${n.namespace.value}-fade-in-linear`), v = ce(() => process.env.NODE_ENV === "test" ? !0 : t.persistent); sr(() => { a == null || a(); }); const _ = ce(() => H(v) ? !0 : H(l)), M = ce(() => t.disabled ? !1 : H(l)), T = ce(() => t.appendTo || r.value), w = ce(() => { var x; return (x = t.style) != null ? x : {}; }), b = Ae(!0), E = () => { g(), b.value = !0; }, S = () => { if (H(s)) return !0; }, C = Kr(S, () => { t.enterable && H(h) === "hover" && p(); }), R = Kr(S, () => { H(h) === "hover" && u(); }), L = () => { var x, I; (I = (x = o.value) == null ? void 0 : x.updatePopper) == null || I.call(x), d == null || d(); }, A = () => { y == null || y(); }, P = () => { m(), a = Bw(ce(() => { var x; return (x = o.value) == null ? void 0 : x.popperContentRef; }), () => { H(s) || H(h) !== "hover" && u(); }); }, O = () => { t.virtualTriggering || u(); }; return Je(() => H(l), (x) => { x ? b.value = !1 : a == null || a(); }, { flush: "post" }), Je(() => t.content, () => { var x, I; (I = (x = o.value) == null ? void 0 : x.updatePopper) == null || I.call(x); }), e({ contentRef: o }), (x, I) => (fe(), He(H(RC), { disabled: !x.teleported, to: H(T) }, { default: pe(() => [ se(hl, { name: H(f), onAfterLeave: E, onBeforeEnter: L, onAfterEnter: P, onBeforeLeave: A }, { default: pe(() => [ H(_) ? Bt((fe(), He(H(gC), Pr({ key: 0, id: H(c), ref_key: "contentRef", ref: o }, x.$attrs, { "aria-label": x.ariaLabel, "aria-hidden": b.value, "boundaries-padding": x.boundariesPadding, "fallback-placements": x.fallbackPlacements, "gpu-acceleration": x.gpuAcceleration, offset: x.offset, placement: x.placement, "popper-options": x.popperOptions, strategy: x.strategy, effect: x.effect, enterable: x.enterable, pure: x.pure, "popper-class": x.popperClass, "popper-style": [x.popperStyle, H(w)], "reference-el": x.referenceEl, "trigger-target-el": x.triggerTargetEl, visible: H(M), "z-index": x.zIndex, onMouseenter: H(C), onMouseleave: H(R), onBlur: O, onClose: H(u) }), { default: pe(() => [ qe(x.$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"])), [ [yi, H(M)] ]) : Ve("v-if", !0) ]), _: 3 }, 8, ["name"]) ]), _: 3 }, 8, ["disabled", "to"])); } }); var IC = /* @__PURE__ */ at(PC, [["__file", "content.vue"]]); const DC = Ie({ name: "ElTooltip" }), NC = /* @__PURE__ */ Ie({ ...DC, props: wC, emits: _C, setup(i, { expose: e, emit: t }) { const r = i; HA(); const n = vu(), o = Ae(), a = Ae(), s = () => { var f; const v = H(o); v && ((f = v.popperInstanceRef) == null || f.update()); }, c = Ae(!1), l = Ae(), { show: h, hide: u, hasUpdateHandler: p } = xC({ indicator: c, toggleReason: l }), { onOpen: m, onClose: g } = GA({ showAfter: ki(r, "showAfter"), hideAfter: ki(r, "hideAfter"), autoClose: ki(r, "autoClose"), open: h, close: u }), d = ce(() => fp(r.visible) && !p.value); pi(Dp, { controlled: d, id: n, open: a0(c), trigger: ki(r, "trigger"), onOpen: (f) => { m(f); }, onClose: (f) => { g(f); }, onToggle: (f) => { H(c) ? g(f) : m(f); }, onShow: () => { t("show", l.value); }, onHide: () => { t("hide", l.value); }, onBeforeShow: () => { t("before-show", l.value); }, onBeforeHide: () => { t("before-hide", l.value); }, updatePopper: s }), Je(() => r.disabled, (f) => { f && c.value && (c.value = !1); }); const y = (f) => { var v, _; const M = (_ = (v = a.value) == null ? void 0 : v.contentRef) == null ? void 0 : _.popperContentRef, T = (f == null ? void 0 : f.relatedTarget) || document.activeElement; return M && M.contains(T); }; return hw(() => c.value && u()), e({ popperRef: o, contentRef: a, isFocusInsideContent: y, updatePopper: s, onOpen: m, onClose: g, hide: u }), (f, v) => (fe(), He(H(vC), { ref_key: "popperRef", ref: o, role: f.role }, { default: pe(() => [ se(EC, { disabled: f.disabled, trigger: f.trigger, "trigger-keys": f.triggerKeys, "virtual-ref": f.virtualRef, "virtual-triggering": f.virtualTriggering }, { default: pe(() => [ f.$slots.default ? qe(f.$slots, "default", { key: 0 }) : Ve("v-if", !0) ]), _: 3 }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]), se(IC, { ref_key: "contentRef", ref: a, "aria-label": f.ariaLabel, "boundaries-padding": f.boundariesPadding, content: f.content, disabled: f.disabled, effect: f.effect, enterable: f.enterable, "fallback-placements": f.fallbackPlacements, "hide-after": f.hideAfter, "gpu-acceleration": f.gpuAcceleration, offset: f.offset, persistent: f.persistent, "popper-class": f.popperClass, "popper-style": f.popperStyle, placement: f.placement, "popper-options": f.popperOptions, pure: f.pure, "raw-content": f.rawContent, "reference-el": f.referenceEl, "trigger-target-el": f.triggerTargetEl, "show-after": f.showAfter, strategy: f.strategy, teleported: f.teleported, transition: f.transition, "virtual-triggering": f.virtualTriggering, "z-index": f.zIndex, "append-to": f.appendTo }, { default: pe(() => [ qe(f.$slots, "content", {}, () => [ f.rawContent ? (fe(), Ce("span", { key: 0, innerHTML: f.content }, null, 8, ["innerHTML"])) : (fe(), Ce("span", { key: 1 }, wt(f.content), 1)) ]), f.showArrow ? (fe(), He(H(z2), { key: 0, "arrow-offset": f.arrowOffset }, null, 8, ["arrow-offset"])) : Ve("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 BC = /* @__PURE__ */ at(NC, [["__file", "tooltip.vue"]]); const Np = fi(BC), py = Symbol("buttonGroupContextKey"), kC = (i, e) => { EE({ from: "type.text", replacement: "link", version: "3.0.0", scope: "props", ref: "https://element-plus.org/en-US/component/button.html#button-attributes" }, ce(() => i.type === "text")); const t = ct(py, void 0), r = Ap("button"), { form: n } = gl(), o = ns(ce(() => t == null ? void 0 : t.size)), a = yu(), s = Ae(), c = au(), l = ce(() => i.type || (t == null ? void 0 : t.type) || ""), h = ce(() => { var m, g, d; return (d = (g = i.autoInsertSpace) != null ? g : (m = r.value) == null ? void 0 : m.autoInsertSpace) != null ? d : !1; }), u = ce(() => i.tag === "button" ? { ariaDisabled: a.value || i.loading, disabled: a.value || i.loading, autofocus: i.autofocus, type: i.nativeType } : {}), p = ce(() => { var m; const g = (m = c.default) == null ? void 0 : m.call(c); if (h.value && (g == null ? void 0 : g.length) === 1) { const d = g[0]; if ((d == null ? void 0 : d.type) === o0) { const y = d.children; return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(y.trim()); } } return !1; }); return { _disabled: a, _size: o, _type: l, _ref: s, _props: u, shouldAddSpace: p, handleClick: (m) => { if (a.value || i.loading) { m.stopPropagation(); return; } i.nativeType === "reset" && (n == null || n.resetFields()), e("click", m); } }; }, FC = [ "default", "primary", "success", "warning", "info", "danger", "text", "" ], zC = ["button", "submit", "reset"], dd = ht({ size: Da, disabled: Boolean, type: { type: String, values: FC, default: "" }, icon: { type: qn }, nativeType: { type: String, values: zC, default: "button" }, loading: Boolean, loadingIcon: { type: qn, default: () => O0 }, 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: Xe([String, Object]), default: "button" } }), UC = { click: (i) => i instanceof MouseEvent }; function xi(i, e) { VC(i) && (i = "100%"); var t = HC(i); return i = e === 360 ? i : Math.min(e, Math.max(0, parseFloat(i))), t && (i = parseInt(String(i * e), 10) / 100), Math.abs(i - e) < 1e-6 ? 1 : (e === 360 ? i = (i < 0 ? i % e + e : i % e) / parseFloat(String(e)) : i = i % e / parseFloat(String(e)), i); } function Ul(i) { return Math.min(1, Math.max(0, i)); } function VC(i) { return typeof i == "string" && i.indexOf(".") !== -1 && parseFloat(i) === 1; } function HC(i) { return typeof i == "string" && i.indexOf("%") !== -1; } function fy(i) { return i = parseFloat(i), (isNaN(i) || i < 0 || i > 1) && (i = 1), i; } function Vl(i) { return i <= 1 ? "".concat(Number(i) * 100, "%") : i; } function xo(i) { return i.length === 1 ? "0" + i : String(i); } function jC(i, e, t) { return { r: xi(i, 255) * 255, g: xi(e, 255) * 255, b: xi(t, 255) * 255 }; } function Km(i, e, t) { i = xi(i, 255), e = xi(e, 255), t = xi(t, 255); var r = Math.max(i, e, t), n = Math.min(i, e, t), o = 0, a = 0, s = (r + n) / 2; if (r === n) a = 0, o = 0; else { var c = r - n; switch (a = s > 0.5 ? c / (2 - r - n) : c / (r + n), r) { case i: o = (e - t) / c + (e < t ? 6 : 0); break; case e: o = (t - i) / c + 2; break; case t: o = (i - e) / c + 4; break; } o /= 6; } return { h: o, s: a, l: s }; } function eh(i, e, t) { return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? i + (e - i) * (6 * t) : t < 1 / 2 ? e : t < 2 / 3 ? i + (e - i) * (2 / 3 - t) * 6 : i; } function GC(i, e, t) { var r, n, o; if (i = xi(i, 360), e = xi(e, 100), t = xi(t, 100), e === 0) n = t, o = t, r = t; else { var a = t < 0.5 ? t * (1 + e) : t + e - t * e, s = 2 * t - a; r = eh(s, a, i + 1 / 3), n = eh(s, a, i), o = eh(s, a, i - 1 / 3); } return { r: r * 255, g: n * 255, b: o * 255 }; } function Qm(i, e, t) { i = xi(i, 255), e = xi(e, 255), t = xi(t, 255); var r = Math.max(i, e, t), n = Math.min(i, e, t), o = 0, a = r, s = r - n, c = r === 0 ? 0 : s / r; if (r === n) o = 0; else { switch (r) { case i: o = (e - t) / s + (e < t ? 6 : 0); break; case e: o = (t - i) / s + 2; break; case t: o = (i - e) / s + 4; break; } o /= 6; } return { h: o, s: c, v: a }; } function WC(i, e, t) { i = xi(i, 360) * 6, e = xi(e, 100), t = xi(t, 100); var r = Math.floor(i), n = i - r, o = t * (1 - e), a = t * (1 - n * e), s = t * (1 - (1 - n) * e), c = r % 6, l = [t, a, o, o, s, t][c], h = [s, t, t, a, o, o][c], u = [o, o, s, t, t, a][c]; return { r: l * 255, g: h * 255, b: u * 255 }; } function eg(i, e, t, r) { var n = [ xo(Math.round(i).toString(16)), xo(Math.round(e).toString(16)), xo(Math.round(t).toString(16)) ]; return r && n[0].startsWith(n[0].charAt(1)) && n[1].startsWith(n[1].charAt(1)) && n[2].startsWith(n[2].charAt(1)) ? n[0].charAt(0) + n[1].charAt(0) + n[2].charAt(0) : n.join(""); } function $C(i, e, t, r, n) { var o = [ xo(Math.round(i).toString(16)), xo(Math.round(e).toString(16)), xo(Math.round(t).toString(16)), xo(qC(r)) ]; return n && o[0].startsWith(o[0].charAt(1)) && o[1].startsWith(o[1].charAt(1)) && o[2].startsWith(o[2].charAt(1)) && o[3].startsWith(o[3].charAt(1)) ? o[0].charAt(0) + o[1].charAt(0) + o[2].charAt(0) + o[3].charAt(0) : o.join(""); } function qC(i) { return Math.round(parseFloat(i) * 255).toString(16); } function tg(i) { return $i(i) / 255; } function $i(i) { return parseInt(i, 16); } function XC(i) { return { r: i >> 16, g: (i & 65280) >> 8, b: i & 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 ZC(i) { var e = { r: 0, g: 0, b: 0 }, t = 1, r = null, n = null, o = null, a = !1, s = !1; return typeof i == "string" && (i = KC(i)), typeof i == "object" && (Gr(i.r) && Gr(i.g) && Gr(i.b) ? (e = jC(i.r, i.g, i.b), a = !0, s = String(i.r).substr(-1) === "%" ? "prgb" : "rgb") : Gr(i.h) && Gr(i.s) && Gr(i.v) ? (r = Vl(i.s), n = Vl(i.v), e = WC(i.h, r, n), a = !0, s = "hsv") : Gr(i.h) && Gr(i.s) && Gr(i.l) && (r = Vl(i.s), o = Vl(i.l), e = GC(i.h, r, o), a = !0, s = "hsl"), Object.prototype.hasOwnProperty.call(i, "a") && (t = i.a)), t = fy(t), { ok: a, format: i.format || s, 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 YC = "[-\\+]?\\d+%?", JC = "[-\\+]?\\d*\\.\\d+%?", Fn = "(?:".concat(JC, ")|(?:").concat(YC, ")"), th = "[\\s|\\(]+(".concat(Fn, ")[,|\\s]+(").concat(Fn, ")[,|\\s]+(").concat(Fn, ")\\s*\\)?"), ih = "[\\s|\\(]+(".concat(Fn, ")[,|\\s]+(").concat(Fn, ")[,|\\s]+(").concat(Fn, ")[,|\\s]+(").concat(Fn, ")\\s*\\)?"), fr = { CSS_UNIT: new RegExp(Fn), rgb: new RegExp("rgb" + th), rgba: new RegExp("rgba" + ih), hsl: new RegExp("hsl" + th), hsla: new RegExp("hsla" + ih), hsv: new RegExp("hsv" + th), hsva: new RegExp("hsva" + ih), 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 KC(i) { if (i = i.trim().toLowerCase(), i.length === 0) return !1; var e = !1; if (pd[i]) i = pd[i], e = !0; else if (i === "transparent") return { r: 0, g: 0, b: 0, a: 0, format: "name" }; var t = fr.rgb.exec(i); return t ? { r: t[1], g: t[2], b: t[3] } : (t = fr.rgba.exec(i), t ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = fr.hsl.exec(i), t ? { h: t[1], s: t[2], l: t[3] } : (t = fr.hsla.exec(i), t ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = fr.hsv.exec(i), t ? { h: t[1], s: t[2], v: t[3] } : (t = fr.hsva.exec(i), t ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = fr.hex8.exec(i), t ? { r: $i(t[1]), g: $i(t[2]), b: $i(t[3]), a: tg(t[4]), format: e ? "name" : "hex8" } : (t = fr.hex6.exec(i), t ? { r: $i(t[1]), g: $i(t[2]), b: $i(t[3]), format: e ? "name" : "hex" } : (t = fr.hex4.exec(i), t ? { r: $i(t[1] + t[1]), g: $i(t[2] + t[2]), b: $i(t[3] + t[3]), a: tg(t[4] + t[4]), format: e ? "name" : "hex8" } : (t = fr.hex3.exec(i), t ? { r: $i(t[1] + t[1]), g: $i(t[2] + t[2]), b: $i(t[3] + t[3]), format: e ? "name" : "hex" } : !1))))))))); } function Gr(i) { return !!fr.CSS_UNIT.exec(String(i)); } var QC = ( /** @class */ function() { function i(e, t) { e === void 0 && (e = ""), t === void 0 && (t = {}); var r; if (e instanceof i) return e; typeof e == "number" && (e = XC(e)), this.originalInput = e; var n = ZC(e); this.originalInput = e, this.r = n.r, this.g = n.g, this.b = n.b, this.a = n.a, this.roundA = Math.round(100 * this.a) / 100, this.format = (r = t.format) !== null && r !== void 0 ? r : n.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 = n.ok; } return i.prototype.isDark = function() { return this.getBrightness() < 128; }, i.prototype.isLight = function() { return !this.isDark(); }, i.prototype.getBrightness = function() { var e = this.toRgb(); return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3; }, i.prototype.getLuminance = function() { var e = this.toRgb(), t, r, n, o = e.r / 255, a = e.g / 255, s = e.b / 255; return o <= 0.03928 ? t = o / 12.92 : t = 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), s <= 0.03928 ? n = s / 12.92 : n = Math.pow((s + 0.055) / 1.055, 2.4), 0.2126 * t + 0.7152 * r + 0.0722 * n; }, i.prototype.getAlpha = function() { return this.a; }, i.prototype.setAlpha = function(e) { return this.a = fy(e), this.roundA = Math.round(100 * this.a) / 100, this; }, i.prototype.isMonochrome = function() { var e = this.toHsl().s; return e === 0; }, i.prototype.toHsv = function() { var e = Qm(this.r, this.g, this.b); return { h: e.h * 360, s: e.s, v: e.v, a: this.a }; }, i.prototype.toHsvString = function() { var e = Qm(this.r, this.g, this.b), t = Math.round(e.h * 360), r = Math.round(e.s * 100), n = Math.round(e.v * 100); return this.a === 1 ? "hsv(".concat(t, ", ").concat(r, "%, ").concat(n, "%)") : "hsva(".concat(t, ", ").concat(r, "%, ").concat(n, "%, ").concat(this.roundA, ")"); }, i.prototype.toHsl = function() { var e = Km(this.r, this.g, this.b); return { h: e.h * 360, s: e.s, l: e.l, a: this.a }; }, i.prototype.toHslString = function() { var e = Km(this.r, this.g, this.b), t = Math.round(e.h * 360), r = Math.round(e.s * 100), n = Math.round(e.l * 100); return this.a === 1 ? "hsl(".concat(t, ", ").concat(r, "%, ").concat(n, "%)") : "hsla(".concat(t, ", ").concat(r, "%, ").concat(n, "%, ").concat(this.roundA, ")"); }, i.prototype.toHex = function(e) { return e === void 0 && (e = !1), eg(this.r, this.g, this.b, e); }, i.prototype.toHexString = function(e) { return e === void 0 && (e = !1), "#" + this.toHex(e); }, i.prototype.toHex8 = function(e) { return e === void 0 && (e = !1), $C(this.r, this.g, this.b, this.a, e); }, i.prototype.toHex8String = function(e) { return e === void 0 && (e = !1), "#" + this.toHex8(e); }, i.prototype.toHexShortString = function(e) { return e === void 0 && (e = !1), this.a === 1 ? this.toHexString(e) : this.toHex8String(e); }, i.prototype.toRgb = function() { return { r: Math.round(this.r), g: Math.round(this.g), b: Math.round(this.b), a: this.a }; }, i.prototype.toRgbString = function() { var e = Math.round(this.r), t = Math.round(this.g), r = Math.round(this.b); return this.a === 1 ? "rgb(".concat(e, ", ").concat(t, ", ").concat(r, ")") : "rgba(".concat(e, ", ").concat(t, ", ").concat(r, ", ").concat(this.roundA, ")"); }, i.prototype.toPercentageRgb = function() { var e = function(t) { return "".concat(Math.round(xi(t, 255) * 100), "%"); }; return { r: e(this.r), g: e(this.g), b: e(this.b), a: this.a }; }, i.prototype.toPercentageRgbString = function() { var e = function(t) { return Math.round(xi(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, ")"); }, i.prototype.toName = function() { if (this.a === 0) return "transparent"; if (this.a < 1) return !1; for (var e = "#" + eg(this.r, this.g, this.b, !1), t = 0, r = Object.entries(pd); t < r.length; t++) { var n = r[t], o = n[0], a = n[1]; if (e === a) return o; } return !1; }, i.prototype.toString = function(e) { var t = !!e; e = e ?? this.format; var r = !1, n = this.a < 1 && this.a >= 0, o = !t && n && (e.startsWith("hex") || e === "name"); return o ? e === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (r = this.toRgbString()), e === "prgb" && (r = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (r = this.toHexString()), e === "hex3" && (r = this.toHexString(!0)), e === "hex4" && (r = this.toHex8String(!0)), e === "hex8" && (r = this.toHex8String()), e === "name" && (r = this.toName()), e === "hsl" && (r = this.toHslString()), e === "hsv" && (r = this.toHsvString()), r || this.toHexString()); }, i.prototype.toNumber = function() { return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b); }, i.prototype.clone = function() { return new i(this.toString()); }, i.prototype.lighten = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.l += e / 100, t.l = Ul(t.l), new i(t); }, i.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 i(t); }, i.prototype.darken = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.l -= e / 100, t.l = Ul(t.l), new i(t); }, i.prototype.tint = function(e) { return e === void 0 && (e = 10), this.mix("white", e); }, i.prototype.shade = function(e) { return e === void 0 && (e = 10), this.mix("black", e); }, i.prototype.desaturate = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.s -= e / 100, t.s = Ul(t.s), new i(t); }, i.prototype.saturate = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.s += e / 100, t.s = Ul(t.s), new i(t); }, i.prototype.greyscale = function() { return this.desaturate(100); }, i.prototype.spin = function(e) { var t = this.toHsl(), r = (t.h + e) % 360; return t.h = r < 0 ? 360 + r : r, new i(t); }, i.prototype.mix = function(e, t) { t === void 0 && (t = 50); var r = this.toRgb(), n = new i(e).toRgb(), o = t / 100, a = { r: (n.r - r.r) * o + r.r, g: (n.g - r.g) * o + r.g, b: (n.b - r.b) * o + r.b, a: (n.a - r.a) * o + r.a }; return new i(a); }, i.prototype.analogous = function(e, t) { e === void 0 && (e = 6), t === void 0 && (t = 30); var r = this.toHsl(), n = 360 / t, o = [this]; for (r.h = (r.h - (n * e >> 1) + 720) % 360; --e; ) r.h = (r.h + n) % 360, o.push(new i(r)); return o; }, i.prototype.complement = function() { var e = this.toHsl(); return e.h = (e.h + 180) % 360, new i(e); }, i.prototype.monochromatic = function(e) { e === void 0 && (e = 6); for (var t = this.toHsv(), r = t.h, n = t.s, o = t.v, a = [], s = 1 / e; e--; ) a.push(new i({ h: r, s: n, v: o })), o = (o + s) % 1; return a; }, i.prototype.splitcomplement = function() { var e = this.toHsl(), t = e.h; return [ this, new i({ h: (t + 72) % 360, s: e.s, l: e.l }), new i({ h: (t + 216) % 360, s: e.s, l: e.l }) ]; }, i.prototype.onBackground = function(e) { var t = this.toRgb(), r = new i(e).toRgb(), n = t.a + r.a * (1 - t.a); return new i({ r: (t.r * t.a + r.r * r.a * (1 - t.a)) / n, g: (t.g * t.a + r.g * r.a * (1 - t.a)) / n, b: (t.b * t.a + r.b * r.a * (1 - t.a)) / n, a: n }); }, i.prototype.triad = function() { return this.polyad(3); }, i.prototype.tetrad = function() { return this.polyad(4); }, i.prototype.polyad = function(e) { for (var t = this.toHsl(), r = t.h, n = [this], o = 360 / e, a = 1; a < e; a++) n.push(new i({ h: (r + a * o) % 360, s: t.s, l: t.l })); return n; }, i.prototype.equals = function(e) { return this.toRgbString() === new i(e).toRgbString(); }, i; }() ); function _n(i, e = 20) { return i.mix("#141414", e).toString(); } function eL(i) { const e = yu(), t = it("button"); return ce(() => { let r = {}, n = i.color; if (n) { const o = n.match(/var\((.*?)\)/); o && (n = window.getComputedStyle(window.document.documentElement).getPropertyValue(o[1])); const a = new QC(n), s = i.dark ? a.tint(20).toString() : _n(a, 20); if (i.plain) r = t.cssVarBlock({ "bg-color": i.dark ? _n(a, 90) : a.tint(90).toString(), "text-color": n, "border-color": i.dark ? _n(a, 50) : a.tint(50).toString(), "hover-text-color": `var(${t.cssVarName("color-white")})`, "hover-bg-color": n, "hover-border-color": n, "active-bg-color": s, "active-text-color": `var(${t.cssVarName("color-white")})`, "active-border-color": s }), e.value && (r[t.cssVarBlockName("disabled-bg-color")] = i.dark ? _n(a, 90) : a.tint(90).toString(), r[t.cssVarBlockName("disabled-text-color")] = i.dark ? _n(a, 50) : a.tint(50).toString(), r[t.cssVarBlockName("disabled-border-color")] = i.dark ? _n(a, 80) : a.tint(80).toString()); else { const c = i.dark ? _n(a, 30) : a.tint(30).toString(), l = a.isDark() ? `var(${t.cssVarName("color-white")})` : `var(${t.cssVarName("color-black")})`; if (r = t.cssVarBlock({ "bg-color": n, "text-color": l, "border-color": n, "hover-bg-color": c, "hover-text-color": l, "hover-border-color": c, "active-bg-color": s, "active-border-color": s }), e.value) { const h = i.dark ? _n(a, 50) : a.tint(50).toString(); r[t.cssVarBlockName("disabled-bg-color")] = h, r[t.cssVarBlockName("disabled-text-color")] = i.dark ? "rgba(255, 255, 255, 0.5)" : `var(${t.cssVarName("color-white")})`, r[t.cssVarBlockName("disabled-border-color")] = h; } } } return r; }); } const tL = Ie({ name: "ElButton" }), iL = /* @__PURE__ */ Ie({ ...tL, props: dd, emits: UC, setup(i, { expose: e, emit: t }) { const r = i, n = eL(r), o = it("button"), { _ref: a, _size: s, _type: c, _disabled: l, _props: h, shouldAddSpace: u, handleClick: p } = kC(r, t), m = ce(() => [ o.b(), o.m(c.value), o.m(s.value), o.is("disabled", l.value), o.is("loading", r.loading), o.is("plain", r.plain), o.is("round", r.round), o.is("circle", r.circle), o.is("text", r.text), o.is("link", r.link), o.is("has-bg", r.bg) ]); return e({ ref: a, size: s, type: c, disabled: l, shouldAddSpace: u }), (g, d) => (fe(), He(Fi(g.tag), Pr({ ref_key: "_ref", ref: a }, H(h), { class: H(m), style: H(n), onClick: H(p) }), { default: pe(() => [ g.loading ? (fe(), Ce(Gt, { key: 0 }, [ g.$slots.loading ? qe(g.$slots, "loading", { key: 0 }) : (fe(), He(H(kt), { key: 1, class: Le(H(o).is("loading")) }, { default: pe(() => [ (fe(), He(Fi(g.loadingIcon))) ]), _: 1 }, 8, ["class"])) ], 64)) : g.icon || g.$slots.icon ? (fe(), He(H(kt), { key: 1 }, { default: pe(() => [ g.icon ? (fe(), He(Fi(g.icon), { key: 0 })) : qe(g.$slots, "icon", { key: 1 }) ]), _: 3 })) : Ve("v-if", !0), g.$slots.default ? (fe(), Ce("span", { key: 2, class: Le({ [H(o).em("text", "expand")]: H(u) }) }, [ qe(g.$slots, "default") ], 2)) : Ve("v-if", !0) ]), _: 3 }, 16, ["class", "style", "onClick"])); } }); var rL = /* @__PURE__ */ at(iL, [["__file", "button.vue"]]); const nL = { size: dd.size, type: dd.type }, oL = Ie({ name: "ElButtonGroup" }), aL = /* @__PURE__ */ Ie({ ...oL, props: nL, setup(i) { const e = i; pi(py, Yi({ size: ki(e, "size"), type: ki(e, "type") })); const t = it("button"); return (r, n) => (fe(), Ce("div", { class: Le(H(t).b("group")) }, [ qe(r.$slots, "default") ], 2)); } }); var my = /* @__PURE__ */ at(aL, [["__file", "button-group.vue"]]); const os = fi(rL, { ButtonGroup: my }); gn(my); var Bn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function sL(i) { return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i; } function xu(i) { if (i.__esModule) return i; var e = i.default; if (typeof e == "function") { var t = function r() { return this instanceof r ? 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(i).forEach(function(r) { var n = Object.getOwnPropertyDescriptor(i, r); Object.defineProperty(t, r, n.get ? n : { enumerable: !0, get: function() { return i[r]; } }); }), t; } const In = /* @__PURE__ */ new Map(); if (ii) { let i; document.addEventListener("mousedown", (e) => i = e), document.addEventListener("mouseup", (e) => { if (i) { for (const t of In.values()) for (const { documentHandler: r } of t) r(e, i); i = void 0; } }); } function ig(i, e) { let t = []; return Array.isArray(e.arg) ? t = e.arg : Mo(e.arg) && t.push(e.arg), function(r, n) { const o = e.instance.popperRef, a = r.target, s = n == null ? void 0 : n.target, c = !e || !e.instance, l = !a || !s, h = i.contains(a) || i.contains(s), u = i === a, p = t.length && t.some((g) => g == null ? void 0 : g.contains(a)) || t.length && t.includes(s), m = o && (o.contains(a) || o.contains(s)); c || l || h || u || p || m || e.value(r, n); }; } const lL = { beforeMount(i, e) { In.has(i) || In.set(i, []), In.get(i).push({ documentHandler: ig(i, e), bindingFn: e.value }); }, updated(i, e) { In.has(i) || In.set(i, []); const t = In.get(i), r = t.findIndex((o) => o.bindingFn === e.oldValue), n = { documentHandler: ig(i, e), bindingFn: e.value }; r >= 0 ? t.splice(r, 1, n) : t.push(n); }, unmounted(i) { In.delete(i); } }, cL = 100, uL = 600, rg = { beforeMount(i, e) { const t = e.value, { interval: r = cL, delay: n = uL } = Ci(t) ? {} : t; let o, a; const s = () => Ci(t) ? t() : t.handler(), c = () => { a && (clearTimeout(a), a = void 0), o && (clearInterval(o), o = void 0); }; i.addEventListener("mousedown", (l) => { l.button === 0 && (c(), s(), document.addEventListener("mouseup", () => c(), { once: !0 }), a = setTimeout(() => { o = setInterval(() => { s(); }, r); }, n)); }); } }, fd = ht({ 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 }), hL = { close: (i) => i instanceof MouseEvent, click: (i) => i instanceof MouseEvent }, dL = Ie({ name: "ElTag" }), pL = /* @__PURE__ */ Ie({ ...dL, props: fd, emits: hL, setup(i, { emit: e }) { const t = i, r = ns(), n = it("tag"), o = ce(() => { const { type: l, hit: h, effect: u, closable: p, round: m } = t; return [ n.b(), n.is("closable", p), n.m(l || "primary"), n.m(r.value), n.m(u), n.is("hit", h), n.is("round", m) ]; }), a = (l) => { e("close", l); }, s = (l) => { e("click", l); }, c = (l) => { l.component.subTree.component.bum = null; }; return (l, h) => l.disableTransitions ? (fe(), Ce("span", { key: 0, class: Le(H(o)), style: It({ backgroundColor: l.color }), onClick: s }, [ ke("span", { class: Le(H(n).e("content")) }, [ qe(l.$slots, "default") ], 2), l.closable ? (fe(), He(H(kt), { key: 0, class: Le(H(n).e("close")), onClick: ui(a, ["stop"]) }, { default: pe(() => [ se(H(ld)) ]), _: 1 }, 8, ["class", "onClick"])) : Ve("v-if", !0) ], 6)) : (fe(), He(hl, { key: 1, name: `${H(n).namespace.value}-zoom-in-center`, appear: "", onVnodeMounted: c }, { default: pe(() => [ ke("span", { class: Le(H(o)), style: It({ backgroundColor: l.color }), onClick: s }, [ ke("span", { class: Le(H(n).e("content")) }, [ qe(l.$slots, "default") ], 2), l.closable ? (fe(), He(H(kt), { key: 0, class: Le(H(n).e("close")), onClick: ui(a, ["stop"]) }, { default: pe(() => [ se(H(ld)) ]), _: 1 }, 8, ["class", "onClick"])) : Ve("v-if", !0) ], 6) ]), _: 3 }, 8, ["name"])); } }); var fL = /* @__PURE__ */ at(pL, [["__file", "tag.vue"]]); const mL = fi(fL), gy = Symbol("rowContextKey"), gL = [ "start", "center", "end", "space-around", "space-between", "space-evenly" ], vL = ["top", "middle", "bottom"], yL = ht({ tag: { type: String, default: "div" }, gutter: { type: Number, default: 0 }, justify: { type: String, values: gL, default: "start" }, align: { type: String, values: vL } }), bL = Ie({ name: "ElRow" }), xL = /* @__PURE__ */ Ie({ ...bL, props: yL, setup(i) { const e = i, t = it("row"), r = ce(() => e.gutter); pi(gy, { gutter: r }); const n = ce(() => { const a = {}; return e.gutter && (a.marginRight = a.marginLeft = `-${e.gutter / 2}px`), a; }), o = ce(() => [ t.b(), t.is(`justify-${e.justify}`, e.justify !== "start"), t.is(`align-${e.align}`, !!e.align) ]); return (a, s) => (fe(), He(Fi(a.tag), { class: Le(H(o)), style: It(H(n)) }, { default: pe(() => [ qe(a.$slots, "default") ]), _: 3 }, 8, ["class", "style"])); } }); var wL = /* @__PURE__ */ at(xL, [["__file", "row.vue"]]); const Hr = fi(wL), _L = ht({ 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: Xe([Number, Object]), default: () => en({}) }, sm: { type: Xe([Number, Object]), default: () => en({}) }, md: { type: Xe([Number, Object]), default: () => en({}) }, lg: { type: Xe([Number, Object]), default: () => en({}) }, xl: { type: Xe([Number, Object]), default: () => en({}) } }), ML = Ie({ name: "ElCol" }), SL = /* @__PURE__ */ Ie({ ...ML, props: _L, setup(i) { const e = i, { gutter: t } = ct(gy, { gutter: ce(() => 0) }), r = it("col"), n = ce(() => { const a = {}; return t.value && (a.paddingLeft = a.paddingRight = `${t.value / 2}px`), a; }), o = ce(() => { const a = []; return ["span", "offset", "pull", "push"].forEach((s) => { const c = e[s]; Mt(c) && (s === "span" ? a.push(r.b(`${e[s]}`)) : c > 0 && a.push(r.b(`${s}-${e[s]}`))); }), ["xs", "sm", "md", "lg", "xl"].forEach((s) => { Mt(e[s]) ? a.push(r.b(`${s}-${e[s]}`)) : Oi(e[s]) && Object.entries(e[s]).forEach(([c, l]) => { a.push(c !== "span" ? r.b(`${s}-${c}-${l}`) : r.b(`${s}-${l}`)); }); }), t.value && a.push(r.is("guttered")), [r.b(), a]; }); return (a, s) => (fe(), He(Fi(a.tag), { class: Le(H(o)), style: It(H(n)) }, { default: pe(() => [ qe(a.$slots, "default") ]), _: 3 }, 8, ["class", "style"])); } }); var TL = /* @__PURE__ */ at(SL, [["__file", "col.vue"]]); const Mr = fi(TL), ng = (i) => Mt(i) || Ii(i) || zi(i), EL = ht({ accordion: Boolean, modelValue: { type: Xe([Array, String, Number]), default: () => en([]) } }), AL = { [Dt]: ng, [Qn]: ng }, vy = Symbol("collapseContextKey"), CL = (i, e) => { const t = Ae(Lr(i.modelValue)), r = (o) => { t.value = o; const a = i.accordion ? t.value[0] : t.value; e(Dt, a), e(Qn, a); }, n = (o) => { if (i.accordion) r([t.value[0] === o ? "" : o]); else { const a = [...t.value], s = a.indexOf(o); s > -1 ? a.splice(s, 1) : a.push(o), r(a); } }; return Je(() => i.modelValue, () => t.value = Lr(i.modelValue), { deep: !0 }), pi(vy, { activeNames: t, handleItemClick: n }), { activeNames: t, setActiveNames: r }; }, LL = () => { const i = it("collapse"); return { rootKls: ce(() => i.b()) }; }, RL = Ie({ name: "ElCollapse" }), OL = /* @__PURE__ */ Ie({ ...RL, props: EL, emits: AL, setup(i, { expose: e, emit: t }) { const r = i, { activeNames: n, setActiveNames: o } = CL(r, t), { rootKls: a } = LL(); return e({ activeNames: n, setActiveNames: o }), (s, c) => (fe(), Ce("div", { class: Le(H(a)) }, [ qe(s.$slots, "default") ], 2)); } }); var PL = /* @__PURE__ */ at(OL, [["__file", "collapse.vue"]]); const IL = Ie({ name: "ElCollapseTransition" }), DL = /* @__PURE__ */ Ie({ ...IL, setup(i) { const e = it("collapse-transition"), t = (n) => { n.style.maxHeight = "", n.style.overflow = n.dataset.oldOverflow, n.style.paddingTop = n.dataset.oldPaddingTop, n.style.paddingBottom = n.dataset.oldPaddingBottom; }, r = { beforeEnter(n) { n.dataset || (n.dataset = {}), n.dataset.oldPaddingTop = n.style.paddingTop, n.dataset.oldPaddingBottom = n.style.paddingBottom, n.style.height && (n.dataset.elExistsHeight = n.style.height), n.style.maxHeight = 0, n.style.paddingTop = 0, n.style.paddingBottom = 0; }, enter(n) { requestAnimationFrame(() => { n.dataset.oldOverflow = n.style.overflow, n.dataset.elExistsHeight ? n.style.maxHeight = n.dataset.elExistsHeight : n.scrollHeight !== 0 ? n.style.maxHeight = `${n.scrollHeight}px` : n.style.maxHeight = 0, n.style.paddingTop = n.dataset.oldPaddingTop, n.style.paddingBottom = n.dataset.oldPaddingBottom, n.style.overflow = "hidden"; }); }, afterEnter(n) { n.style.maxHeight = "", n.style.overflow = n.dataset.oldOverflow; }, enterCancelled(n) { t(n); }, beforeLeave(n) { n.dataset || (n.dataset = {}), n.dataset.oldPaddingTop = n.style.paddingTop, n.dataset.oldPaddingBottom = n.style.paddingBottom, n.dataset.oldOverflow = n.style.overflow, n.style.maxHeight = `${n.scrollHeight}px`, n.style.overflow = "hidden"; }, leave(n) { n.scrollHeight !== 0 && (n.style.maxHeight = 0, n.style.paddingTop = 0, n.style.paddingBottom = 0); }, afterLeave(n) { t(n); }, leaveCancelled(n) { t(n); } }; return (n, o) => (fe(), He(hl, Pr({ name: H(e).b() }, dw(r)), { default: pe(() => [ qe(n.$slots, "default") ]), _: 3 }, 16, ["name"])); } }); var NL = /* @__PURE__ */ at(DL, [["__file", "collapse-transition.vue"]]); const BL = fi(NL), kL = ht({ title: { type: String, default: "" }, name: { type: Xe([String, Number]), default: void 0 }, icon: { type: qn, default: $n }, disabled: Boolean }), FL = (i) => { const e = ct(vy), { namespace: t } = it("collapse"), r = Ae(!1), n = Ae(!1), o = Ep(), a = ce(() => o.current++), s = ce(() => { var l; return (l = i.name) != null ? l : `${t.value}-id-${o.prefix}-${H(a)}`; }), c = ce(() => e == null ? void 0 : e.activeNames.value.includes(H(s))); return { focusing: r, id: a, isActive: c, handleFocus: () => { setTimeout(() => { n.value ? n.value = !1 : r.value = !0; }, 50); }, handleHeaderClick: () => { i.disabled || (e == null || e.handleItemClick(H(s)), r.value = !1, n.value = !0); }, handleEnterClick: () => { e == null || e.handleItemClick(H(s)); } }; }, zL = (i, { focusing: e, isActive: t, id: r }) => { const n = it("collapse"), o = ce(() => [ n.b("item"), n.is("active", H(t)), n.is("disabled", i.disabled) ]), a = ce(() => [ n.be("item", "header"), n.is("active", H(t)), { focusing: H(e) && !i.disabled } ]), s = ce(() => [ n.be("item", "arrow"), n.is("active", H(t)) ]), c = ce(() => n.be("item", "wrap")), l = ce(() => n.be("item", "content")), h = ce(() => n.b(`content-${H(r)}`)), u = ce(() => n.b(`head-${H(r)}`)); return { arrowKls: s, headKls: a, rootKls: o, itemWrapperKls: c, itemContentKls: l, scopedContentId: h, scopedHeadId: u }; }, UL = Ie({ name: "ElCollapseItem" }), VL = /* @__PURE__ */ Ie({ ...UL, props: kL, setup(i, { expose: e }) { const t = i, { focusing: r, id: n, isActive: o, handleFocus: a, handleHeaderClick: s, handleEnterClick: c } = FL(t), { arrowKls: l, headKls: h, rootKls: u, itemWrapperKls: p, itemContentKls: m, scopedContentId: g, scopedHeadId: d } = zL(t, { focusing: r, isActive: o, id: n }); return e({ isActive: o }), (y, f) => (fe(), Ce("div", { class: Le(H(u)) }, [ ke("button", { id: H(d), class: Le(H(h)), "aria-expanded": H(o), "aria-controls": H(g), "aria-describedby": H(g), tabindex: y.disabled ? -1 : 0, type: "button", onClick: H(s), onKeydown: gr(ui(H(c), ["stop", "prevent"]), ["space", "enter"]), onFocus: H(a), onBlur: (v) => r.value = !1 }, [ qe(y.$slots, "title", {}, () => [ yt(wt(y.title), 1) ]), qe(y.$slots, "icon", { isActive: H(o) }, () => [ se(H(kt), { class: Le(H(l)) }, { default: pe(() => [ (fe(), He(Fi(y.icon))) ]), _: 1 }, 8, ["class"]) ]) ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]), se(H(BL), null, { default: pe(() => [ Bt(ke("div", { id: H(g), role: "region", class: Le(H(p)), "aria-hidden": !H(o), "aria-labelledby": H(d) }, [ ke("div", { class: Le(H(m)) }, [ qe(y.$slots, "default") ], 2) ], 10, ["id", "aria-hidden", "aria-labelledby"]), [ [yi, H(o)] ]) ]), _: 3 }) ], 2)); } }); var yy = /* @__PURE__ */ at(VL, [["__file", "collapse-item.vue"]]); const by = fi(PL, { CollapseItem: yy }), xy = gn(yy), HL = Ie({ name: "ElContainer" }), jL = /* @__PURE__ */ Ie({ ...HL, props: { direction: { type: String } }, setup(i) { const e = i, t = au(), r = it("container"), n = 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 (o, a) => (fe(), Ce("section", { class: Le([H(r).b(), H(r).is("vertical", H(n))]) }, [ qe(o.$slots, "default") ], 2)); } }); var GL = /* @__PURE__ */ at(jL, [["__file", "container.vue"]]); const WL = Ie({ name: "ElAside" }), $L = /* @__PURE__ */ Ie({ ...WL, props: { width: { type: String, default: null } }, setup(i) { const e = i, t = it("aside"), r = ce(() => e.width ? t.cssVarBlock({ width: e.width }) : {}); return (n, o) => (fe(), Ce("aside", { class: Le(H(t).b()), style: It(H(r)) }, [ qe(n.$slots, "default") ], 6)); } }); var wy = /* @__PURE__ */ at($L, [["__file", "aside.vue"]]); const qL = Ie({ name: "ElFooter" }), XL = /* @__PURE__ */ Ie({ ...qL, props: { height: { type: String, default: null } }, setup(i) { const e = i, t = it("footer"), r = ce(() => e.height ? t.cssVarBlock({ height: e.height }) : {}); return (n, o) => (fe(), Ce("footer", { class: Le(H(t).b()), style: It(H(r)) }, [ qe(n.$slots, "default") ], 6)); } }); var _y = /* @__PURE__ */ at(XL, [["__file", "footer.vue"]]); const ZL = Ie({ name: "ElHeader" }), YL = /* @__PURE__ */ Ie({ ...ZL, props: { height: { type: String, default: null } }, setup(i) { const e = i, t = it("header"), r = ce(() => e.height ? t.cssVarBlock({ height: e.height }) : {}); return (n, o) => (fe(), Ce("header", { class: Le(H(t).b()), style: It(H(r)) }, [ qe(n.$slots, "default") ], 6)); } }); var My = /* @__PURE__ */ at(YL, [["__file", "header.vue"]]); const JL = Ie({ name: "ElMain" }), KL = /* @__PURE__ */ Ie({ ...JL, setup(i) { const e = it("main"); return (t, r) => (fe(), Ce("main", { class: Le(H(e).b()) }, [ qe(t.$slots, "default") ], 2)); } }); var Sy = /* @__PURE__ */ at(KL, [["__file", "main.vue"]]); const jr = fi(GL, { Aside: wy, Footer: _y, Header: My, Main: Sy }); gn(wy); const Ty = gn(_y), QL = gn(My), vn = gn(Sy), e3 = /* @__PURE__ */ Ie({ inheritAttrs: !1 }); function t3(i, e, t, r, n, o) { return qe(i.$slots, "default"); } var i3 = /* @__PURE__ */ at(e3, [["render", t3], ["__file", "collection.vue"]]); const r3 = /* @__PURE__ */ Ie({ name: "ElCollectionItem", inheritAttrs: !1 }); function n3(i, e, t, r, n, o) { return qe(i.$slots, "default"); } var o3 = /* @__PURE__ */ at(r3, [["render", n3], ["__file", "collection-item.vue"]]); const a3 = "data-el-collection-item", s3 = (i) => { const e = `El${i}Collection`, t = `${e}Item`, r = Symbol(e), n = Symbol(t), o = { ...i3, name: e, setup() { const s = Ae(null), c = /* @__PURE__ */ new Map(); pi(r, { itemMap: c, getItems: () => { const l = H(s); if (!l) return []; const h = Array.from(l.querySelectorAll(`[${a3}]`)); return [...c.values()].sort((u, p) => h.indexOf(u.ref) - h.indexOf(p.ref)); }, collectionRef: s }); } }, a = { ...o3, name: t, setup(s, { attrs: c }) { const l = Ae(null), h = ct(r, void 0); pi(n, { collectionItemRef: l }), ni(() => { const u = H(l); u && h.itemMap.set(u, { ref: u, ...c }); }), sr(() => { const u = H(l); h.itemMap.delete(u); }); } }; return { COLLECTION_INJECTION_KEY: r, COLLECTION_ITEM_INJECTION_KEY: n, ElCollection: o, ElCollectionItem: a }; }, rh = ht({ trigger: Js.trigger, effect: { ...qi.effect, default: "light" }, type: { type: Xe(String) }, placement: { type: Xe(String), default: "bottom" }, popperOptions: { type: Xe(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: Xe([Number, String]), default: 0 }, maxHeight: { type: Xe([Number, String]), default: "" }, popperClass: { type: String, default: "" }, disabled: Boolean, role: { type: String, default: "menu" }, buttonProps: { type: Xe(Object) }, teleported: qi.teleported }); ht({ command: { type: [Object, String, Number], default: () => ({}) }, disabled: Boolean, divided: Boolean, textValue: String, icon: { type: qn } }); ht({ onKeydown: { type: Xe(Function) } }); s3("Dropdown"); const l3 = ht({ 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: Da, controls: { type: Boolean, default: !0 }, controlsPosition: { type: String, default: "", values: ["", "right"] }, valueOnClear: { type: [String, Number, null], validator: (i) => i === null || Mt(i) || ["min", "max"].includes(i), default: null }, name: String, placeholder: String, precision: { type: Number, validator: (i) => i >= 0 && i === Number.parseInt(`${i}`, 10) }, validateEvent: { type: Boolean, default: !0 }, ...jo(["ariaLabel"]) }), c3 = { [Qn]: (i, e) => e !== i, blur: (i) => i instanceof FocusEvent, focus: (i) => i instanceof FocusEvent, [So]: (i) => Mt(i) || on(i), [Dt]: (i) => Mt(i) || on(i) }, u3 = Ie({ name: "ElInputNumber" }), h3 = /* @__PURE__ */ Ie({ ...u3, props: l3, emits: c3, setup(i, { expose: e, emit: t }) { const r = i, { t: n } = mu(), o = it("input-number"), a = Ae(), s = Yi({ currentValue: r.modelValue, userInput: null }), { formItem: c } = gl(), l = ce(() => Mt(r.modelValue) && r.modelValue <= r.min), h = ce(() => Mt(r.modelValue) && r.modelValue >= r.max), u = ce(() => { const O = f(r.step); return vr(r.precision) ? Math.max(f(r.modelValue), O) : (O > r.precision && Qt("InputNumber", "precision should not be less than the decimal places of step"), r.precision); }), p = ce(() => r.controls && r.controlsPosition === "right"), m = ns(), g = yu(), d = ce(() => { if (s.userInput !== null) return s.userInput; let O = s.currentValue; if (on(O)) return ""; if (Mt(O)) { if (Number.isNaN(O)) return ""; vr(r.precision) || (O = O.toFixed(r.precision)); } return O; }), y = (O, x) => { if (vr(x) && (x = u.value), x === 0) return Math.round(O); let I = String(O); const N = I.indexOf("."); if (N === -1 || !I.replace(".", "").split("")[N + x]) return O; const D = I.length; return I.charAt(D - 1) === "5" && (I = `${I.slice(0, Math.max(0, D - 1))}6`), Number.parseFloat(Number(I).toFixed(x)); }, f = (O) => { if (on(O)) return 0; const x = O.toString(), I = x.indexOf("."); let N = 0; return I !== -1 && (N = x.length - I - 1), N; }, v = (O, x = 1) => Mt(O) ? y(O + r.step * x) : s.currentValue, _ = () => { if (r.readonly || g.value || h.value) return; const O = Number(d.value) || 0, x = v(O); w(x), t(So, s.currentValue), A(); }, M = () => { if (r.readonly || g.value || l.value) return; const O = Number(d.value) || 0, x = v(O, -1); w(x), t(So, s.currentValue), A(); }, T = (O, x) => { const { max: I, min: N, step: D, precision: k, stepStrictly: F, valueOnClear: W } = r; I < N && is("InputNumber", "min should not be greater than max."); let K = Number(O); if (on(O) || Number.isNaN(K)) return null; if (O === "") { if (W === null) return null; K = Ii(W) ? { min: N, max: I }[W] : W; } return F && (K = y(Math.round(K / D) * D, k), K !== O && x && t(Dt, K)), vr(k) || (K = y(K, k)), (K > I || K < N) && (K = K > I ? I : N, x && t(Dt, K)), K; }, w = (O, x = !0) => { var I; const N = s.currentValue, D = T(O); if (!x) { t(Dt, D); return; } N === D && O || (s.userInput = null, t(Dt, D), N !== D && t(Qn, D, N), r.validateEvent && ((I = c == null ? void 0 : c.validate) == null || I.call(c, "change").catch((k) => Qt(k))), s.currentValue = D); }, b = (O) => { s.userInput = O; const x = O === "" ? null : Number(O); t(So, x), w(x, !1); }, E = (O) => { const x = O !== "" ? Number(O) : ""; (Mt(x) && !Number.isNaN(x) || O === "") && w(x), A(), s.userInput = null; }, S = () => { var O, x; (x = (O = a.value) == null ? void 0 : O.focus) == null || x.call(O); }, C = () => { var O, x; (x = (O = a.value) == null ? void 0 : O.blur) == null || x.call(O); }, R = (O) => { t("focus", O); }, L = (O) => { var x; s.userInput = null, t("blur", O), r.validateEvent && ((x = c == null ? void 0 : c.validate) == null || x.call(c, "blur").catch((I) => Qt(I))); }, A = () => { s.currentValue !== r.modelValue && (s.currentValue = r.modelValue); }, P = (O) => { document.activeElement === O.target && O.preventDefault(); }; return Je(() => r.modelValue, (O, x) => { const I = T(O, !0); s.userInput === null && I !== x && (s.currentValue = I); }, { immediate: !0 }), ni(() => { var O; const { min: x, max: I, modelValue: N } = r, D = (O = a.value) == null ? void 0 : O.input; if (D.setAttribute("role", "spinbutton"), Number.isFinite(I) ? D.setAttribute("aria-valuemax", String(I)) : D.removeAttribute("aria-valuemax"), Number.isFinite(x) ? D.setAttribute("aria-valuemin", String(x)) : D.removeAttribute("aria-valuemin"), D.setAttribute("aria-valuenow", s.currentValue || s.currentValue === 0 ? String(s.currentValue) : ""), D.setAttribute("aria-disabled", String(g.value)), !Mt(N) && N != null) { let k = Number(N); Number.isNaN(k) && (k = null), t(Dt, k); } D.addEventListener("wheel", P, { passive: !1 }); }), rp(() => { var O, x; const I = (O = a.value) == null ? void 0 : O.input; I == null || I.setAttribute("aria-valuenow", `${(x = s.currentValue) != null ? x : ""}`); }), e({ focus: S, blur: C }), (O, x) => (fe(), Ce("div", { class: Le([ H(o).b(), H(o).m(H(m)), H(o).is("disabled", H(g)), H(o).is("without-controls", !O.controls), H(o).is("controls-right", H(p)) ]), onDragstart: ui(() => { }, ["prevent"]) }, [ O.controls ? Bt((fe(), Ce("span", { key: 0, role: "button", "aria-label": H(n)("el.inputNumber.decrease"), class: Le([H(o).e("decrease"), H(o).is("disabled", H(l))]), onKeydown: gr(M, ["enter"]) }, [ qe(O.$slots, "decrease-icon", {}, () => [ se(H(kt), null, { default: pe(() => [ H(p) ? (fe(), He(H(mp), { key: 0 })) : (fe(), He(H(mE), { key: 1 })) ]), _: 1 }) ]) ], 42, ["aria-label", "onKeydown"])), [ [H(rg), M] ]) : Ve("v-if", !0), O.controls ? Bt((fe(), Ce("span", { key: 1, role: "button", "aria-label": H(n)("el.inputNumber.increase"), class: Le([H(o).e("increase"), H(o).is("disabled", H(h))]), onKeydown: gr(_, ["enter"]) }, [ qe(O.$slots, "increase-icon", {}, () => [ se(H(kt), null, { default: pe(() => [ H(p) ? (fe(), He(H(oE), { key: 0 })) : (fe(), He(H(pu), { key: 1 })) ]), _: 1 }) ]) ], 42, ["aria-label", "onKeydown"])), [ [H(rg), _] ]) : Ve("v-if", !0), se(H(y2), { id: O.id, ref_key: "input", ref: a, type: "number", step: O.step, "model-value": H(d), placeholder: O.placeholder, readonly: O.readonly, disabled: H(g), size: H(m), max: O.max, min: O.min, name: O.name, "aria-label": O.ariaLabel, "validate-event": !1, onKeydown: [ gr(ui(_, ["prevent"]), ["up"]), gr(ui(M, ["prevent"]), ["down"]) ], onBlur: L, onFocus: R, onInput: b, onChange: E }, pw({ _: 2 }, [ O.$slots.prefix ? { name: "prefix", fn: pe(() => [ qe(O.$slots, "prefix") ]) } : void 0, O.$slots.suffix ? { name: "suffix", fn: pe(() => [ qe(O.$slots, "suffix") ]) } : void 0 ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"]) ], 42, ["onDragstart"])); } }); var d3 = /* @__PURE__ */ at(h3, [["__file", "input-number.vue"]]); const yn = fi(d3), Ey = Symbol("ElSelectGroup"), wu = Symbol("ElSelect"); function p3(i, e) { const t = ct(wu), r = ct(Ey, { disabled: !1 }), n = ce(() => h(Lr(t.props.modelValue), i.value)), o = ce(() => { var m; if (t.props.multiple) { const g = Lr((m = t.props.modelValue) != null ? m : []); return !n.value && g.length >= t.props.multipleLimit && t.props.multipleLimit > 0; } else return !1; }), a = ce(() => i.label || (Oi(i.value) ? "" : i.value)), s = ce(() => i.value || i.label || ""), c = ce(() => i.disabled || e.groupDisabled || o.value), l = si(), h = (m = [], g) => { if (Oi(i.value)) { const d = t.props.valueKey; return m && m.some((y) => np(Qr(y, d)) === Qr(g, d)); } else return m && m.includes(g); }, u = () => { !i.disabled && !r.disabled && (t.states.hoveringIndex = t.optionsArray.indexOf(l.proxy)); }, p = (m) => { const g = new RegExp(KT(m), "i"); e.visible = g.test(a.value) || i.created; }; return Je(() => a.value, () => { !i.created && !t.props.remote && t.setSelected(); }), Je(() => i.value, (m, g) => { const { remote: d, valueKey: y } = t.props; if (m !== g && (t.onOptionDestroy(g, l.proxy), t.onOptionCreate(l.proxy)), !i.created && !d) { if (y && Oi(m) && Oi(g) && m[y] === g[y]) return; t.setSelected(); } }), Je(() => r.disabled, () => { e.groupDisabled = r.disabled; }, { immediate: !0 }), { select: t, currentLabel: a, currentValue: s, itemSelected: n, isDisabled: c, hoverItem: u, updateOption: p }; } const f3 = Ie({ name: "ElOption", componentName: "ElOption", props: { value: { required: !0, type: [String, Number, Boolean, Object] }, label: [String, Number], created: Boolean, disabled: Boolean }, setup(i) { const e = it("select"), t = vu(), r = ce(() => [ e.be("dropdown", "item"), e.is("disabled", H(s)), e.is("selected", H(a)), e.is("hovering", H(p)) ]), n = Yi({ index: -1, groupDisabled: !1, visible: !0, hover: !1 }), { currentLabel: o, itemSelected: a, isDisabled: s, select: c, hoverItem: l, updateOption: h } = p3(i, n), { visible: u, hover: p } = cn(n), m = si().proxy; c.onOptionCreate(m), sr(() => { const d = m.value, { selected: y } = c.states, f = (c.props.multiple ? y : [y]).some((v) => v.value === m.value); _t(() => { c.states.cachedOptions.get(d) === m && !f && c.states.cachedOptions.delete(d); }), c.onOptionDestroy(d, m); }); function g() { s.value || c.handleOptionSelect(m); } return { ns: e, id: t, containerKls: r, currentLabel: o, itemSelected: a, isDisabled: s, select: c, hoverItem: l, updateOption: h, visible: u, hover: p, selectOptionClick: g, states: n }; } }); function m3(i, e, t, r, n, o) { return Bt((fe(), Ce("li", { id: i.id, class: Le(i.containerKls), role: "option", "aria-disabled": i.isDisabled || void 0, "aria-selected": i.itemSelected, onMouseenter: i.hoverItem, onClick: ui(i.selectOptionClick, ["stop"]) }, [ qe(i.$slots, "default", {}, () => [ ke("span", null, wt(i.currentLabel), 1) ]) ], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [ [yi, i.visible] ]); } var Bp = /* @__PURE__ */ at(f3, [["render", m3], ["__file", "option.vue"]]); const g3 = Ie({ name: "ElSelectDropdown", componentName: "ElSelectDropdown", setup() { const i = ct(wu), e = it("select"), t = ce(() => i.props.popperClass), r = ce(() => i.props.multiple), n = ce(() => i.props.fitInputWidth), o = Ae(""); function a() { var s; o.value = `${(s = i.selectRef) == null ? void 0 : s.offsetWidth}px`; } return ni(() => { a(), ir(i.selectRef, a); }), { ns: e, minWidth: o, popperClass: t, isMultiple: r, isFitInputWidth: n }; } }); function v3(i, e, t, r, n, o) { return fe(), Ce("div", { class: Le([i.ns.b("dropdown"), i.ns.is("multiple", i.isMultiple), i.popperClass]), style: It({ [i.isFitInputWidth ? "width" : "minWidth"]: i.minWidth }) }, [ i.$slots.header ? (fe(), Ce("div", { key: 0, class: Le(i.ns.be("dropdown", "header")) }, [ qe(i.$slots, "header") ], 2)) : Ve("v-if", !0), qe(i.$slots, "default"), i.$slots.footer ? (fe(), Ce("div", { key: 1, class: Le(i.ns.be("dropdown", "footer")) }, [ qe(i.$slots, "footer") ], 2)) : Ve("v-if", !0) ], 6); } var y3 = /* @__PURE__ */ at(g3, [["render", v3], ["__file", "select-dropdown.vue"]]); const b3 = 11, x3 = (i, e) => { const { t } = mu(), r = vu(), n = it("select"), o = it("input"), a = Yi({ 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 }), s = Ae(null), c = Ae(null), l = Ae(null), h = Ae(null), u = Ae(null), p = Ae(null), m = Ae(null), g = Ae(null), d = Ae(null), y = Ae(null), f = Ae(null), v = Ae(null), { isComposing: _, handleCompositionStart: M, handleCompositionUpdate: T, handleCompositionEnd: w } = ry({ afterComposition: (he) => oe(he) }), { wrapperRef: b, isFocused: E } = iy(u, { beforeFocus() { return x.value; }, afterFocus() { i.automaticDropdown && !S.value && (S.value = !0, a.menuVisibleOnFocus = !0); }, beforeBlur(he) { var we, De; return ((we = l.value) == null ? void 0 : we.isFocusInsideContent(he)) || ((De = h.value) == null ? void 0 : De.isFocusInsideContent(he)); }, afterBlur() { S.value = !1, a.menuVisibleOnFocus = !1; } }), S = Ae(!1), C = Ae(), { form: R, formItem: L } = gl(), { inputId: A } = Lp(i, { formItemContext: L }), { valueOnClear: P, isEmptyValue: O } = t2(i), x = ce(() => i.disabled || (R == null ? void 0 : R.disabled)), I = ce(() => zi(i.modelValue) ? i.modelValue.length > 0 : !O(i.modelValue)), N = ce(() => i.clearable && !x.value && a.inputHovering && I.value), D = ce(() => i.remote && i.filterable && !i.remoteShowSuffix ? "" : i.suffixIcon), k = ce(() => n.is("reverse", D.value && S.value)), F = ce(() => (L == null ? void 0 : L.validateState) || ""), W = ce(() => D0[F.value]), K = ce(() => i.remote ? 300 : 0), ne = ce(() => i.loading ? i.loadingText || t("el.select.loading") : i.remote && !a.inputValue && a.options.size === 0 ? !1 : i.filterable && a.inputValue && a.options.size > 0 && q.value === 0 ? i.noMatchText || t("el.select.noMatch") : a.options.size === 0 ? i.noDataText || t("el.select.noData") : null), q = ce(() => z.value.filter((he) => he.visible).length), z = ce(() => { const he = Array.from(a.options.values()), we = []; return a.optionValues.forEach((De) => { const We = he.findIndex((Ze) => Ze.value === De); We > -1 && we.push(he[We]); }), we.length >= he.length ? we : he; }), j = ce(() => Array.from(a.cachedOptions.values())), Q = ce(() => { const he = z.value.filter((we) => !we.created).some((we) => we.currentLabel === a.inputValue); return i.filterable && i.allowCreate && a.inputValue !== "" && !he; }), Y = () => { i.filterable && Ci(i.filterMethod) || i.filterable && i.remote && Ci(i.remoteMethod) || z.value.forEach((he) => { var we; (we = he.updateOption) == null || we.call(he, a.inputValue); }); }, ee = ns(), G = ce(() => ["small"].includes(ee.value) ? "small" : "default"), J = ce({ get() { return S.value && ne.value !== !1; }, set(he) { S.value = he; } }), re = ce(() => { if (i.multiple && !vr(i.modelValue)) return Lr(i.modelValue).length === 0 && !a.inputValue; const he = zi(i.modelValue) ? i.modelValue[0] : i.modelValue; return i.filterable || vr(he) ? !a.inputValue : !0; }), B = ce(() => { var he; const we = (he = i.placeholder) != null ? he : t("el.select.placeholder"); return i.multiple || !I.value ? we : a.selectedLabel; }), $ = ce(() => ed ? null : "mouseenter"); Je(() => i.modelValue, (he, we) => { i.multiple && i.filterable && !i.reserveKeyword && (a.inputValue = "", te("")), V(), !sd(he, we) && i.validateEvent && (L == null || L.validate("change").catch((De) => Qt(De))); }, { flush: "post", deep: !0 }), Je(() => S.value, (he) => { he ? te(a.inputValue) : (a.inputValue = "", a.previousQuery = null, a.isBeforeHide = !0), e("visible-change", he); }), Je(() => a.options.entries(), () => { var he; if (!ii) return; const we = ((he = s.value) == null ? void 0 : he.querySelectorAll("input")) || []; (!i.filterable && !i.defaultFirstOption && !vr(i.modelValue) || !Array.from(we).includes(document.activeElement)) && V(), i.defaultFirstOption && (i.filterable || i.remote) && q.value && U(); }, { flush: "post" }), Je(() => a.hoveringIndex, (he) => { Mt(he) && he > -1 ? C.value = z.value[he] || {} : C.value = {}, z.value.forEach((we) => { we.hover = C.value === we; }); }), l0(() => { a.isBeforeHide || Y(); }); const te = (he) => { a.previousQuery === he || _.value || (a.previousQuery = he, i.filterable && Ci(i.filterMethod) ? i.filterMethod(he) : i.filterable && i.remote && Ci(i.remoteMethod) && i.remoteMethod(he), i.defaultFirstOption && (i.filterable || i.remote) && q.value ? _t(U) : _t(ue)); }, U = () => { const he = z.value.filter((We) => We.visible && !We.disabled && !We.states.groupDisabled), we = he.find((We) => We.created), De = he[0]; a.hoveringIndex = bt(z.value, we || De); }, V = () => { if (i.multiple) a.selectedLabel = ""; else { const we = zi(i.modelValue) ? i.modelValue[0] : i.modelValue, De = ae(we); a.selectedLabel = De.currentLabel, a.selected = [De]; return; } const he = []; vr(i.modelValue) || Lr(i.modelValue).forEach((we) => { he.push(ae(we)); }), a.selected = he; }, ae = (he) => { let we; const De = $u(he).toLowerCase() === "object", We = $u(he).toLowerCase() === "null", Ze = $u(he).toLowerCase() === "undefined"; for (let Ke = a.cachedOptions.size - 1; Ke >= 0; Ke--) { const dt = j.value[Ke]; if (De ? Qr(dt.value, i.valueKey) === Qr(he, i.valueKey) : dt.value === he) { we = { value: he, currentLabel: dt.currentLabel, get isDisabled() { return dt.isDisabled; } }; break; } } if (we) return we; const Qe = De ? he.label : !We && !Ze ? he : ""; return { value: he, currentLabel: Qe }; }, ue = () => { a.hoveringIndex = z.value.findIndex((he) => a.selected.some((we) => gt(we) === gt(he))); }, de = () => { a.selectionWidth = c.value.getBoundingClientRect().width; }, ve = () => { a.calculatorWidth = p.value.getBoundingClientRect().width; }, ye = () => { a.collapseItemWidth = f.value.getBoundingClientRect().width; }, le = () => { var he, we; (we = (he = l.value) == null ? void 0 : he.updatePopper) == null || we.call(he); }, Se = () => { var he, we; (we = (he = h.value) == null ? void 0 : he.updatePopper) == null || we.call(he); }, Te = () => { a.inputValue.length > 0 && !S.value && (S.value = !0), te(a.inputValue); }, oe = (he) => { if (a.inputValue = he.target.value, i.remote) Me(); else return Te(); }, Me = ad(() => { Te(); }, K.value), ge = (he) => { sd(i.modelValue, he) || e(Qn, he); }, xe = (he) => WT(he, (we) => !a.disabledOptions.has(we)), Oe = (he) => { if (i.multiple && he.code !== Ir.delete && he.target.value.length <= 0) { const we = Lr(i.modelValue).slice(), De = xe(we); if (De < 0) return; const We = we[De]; we.splice(De, 1), e(Dt, we), ge(we), e("remove-tag", We); } }, ut = (he, we) => { const De = a.selected.indexOf(we); if (De > -1 && !x.value) { const We = Lr(i.modelValue).slice(); We.splice(De, 1), e(Dt, We), ge(We), e("remove-tag", we.value); } he.stopPropagation(), Ut(); }, mt = (he) => { he.stopPropagation(); const we = i.multiple ? [] : P.value; if (i.multiple) for (const De of a.selected) De.isDisabled && we.push(De.value); e(Dt, we), ge(we), a.hoveringIndex = -1, S.value = !1, e("clear"), Ut(); }, ze = (he) => { var we; if (i.multiple) { const De = Lr((we = i.modelValue) != null ? we : []).slice(), We = bt(De, he.value); We > -1 ? De.splice(We, 1) : (i.multipleLimit <= 0 || De.length < i.multipleLimit) && De.push(he.value), e(Dt, De), ge(De), he.created && te(""), i.filterable && !i.reserveKeyword && (a.inputValue = ""); } else e(Dt, he.value), ge(he.value), S.value = !1; Ut(), !S.value && _t(() => { Ue(he); }); }, bt = (he = [], we) => { if (!Oi(we)) return he.indexOf(we); const De = i.valueKey; let We = -1; return he.some((Ze, Qe) => np(Qr(Ze, De)) === Qr(we, De) ? (We = Qe, !0) : !1), We; }, Ue = (he) => { var we, De, We, Ze, Qe; const Ke = zi(he) ? he[0] : he; let dt = null; if (Ke != null && Ke.value) { const Mi = z.value.filter((mi) => mi.value === Ke.value); Mi.length > 0 && (dt = Mi[0].$el); } if (l.value && dt) { const Mi = (Ze = (We = (De = (we = l.value) == null ? void 0 : we.popperRef) == null ? void 0 : De.contentRef) == null ? void 0 : We.querySelector) == null ? void 0 : Ze.call(We, `.${n.be("dropdown", "wrap")}`); Mi && eE(Mi, dt); } (Qe = v.value) == null || Qe.handleScroll(); }, st = (he) => { a.options.set(he.value, he), a.cachedOptions.set(he.value, he), he.disabled && a.disabledOptions.set(he.value, he); }, et = (he, we) => { a.options.get(he) === we && a.options.delete(he); }, xt = ce(() => { var he, we; return (we = (he = l.value) == null ? void 0 : he.popperRef) == null ? void 0 : we.contentRef; }), ft = () => { a.isBeforeHide = !1, _t(() => Ue(a.selected)); }, Ut = () => { var he; (he = u.value) == null || he.focus(); }, Nt = () => { var he; (he = u.value) == null || he.blur(); }, ie = (he) => { mt(he); }, Ee = () => { S.value = !1, E.value && Nt(); }, Ne = () => { a.inputValue.length > 0 ? a.inputValue = "" : S.value = !1; }, Ge = () => { x.value || (ed && (a.inputHovering = !0), a.menuVisibleOnFocus ? a.menuVisibleOnFocus = !1 : S.value = !S.value); }, rt = () => { S.value ? z.value[a.hoveringIndex] && ze(z.value[a.hoveringIndex]) : Ge(); }, gt = (he) => Oi(he.value) ? Qr(he.value, i.valueKey) : he.value, Tt = ce(() => z.value.filter((he) => he.visible).every((he) => he.disabled)), Lt = ce(() => i.multiple ? i.collapseTags ? a.selected.slice(0, i.maxCollapseTags) : a.selected : []), Vt = ce(() => i.multiple ? i.collapseTags ? a.selected.slice(i.maxCollapseTags) : [] : []), X = (he) => { if (!S.value) { S.value = !0; return; } if (!(a.options.size === 0 || a.filteredOptionsCount === 0 || _.value) && !Tt.value) { he === "next" ? (a.hoveringIndex++, a.hoveringIndex === a.options.size && (a.hoveringIndex = 0)) : he === "prev" && (a.hoveringIndex--, a.hoveringIndex < 0 && (a.hoveringIndex = a.options.size - 1)); const we = z.value[a.hoveringIndex]; (we.disabled === !0 || we.states.groupDisabled === !0 || !we.visible) && X(he), _t(() => Ue(C.value)); } }, be = () => { if (!c.value) return 0; const he = window.getComputedStyle(c.value); return Number.parseFloat(he.gap || "6px"); }, me = ce(() => { const he = be(); return { maxWidth: `${f.value && i.maxCollapseTags === 1 ? a.selectionWidth - a.collapseItemWidth - he : a.selectionWidth}px` }; }), _e = ce(() => ({ maxWidth: `${a.selectionWidth}px` })), Pe = ce(() => ({ width: `${Math.max(a.calculatorWidth, b3)}px` })); return ir(c, de), ir(p, ve), ir(d, le), ir(b, le), ir(y, Se), ir(f, ye), ni(() => { V(); }), { inputId: A, contentId: r, nsSelect: n, nsInput: o, states: a, isFocused: E, expanded: S, optionsArray: z, hoverOption: C, selectSize: ee, filteredOptionsCount: q, resetCalculatorWidth: ve, updateTooltip: le, updateTagTooltip: Se, debouncedOnInputChange: Me, onInput: oe, deletePrevTag: Oe, deleteTag: ut, deleteSelected: mt, handleOptionSelect: ze, scrollToOption: Ue, hasModelValue: I, shouldShowPlaceholder: re, currentPlaceholder: B, mouseEnterEventName: $, showClose: N, iconComponent: D, iconReverse: k, validateState: F, validateIcon: W, showNewOption: Q, updateOptions: Y, collapseTagSize: G, setSelected: V, selectDisabled: x, emptyText: ne, handleCompositionStart: M, handleCompositionUpdate: T, handleCompositionEnd: w, onOptionCreate: st, onOptionDestroy: et, handleMenuEnter: ft, focus: Ut, blur: Nt, handleClearClick: ie, handleClickOutside: Ee, handleEsc: Ne, toggleMenu: Ge, selectOption: rt, getValueKey: gt, navigateOptions: X, dropdownMenuVisible: J, showTagList: Lt, collapseTagList: Vt, tagStyle: me, collapseTagStyle: _e, inputStyle: Pe, popperRef: xt, inputRef: u, tooltipRef: l, tagTooltipRef: h, calculatorRef: p, prefixRef: m, suffixRef: g, selectRef: s, wrapperRef: b, selectionRef: c, scrollbarRef: v, menuRef: d, tagMenuRef: y, collapseItemRef: f }; }; var w3 = Ie({ name: "ElOptions", setup(i, { slots: e }) { const t = ct(wu); let r = []; return () => { var n, o; const a = (n = e.default) == null ? void 0 : n.call(e), s = []; function c(l) { zi(l) && l.forEach((h) => { var u, p, m, g; const d = (u = (h == null ? void 0 : h.type) || {}) == null ? void 0 : u.name; d === "ElOptionGroup" ? c(!Ii(h.children) && !zi(h.children) && Ci((p = h.children) == null ? void 0 : p.default) ? (m = h.children) == null ? void 0 : m.default() : h.children) : d === "ElOption" ? s.push((g = h.props) == null ? void 0 : g.value) : zi(h.children) && c(h.children); }); } return a.length && c((o = a[0]) == null ? void 0 : o.children), sd(s, r) || (r = s, t && (t.states.optionValues = s)), a; }; } }); const _3 = ht({ name: String, id: String, modelValue: { type: [Array, String, Number, Boolean, Object], default: void 0 }, autocomplete: { type: String, default: "off" }, automaticDropdown: Boolean, size: Da, effect: { type: Xe(String), default: "light" }, disabled: Boolean, clearable: Boolean, filterable: Boolean, allowCreate: Boolean, loading: Boolean, popperClass: { type: String, default: "" }, popperOptions: { type: Xe(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: qi.teleported, persistent: { type: Boolean, default: !0 }, clearIcon: { type: qn, default: gp }, fitInputWidth: Boolean, suffixIcon: { type: qn, default: mp }, tagType: { ...fd.type, default: "info" }, tagEffect: { ...fd.effect, default: "light" }, validateEvent: { type: Boolean, default: !0 }, remoteShowSuffix: Boolean, placement: { type: Xe(String), values: rs, default: "bottom-start" }, fallbackPlacements: { type: Xe(Array), default: ["bottom-start", "top-start", "right", "left"] }, appendTo: String, ...e2, ...jo(["ariaLabel"]) }), og = "ElSelect", M3 = Ie({ name: og, componentName: og, components: { ElSelectMenu: y3, ElOption: Bp, ElOptions: w3, ElTag: mL, ElScrollbar: P2, ElTooltip: Np, ElIcon: kt }, directives: { ClickOutside: lL }, props: _3, emits: [ Dt, Qn, "remove-tag", "clear", "visible-change", "focus", "blur" ], setup(i, { emit: e }) { const t = ce(() => { const { modelValue: o, multiple: a } = i, s = a ? [] : void 0; return zi(o) ? a ? o : s : a ? s : o; }), r = Yi({ ...cn(i), modelValue: t }), n = x3(r, e); return pi(wu, Yi({ props: r, states: n.states, optionsArray: n.optionsArray, handleOptionSelect: n.handleOptionSelect, onOptionCreate: n.onOptionCreate, onOptionDestroy: n.onOptionDestroy, selectRef: n.selectRef, setSelected: n.setSelected })), { ...n, modelValue: t }; } }); function S3(i, e, t, r, n, o) { const a = Ri("el-tag"), s = Ri("el-tooltip"), c = Ri("el-icon"), l = Ri("el-option"), h = Ri("el-options"), u = Ri("el-scrollbar"), p = Ri("el-select-menu"), m = vw("click-outside"); return Bt((fe(), Ce("div", { ref: "selectRef", class: Le([i.nsSelect.b(), i.nsSelect.m(i.selectSize)]), [yw(i.mouseEnterEventName)]: (g) => i.states.inputHovering = !0, onMouseleave: (g) => i.states.inputHovering = !1 }, [ se(s, { ref: "tooltipRef", visible: i.dropdownMenuVisible, placement: i.placement, teleported: i.teleported, "popper-class": [i.nsSelect.e("popper"), i.popperClass], "popper-options": i.popperOptions, "fallback-placements": i.fallbackPlacements, effect: i.effect, pure: "", trigger: "click", transition: `${i.nsSelect.namespace.value}-zoom-in-top`, "stop-popper-mouse-event": !1, "gpu-acceleration": !1, persistent: i.persistent, "append-to": i.appendTo, onBeforeShow: i.handleMenuEnter, onHide: (g) => i.states.isBeforeHide = !1 }, { default: pe(() => { var g; return [ ke("div", { ref: "wrapperRef", class: Le([ i.nsSelect.e("wrapper"), i.nsSelect.is("focused", i.isFocused), i.nsSelect.is("hovering", i.states.inputHovering), i.nsSelect.is("filterable", i.filterable), i.nsSelect.is("disabled", i.selectDisabled) ]), onClick: ui(i.toggleMenu, ["prevent"]) }, [ i.$slots.prefix ? (fe(), Ce("div", { key: 0, ref: "prefixRef", class: Le(i.nsSelect.e("prefix")) }, [ qe(i.$slots, "prefix") ], 2)) : Ve("v-if", !0), ke("div", { ref: "selectionRef", class: Le([ i.nsSelect.e("selection"), i.nsSelect.is("near", i.multiple && !i.$slots.prefix && !!i.states.selected.length) ]) }, [ i.multiple ? qe(i.$slots, "tag", { key: 0 }, () => [ (fe(!0), Ce(Gt, null, rr(i.showTagList, (d) => (fe(), Ce("div", { key: i.getValueKey(d), class: Le(i.nsSelect.e("selected-item")) }, [ se(a, { closable: !i.selectDisabled && !d.isDisabled, size: i.collapseTagSize, type: i.tagType, effect: i.tagEffect, "disable-transitions": "", style: It(i.tagStyle), onClose: (y) => i.deleteTag(y, d) }, { default: pe(() => [ ke("span", { class: Le(i.nsSelect.e("tags-text")) }, [ qe(i.$slots, "label", { label: d.currentLabel, value: d.value }, () => [ yt(wt(d.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "style", "onClose"]) ], 2))), 128)), i.collapseTags && i.states.selected.length > i.maxCollapseTags ? (fe(), He(s, { key: 0, ref: "tagTooltipRef", disabled: i.dropdownMenuVisible || !i.collapseTagsTooltip, "fallback-placements": ["bottom", "top", "right", "left"], effect: i.effect, placement: "bottom", teleported: i.teleported }, { default: pe(() => [ ke("div", { ref: "collapseItemRef", class: Le(i.nsSelect.e("selected-item")) }, [ se(a, { closable: !1, size: i.collapseTagSize, type: i.tagType, effect: i.tagEffect, "disable-transitions": "", style: It(i.collapseTagStyle) }, { default: pe(() => [ ke("span", { class: Le(i.nsSelect.e("tags-text")) }, " + " + wt(i.states.selected.length - i.maxCollapseTags), 3) ]), _: 1 }, 8, ["size", "type", "effect", "style"]) ], 2) ]), content: pe(() => [ ke("div", { ref: "tagMenuRef", class: Le(i.nsSelect.e("selection")) }, [ (fe(!0), Ce(Gt, null, rr(i.collapseTagList, (d) => (fe(), Ce("div", { key: i.getValueKey(d), class: Le(i.nsSelect.e("selected-item")) }, [ se(a, { class: "in-tooltip", closable: !i.selectDisabled && !d.isDisabled, size: i.collapseTagSize, type: i.tagType, effect: i.tagEffect, "disable-transitions": "", onClose: (y) => i.deleteTag(y, d) }, { default: pe(() => [ ke("span", { class: Le(i.nsSelect.e("tags-text")) }, [ qe(i.$slots, "label", { label: d.currentLabel, value: d.value }, () => [ yt(wt(d.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "onClose"]) ], 2))), 128)) ], 2) ]), _: 3 }, 8, ["disabled", "effect", "teleported"])) : Ve("v-if", !0) ]) : Ve("v-if", !0), i.selectDisabled ? Ve("v-if", !0) : (fe(), Ce("div", { key: 1, class: Le([ i.nsSelect.e("selected-item"), i.nsSelect.e("input-wrapper"), i.nsSelect.is("hidden", !i.filterable) ]) }, [ Bt(ke("input", { id: i.inputId, ref: "inputRef", "onUpdate:modelValue": (d) => i.states.inputValue = d, type: "text", name: i.name, class: Le([i.nsSelect.e("input"), i.nsSelect.is(i.selectSize)]), disabled: i.selectDisabled, autocomplete: i.autocomplete, style: It(i.inputStyle), role: "combobox", readonly: !i.filterable, spellcheck: "false", "aria-activedescendant": ((g = i.hoverOption) == null ? void 0 : g.id) || "", "aria-controls": i.contentId, "aria-expanded": i.dropdownMenuVisible, "aria-label": i.ariaLabel, "aria-autocomplete": "none", "aria-haspopup": "listbox", onKeydown: [ gr(ui((d) => i.navigateOptions("next"), ["stop", "prevent"]), ["down"]), gr(ui((d) => i.navigateOptions("prev"), ["stop", "prevent"]), ["up"]), gr(ui(i.handleEsc, ["stop", "prevent"]), ["esc"]), gr(ui(i.selectOption, ["stop", "prevent"]), ["enter"]), gr(ui(i.deletePrevTag, ["stop"]), ["delete"]) ], onCompositionstart: i.handleCompositionStart, onCompositionupdate: i.handleCompositionUpdate, onCompositionend: i.handleCompositionEnd, onInput: i.onInput, onClick: ui(i.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"]), [ [bw, i.states.inputValue] ]), i.filterable ? (fe(), Ce("span", { key: 0, ref: "calculatorRef", "aria-hidden": "true", class: Le(i.nsSelect.e("input-calculator")), textContent: wt(i.states.inputValue) }, null, 10, ["textContent"])) : Ve("v-if", !0) ], 2)), i.shouldShowPlaceholder ? (fe(), Ce("div", { key: 2, class: Le([ i.nsSelect.e("selected-item"), i.nsSelect.e("placeholder"), i.nsSelect.is("transparent", !i.hasModelValue || i.expanded && !i.states.inputValue) ]) }, [ i.hasModelValue ? qe(i.$slots, "label", { key: 0, label: i.currentPlaceholder, value: i.modelValue }, () => [ ke("span", null, wt(i.currentPlaceholder), 1) ]) : (fe(), Ce("span", { key: 1 }, wt(i.currentPlaceholder), 1)) ], 2)) : Ve("v-if", !0) ], 2), ke("div", { ref: "suffixRef", class: Le(i.nsSelect.e("suffix")) }, [ i.iconComponent && !i.showClose ? (fe(), He(c, { key: 0, class: Le([i.nsSelect.e("caret"), i.nsSelect.e("icon"), i.iconReverse]) }, { default: pe(() => [ (fe(), He(Fi(i.iconComponent))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0), i.showClose && i.clearIcon ? (fe(), He(c, { key: 1, class: Le([ i.nsSelect.e("caret"), i.nsSelect.e("icon"), i.nsSelect.e("clear") ]), onClick: i.handleClearClick }, { default: pe(() => [ (fe(), He(Fi(i.clearIcon))) ]), _: 1 }, 8, ["class", "onClick"])) : Ve("v-if", !0), i.validateState && i.validateIcon ? (fe(), He(c, { key: 2, class: Le([i.nsInput.e("icon"), i.nsInput.e("validateIcon")]) }, { default: pe(() => [ (fe(), He(Fi(i.validateIcon))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0) ], 2) ], 10, ["onClick"]) ]; }), content: pe(() => [ se(p, { ref: "menuRef" }, { default: pe(() => [ i.$slots.header ? (fe(), Ce("div", { key: 0, class: Le(i.nsSelect.be("dropdown", "header")), onClick: ui(() => { }, ["stop"]) }, [ qe(i.$slots, "header") ], 10, ["onClick"])) : Ve("v-if", !0), Bt(se(u, { id: i.contentId, ref: "scrollbarRef", tag: "ul", "wrap-class": i.nsSelect.be("dropdown", "wrap"), "view-class": i.nsSelect.be("dropdown", "list"), class: Le([i.nsSelect.is("empty", i.filteredOptionsCount === 0)]), role: "listbox", "aria-label": i.ariaLabel, "aria-orientation": "vertical" }, { default: pe(() => [ i.showNewOption ? (fe(), He(l, { key: 0, value: i.states.inputValue, created: !0 }, null, 8, ["value"])) : Ve("v-if", !0), se(h, null, { default: pe(() => [ qe(i.$slots, "default") ]), _: 3 }) ]), _: 3 }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [ [yi, i.states.options.size > 0 && !i.loading] ]), i.$slots.loading && i.loading ? (fe(), Ce("div", { key: 1, class: Le(i.nsSelect.be("dropdown", "loading")) }, [ qe(i.$slots, "loading") ], 2)) : i.loading || i.filteredOptionsCount === 0 ? (fe(), Ce("div", { key: 2, class: Le(i.nsSelect.be("dropdown", "empty")) }, [ qe(i.$slots, "empty", {}, () => [ ke("span", null, wt(i.emptyText), 1) ]) ], 2)) : Ve("v-if", !0), i.$slots.footer ? (fe(), Ce("div", { key: 3, class: Le(i.nsSelect.be("dropdown", "footer")), onClick: ui(() => { }, ["stop"]) }, [ qe(i.$slots, "footer") ], 10, ["onClick"])) : Ve("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"])), [ [m, i.handleClickOutside, i.popperRef] ]); } var T3 = /* @__PURE__ */ at(M3, [["render", S3], ["__file", "select.vue"]]); const E3 = Ie({ name: "ElOptionGroup", componentName: "ElOptionGroup", props: { label: String, disabled: Boolean }, setup(i) { const e = it("select"), t = Ae(null), r = si(), n = Ae([]); pi(Ey, Yi({ ...cn(i) })); const o = ce(() => n.value.some((l) => l.visible === !0)), a = (l) => { var h, u; return ((h = l.type) == null ? void 0 : h.name) === "ElOption" && !!((u = l.component) != null && u.proxy); }, s = (l) => { const h = Lr(l), u = []; return h.forEach((p) => { var m, g; a(p) ? u.push(p.component.proxy) : (m = p.children) != null && m.length ? u.push(...s(p.children)) : (g = p.component) != null && g.subTree && u.push(...s(p.component.subTree)); }), u; }, c = () => { n.value = s(r.subTree); }; return ni(() => { c(); }), Gw(t, c, { attributes: !0, subtree: !0, childList: !0 }), { groupRef: t, visible: o, ns: e }; } }); function A3(i, e, t, r, n, o) { return Bt((fe(), Ce("ul", { ref: "groupRef", class: Le(i.ns.be("group", "wrap")) }, [ ke("li", { class: Le(i.ns.be("group", "title")) }, wt(i.label), 3), ke("li", null, [ ke("ul", { class: Le(i.ns.b("group")) }, [ qe(i.$slots, "default") ], 2) ]) ], 2)), [ [yi, i.visible] ]); } var Ay = /* @__PURE__ */ at(E3, [["render", A3], ["__file", "option-group.vue"]]); const as = fi(T3, { Option: Bp, OptionGroup: Ay }), ss = gn(Bp); gn(Ay); const C3 = ht({ trigger: Js.trigger, placement: rh.placement, disabled: Js.disabled, visible: qi.visible, transition: qi.transition, popperOptions: rh.popperOptions, tabindex: rh.tabindex, content: qi.content, popperStyle: qi.popperStyle, popperClass: qi.popperClass, enterable: { ...qi.enterable, default: !0 }, effect: { ...qi.effect, default: "light" }, teleported: qi.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 } }), L3 = { "update:visible": (i) => fp(i), "before-enter": () => !0, "before-leave": () => !0, "after-enter": () => !0, "after-leave": () => !0 }, R3 = "onUpdate:visible", O3 = Ie({ name: "ElPopover" }), P3 = /* @__PURE__ */ Ie({ ...O3, props: C3, emits: L3, setup(i, { expose: e, emit: t }) { const r = i, n = ce(() => r[R3]), o = it("popover"), a = Ae(), s = ce(() => { var y; return (y = H(a)) == null ? void 0 : y.popperRef; }), c = ce(() => [ { width: qc(r.width) }, r.popperStyle ]), l = ce(() => [o.b(), r.popperClass, { [o.m("plain")]: !!r.content }]), h = ce(() => r.transition === `${o.namespace.value}-fade-in-linear`), u = () => { var y; (y = a.value) == null || y.hide(); }, p = () => { t("before-enter"); }, m = () => { t("before-leave"); }, g = () => { t("after-enter"); }, d = () => { t("update:visible", !1), t("after-leave"); }; return e({ popperRef: s, hide: u }), (y, f) => (fe(), He(H(Np), Pr({ ref_key: "tooltipRef", ref: a }, 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(h), "onUpdate:visible": H(n), onBeforeShow: p, onBeforeHide: m, onShow: g, onHide: d }), { content: pe(() => [ y.title ? (fe(), Ce("div", { key: 0, class: Le(H(o).e("title")), role: "title" }, wt(y.title), 3)) : Ve("v-if", !0), qe(y.$slots, "default", {}, () => [ yt(wt(y.content), 1) ]) ]), default: pe(() => [ y.$slots.reference ? qe(y.$slots, "reference", { key: 0 }) : Ve("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 I3 = /* @__PURE__ */ at(P3, [["__file", "popover.vue"]]); const ag = (i, e) => { const t = e.arg || e.value, r = t == null ? void 0 : t.popperRef; r && (r.triggerRef = i); }; var D3 = { mounted(i, e) { ag(i, e); }, updated(i, e) { ag(i, e); } }; const N3 = "popover", B3 = wE(D3, N3), _u = fi(I3, { directive: B3 }), Cy = Symbol("sliderContextKey"), k3 = ht({ modelValue: { type: Xe([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: Da, inputSize: Da, showStops: Boolean, showTooltip: { type: Boolean, default: !0 }, formatTooltip: { type: Xe(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: Xe(Function), default: void 0 }, tooltipClass: { type: String, default: void 0 }, placement: { type: String, values: rs, default: "top" }, marks: { type: Xe(Object) }, validateEvent: { type: Boolean, default: !0 }, ...jo(["ariaLabel"]) }), nh = (i) => Mt(i) || zi(i) && i.every(Mt), F3 = { [Dt]: nh, [So]: nh, [Qn]: nh }, z3 = (i, e, t) => { const r = Ae(); return ni(async () => { i.range ? (Array.isArray(i.modelValue) ? (e.firstValue = Math.max(i.min, i.modelValue[0]), e.secondValue = Math.min(i.max, i.modelValue[1])) : (e.firstValue = i.min, e.secondValue = i.max), e.oldValue = [e.firstValue, e.secondValue]) : (typeof i.modelValue != "number" || Number.isNaN(i.modelValue) ? e.firstValue = i.min : e.firstValue = Math.min(i.max, Math.max(i.min, i.modelValue)), e.oldValue = e.firstValue), hi(window, "resize", t), await _t(), t(); }), { sliderWrapper: r }; }, U3 = (i) => ce(() => i.marks ? Object.keys(i.marks).map(Number.parseFloat).sort((e, t) => e - t).filter((e) => e <= i.max && e >= i.min).map((e) => ({ point: e, position: (e - i.min) * 100 / (i.max - i.min), mark: i.marks[e] })) : []), V3 = (i, e, t) => { const { form: r, formItem: n } = gl(), o = Pi(), a = Ae(), s = Ae(), c = { firstButton: a, secondButton: s }, l = ce(() => i.disabled || (r == null ? void 0 : r.disabled) || !1), h = ce(() => Math.min(e.firstValue, e.secondValue)), u = ce(() => Math.max(e.firstValue, e.secondValue)), p = ce(() => i.range ? `${100 * (u.value - h.value) / (i.max - i.min)}%` : `${100 * (e.firstValue - i.min) / (i.max - i.min)}%`), m = ce(() => i.range ? `${100 * (h.value - i.min) / (i.max - i.min)}%` : "0%"), g = ce(() => i.vertical ? { height: i.height } : {}), d = ce(() => i.vertical ? { height: p.value, bottom: m.value } : { width: p.value, left: m.value }), y = () => { o.value && (e.sliderSize = o.value[`client${i.vertical ? "Height" : "Width"}`]); }, f = (E) => { const S = i.min + E * (i.max - i.min) / 100; if (!i.range) return a; let C; return Math.abs(h.value - S) < Math.abs(u.value - S) ? C = e.firstValue < e.secondValue ? "firstButton" : "secondButton" : C = e.firstValue > e.secondValue ? "firstButton" : "secondButton", c[C]; }, v = (E) => { const S = f(E); return S.value.setPosition(E), S; }, _ = (E) => { e.firstValue = E ?? i.min, T(i.range ? [h.value, u.value] : E ?? i.min); }, M = (E) => { e.secondValue = E, i.range && T([h.value, u.value]); }, T = (E) => { t(Dt, E), t(So, E); }, w = async () => { await _t(), t(Qn, i.range ? [h.value, u.value] : i.modelValue); }, b = (E) => { var S, C, R, L, A, P; if (l.value || e.dragging) return; y(); let O = 0; if (i.vertical) { const x = (R = (C = (S = E.touches) == null ? void 0 : S.item(0)) == null ? void 0 : C.clientY) != null ? R : E.clientY; O = (o.value.getBoundingClientRect().bottom - x) / e.sliderSize * 100; } else { const x = (P = (A = (L = E.touches) == null ? void 0 : L.item(0)) == null ? void 0 : A.clientX) != null ? P : E.clientX, I = o.value.getBoundingClientRect().left; O = (x - I) / e.sliderSize * 100; } if (!(O < 0 || O > 100)) return v(O); }; return { elFormItem: n, slider: o, firstButton: a, secondButton: s, sliderDisabled: l, minValue: h, maxValue: u, runwayStyle: g, barStyle: d, resetSize: y, setPosition: v, emitChange: w, onSliderWrapperPrevent: (E) => { var S, C; ((S = c.firstButton.value) != null && S.dragging || (C = c.secondButton.value) != null && C.dragging) && E.preventDefault(); }, onSliderClick: (E) => { b(E) && w(); }, onSliderDown: async (E) => { const S = b(E); S && (await _t(), S.value.onButtonDown(E)); }, onSliderMarkerDown: (E) => { l.value || e.dragging || v(E); }, setFirstValue: _, setSecondValue: M }; }, { left: H3, down: j3, right: G3, up: W3, home: $3, end: q3, pageUp: X3, pageDown: Z3 } = Ir, Y3 = (i, e, t) => { const r = Ae(), n = Ae(!1), o = ce(() => e.value instanceof Function), a = ce(() => o.value && e.value(i.modelValue) || i.modelValue), s = ad(() => { t.value && (n.value = !0); }, 50), c = ad(() => { t.value && (n.value = !1); }, 50); return { tooltip: r, tooltipVisible: n, formatValue: a, displayTooltip: s, hideTooltip: c }; }, J3 = (i, e, t) => { const { disabled: r, min: n, max: o, step: a, showTooltip: s, precision: c, sliderSize: l, formatTooltip: h, emitChange: u, resetSize: p, updateDragging: m } = ct(Cy), { tooltip: g, tooltipVisible: d, formatValue: y, displayTooltip: f, hideTooltip: v } = Y3(i, h, s), _ = Ae(), M = ce(() => `${(i.modelValue - n.value) / (o.value - n.value) * 100}%`), T = ce(() => i.vertical ? { bottom: M.value } : { left: M.value }), w = () => { e.hovering = !0, f(); }, b = () => { e.hovering = !1, e.dragging || v(); }, E = (W) => { r.value || (W.preventDefault(), N(W), window.addEventListener("mousemove", D), window.addEventListener("touchmove", D), window.addEventListener("mouseup", k), window.addEventListener("touchend", k), window.addEventListener("contextmenu", k), _.value.focus()); }, S = (W) => { r.value || (e.newPosition = Number.parseFloat(M.value) + W / (o.value - n.value) * 100, F(e.newPosition), u()); }, C = () => { S(-a.value); }, R = () => { S(a.value); }, L = () => { S(-a.value * 4); }, A = () => { S(a.value * 4); }, P = () => { r.value || (F(0), u()); }, O = () => { r.value || (F(100), u()); }, x = (W) => { let K = !0; [H3, j3].includes(W.key) ? C() : [G3, W3].includes(W.key) ? R() : W.key === $3 ? P() : W.key === q3 ? O() : W.key === Z3 ? L() : W.key === X3 ? A() : K = !1, K && W.preventDefault(); }, I = (W) => { let K, ne; return W.type.startsWith("touch") ? (ne = W.touches[0].clientY, K = W.touches[0].clientX) : (ne = W.clientY, K = W.clientX), { clientX: K, clientY: ne }; }, N = (W) => { e.dragging = !0, e.isClick = !0; const { clientX: K, clientY: ne } = I(W); i.vertical ? e.startY = ne : e.startX = K, e.startPosition = Number.parseFloat(M.value), e.newPosition = e.startPosition; }, D = (W) => { if (e.dragging) { e.isClick = !1, f(), p(); let K; const { clientX: ne, clientY: q } = I(W); i.vertical ? (e.currentY = q, K = (e.startY - e.currentY) / l.value * 100) : (e.currentX = ne, K = (e.currentX - e.startX) / l.value * 100), e.newPosition = e.startPosition + K, F(e.newPosition); } }, k = () => { e.dragging && (setTimeout(() => { e.dragging = !1, e.hovering || v(), e.isClick || F(e.newPosition), u(); }, 0), window.removeEventListener("mousemove", D), window.removeEventListener("touchmove", D), window.removeEventListener("mouseup", k), window.removeEventListener("touchend", k), window.removeEventListener("contextmenu", k)); }, F = async (W) => { if (W === null || Number.isNaN(+W)) return; W < 0 ? W = 0 : W > 100 && (W = 100); const K = 100 / ((o.value - n.value) / a.value); let ne = Math.round(W / K) * K * (o.value - n.value) * 0.01 + n.value; ne = Number.parseFloat(ne.toFixed(c.value)), ne !== i.modelValue && t(Dt, ne), !e.dragging && i.modelValue !== e.oldValue && (e.oldValue = i.modelValue), await _t(), e.dragging && f(), g.value.updatePopper(); }; return Je(() => e.dragging, (W) => { m(W); }), hi(_, "touchstart", E, { passive: !1 }), { disabled: r, button: _, tooltip: g, tooltipVisible: d, showTooltip: s, wrapperStyle: T, formatValue: y, handleMouseEnter: w, handleMouseLeave: b, onButtonDown: E, onKeyDown: x, setPosition: F }; }, K3 = (i, e, t, r) => ({ stops: ce(() => { if (!i.showStops || i.min > i.max) return []; if (i.step === 0) return Qt("ElSlider", "step should not be 0."), []; const n = (i.max - i.min) / i.step, o = 100 * i.step / (i.max - i.min), a = Array.from({ length: n - 1 }).map((s, c) => (c + 1) * o); return i.range ? a.filter((s) => s < 100 * (t.value - i.min) / (i.max - i.min) || s > 100 * (r.value - i.min) / (i.max - i.min)) : a.filter((s) => s > 100 * (e.firstValue - i.min) / (i.max - i.min)); }), getStopStyle: (n) => i.vertical ? { bottom: `${n}%` } : { left: `${n}%` } }), Q3 = (i, e, t, r, n, o) => { const a = (l) => { n(Dt, l), n(So, l); }, s = () => i.range ? ![t.value, r.value].every((l, h) => l === e.oldValue[h]) : i.modelValue !== e.oldValue, c = () => { var l, h; i.min > i.max && is("Slider", "min should not be greater than max."); const u = i.modelValue; i.range && Array.isArray(u) ? u[1] < i.min ? a([i.min, i.min]) : u[0] > i.max ? a([i.max, i.max]) : u[0] < i.min ? a([i.min, u[1]]) : u[1] > i.max ? a([u[0], i.max]) : (e.firstValue = u[0], e.secondValue = u[1], s() && (i.validateEvent && ((l = o == null ? void 0 : o.validate) == null || l.call(o, "change").catch((p) => Qt(p))), e.oldValue = u.slice())) : !i.range && typeof u == "number" && !Number.isNaN(u) && (u < i.min ? a(i.min) : u > i.max ? a(i.max) : (e.firstValue = u, s() && (i.validateEvent && ((h = o == null ? void 0 : o.validate) == null || h.call(o, "change").catch((p) => Qt(p))), e.oldValue = u))); }; c(), Je(() => e.dragging, (l) => { l || c(); }), Je(() => i.modelValue, (l, h) => { e.dragging || Array.isArray(l) && Array.isArray(h) && l.every((u, p) => u === h[p]) && e.firstValue === l[0] && e.secondValue === l[1] || c(); }, { deep: !0 }), Je(() => [i.min, i.max], () => { c(); }); }, eR = ht({ modelValue: { type: Number, default: 0 }, vertical: Boolean, tooltipClass: String, placement: { type: String, values: rs, default: "top" } }), tR = { [Dt]: (i) => Mt(i) }, iR = Ie({ name: "ElSliderButton" }), rR = /* @__PURE__ */ Ie({ ...iR, props: eR, emits: tR, setup(i, { expose: e, emit: t }) { const r = i, n = it("slider"), o = Yi({ hovering: !1, dragging: !1, isClick: !1, startX: 0, currentX: 0, startY: 0, currentY: 0, startPosition: 0, newPosition: 0, oldValue: r.modelValue }), { disabled: a, button: s, tooltip: c, showTooltip: l, tooltipVisible: h, wrapperStyle: u, formatValue: p, handleMouseEnter: m, handleMouseLeave: g, onButtonDown: d, onKeyDown: y, setPosition: f } = J3(r, o, t), { hovering: v, dragging: _ } = cn(o); return e({ onButtonDown: d, onKeyDown: y, setPosition: f, hovering: v, dragging: _ }), (M, T) => (fe(), Ce("div", { ref_key: "button", ref: s, class: Le([H(n).e("button-wrapper"), { hover: H(v), dragging: H(_) }]), style: It(H(u)), tabindex: H(a) ? -1 : 0, onMouseenter: H(m), onMouseleave: H(g), onMousedown: H(d), onFocus: H(m), onBlur: H(g), onKeydown: H(y) }, [ se(H(Np), { ref_key: "tooltip", ref: c, visible: H(h), placement: M.placement, "fallback-placements": ["top", "bottom", "right", "left"], "stop-popper-mouse-event": !1, "popper-class": M.tooltipClass, disabled: !H(l), persistent: "" }, { content: pe(() => [ ke("span", null, wt(H(p)), 1) ]), default: pe(() => [ ke("div", { class: Le([H(n).e("button"), { hover: H(v), dragging: H(_) }]) }, null, 2) ]), _: 1 }, 8, ["visible", "placement", "popper-class", "disabled"]) ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"])); } }); var sg = /* @__PURE__ */ at(rR, [["__file", "button.vue"]]); const nR = ht({ mark: { type: Xe([String, Object]), default: void 0 } }); var oR = Ie({ name: "ElSliderMarker", props: nR, setup(i) { const e = it("slider"), t = ce(() => Ii(i.mark) ? i.mark : i.mark.label), r = ce(() => Ii(i.mark) ? void 0 : i.mark.style); return () => ba("div", { class: e.e("marks-text"), style: r.value }, t.value); } }); const aR = Ie({ name: "ElSlider" }), sR = /* @__PURE__ */ Ie({ ...aR, props: k3, emits: F3, setup(i, { expose: e, emit: t }) { const r = i, n = it("slider"), { t: o } = mu(), a = Yi({ firstValue: 0, secondValue: 0, oldValue: 0, dragging: !1, sliderSize: 1 }), { elFormItem: s, slider: c, firstButton: l, secondButton: h, sliderDisabled: u, minValue: p, maxValue: m, runwayStyle: g, barStyle: d, resetSize: y, emitChange: f, onSliderWrapperPrevent: v, onSliderClick: _, onSliderDown: M, onSliderMarkerDown: T, setFirstValue: w, setSecondValue: b } = V3(r, a, t), { stops: E, getStopStyle: S } = K3(r, a, p, m), { inputId: C, isLabeledByFormItem: R } = Lp(r, { formItemContext: s }), L = ns(), A = ce(() => r.inputSize || L.value), P = ce(() => r.ariaLabel || o("el.slider.defaultLabel", { min: r.min, max: r.max })), O = ce(() => r.range ? r.rangeStartLabel || o("el.slider.defaultRangeStartLabel") : P.value), x = ce(() => r.formatValueText ? r.formatValueText(K.value) : `${K.value}`), I = ce(() => r.rangeEndLabel || o("el.slider.defaultRangeEndLabel")), N = ce(() => r.formatValueText ? r.formatValueText(ne.value) : `${ne.value}`), D = ce(() => [ n.b(), n.m(L.value), n.is("vertical", r.vertical), { [n.m("with-input")]: r.showInput } ]), k = U3(r); Q3(r, a, p, m, t, s); const F = ce(() => { const j = [r.min, r.max, r.step].map((Q) => { const Y = `${Q}`.split(".")[1]; return Y ? Y.length : 0; }); return Math.max.apply(null, j); }), { sliderWrapper: W } = z3(r, a, y), { firstValue: K, secondValue: ne, sliderSize: q } = cn(a), z = (j) => { a.dragging = j; }; return hi(W, "touchstart", v, { passive: !1 }), hi(W, "touchmove", v, { passive: !1 }), pi(Cy, { ...cn(r), sliderSize: q, disabled: u, precision: F, emitChange: f, resetSize: y, updateDragging: z }), e({ onSliderClick: _ }), (j, Q) => { var Y, ee; return fe(), Ce("div", { id: j.range ? H(C) : void 0, ref_key: "sliderWrapper", ref: W, class: Le(H(D)), role: j.range ? "group" : void 0, "aria-label": j.range && !H(R) ? H(P) : void 0, "aria-labelledby": j.range && H(R) ? (Y = H(s)) == null ? void 0 : Y.labelId : void 0 }, [ ke("div", { ref_key: "slider", ref: c, class: Le([ H(n).e("runway"), { "show-input": j.showInput && !j.range }, H(n).is("disabled", H(u)) ]), style: It(H(g)), onMousedown: H(M), onTouchstartPassive: H(M) }, [ ke("div", { class: Le(H(n).e("bar")), style: It(H(d)) }, null, 6), se(sg, { id: j.range ? void 0 : H(C), ref_key: "firstButton", ref: l, "model-value": H(K), vertical: j.vertical, "tooltip-class": j.tooltipClass, placement: j.placement, role: "slider", "aria-label": j.range || !H(R) ? H(O) : void 0, "aria-labelledby": !j.range && H(R) ? (ee = H(s)) == null ? void 0 : ee.labelId : void 0, "aria-valuemin": j.min, "aria-valuemax": j.range ? H(ne) : j.max, "aria-valuenow": H(K), "aria-valuetext": H(x), "aria-orientation": j.vertical ? "vertical" : "horizontal", "aria-disabled": H(u), "onUpdate:modelValue": H(w) }, 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"]), j.range ? (fe(), He(sg, { key: 0, ref_key: "secondButton", ref: h, "model-value": H(ne), vertical: j.vertical, "tooltip-class": j.tooltipClass, placement: j.placement, role: "slider", "aria-label": H(I), "aria-valuemin": H(K), "aria-valuemax": j.max, "aria-valuenow": H(ne), "aria-valuetext": H(N), "aria-orientation": j.vertical ? "vertical" : "horizontal", "aria-disabled": H(u), "onUpdate:modelValue": H(b) }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : Ve("v-if", !0), j.showStops ? (fe(), Ce("div", { key: 1 }, [ (fe(!0), Ce(Gt, null, rr(H(E), (G, J) => (fe(), Ce("div", { key: J, class: Le(H(n).e("stop")), style: It(H(S)(G)) }, null, 6))), 128)) ])) : Ve("v-if", !0), H(k).length > 0 ? (fe(), Ce(Gt, { key: 2 }, [ ke("div", null, [ (fe(!0), Ce(Gt, null, rr(H(k), (G, J) => (fe(), Ce("div", { key: J, style: It(H(S)(G.position)), class: Le([H(n).e("stop"), H(n).e("marks-stop")]) }, null, 6))), 128)) ]), ke("div", { class: Le(H(n).e("marks")) }, [ (fe(!0), Ce(Gt, null, rr(H(k), (G, J) => (fe(), He(H(oR), { key: J, mark: G.mark, style: It(H(S)(G.position)), onMousedown: ui((re) => H(T)(G.position), ["stop"]) }, null, 8, ["mark", "style", "onMousedown"]))), 128)) ], 2) ], 64)) : Ve("v-if", !0) ], 46, ["onMousedown", "onTouchstartPassive"]), j.showInput && !j.range ? (fe(), He(H(yn), { key: 0, ref: "input", "model-value": H(K), class: Le(H(n).e("input")), step: j.step, disabled: H(u), controls: j.showInputControls, min: j.min, max: j.max, precision: H(F), debounce: j.debounce, size: H(A), "onUpdate:modelValue": H(w), onChange: H(f) }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : Ve("v-if", !0) ], 10, ["id", "role", "aria-label", "aria-labelledby"]); }; } }); var lR = /* @__PURE__ */ at(sR, [["__file", "slider.vue"]]); const lr = fi(lR), Mu = Symbol("tabsRootContextKey"), cR = ht({ tabs: { type: Xe(Array), default: () => en([]) } }), Ly = "ElTabBar", uR = Ie({ name: Ly }), hR = /* @__PURE__ */ Ie({ ...uR, props: cR, setup(i, { expose: e }) { const t = i, r = si(), n = ct(Mu); n || is(Ly, ""); const o = it("tabs"), a = Ae(), s = Ae(), c = () => { let m = 0, g = 0; const d = ["top", "bottom"].includes(n.props.tabPosition) ? "width" : "height", y = d === "width" ? "x" : "y", f = y === "x" ? "left" : "top"; return t.tabs.every((v) => { var _, M; const T = (M = (_ = r.parent) == null ? void 0 : _.refs) == null ? void 0 : M[`tab-${v.uid}`]; if (!T) return !1; if (!v.active) return !0; m = T[`offset${kn(f)}`], g = T[`client${kn(d)}`]; const w = window.getComputedStyle(T); return d === "width" && (g -= Number.parseFloat(w.paddingLeft) + Number.parseFloat(w.paddingRight), m += Number.parseFloat(w.paddingLeft)), !1; }), { [d]: `${g}px`, transform: `translate${kn(y)}(${m}px)` }; }, l = () => s.value = c(), h = [], u = () => { var m; h.forEach((d) => d.stop()), h.length = 0; const g = (m = r.parent) == null ? void 0 : m.refs; if (g) { for (const d in g) if (d.startsWith("tab-")) { const y = g[d]; y && h.push(ir(y, l)); } } }; Je(() => t.tabs, async () => { await _t(), l(), u(); }, { immediate: !0 }); const p = ir(a, () => l()); return sr(() => { h.forEach((m) => m.stop()), h.length = 0, p.stop(); }), e({ ref: a, update: l }), (m, g) => (fe(), Ce("div", { ref_key: "barRef", ref: a, class: Le([H(o).e("active-bar"), H(o).is(H(n).props.tabPosition)]), style: It(s.value) }, null, 6)); } }); var dR = /* @__PURE__ */ at(hR, [["__file", "tab-bar.vue"]]); const pR = ht({ panes: { type: Xe(Array), default: () => en([]) }, currentName: { type: [String, Number], default: "" }, editable: Boolean, type: { type: String, values: ["card", "border-card", ""], default: "" }, stretch: Boolean }), fR = { tabClick: (i, e, t) => t instanceof Event, tabRemove: (i, e) => e instanceof Event }, lg = "ElTabNav", mR = Ie({ name: lg, props: pR, emits: fR, setup(i, { expose: e, emit: t }) { const r = ct(Mu); r || is(lg, ""); const n = it("tabs"), o = kw(), a = Yw(), s = Ae(), c = Ae(), l = Ae(), h = Ae(), u = Ae(!1), p = Ae(0), m = Ae(!1), g = Ae(!0), d = ce(() => ["top", "bottom"].includes(r.props.tabPosition) ? "width" : "height"), y = ce(() => ({ transform: `translate${d.value === "width" ? "X" : "Y"}(-${p.value}px)` })), f = () => { if (!s.value) return; const E = s.value[`offset${kn(d.value)}`], S = p.value; if (!S) return; const C = S > E ? S - E : 0; p.value = C; }, v = () => { if (!s.value || !c.value) return; const E = c.value[`offset${kn(d.value)}`], S = s.value[`offset${kn(d.value)}`], C = p.value; if (E - C <= S) return; const R = E - C > S * 2 ? C + S : E - S; p.value = R; }, _ = async () => { const E = c.value; if (!u.value || !l.value || !s.value || !E) return; await _t(); const S = l.value.querySelector(".is-active"); if (!S) return; const C = s.value, R = ["top", "bottom"].includes(r.props.tabPosition), L = S.getBoundingClientRect(), A = C.getBoundingClientRect(), P = R ? E.offsetWidth - A.width : E.offsetHeight - A.height, O = p.value; let x = O; R ? (L.left < A.left && (x = O - (A.left - L.left)), L.right > A.right && (x = O + L.right - A.right)) : (L.top < A.top && (x = O - (A.top - L.top)), L.bottom > A.bottom && (x = O + (L.bottom - A.bottom))), x = Math.max(x, 0), p.value = Math.min(x, P); }, M = () => { var E; if (!c.value || !s.value) return; i.stretch && ((E = h.value) == null || E.update()); const S = c.value[`offset${kn(d.value)}`], C = s.value[`offset${kn(d.value)}`], R = p.value; C < S ? (u.value = u.value || {}, u.value.prev = R, u.value.next = R + C < S, S - R < C && (p.value = S - C)) : (u.value = !1, R > 0 && (p.value = 0)); }, T = (E) => { const S = E.code, { up: C, down: R, left: L, right: A } = Ir; if (![C, R, L, A].includes(S)) return; const P = Array.from(E.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)")), O = P.indexOf(E.target); let x; S === L || S === C ? O === 0 ? x = P.length - 1 : x = O - 1 : O < P.length - 1 ? x = O + 1 : x = 0, P[x].focus({ preventScroll: !0 }), P[x].click(), w(); }, w = () => { g.value && (m.value = !0); }, b = () => m.value = !1; return Je(o, (E) => { E === "hidden" ? g.value = !1 : E === "visible" && setTimeout(() => g.value = !0, 50); }), Je(a, (E) => { E ? setTimeout(() => g.value = !0, 50) : g.value = !1; }), ir(l, M), ni(() => setTimeout(() => _(), 0)), rp(() => M()), e({ scrollToActiveTab: _, removeFocus: b }), () => { const E = u.value ? [se("span", { class: [n.e("nav-prev"), n.is("disabled", !u.value.prev)], onClick: f }, [se(kt, null, { default: () => [se(Wn, null, null)] })]), se("span", { class: [n.e("nav-next"), n.is("disabled", !u.value.next)], onClick: v }, [se(kt, null, { default: () => [se($n, null, null)] })])] : null, S = i.panes.map((C, R) => { var L, A, P, O; const x = C.uid, I = C.props.disabled, N = (A = (L = C.props.name) != null ? L : C.index) != null ? A : `${R}`, D = !I && (C.isClosable || i.editable); C.index = `${R}`; const k = D ? se(kt, { class: "is-icon-close", onClick: (K) => t("tabRemove", C, K) }, { default: () => [se(ld, null, null)] }) : null, F = ((O = (P = C.slots).label) == null ? void 0 : O.call(P)) || C.props.label, W = !I && C.active ? 0 : -1; return se("div", { ref: `tab-${x}`, class: [n.e("item"), n.is(r.props.tabPosition), n.is("active", C.active), n.is("disabled", I), n.is("closable", D), n.is("focus", m.value)], id: `tab-${N}`, key: `tab-${x}`, "aria-controls": `pane-${N}`, role: "tab", "aria-selected": C.active, tabindex: W, onFocus: () => w(), onBlur: () => b(), onClick: (K) => { b(), t("tabClick", C, N, K); }, onKeydown: (K) => { D && (K.code === Ir.delete || K.code === Ir.backspace) && t("tabRemove", C, K); } }, [F, k]); }); return se("div", { ref: l, class: [n.e("nav-wrap"), n.is("scrollable", !!u.value), n.is(r.props.tabPosition)] }, [E, se("div", { class: n.e("nav-scroll"), ref: s }, [se("div", { class: [n.e("nav"), n.is(r.props.tabPosition), n.is("stretch", i.stretch && ["top", "bottom"].includes(r.props.tabPosition))], ref: c, style: y.value, role: "tablist", onKeydown: T }, [i.type ? null : se(dR, { ref: h, tabs: [...i.panes] }, null), S])])]); }; } }), gR = ht({ 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: Xe(Function), default: () => !0 }, stretch: Boolean }), oh = (i) => Ii(i) || Mt(i), vR = { [Dt]: (i) => oh(i), tabClick: (i, e) => e instanceof Event, tabChange: (i) => oh(i), edit: (i, e) => ["remove", "add"].includes(e), tabRemove: (i) => oh(i), tabAdd: () => !0 }, yR = Ie({ name: "ElTabs", props: gR, emits: vR, setup(i, { emit: e, slots: t, expose: r }) { var n; const o = it("tabs"), a = ce(() => ["left", "right"].includes(i.tabPosition)), { children: s, addChild: c, removeChild: l } = ZA(si(), "ElTabPane"), h = Ae(), u = Ae((n = i.modelValue) != null ? n : "0"), p = async (f, v = !1) => { var _, M, T; if (!(u.value === f || vr(f))) try { await ((_ = i.beforeLeave) == null ? void 0 : _.call(i, f, u.value)) !== !1 && (u.value = f, v && (e(Dt, f), e("tabChange", f)), (T = (M = h.value) == null ? void 0 : M.removeFocus) == null || T.call(M)); } catch { } }, m = (f, v, _) => { f.props.disabled || (p(v, !0), e("tabClick", f, _)); }, g = (f, v) => { f.props.disabled || vr(f.props.name) || (v.stopPropagation(), e("edit", f.props.name, "remove"), e("tabRemove", f.props.name)); }, d = () => { e("edit", void 0, "add"), e("tabAdd"); }; Je(() => i.modelValue, (f) => p(f)), Je(u, async () => { var f; await _t(), (f = h.value) == null || f.scrollToActiveTab(); }), pi(Mu, { props: i, currentName: u, registerPane: (f) => { s.value.push(f); }, sortPane: c, unregisterPane: l }), r({ currentName: u }); const y = ({ render: f }) => f(); return () => { const f = t["add-icon"], v = i.editable || i.addable ? se("div", { class: [o.e("new-tab"), a.value && o.e("new-tab-vertical")], tabindex: "0", onClick: d, onKeydown: (T) => { T.code === Ir.enter && d(); } }, [f ? qe(t, "add-icon") : se(kt, { class: o.is("icon-plus") }, { default: () => [se(pu, null, null)] })]) : null, _ = se("div", { class: [o.e("header"), a.value && o.e("header-vertical"), o.is(i.tabPosition)] }, [se(y, { render: () => { const T = s.value.some((w) => w.slots.label); return se(mR, { ref: h, currentName: u.value, editable: i.editable, type: i.type, panes: s.value, stretch: i.stretch, onTabClick: m, onTabRemove: g }, { $stable: !T }); } }, null), v]), M = se("div", { class: o.e("content") }, [qe(t, "default")]); return se("div", { class: [o.b(), o.m(i.tabPosition), { [o.m("card")]: i.type === "card", [o.m("border-card")]: i.type === "border-card" }] }, [M, _]); }; } }), bR = ht({ label: { type: String, default: "" }, name: { type: [String, Number] }, closable: Boolean, disabled: Boolean, lazy: Boolean }), Ry = "ElTabPane", xR = Ie({ name: Ry }), wR = /* @__PURE__ */ Ie({ ...xR, props: bR, setup(i) { const e = i, t = si(), r = au(), n = ct(Mu); n || is(Ry, "usage: "); const o = it("tab-pane"), a = Ae(), s = ce(() => e.closable || n.props.closable), c = jf(() => { var m; return n.currentName.value === ((m = e.name) != null ? m : a.value); }), l = Ae(c.value), h = ce(() => { var m; return (m = e.name) != null ? m : a.value; }), u = jf(() => !e.lazy || l.value || c.value); Je(c, (m) => { m && (l.value = !0); }); const p = Yi({ uid: t.uid, slots: r, props: e, paneName: h, active: c, index: a, isClosable: s }); return n.registerPane(p), ni(() => { n.sortPane(p); }), s0(() => { n.unregisterPane(p.uid); }), (m, g) => H(u) ? Bt((fe(), Ce("div", { key: 0, id: `pane-${H(h)}`, class: Le(H(o).b()), role: "tabpanel", "aria-hidden": !H(c), "aria-labelledby": `tab-${H(h)}` }, [ qe(m.$slots, "default") ], 10, ["id", "aria-hidden", "aria-labelledby"])), [ [yi, H(c)] ]) : Ve("v-if", !0); } }); var Oy = /* @__PURE__ */ at(wR, [["__file", "tab-pane.vue"]]); const Py = fi(yR, { TabPane: Oy }), Iy = gn(Oy); function _R(i) { let e; const t = Ae(!1), r = Yi({ ...i, originalPosition: "", originalOverflow: "", visible: !1 }); function n(p) { r.text = p; } function o() { const p = r.parent, m = u.ns; if (!p.vLoadingAddClassList) { let g = p.getAttribute("loading-number"); g = Number.parseInt(g) - 1, g ? p.setAttribute("loading-number", g.toString()) : ($c(p, m.bm("parent", "relative")), p.removeAttribute("loading-number")), $c(p, m.bm("parent", "hidden")); } a(), h.unmount(); } function a() { var p, m; (m = (p = u.$el) == null ? void 0 : p.parentNode) == null || m.removeChild(u.$el); } function s() { var p; i.beforeClose && !i.beforeClose() || (t.value = !0, clearTimeout(e), e = setTimeout(c, 400), r.visible = !1, (p = i.closed) == null || p.call(i)); } function c() { if (!t.value) return; const p = r.parent; t.value = !1, p.vLoadingAddClassList = void 0, o(); } const l = Ie({ name: "ElLoading", setup(p, { expose: m }) { const { ns: g, zIndex: d } = r2("loading"); return m({ ns: g, zIndex: d }), () => { const y = r.spinner || r.svg, f = ba("svg", { class: "circular", viewBox: r.svgViewBox ? r.svgViewBox : "0 0 50 50", ...y ? { innerHTML: y } : {} }, [ ba("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none" }) ]), v = r.text ? ba("p", { class: g.b("text") }, [r.text]) : void 0; return ba(hl, { name: g.b("fade"), onAfterLeave: c }, { default: pe(() => [ Bt(se("div", { style: { backgroundColor: r.background || "" }, class: [ g.b("mask"), r.customClass, r.fullscreen ? "is-fullscreen" : "" ] }, [ ba("div", { class: g.b("spinner") }, [f, v]) ]), [[yi, r.visible]]) ]) }); }; } }), h = xw(l), u = h.mount(document.createElement("div")); return { ...cn(r), setText: n, removeElLoadingChild: a, close: s, handleAfterLeave: c, vm: u, get $el() { return u.$el; } }; } let Hl; const md = function(i = {}) { if (!ii) return; const e = MR(i); if (e.fullscreen && Hl) return Hl; const t = _R({ ...e, closed: () => { var n; (n = e.closed) == null || n.call(e), e.fullscreen && (Hl = void 0); } }); SR(e, e.parent, t), cg(e, e.parent, t), e.parent.vLoadingAddClassList = () => cg(e, e.parent, t); let r = e.parent.getAttribute("loading-number"); return r ? r = `${Number.parseInt(r) + 1}` : r = "1", e.parent.setAttribute("loading-number", r), e.parent.appendChild(t.$el), _t(() => t.visible.value = e.visible), e.fullscreen && (Hl = t), t; }, MR = (i) => { var e, t, r, n; let o; return Ii(i.target) ? o = (e = document.querySelector(i.target)) != null ? e : document.body : o = i.target || document.body, { parent: o === document.body || i.body ? document.body : o, background: i.background || "", svg: i.svg || "", svgViewBox: i.svgViewBox || "", spinner: i.spinner || !1, text: i.text || "", fullscreen: o === document.body && ((t = i.fullscreen) != null ? t : !0), lock: (r = i.lock) != null ? r : !1, customClass: i.customClass || "", visible: (n = i.visible) != null ? n : !0, beforeClose: i.beforeClose, closed: i.closed, target: o }; }, SR = async (i, e, t) => { const { nextZIndex: r } = t.vm.zIndex || t.vm._.exposed.zIndex, n = {}; if (i.fullscreen) t.originalPosition.value = vs(document.body, "position"), t.originalOverflow.value = vs(document.body, "overflow"), n.zIndex = r(); else if (i.parent === document.body) { t.originalPosition.value = vs(document.body, "position"), await _t(); for (const o of ["top", "left"]) { const a = o === "top" ? "scrollTop" : "scrollLeft"; n[o] = `${i.target.getBoundingClientRect()[o] + document.body[a] + document.documentElement[a] - Number.parseInt(vs(document.body, `margin-${o}`), 10)}px`; } for (const o of ["height", "width"]) n[o] = `${i.target.getBoundingClientRect()[o]}px`; } else t.originalPosition.value = vs(e, "position"); for (const [o, a] of Object.entries(n)) t.$el.style[o] = a; }, cg = (i, e, t) => { const r = t.vm.ns || t.vm._.exposed.ns; ["absolute", "fixed", "sticky"].includes(t.originalPosition.value) ? $c(e, r.bm("parent", "relative")) : Em(e, r.bm("parent", "relative")), i.fullscreen && i.lock ? Em(e, r.bm("parent", "hidden")) : $c(e, r.bm("parent", "hidden")); }, zc = Symbol("ElLoading"), ug = (i, e) => { var t, r, n, o; const a = e.instance, s = (p) => Oi(e.value) ? e.value[p] : void 0, c = (p) => { const m = Ii(p) && (a == null ? void 0 : a[p]) || p; return m && Ae(m); }, l = (p) => c(s(p) || i.getAttribute(`element-loading-${n_(p)}`)), h = (t = s("fullscreen")) != null ? t : e.modifiers.fullscreen, u = { text: l("text"), svg: l("svg"), svgViewBox: l("svgViewBox"), spinner: l("spinner"), background: l("background"), customClass: l("customClass"), fullscreen: h, target: (r = s("target")) != null ? r : h ? void 0 : i, body: (n = s("body")) != null ? n : e.modifiers.body, lock: (o = s("lock")) != null ? o : e.modifiers.lock }; i[zc] = { options: u, instance: md(u) }; }, TR = (i, e) => { for (const t of Object.keys(e)) Ro(e[t]) && (e[t].value = i[t]); }, gd = { mounted(i, e) { e.value && ug(i, e); }, updated(i, e) { const t = i[zc]; e.oldValue !== e.value && (e.value && !e.oldValue ? ug(i, e) : e.value && e.oldValue ? Oi(e.value) && TR(e.value, t.options) : t == null || t.instance.close()); }, unmounted(i) { var e; (e = i[zc]) == null || e.instance.close(), i[zc] = null; } }, ER = { install(i) { i.directive("loading", gd), i.config.globalProperties.$loading = md; }, directive: gd, service: md }; var Dy = { exports: {} }, AR = {}, hg; function CR() { return hg || (hg = 1, function(i) { var e = function() { try { return !!Symbol.iterator; } catch { return !1; } }, t = e(), r = function(l) { var h = { next: function() { var u = l.shift(); return { done: u === void 0, value: u }; } }; return t && (h[Symbol.iterator] = function() { return h; }), h; }, n = function(l) { return encodeURIComponent(l).replace(/%20/g, "+"); }, o = function(l) { return decodeURIComponent(String(l).replace(/\+/g, " ")); }, a = function() { var l = function(u) { Object.defineProperty(this, "_entries", { writable: !0, value: {} }); var p = typeof u; if (p !== "undefined") if (p === "string") u !== "" && this._fromString(u); else if (u instanceof l) { var m = this; u.forEach(function(f, v) { m.append(v, f); }); } else if (u !== null && p === "object") if (Object.prototype.toString.call(u) === "[object Array]") for (var g = 0; g < u.length; g++) { var d = u[g]; if (Object.prototype.toString.call(d) === "[object Array]" || d.length !== 2) this.append(d[0], d[1]); else throw new TypeError("Expected [string, any] as entry at index " + g + " of URLSearchParams's input"); } else for (var y in u) u.hasOwnProperty(y) && this.append(y, u[y]); else throw new TypeError("Unsupported input's type for URLSearchParams"); }, h = l.prototype; h.append = function(u, p) { u in this._entries ? this._entries[u].push(String(p)) : this._entries[u] = [String(p)]; }, h.delete = function(u) { delete this._entries[u]; }, h.get = function(u) { return u in this._entries ? this._entries[u][0] : null; }, h.getAll = function(u) { return u in this._entries ? this._entries[u].slice(0) : []; }, h.has = function(u) { return u in this._entries; }, h.set = function(u, p) { this._entries[u] = [String(p)]; }, h.forEach = function(u, p) { var m; for (var g in this._entries) if (this._entries.hasOwnProperty(g)) { m = this._entries[g]; for (var d = 0; d < m.length; d++) u.call(p, m[d], g, this); } }, h.keys = function() { var u = []; return this.forEach(function(p, m) { u.push(m); }), r(u); }, h.values = function() { var u = []; return this.forEach(function(p) { u.push(p); }), r(u); }, h.entries = function() { var u = []; return this.forEach(function(p, m) { u.push([m, p]); }), r(u); }, t && (h[Symbol.iterator] = h.entries), h.toString = function() { var u = []; return this.forEach(function(p, m) { u.push(n(m) + "=" + n(p)); }), u.join("&"); }, i.URLSearchParams = l; }, s = function() { try { var l = i.URLSearchParams; return new l("?a=1").toString() === "a=1" && typeof l.prototype.set == "function" && typeof l.prototype.entries == "function"; } catch { return !1; } }; s() || a(); var c = i.URLSearchParams.prototype; typeof c.sort != "function" && (c.sort = function() { var l = this, h = []; this.forEach(function(p, m) { h.push([m, p]), l._entries || l.delete(m); }), h.sort(function(p, m) { return p[0] < m[0] ? -1 : p[0] > m[0] ? 1 : 0; }), l._entries && (l._entries = {}); for (var u = 0; u < h.length; u++) this.append(h[u][0], h[u][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 h = []; this.forEach(function(g, d) { h.push(d); }); for (var u = 0; u < h.length; u++) this.delete(h[u]); } l = l.replace(/^\?/, ""); for (var p = l.split("&"), m, u = 0; u < p.length; u++) m = p[u].split("="), this.append( o(m[0]), m.length > 1 ? o(m[1]) : "" ); } }); }( typeof Bn < "u" ? Bn : typeof window < "u" ? window : typeof self < "u" ? self : Bn ), function(i) { var e = function() { try { var n = new i.URL("b", "http://a"); return n.pathname = "c d", n.href === "http://a/c%20d" && n.searchParams; } catch { return !1; } }, t = function() { var n = i.URL, o = function(c, l) { typeof c != "string" && (c = String(c)), l && typeof l != "string" && (l = String(l)); var h = document, u; if (l && (i.location === void 0 || l !== i.location.href)) { l = l.toLowerCase(), h = document.implementation.createHTMLDocument(""), u = h.createElement("base"), u.href = l, h.head.appendChild(u); try { if (u.href.indexOf(l) !== 0) throw new Error(u.href); } catch (_) { throw new Error("URL unable to set base " + l + " due to " + _); } } var p = h.createElement("a"); p.href = c, u && (h.body.appendChild(p), p.href = p.href); var m = h.createElement("input"); if (m.type = "url", m.value = c, p.protocol === ":" || !/:/.test(p.href) || !m.checkValidity() && !l) throw new TypeError("Invalid URL"); Object.defineProperty(this, "_anchorElement", { value: p }); var g = new i.URLSearchParams(this.search), d = !0, y = !0, f = this; ["append", "delete", "set"].forEach(function(_) { var M = g[_]; g[_] = function() { M.apply(g, arguments), d && (y = !1, f.search = g.toString(), y = !0); }; }), Object.defineProperty(this, "searchParams", { value: g, enumerable: !0 }); var v = void 0; Object.defineProperty(this, "_updateSearchParams", { enumerable: !1, configurable: !1, writable: !1, value: function() { this.search !== v && (v = this.search, y && (d = !1, this.searchParams._fromString(this.search), d = !0)); } }); }, a = o.prototype, s = function(c) { Object.defineProperty(a, c, { get: function() { return this._anchorElement[c]; }, set: function(l) { this._anchorElement[c] = l; }, enumerable: !0 }); }; ["hash", "host", "hostname", "port", "protocol"].forEach(function(c) { s(c); }), Object.defineProperty(a, "search", { get: function() { return this._anchorElement.search; }, set: function(c) { this._anchorElement.search = c, this._updateSearchParams(); }, enumerable: !0 }), Object.defineProperties(a, { 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 } }), o.createObjectURL = function(c) { return n.createObjectURL.apply(n, arguments); }, o.revokeObjectURL = function(c) { return n.revokeObjectURL.apply(n, arguments); }, i.URL = o; }; if (e() || t(), i.location !== void 0 && !("origin" in i.location)) { var r = function() { return i.location.protocol + "//" + i.location.hostname + (i.location.port ? ":" + i.location.port : ""); }; try { Object.defineProperty(i.location, "origin", { get: r, enumerable: !0 }); } catch { setInterval(function() { i.location.origin = r(); }, 100); } } }( typeof Bn < "u" ? Bn : typeof window < "u" ? window : typeof self < "u" ? self : Bn )), AR; } /** * @license * Copyright 2010-2021 Three.js Authors * SPDX-License-Identifier: MIT */ const kp = "130", LR = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }, RR = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, Ny = 0, vd = 1, By = 2, OR = 3, PR = 0, Fp = 1, ky = 2, wa = 3, Xn = 0, Yt = 1, Zn = 2, zp = 1, IR = 2, an = 0, Sa = 1, yd = 2, bd = 3, xd = 4, Fy = 5, bo = 100, zy = 101, Uy = 102, wd = 103, _d = 104, Vy = 200, Hy = 201, jy = 202, Gy = 203, Up = 204, Vp = 205, Wy = 206, $y = 207, qy = 208, Xy = 209, Zy = 210, Yy = 0, Jy = 1, Ky = 2, Kc = 3, Qy = 4, eb = 5, tb = 6, ib = 7, vl = 0, rb = 1, nb = 2, Un = 0, ob = 1, ab = 2, sb = 3, lb = 4, cb = 5, Su = 300, yl = 301, bl = 302, Qc = 303, eu = 304, ls = 306, xl = 307, Yn = 1e3, di = 1001, Na = 1002, Jt = 1003, Ks = 1004, DR = 1004, Qs = 1005, NR = 1005, Wt = 1006, Tu = 1007, BR = 1007, bn = 1008, kR = 1008, Po = 1009, ub = 1010, hb = 1011, el = 1012, db = 1013, Us = 1014, tn = 1015, Eo = 1016, pb = 1017, fb = 1018, mb = 1019, Ta = 1020, gb = 1021, sn = 1022, Xi = 1023, vb = 1024, yb = 1025, bb = Xi, Ao = 1026, Ba = 1027, xb = 1028, wb = 1029, _b = 1030, Mb = 1031, Sb = 1032, Tb = 1033, Md = 33776, Sd = 33777, Td = 33778, Ed = 33779, Ad = 35840, Cd = 35841, Ld = 35842, Rd = 35843, Eb = 36196, Od = 37492, Pd = 37496, Ab = 37808, Cb = 37809, Lb = 37810, Rb = 37811, Ob = 37812, Pb = 37813, Ib = 37814, Db = 37815, Nb = 37816, Bb = 37817, kb = 37818, Fb = 37819, zb = 37820, Ub = 37821, Vb = 36492, Hb = 37840, jb = 37841, Gb = 37842, Wb = 37843, $b = 37844, qb = 37845, Xb = 37846, Zb = 37847, Yb = 37848, Jb = 37849, Kb = 37850, Qb = 37851, ex = 37852, tx = 37853, ix = 2200, rx = 2201, nx = 2202, ka = 2300, Io = 2301, Uc = 2302, wo = 2400, _o = 2401, tl = 2402, Eu = 2500, Hp = 2501, ox = 0, ax = 1, jp = 2, Di = 3e3, Do = 3001, Au = 3007, Cu = 3002, sx = 3003, Gp = 3004, Wp = 3005, $p = 3006, lx = 3200, cx = 3201, to = 0, ux = 1, FR = 0, Vc = 7680, zR = 7681, UR = 7682, VR = 7683, HR = 34055, jR = 34056, GR = 5386, WR = 512, $R = 513, qR = 514, XR = 515, ZR = 516, YR = 517, JR = 518, hx = 519, Fa = 35044, za = 35048, KR = 35040, QR = 35045, eO = 35049, tO = 35041, iO = 35046, rO = 35050, nO = 35042, oO = "100", Id = "300 es"; class io { addEventListener(e, t) { this._listeners === void 0 && (this._listeners = {}); const r = this._listeners; r[e] === void 0 && (r[e] = []), r[e].indexOf(t) === -1 && r[e].push(t); } hasEventListener(e, t) { if (this._listeners === void 0) return !1; const r = this._listeners; return r[e] !== void 0 && r[e].indexOf(t) !== -1; } removeEventListener(e, t) { if (this._listeners === void 0) return; const r = this._listeners[e]; if (r !== void 0) { const n = r.indexOf(t); n !== -1 && r.splice(n, 1); } } dispatchEvent(e) { if (this._listeners === void 0) return; const t = this._listeners[e.type]; if (t !== void 0) { e.target = this; const r = t.slice(0); for (let n = 0, o = r.length; n < o; n++) r[n].call(this, e); e.target = null; } } } const gi = []; for (let i = 0; i < 256; i++) gi[i] = (i < 16 ? "0" : "") + i.toString(16); let jl = 1234567; const Co = Math.PI / 180, il = 180 / Math.PI; function Zi() { const i = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, r = Math.random() * 4294967295 | 0; return (gi[i & 255] + gi[i >> 8 & 255] + gi[i >> 16 & 255] + gi[i >> 24 & 255] + "-" + gi[e & 255] + gi[e >> 8 & 255] + "-" + gi[e >> 16 & 15 | 64] + gi[e >> 24 & 255] + "-" + gi[t & 63 | 128] + gi[t >> 8 & 255] + "-" + gi[t >> 16 & 255] + gi[t >> 24 & 255] + gi[r & 255] + gi[r >> 8 & 255] + gi[r >> 16 & 255] + gi[r >> 24 & 255]).toUpperCase(); } function bi(i, e, t) { return Math.max(e, Math.min(t, i)); } function qp(i, e) { return (i % e + e) % e; } function aO(i, e, t, r, n) { return r + (i - e) * (n - r) / (t - e); } function sO(i, e, t) { return i !== e ? (t - i) / (e - i) : 0; } function Vs(i, e, t) { return (1 - t) * i + t * e; } function lO(i, e, t, r) { return Vs(i, e, 1 - Math.exp(-t * r)); } function cO(i, e = 1) { return e - Math.abs(qp(i, e * 2) - e); } function uO(i, e, t) { return i <= e ? 0 : i >= t ? 1 : (i = (i - e) / (t - e), i * i * (3 - 2 * i)); } function hO(i, e, t) { return i <= e ? 0 : i >= t ? 1 : (i = (i - e) / (t - e), i * i * i * (i * (i * 6 - 15) + 10)); } function dO(i, e) { return i + Math.floor(Math.random() * (e - i + 1)); } function pO(i, e) { return i + Math.random() * (e - i); } function fO(i) { return i * (0.5 - Math.random()); } function mO(i) { return i !== void 0 && (jl = i % 2147483647), jl = jl * 16807 % 2147483647, (jl - 1) / 2147483646; } function gO(i) { return i * Co; } function vO(i) { return i * il; } function Dd(i) { return (i & i - 1) === 0 && i !== 0; } function dx(i) { return Math.pow(2, Math.ceil(Math.log(i) / Math.LN2)); } function px(i) { return Math.pow(2, Math.floor(Math.log(i) / Math.LN2)); } function yO(i, e, t, r, n) { const o = Math.cos, a = Math.sin, s = o(t / 2), c = a(t / 2), l = o((e + r) / 2), h = a((e + r) / 2), u = o((e - r) / 2), p = a((e - r) / 2), m = o((r - e) / 2), g = a((r - e) / 2); switch (n) { case "XYX": i.set(s * h, c * u, c * p, s * l); break; case "YZY": i.set(c * p, s * h, c * u, s * l); break; case "ZXZ": i.set(c * u, c * p, s * h, s * l); break; case "XZX": i.set(s * h, c * g, c * m, s * l); break; case "YXY": i.set(c * m, s * h, c * g, s * l); break; case "ZYZ": i.set(c * g, c * m, s * h, s * l); break; default: console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + n); } } var Nd = /* @__PURE__ */ Object.freeze({ __proto__: null, DEG2RAD: Co, RAD2DEG: il, generateUUID: Zi, clamp: bi, euclideanModulo: qp, mapLinear: aO, inverseLerp: sO, lerp: Vs, damp: lO, pingpong: cO, smoothstep: uO, smootherstep: hO, randInt: dO, randFloat: pO, randFloatSpread: fO, seededRandom: mO, degToRad: gO, radToDeg: vO, isPowerOfTwo: Dd, ceilPowerOfTwo: dx, floorPowerOfTwo: px, setQuaternionFromProperEuler: yO }); class Re { 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, r = this.y, n = e.elements; return this.x = n[0] * t + n[3] * r + n[6], this.y = n[1] * t + n[4] * r + n[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 r = this.length(); return this.divideScalar(r || 1).multiplyScalar(Math.max(e, Math.min(t, r))); } 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, r = this.y - e.y; return t * t + r * r; } 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, r) { return this.x = e.x + (t.x - e.x) * r, this.y = e.y + (t.y - e.y) * r, 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, r) { return r !== 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 r = Math.cos(t), n = Math.sin(t), o = this.x - e.x, a = this.y - e.y; return this.x = o * r - a * n + e.x, this.y = o * n + a * r + e.y, this; } random() { return this.x = Math.random(), this.y = Math.random(), this; } } Re.prototype.isVector2 = !0; class ai { 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, r, n, o, a, s, c, l) { const h = this.elements; return h[0] = e, h[1] = n, h[2] = s, h[3] = t, h[4] = o, h[5] = c, h[6] = r, h[7] = a, h[8] = l, this; } identity() { return this.set( 1, 0, 0, 0, 1, 0, 0, 0, 1 ), this; } copy(e) { const t = this.elements, r = e.elements; return t[0] = r[0], t[1] = r[1], t[2] = r[2], t[3] = r[3], t[4] = r[4], t[5] = r[5], t[6] = r[6], t[7] = r[7], t[8] = r[8], this; } extractBasis(e, t, r) { return e.setFromMatrix3Column(this, 0), t.setFromMatrix3Column(this, 1), r.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 r = e.elements, n = t.elements, o = this.elements, a = r[0], s = r[3], c = r[6], l = r[1], h = r[4], u = r[7], p = r[2], m = r[5], g = r[8], d = n[0], y = n[3], f = n[6], v = n[1], _ = n[4], M = n[7], T = n[2], w = n[5], b = n[8]; return o[0] = a * d + s * v + c * T, o[3] = a * y + s * _ + c * w, o[6] = a * f + s * M + c * b, o[1] = l * d + h * v + u * T, o[4] = l * y + h * _ + u * w, o[7] = l * f + h * M + u * b, o[2] = p * d + m * v + g * T, o[5] = p * y + m * _ + g * w, o[8] = p * f + m * M + g * b, 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], r = e[1], n = e[2], o = e[3], a = e[4], s = e[5], c = e[6], l = e[7], h = e[8]; return t * a * h - t * s * l - r * o * h + r * s * c + n * o * l - n * a * c; } invert() { const e = this.elements, t = e[0], r = e[1], n = e[2], o = e[3], a = e[4], s = e[5], c = e[6], l = e[7], h = e[8], u = h * a - s * l, p = s * c - h * o, m = l * o - a * c, g = t * u + r * p + n * m; if (g === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); const d = 1 / g; return e[0] = u * d, e[1] = (n * l - h * r) * d, e[2] = (s * r - n * a) * d, e[3] = p * d, e[4] = (h * t - n * c) * d, e[5] = (n * o - s * t) * d, e[6] = m * d, e[7] = (r * c - l * t) * d, e[8] = (a * t - r * o) * d, 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, r, n, o, a, s) { const c = Math.cos(o), l = Math.sin(o); return this.set( r * c, r * l, -r * (c * a + l * s) + a + e, -n * l, n * c, -n * (-l * a + c * s) + s + t, 0, 0, 1 ), this; } scale(e, t) { const r = this.elements; return r[0] *= e, r[3] *= e, r[6] *= e, r[1] *= t, r[4] *= t, r[7] *= t, this; } rotate(e) { const t = Math.cos(e), r = Math.sin(e), n = this.elements, o = n[0], a = n[3], s = n[6], c = n[1], l = n[4], h = n[7]; return n[0] = t * o + r * c, n[3] = t * a + r * l, n[6] = t * s + r * h, n[1] = -r * o + t * c, n[4] = -r * a + t * l, n[7] = -r * s + t * h, this; } translate(e, t) { const r = this.elements; return r[0] += e * r[2], r[3] += e * r[5], r[6] += e * r[8], r[1] += t * r[2], r[4] += t * r[5], r[7] += t * r[8], this; } equals(e) { const t = this.elements, r = e.elements; for (let n = 0; n < 9; n++) if (t[n] !== r[n]) return !1; return !0; } fromArray(e, t = 0) { for (let r = 0; r < 9; r++) this.elements[r] = e[r + t]; return this; } toArray(e = [], t = 0) { const r = this.elements; return e[t] = r[0], e[t + 1] = r[1], e[t + 2] = r[2], e[t + 3] = r[3], e[t + 4] = r[4], e[t + 5] = r[5], e[t + 6] = r[6], e[t + 7] = r[7], e[t + 8] = r[8], e; } clone() { return new this.constructor().fromArray(this.elements); } } ai.prototype.isMatrix3 = !0; let Ko; class Go { static getDataURL(e) { if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u") return e.src; let t; if (e instanceof HTMLCanvasElement) t = e; else { Ko === void 0 && (Ko = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")), Ko.width = e.width, Ko.height = e.height; const r = Ko.getContext("2d"); e instanceof ImageData ? r.putImageData(e, 0, 0) : r.drawImage(e, 0, 0, e.width, e.height), t = Ko; } 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 bO = 0; class ti extends io { constructor(e = ti.DEFAULT_IMAGE, t = ti.DEFAULT_MAPPING, r = di, n = di, o = Wt, a = bn, s = Xi, c = Po, l = 1, h = Di) { super(), Object.defineProperty(this, "id", { value: bO++ }), this.uuid = Zi(), this.name = "", this.image = e, this.mipmaps = [], this.mapping = t, this.wrapS = r, this.wrapT = n, this.magFilter = o, this.minFilter = a, this.anisotropy = l, this.format = s, this.internalFormat = null, this.type = c, this.offset = new Re(0, 0), this.repeat = new Re(1, 1), this.center = new Re(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new ai(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.encoding = h, 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 r = { 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 n = this.image; if (n.uuid === void 0 && (n.uuid = Zi()), !t && e.images[n.uuid] === void 0) { let o; if (Array.isArray(n)) { o = []; for (let a = 0, s = n.length; a < s; a++) n[a].isDataTexture ? o.push(ah(n[a].image)) : o.push(ah(n[a])); } else o = ah(n); e.images[n.uuid] = { uuid: n.uuid, url: o }; } r.image = n.uuid; } return t || (e.textures[this.uuid] = r), r; } dispose() { this.dispatchEvent({ type: "dispose" }); } transformUv(e) { if (this.mapping !== Su) return e; if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1) switch (this.wrapS) { case Yn: e.x = e.x - Math.floor(e.x); break; case di: e.x = e.x < 0 ? 0 : 1; break; case Na: 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 Yn: e.y = e.y - Math.floor(e.y); break; case di: e.y = e.y < 0 ? 0 : 1; break; case Na: 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++; } } ti.DEFAULT_IMAGE = void 0; ti.DEFAULT_MAPPING = Su; ti.prototype.isTexture = !0; function ah(i) { return typeof HTMLImageElement < "u" && i instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && i instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && i instanceof ImageBitmap ? Go.getDataURL(i) : i.data ? { data: Array.prototype.slice.call(i.data), width: i.width, height: i.height, type: i.data.constructor.name } : (console.warn("THREE.Texture: Unable to serialize Texture."), {}); } class St { constructor(e = 0, t = 0, r = 0, n = 1) { this.x = e, this.y = t, this.z = r, this.w = n; } 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, r, n) { return this.x = e, this.y = t, this.z = r, this.w = n, 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, r = this.y, n = this.z, o = this.w, a = e.elements; return this.x = a[0] * t + a[4] * r + a[8] * n + a[12] * o, this.y = a[1] * t + a[5] * r + a[9] * n + a[13] * o, this.z = a[2] * t + a[6] * r + a[10] * n + a[14] * o, this.w = a[3] * t + a[7] * r + a[11] * n + a[15] * o, 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, r, n, o; const a = e.elements, s = a[0], c = a[4], l = a[8], h = a[1], u = a[5], p = a[9], m = a[2], g = a[6], d = a[10]; if (Math.abs(c - h) < 0.01 && Math.abs(l - m) < 0.01 && Math.abs(p - g) < 0.01) { if (Math.abs(c + h) < 0.1 && Math.abs(l + m) < 0.1 && Math.abs(p + g) < 0.1 && Math.abs(s + u + d - 3) < 0.1) return this.set(1, 0, 0, 0), this; t = Math.PI; const f = (s + 1) / 2, v = (u + 1) / 2, _ = (d + 1) / 2, M = (c + h) / 4, T = (l + m) / 4, w = (p + g) / 4; return f > v && f > _ ? f < 0.01 ? (r = 0, n = 0.707106781, o = 0.707106781) : (r = Math.sqrt(f), n = M / r, o = T / r) : v > _ ? v < 0.01 ? (r = 0.707106781, n = 0, o = 0.707106781) : (n = Math.sqrt(v), r = M / n, o = w / n) : _ < 0.01 ? (r = 0.707106781, n = 0.707106781, o = 0) : (o = Math.sqrt(_), r = T / o, n = w / o), this.set(r, n, o, t), this; } let y = Math.sqrt((g - p) * (g - p) + (l - m) * (l - m) + (h - c) * (h - c)); return Math.abs(y) < 1e-3 && (y = 1), this.x = (g - p) / y, this.y = (l - m) / y, this.z = (h - c) / y, this.w = Math.acos((s + u + d - 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 r = this.length(); return this.divideScalar(r || 1).multiplyScalar(Math.max(e, Math.min(t, r))); } 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, r) { return this.x = e.x + (t.x - e.x) * r, this.y = e.y + (t.y - e.y) * r, this.z = e.z + (t.z - e.z) * r, this.w = e.w + (t.w - e.w) * r, 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, r) { return r !== 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; } } St.prototype.isVector4 = !0; class yr extends io { constructor(e, t, r = {}) { super(), this.width = e, this.height = t, this.depth = 1, this.scissor = new St(0, 0, e, t), this.scissorTest = !1, this.viewport = new St(0, 0, e, t), this.texture = new ti(void 0, r.mapping, r.wrapS, r.wrapT, r.magFilter, r.minFilter, r.format, r.type, r.anisotropy, r.encoding), this.texture.image = { width: e, height: t, depth: 1 }, this.texture.generateMipmaps = r.generateMipmaps !== void 0 ? r.generateMipmaps : !1, this.texture.minFilter = r.minFilter !== void 0 ? r.minFilter : Wt, this.depthBuffer = r.depthBuffer !== void 0 ? r.depthBuffer : !0, this.stencilBuffer = r.stencilBuffer !== void 0 ? r.stencilBuffer : !1, this.depthTexture = r.depthTexture !== void 0 ? r.depthTexture : null; } setTexture(e) { e.image = { width: this.width, height: this.height, depth: this.depth }, this.texture = e; } setSize(e, t, r = 1) { (this.width !== e || this.height !== t || this.depth !== r) && (this.width = e, this.height = t, this.depth = r, this.texture.image.width = e, this.texture.image.height = t, this.texture.image.depth = r, 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" }); } } yr.prototype.isWebGLRenderTarget = !0; class fx extends yr { constructor(e, t, r) { super(e, t); const n = this.texture; this.texture = []; for (let o = 0; o < r; o++) this.texture[o] = n.clone(); } setSize(e, t, r = 1) { if (this.width !== e || this.height !== t || this.depth !== r) { this.width = e, this.height = t, this.depth = r; for (let n = 0, o = this.texture.length; n < o; n++) this.texture[n].image.width = e, this.texture[n].image.height = t, this.texture[n].image.depth = r; 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, r = e.texture.length; t < r; t++) this.texture[t] = e.texture[t].clone(); return this; } } fx.prototype.isWebGLMultipleRenderTargets = !0; class Xp extends yr { constructor(e, t, r) { super(e, t, r), this.samples = 4; } copy(e) { return super.copy.call(this, e), this.samples = e.samples, this; } } Xp.prototype.isWebGLMultisampleRenderTarget = !0; class wi { constructor(e = 0, t = 0, r = 0, n = 1) { this._x = e, this._y = t, this._z = r, this._w = n; } static slerp(e, t, r, n) { return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."), r.slerpQuaternions(e, t, n); } static slerpFlat(e, t, r, n, o, a, s) { let c = r[n + 0], l = r[n + 1], h = r[n + 2], u = r[n + 3]; const p = o[a + 0], m = o[a + 1], g = o[a + 2], d = o[a + 3]; if (s === 0) { e[t + 0] = c, e[t + 1] = l, e[t + 2] = h, e[t + 3] = u; return; } if (s === 1) { e[t + 0] = p, e[t + 1] = m, e[t + 2] = g, e[t + 3] = d; return; } if (u !== d || c !== p || l !== m || h !== g) { let y = 1 - s; const f = c * p + l * m + h * g + u * d, v = f >= 0 ? 1 : -1, _ = 1 - f * f; if (_ > Number.EPSILON) { const T = Math.sqrt(_), w = Math.atan2(T, f * v); y = Math.sin(y * w) / T, s = Math.sin(s * w) / T; } const M = s * v; if (c = c * y + p * M, l = l * y + m * M, h = h * y + g * M, u = u * y + d * M, y === 1 - s) { const T = 1 / Math.sqrt(c * c + l * l + h * h + u * u); c *= T, l *= T, h *= T, u *= T; } } e[t] = c, e[t + 1] = l, e[t + 2] = h, e[t + 3] = u; } static multiplyQuaternionsFlat(e, t, r, n, o, a) { const s = r[n], c = r[n + 1], l = r[n + 2], h = r[n + 3], u = o[a], p = o[a + 1], m = o[a + 2], g = o[a + 3]; return e[t] = s * g + h * u + c * m - l * p, e[t + 1] = c * g + h * p + l * u - s * m, e[t + 2] = l * g + h * m + s * p - c * u, e[t + 3] = h * g - s * u - c * p - l * m, 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, r, n) { return this._x = e, this._y = t, this._z = r, this._w = n, 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 r = e._x, n = e._y, o = e._z, a = e._order, s = Math.cos, c = Math.sin, l = s(r / 2), h = s(n / 2), u = s(o / 2), p = c(r / 2), m = c(n / 2), g = c(o / 2); switch (a) { case "XYZ": this._x = p * h * u + l * m * g, this._y = l * m * u - p * h * g, this._z = l * h * g + p * m * u, this._w = l * h * u - p * m * g; break; case "YXZ": this._x = p * h * u + l * m * g, this._y = l * m * u - p * h * g, this._z = l * h * g - p * m * u, this._w = l * h * u + p * m * g; break; case "ZXY": this._x = p * h * u - l * m * g, this._y = l * m * u + p * h * g, this._z = l * h * g + p * m * u, this._w = l * h * u - p * m * g; break; case "ZYX": this._x = p * h * u - l * m * g, this._y = l * m * u + p * h * g, this._z = l * h * g - p * m * u, this._w = l * h * u + p * m * g; break; case "YZX": this._x = p * h * u + l * m * g, this._y = l * m * u + p * h * g, this._z = l * h * g - p * m * u, this._w = l * h * u - p * m * g; break; case "XZY": this._x = p * h * u - l * m * g, this._y = l * m * u - p * h * g, this._z = l * h * g + p * m * u, this._w = l * h * u + p * m * g; break; default: console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + a); } return t !== !1 && this._onChangeCallback(), this; } setFromAxisAngle(e, t) { const r = t / 2, n = Math.sin(r); return this._x = e.x * n, this._y = e.y * n, this._z = e.z * n, this._w = Math.cos(r), this._onChangeCallback(), this; } setFromRotationMatrix(e) { const t = e.elements, r = t[0], n = t[4], o = t[8], a = t[1], s = t[5], c = t[9], l = t[2], h = t[6], u = t[10], p = r + s + u; if (p > 0) { const m = 0.5 / Math.sqrt(p + 1); this._w = 0.25 / m, this._x = (h - c) * m, this._y = (o - l) * m, this._z = (a - n) * m; } else if (r > s && r > u) { const m = 2 * Math.sqrt(1 + r - s - u); this._w = (h - c) / m, this._x = 0.25 * m, this._y = (n + a) / m, this._z = (o + l) / m; } else if (s > u) { const m = 2 * Math.sqrt(1 + s - r - u); this._w = (o - l) / m, this._x = (n + a) / m, this._y = 0.25 * m, this._z = (c + h) / m; } else { const m = 2 * Math.sqrt(1 + u - r - s); this._w = (a - n) / m, this._x = (o + l) / m, this._y = (c + h) / m, this._z = 0.25 * m; } return this._onChangeCallback(), this; } setFromUnitVectors(e, t) { let r = e.dot(t) + 1; return r < Number.EPSILON ? (r = 0, Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y, this._y = e.x, this._z = 0, this._w = r) : (this._x = 0, this._y = -e.z, this._z = e.y, this._w = r)) : (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 = r), this.normalize(); } angleTo(e) { return 2 * Math.acos(Math.abs(bi(this.dot(e), -1, 1))); } rotateTowards(e, t) { const r = this.angleTo(e); if (r === 0) return this; const n = Math.min(1, t / r); return this.slerp(e, n), 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 r = e._x, n = e._y, o = e._z, a = e._w, s = t._x, c = t._y, l = t._z, h = t._w; return this._x = r * h + a * s + n * l - o * c, this._y = n * h + a * c + o * s - r * l, this._z = o * h + a * l + r * c - n * s, this._w = a * h - r * s - n * c - o * l, this._onChangeCallback(), this; } slerp(e, t) { if (t === 0) return this; if (t === 1) return this.copy(e); const r = this._x, n = this._y, o = this._z, a = this._w; let s = a * e._w + r * e._x + n * e._y + o * e._z; if (s < 0 ? (this._w = -e._w, this._x = -e._x, this._y = -e._y, this._z = -e._z, s = -s) : this.copy(e), s >= 1) return this._w = a, this._x = r, this._y = n, this._z = o, this; const c = 1 - s * s; if (c <= Number.EPSILON) { const m = 1 - t; return this._w = m * a + t * this._w, this._x = m * r + t * this._x, this._y = m * n + t * this._y, this._z = m * o + t * this._z, this.normalize(), this._onChangeCallback(), this; } const l = Math.sqrt(c), h = Math.atan2(l, s), u = Math.sin((1 - t) * h) / l, p = Math.sin(t * h) / l; return this._w = a * u + this._w * p, this._x = r * u + this._x * p, this._y = n * u + this._y * p, this._z = o * u + this._z * p, this._onChangeCallback(), this; } slerpQuaternions(e, t, r) { this.copy(e).slerp(t, r); } 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() { } } wi.prototype.isQuaternion = !0; class Z { constructor(e = 0, t = 0, r = 0) { this.x = e, this.y = t, this.z = r; } set(e, t, r) { return r === void 0 && (r = this.z), this.x = e, this.y = t, this.z = r, 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(dg.setFromEuler(e)); } applyAxisAngle(e, t) { return this.applyQuaternion(dg.setFromAxisAngle(e, t)); } applyMatrix3(e) { const t = this.x, r = this.y, n = this.z, o = e.elements; return this.x = o[0] * t + o[3] * r + o[6] * n, this.y = o[1] * t + o[4] * r + o[7] * n, this.z = o[2] * t + o[5] * r + o[8] * n, this; } applyNormalMatrix(e) { return this.applyMatrix3(e).normalize(); } applyMatrix4(e) { const t = this.x, r = this.y, n = this.z, o = e.elements, a = 1 / (o[3] * t + o[7] * r + o[11] * n + o[15]); return this.x = (o[0] * t + o[4] * r + o[8] * n + o[12]) * a, this.y = (o[1] * t + o[5] * r + o[9] * n + o[13]) * a, this.z = (o[2] * t + o[6] * r + o[10] * n + o[14]) * a, this; } applyQuaternion(e) { const t = this.x, r = this.y, n = this.z, o = e.x, a = e.y, s = e.z, c = e.w, l = c * t + a * n - s * r, h = c * r + s * t - o * n, u = c * n + o * r - a * t, p = -o * t - a * r - s * n; return this.x = l * c + p * -o + h * -s - u * -a, this.y = h * c + p * -a + u * -o - l * -s, this.z = u * c + p * -s + l * -a - h * -o, 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, r = this.y, n = this.z, o = e.elements; return this.x = o[0] * t + o[4] * r + o[8] * n, this.y = o[1] * t + o[5] * r + o[9] * n, this.z = o[2] * t + o[6] * r + o[10] * n, 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 r = this.length(); return this.divideScalar(r || 1).multiplyScalar(Math.max(e, Math.min(t, r))); } 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, r) { return this.x = e.x + (t.x - e.x) * r, this.y = e.y + (t.y - e.y) * r, this.z = e.z + (t.z - e.z) * r, 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 r = e.x, n = e.y, o = e.z, a = t.x, s = t.y, c = t.z; return this.x = n * c - o * s, this.y = o * a - r * c, this.z = r * s - n * a, this; } projectOnVector(e) { const t = e.lengthSq(); if (t === 0) return this.set(0, 0, 0); const r = e.dot(this) / t; return this.copy(e).multiplyScalar(r); } projectOnPlane(e) { return sh.copy(this).projectOnVector(e), this.sub(sh); } reflect(e) { return this.sub(sh.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 r = this.dot(e) / t; return Math.acos(bi(r, -1, 1)); } distanceTo(e) { return Math.sqrt(this.distanceToSquared(e)); } distanceToSquared(e) { const t = this.x - e.x, r = this.y - e.y, n = this.z - e.z; return t * t + r * r + n * n; } 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, r) { const n = Math.sin(t) * e; return this.x = n * Math.sin(r), this.y = Math.cos(t) * e, this.z = n * Math.cos(r), this; } setFromCylindrical(e) { return this.setFromCylindricalCoords(e.radius, e.theta, e.y); } setFromCylindricalCoords(e, t, r) { return this.x = e * Math.sin(t), this.y = r, 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(), r = this.setFromMatrixColumn(e, 1).length(), n = this.setFromMatrixColumn(e, 2).length(); return this.x = t, this.y = r, this.z = n, 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, r) { return r !== 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; } } Z.prototype.isVector3 = !0; const sh = /* @__PURE__ */ new Z(), dg = /* @__PURE__ */ new wi(); class ji { constructor(e = new Z(1 / 0, 1 / 0, 1 / 0), t = new Z(-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, r = 1 / 0, n = 1 / 0, o = -1 / 0, a = -1 / 0, s = -1 / 0; for (let c = 0, l = e.length; c < l; c += 3) { const h = e[c], u = e[c + 1], p = e[c + 2]; h < t && (t = h), u < r && (r = u), p < n && (n = p), h > o && (o = h), u > a && (a = u), p > s && (s = p); } return this.min.set(t, r, n), this.max.set(o, a, s), this; } setFromBufferAttribute(e) { let t = 1 / 0, r = 1 / 0, n = 1 / 0, o = -1 / 0, a = -1 / 0, s = -1 / 0; for (let c = 0, l = e.count; c < l; c++) { const h = e.getX(c), u = e.getY(c), p = e.getZ(c); h < t && (t = h), u < r && (r = u), p < n && (n = p), h > o && (o = h), u > a && (a = u), p > s && (s = p); } return this.min.set(t, r, n), this.max.set(o, a, s), this; } setFromPoints(e) { this.makeEmpty(); for (let t = 0, r = e.length; t < r; t++) this.expandByPoint(e[t]); return this; } setFromCenterAndSize(e, t) { const r = bs.copy(t).multiplyScalar(0.5); return this.min.copy(e).sub(r), this.max.copy(e).add(r), 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(), lh.copy(t.boundingBox), lh.applyMatrix4(e.matrixWorld), this.union(lh)); const r = e.children; for (let n = 0, o = r.length; n < o; n++) this.expandByObject(r[n]); 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, bs), bs.distanceToSquared(e.center) <= e.radius * e.radius; } intersectsPlane(e) { let t, r; return e.normal.x > 0 ? (t = e.normal.x * this.min.x, r = e.normal.x * this.max.x) : (t = e.normal.x * this.max.x, r = e.normal.x * this.min.x), e.normal.y > 0 ? (t += e.normal.y * this.min.y, r += e.normal.y * this.max.y) : (t += e.normal.y * this.max.y, r += e.normal.y * this.min.y), e.normal.z > 0 ? (t += e.normal.z * this.min.z, r += e.normal.z * this.max.z) : (t += e.normal.z * this.max.z, r += e.normal.z * this.min.z), t <= -e.constant && r >= -e.constant; } intersectsTriangle(e) { if (this.isEmpty()) return !1; this.getCenter(xs), Gl.subVectors(this.max, xs), Qo.subVectors(e.a, xs), ea.subVectors(e.b, xs), ta.subVectors(e.c, xs), Mn.subVectors(ea, Qo), Sn.subVectors(ta, ea), co.subVectors(Qo, ta); let t = [ 0, -Mn.z, Mn.y, 0, -Sn.z, Sn.y, 0, -co.z, co.y, Mn.z, 0, -Mn.x, Sn.z, 0, -Sn.x, co.z, 0, -co.x, -Mn.y, Mn.x, 0, -Sn.y, Sn.x, 0, -co.y, co.x, 0 ]; return !ch(t, Qo, ea, ta, Gl) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !ch(t, Qo, ea, ta, Gl)) ? !1 : (Wl.crossVectors(Mn, Sn), t = [Wl.x, Wl.y, Wl.z], ch(t, Qo, ea, ta, Gl)); } clampPoint(e, t) { return t.copy(e).clamp(this.min, this.max); } distanceToPoint(e) { return bs.copy(e).clamp(this.min, this.max).sub(e).length(); } getBoundingSphere(e) { return this.getCenter(e.center), e.radius = this.getSize(bs).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 : (Wr[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), Wr[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), Wr[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), Wr[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), Wr[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), Wr[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), Wr[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), Wr[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(Wr), 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); } } ji.prototype.isBox3 = !0; const Wr = [ /* @__PURE__ */ new Z(), /* @__PURE__ */ new Z(), /* @__PURE__ */ new Z(), /* @__PURE__ */ new Z(), /* @__PURE__ */ new Z(), /* @__PURE__ */ new Z(), /* @__PURE__ */ new Z(), /* @__PURE__ */ new Z() ], bs = /* @__PURE__ */ new Z(), lh = /* @__PURE__ */ new ji(), Qo = /* @__PURE__ */ new Z(), ea = /* @__PURE__ */ new Z(), ta = /* @__PURE__ */ new Z(), Mn = /* @__PURE__ */ new Z(), Sn = /* @__PURE__ */ new Z(), co = /* @__PURE__ */ new Z(), xs = /* @__PURE__ */ new Z(), Gl = /* @__PURE__ */ new Z(), Wl = /* @__PURE__ */ new Z(), uo = /* @__PURE__ */ new Z(); function ch(i, e, t, r, n) { for (let o = 0, a = i.length - 3; o <= a; o += 3) { uo.fromArray(i, o); const s = n.x * Math.abs(uo.x) + n.y * Math.abs(uo.y) + n.z * Math.abs(uo.z), c = e.dot(uo), l = t.dot(uo), h = r.dot(uo); if (Math.max(-Math.max(c, l, h), Math.min(c, l, h)) > s) return !1; } return !0; } const xO = /* @__PURE__ */ new ji(), pg = /* @__PURE__ */ new Z(), uh = /* @__PURE__ */ new Z(), hh = /* @__PURE__ */ new Z(); class xn { constructor(e = new Z(), t = -1) { this.center = e, this.radius = t; } set(e, t) { return this.center.copy(e), this.radius = t, this; } setFromPoints(e, t) { const r = this.center; t !== void 0 ? r.copy(t) : xO.setFromPoints(e).getCenter(r); let n = 0; for (let o = 0, a = e.length; o < a; o++) n = Math.max(n, r.distanceToSquared(e[o])); return this.radius = Math.sqrt(n), 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 r = this.center.distanceToSquared(e); return t.copy(e), r > 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) { hh.subVectors(e, this.center); const t = hh.lengthSq(); if (t > this.radius * this.radius) { const r = Math.sqrt(t), n = (r - this.radius) * 0.5; this.center.add(hh.multiplyScalar(n / r)), this.radius += n; } return this; } union(e) { return uh.subVectors(e.center, this.center).normalize().multiplyScalar(e.radius), this.expandByPoint(pg.copy(e.center).add(uh)), this.expandByPoint(pg.copy(e.center).sub(uh)), this; } equals(e) { return e.center.equals(this.center) && e.radius === this.radius; } clone() { return new this.constructor().copy(this); } } const $r = /* @__PURE__ */ new Z(), dh = /* @__PURE__ */ new Z(), $l = /* @__PURE__ */ new Z(), Tn = /* @__PURE__ */ new Z(), ph = /* @__PURE__ */ new Z(), ql = /* @__PURE__ */ new Z(), fh = /* @__PURE__ */ new Z(); class ro { constructor(e = new Z(), t = new Z(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, $r)), this; } closestPointToPoint(e, t) { t.subVectors(e, this.origin); const r = t.dot(this.direction); return r < 0 ? t.copy(this.origin) : t.copy(this.direction).multiplyScalar(r).add(this.origin); } distanceToPoint(e) { return Math.sqrt(this.distanceSqToPoint(e)); } distanceSqToPoint(e) { const t = $r.subVectors(e, this.origin).dot(this.direction); return t < 0 ? this.origin.distanceToSquared(e) : ($r.copy(this.direction).multiplyScalar(t).add(this.origin), $r.distanceToSquared(e)); } distanceSqToSegment(e, t, r, n) { dh.copy(e).add(t).multiplyScalar(0.5), $l.copy(t).sub(e).normalize(), Tn.copy(this.origin).sub(dh); const o = e.distanceTo(t) * 0.5, a = -this.direction.dot($l), s = Tn.dot(this.direction), c = -Tn.dot($l), l = Tn.lengthSq(), h = Math.abs(1 - a * a); let u, p, m, g; if (h > 0) if (u = a * c - s, p = a * s - c, g = o * h, u >= 0) if (p >= -g) if (p <= g) { const d = 1 / h; u *= d, p *= d, m = u * (u + a * p + 2 * s) + p * (a * u + p + 2 * c) + l; } else p = o, u = Math.max(0, -(a * p + s)), m = -u * u + p * (p + 2 * c) + l; else p = -o, u = Math.max(0, -(a * p + s)), m = -u * u + p * (p + 2 * c) + l; else p <= -g ? (u = Math.max(0, -(-a * o + s)), p = u > 0 ? -o : Math.min(Math.max(-o, -c), o), m = -u * u + p * (p + 2 * c) + l) : p <= g ? (u = 0, p = Math.min(Math.max(-o, -c), o), m = p * (p + 2 * c) + l) : (u = Math.max(0, -(a * o + s)), p = u > 0 ? o : Math.min(Math.max(-o, -c), o), m = -u * u + p * (p + 2 * c) + l); else p = a > 0 ? -o : o, u = Math.max(0, -(a * p + s)), m = -u * u + p * (p + 2 * c) + l; return r && r.copy(this.direction).multiplyScalar(u).add(this.origin), n && n.copy($l).multiplyScalar(p).add(dh), m; } intersectSphere(e, t) { $r.subVectors(e.center, this.origin); const r = $r.dot(this.direction), n = $r.dot($r) - r * r, o = e.radius * e.radius; if (n > o) return null; const a = Math.sqrt(o - n), s = r - a, c = r + a; return s < 0 && c < 0 ? null : s < 0 ? this.at(c, t) : this.at(s, 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 r = -(this.origin.dot(e.normal) + e.constant) / t; return r >= 0 ? r : null; } intersectPlane(e, t) { const r = this.distanceToPlane(e); return r === null ? null : this.at(r, t); } intersectsPlane(e) { const t = e.distanceToPoint(this.origin); return t === 0 || e.normal.dot(this.direction) * t < 0; } intersectBox(e, t) { let r, n, o, a, s, c; const l = 1 / this.direction.x, h = 1 / this.direction.y, u = 1 / this.direction.z, p = this.origin; return l >= 0 ? (r = (e.min.x - p.x) * l, n = (e.max.x - p.x) * l) : (r = (e.max.x - p.x) * l, n = (e.min.x - p.x) * l), h >= 0 ? (o = (e.min.y - p.y) * h, a = (e.max.y - p.y) * h) : (o = (e.max.y - p.y) * h, a = (e.min.y - p.y) * h), r > a || o > n || ((o > r || r !== r) && (r = o), (a < n || n !== n) && (n = a), u >= 0 ? (s = (e.min.z - p.z) * u, c = (e.max.z - p.z) * u) : (s = (e.max.z - p.z) * u, c = (e.min.z - p.z) * u), r > c || s > n) || ((s > r || r !== r) && (r = s), (c < n || n !== n) && (n = c), n < 0) ? null : this.at(r >= 0 ? r : n, t); } intersectsBox(e) { return this.intersectBox(e, $r) !== null; } intersectTriangle(e, t, r, n, o) { ph.subVectors(t, e), ql.subVectors(r, e), fh.crossVectors(ph, ql); let a = this.direction.dot(fh), s; if (a > 0) { if (n) return null; s = 1; } else if (a < 0) s = -1, a = -a; else return null; Tn.subVectors(this.origin, e); const c = s * this.direction.dot(ql.crossVectors(Tn, ql)); if (c < 0) return null; const l = s * this.direction.dot(ph.cross(Tn)); if (l < 0 || c + l > a) return null; const h = -s * Tn.dot(fh); return h < 0 ? null : this.at(h / a, o); } 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, r, n, o, a, s, c, l, h, u, p, m, g, d, y) { const f = this.elements; return f[0] = e, f[4] = t, f[8] = r, f[12] = n, f[1] = o, f[5] = a, f[9] = s, f[13] = c, f[2] = l, f[6] = h, f[10] = u, f[14] = p, f[3] = m, f[7] = g, f[11] = d, f[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, r = e.elements; return t[0] = r[0], t[1] = r[1], t[2] = r[2], t[3] = r[3], t[4] = r[4], t[5] = r[5], t[6] = r[6], t[7] = r[7], t[8] = r[8], t[9] = r[9], t[10] = r[10], t[11] = r[11], t[12] = r[12], t[13] = r[13], t[14] = r[14], t[15] = r[15], this; } copyPosition(e) { const t = this.elements, r = e.elements; return t[12] = r[12], t[13] = r[13], t[14] = r[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, r) { return e.setFromMatrixColumn(this, 0), t.setFromMatrixColumn(this, 1), r.setFromMatrixColumn(this, 2), this; } makeBasis(e, t, r) { return this.set( e.x, t.x, r.x, 0, e.y, t.y, r.y, 0, e.z, t.z, r.z, 0, 0, 0, 0, 1 ), this; } extractRotation(e) { const t = this.elements, r = e.elements, n = 1 / ia.setFromMatrixColumn(e, 0).length(), o = 1 / ia.setFromMatrixColumn(e, 1).length(), a = 1 / ia.setFromMatrixColumn(e, 2).length(); return t[0] = r[0] * n, t[1] = r[1] * n, t[2] = r[2] * n, t[3] = 0, t[4] = r[4] * o, t[5] = r[5] * o, t[6] = r[6] * o, t[7] = 0, t[8] = r[8] * a, t[9] = r[9] * a, t[10] = r[10] * a, 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, r = e.x, n = e.y, o = e.z, a = Math.cos(r), s = Math.sin(r), c = Math.cos(n), l = Math.sin(n), h = Math.cos(o), u = Math.sin(o); if (e.order === "XYZ") { const p = a * h, m = a * u, g = s * h, d = s * u; t[0] = c * h, t[4] = -c * u, t[8] = l, t[1] = m + g * l, t[5] = p - d * l, t[9] = -s * c, t[2] = d - p * l, t[6] = g + m * l, t[10] = a * c; } else if (e.order === "YXZ") { const p = c * h, m = c * u, g = l * h, d = l * u; t[0] = p + d * s, t[4] = g * s - m, t[8] = a * l, t[1] = a * u, t[5] = a * h, t[9] = -s, t[2] = m * s - g, t[6] = d + p * s, t[10] = a * c; } else if (e.order === "ZXY") { const p = c * h, m = c * u, g = l * h, d = l * u; t[0] = p - d * s, t[4] = -a * u, t[8] = g + m * s, t[1] = m + g * s, t[5] = a * h, t[9] = d - p * s, t[2] = -a * l, t[6] = s, t[10] = a * c; } else if (e.order === "ZYX") { const p = a * h, m = a * u, g = s * h, d = s * u; t[0] = c * h, t[4] = g * l - m, t[8] = p * l + d, t[1] = c * u, t[5] = d * l + p, t[9] = m * l - g, t[2] = -l, t[6] = s * c, t[10] = a * c; } else if (e.order === "YZX") { const p = a * c, m = a * l, g = s * c, d = s * l; t[0] = c * h, t[4] = d - p * u, t[8] = g * u + m, t[1] = u, t[5] = a * h, t[9] = -s * h, t[2] = -l * h, t[6] = m * u + g, t[10] = p - d * u; } else if (e.order === "XZY") { const p = a * c, m = a * l, g = s * c, d = s * l; t[0] = c * h, t[4] = -u, t[8] = l * h, t[1] = p * u + d, t[5] = a * h, t[9] = m * u - g, t[2] = g * u - m, t[6] = s * h, t[10] = d * u + 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(wO, e, _O); } lookAt(e, t, r) { const n = this.elements; return Gi.subVectors(e, t), Gi.lengthSq() === 0 && (Gi.z = 1), Gi.normalize(), En.crossVectors(r, Gi), En.lengthSq() === 0 && (Math.abs(r.z) === 1 ? Gi.x += 1e-4 : Gi.z += 1e-4, Gi.normalize(), En.crossVectors(r, Gi)), En.normalize(), Xl.crossVectors(Gi, En), n[0] = En.x, n[4] = Xl.x, n[8] = Gi.x, n[1] = En.y, n[5] = Xl.y, n[9] = Gi.y, n[2] = En.z, n[6] = Xl.z, n[10] = Gi.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 r = e.elements, n = t.elements, o = this.elements, a = r[0], s = r[4], c = r[8], l = r[12], h = r[1], u = r[5], p = r[9], m = r[13], g = r[2], d = r[6], y = r[10], f = r[14], v = r[3], _ = r[7], M = r[11], T = r[15], w = n[0], b = n[4], E = n[8], S = n[12], C = n[1], R = n[5], L = n[9], A = n[13], P = n[2], O = n[6], x = n[10], I = n[14], N = n[3], D = n[7], k = n[11], F = n[15]; return o[0] = a * w + s * C + c * P + l * N, o[4] = a * b + s * R + c * O + l * D, o[8] = a * E + s * L + c * x + l * k, o[12] = a * S + s * A + c * I + l * F, o[1] = h * w + u * C + p * P + m * N, o[5] = h * b + u * R + p * O + m * D, o[9] = h * E + u * L + p * x + m * k, o[13] = h * S + u * A + p * I + m * F, o[2] = g * w + d * C + y * P + f * N, o[6] = g * b + d * R + y * O + f * D, o[10] = g * E + d * L + y * x + f * k, o[14] = g * S + d * A + y * I + f * F, o[3] = v * w + _ * C + M * P + T * N, o[7] = v * b + _ * R + M * O + T * D, o[11] = v * E + _ * L + M * x + T * k, o[15] = v * S + _ * A + M * I + T * F, 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], r = e[4], n = e[8], o = e[12], a = e[1], s = e[5], c = e[9], l = e[13], h = e[2], u = e[6], p = e[10], m = e[14], g = e[3], d = e[7], y = e[11], f = e[15]; return g * (+o * c * u - n * l * u - o * s * p + r * l * p + n * s * m - r * c * m) + d * (+t * c * m - t * l * p + o * a * p - n * a * m + n * l * h - o * c * h) + y * (+t * l * u - t * s * m - o * a * u + r * a * m + o * s * h - r * l * h) + f * (-n * s * h - t * c * u + t * s * p + n * a * u - r * a * p + r * c * h); } 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, r) { const n = this.elements; return e.isVector3 ? (n[12] = e.x, n[13] = e.y, n[14] = e.z) : (n[12] = e, n[13] = t, n[14] = r), this; } invert() { const e = this.elements, t = e[0], r = e[1], n = e[2], o = e[3], a = e[4], s = e[5], c = e[6], l = e[7], h = e[8], u = e[9], p = e[10], m = e[11], g = e[12], d = e[13], y = e[14], f = e[15], v = u * y * l - d * p * l + d * c * m - s * y * m - u * c * f + s * p * f, _ = g * p * l - h * y * l - g * c * m + a * y * m + h * c * f - a * p * f, M = h * d * l - g * u * l + g * s * m - a * d * m - h * s * f + a * u * f, T = g * u * c - h * d * c - g * s * p + a * d * p + h * s * y - a * u * y, w = t * v + r * _ + n * M + o * T; if (w === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); const b = 1 / w; return e[0] = v * b, e[1] = (d * p * o - u * y * o - d * n * m + r * y * m + u * n * f - r * p * f) * b, e[2] = (s * y * o - d * c * o + d * n * l - r * y * l - s * n * f + r * c * f) * b, e[3] = (u * c * o - s * p * o - u * n * l + r * p * l + s * n * m - r * c * m) * b, e[4] = _ * b, e[5] = (h * y * o - g * p * o + g * n * m - t * y * m - h * n * f + t * p * f) * b, e[6] = (g * c * o - a * y * o - g * n * l + t * y * l + a * n * f - t * c * f) * b, e[7] = (a * p * o - h * c * o + h * n * l - t * p * l - a * n * m + t * c * m) * b, e[8] = M * b, e[9] = (g * u * o - h * d * o - g * r * m + t * d * m + h * r * f - t * u * f) * b, e[10] = (a * d * o - g * s * o + g * r * l - t * d * l - a * r * f + t * s * f) * b, e[11] = (h * s * o - a * u * o - h * r * l + t * u * l + a * r * m - t * s * m) * b, e[12] = T * b, e[13] = (h * d * n - g * u * n + g * r * p - t * d * p - h * r * y + t * u * y) * b, e[14] = (g * s * n - a * d * n - g * r * c + t * d * c + a * r * y - t * s * y) * b, e[15] = (a * u * n - h * s * n + h * r * c - t * u * c - a * r * p + t * s * p) * b, this; } scale(e) { const t = this.elements, r = e.x, n = e.y, o = e.z; return t[0] *= r, t[4] *= n, t[8] *= o, t[1] *= r, t[5] *= n, t[9] *= o, t[2] *= r, t[6] *= n, t[10] *= o, t[3] *= r, t[7] *= n, t[11] *= o, this; } getMaxScaleOnAxis() { const e = this.elements, t = e[0] * e[0] + e[1] * e[1] + e[2] * e[2], r = e[4] * e[4] + e[5] * e[5] + e[6] * e[6], n = e[8] * e[8] + e[9] * e[9] + e[10] * e[10]; return Math.sqrt(Math.max(t, r, n)); } makeTranslation(e, t, r) { return this.set( 1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, r, 0, 0, 0, 1 ), this; } makeRotationX(e) { const t = Math.cos(e), r = Math.sin(e); return this.set( 1, 0, 0, 0, 0, t, -r, 0, 0, r, t, 0, 0, 0, 0, 1 ), this; } makeRotationY(e) { const t = Math.cos(e), r = Math.sin(e); return this.set( t, 0, r, 0, 0, 1, 0, 0, -r, 0, t, 0, 0, 0, 0, 1 ), this; } makeRotationZ(e) { const t = Math.cos(e), r = Math.sin(e); return this.set( t, -r, 0, 0, r, t, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ), this; } makeRotationAxis(e, t) { const r = Math.cos(t), n = Math.sin(t), o = 1 - r, a = e.x, s = e.y, c = e.z, l = o * a, h = o * s; return this.set( l * a + r, l * s - n * c, l * c + n * s, 0, l * s + n * c, h * s + r, h * c - n * a, 0, l * c - n * s, h * c + n * a, o * c * c + r, 0, 0, 0, 0, 1 ), this; } makeScale(e, t, r) { return this.set( e, 0, 0, 0, 0, t, 0, 0, 0, 0, r, 0, 0, 0, 0, 1 ), this; } makeShear(e, t, r, n, o, a) { return this.set( 1, r, o, 0, e, 1, a, 0, t, n, 1, 0, 0, 0, 0, 1 ), this; } compose(e, t, r) { const n = this.elements, o = t._x, a = t._y, s = t._z, c = t._w, l = o + o, h = a + a, u = s + s, p = o * l, m = o * h, g = o * u, d = a * h, y = a * u, f = s * u, v = c * l, _ = c * h, M = c * u, T = r.x, w = r.y, b = r.z; return n[0] = (1 - (d + f)) * T, n[1] = (m + M) * T, n[2] = (g - _) * T, n[3] = 0, n[4] = (m - M) * w, n[5] = (1 - (p + f)) * w, n[6] = (y + v) * w, n[7] = 0, n[8] = (g + _) * b, n[9] = (y - v) * b, n[10] = (1 - (p + d)) * b, n[11] = 0, n[12] = e.x, n[13] = e.y, n[14] = e.z, n[15] = 1, this; } decompose(e, t, r) { const n = this.elements; let o = ia.set(n[0], n[1], n[2]).length(); const a = ia.set(n[4], n[5], n[6]).length(), s = ia.set(n[8], n[9], n[10]).length(); this.determinant() < 0 && (o = -o), e.x = n[12], e.y = n[13], e.z = n[14], ur.copy(this); const c = 1 / o, l = 1 / a, h = 1 / s; return ur.elements[0] *= c, ur.elements[1] *= c, ur.elements[2] *= c, ur.elements[4] *= l, ur.elements[5] *= l, ur.elements[6] *= l, ur.elements[8] *= h, ur.elements[9] *= h, ur.elements[10] *= h, t.setFromRotationMatrix(ur), r.x = o, r.y = a, r.z = s, this; } makePerspective(e, t, r, n, o, a) { a === void 0 && console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); const s = this.elements, c = 2 * o / (t - e), l = 2 * o / (r - n), h = (t + e) / (t - e), u = (r + n) / (r - n), p = -(a + o) / (a - o), m = -2 * a * o / (a - o); return s[0] = c, s[4] = 0, s[8] = h, s[12] = 0, s[1] = 0, s[5] = l, s[9] = u, s[13] = 0, s[2] = 0, s[6] = 0, s[10] = p, s[14] = m, s[3] = 0, s[7] = 0, s[11] = -1, s[15] = 0, this; } makeOrthographic(e, t, r, n, o, a) { const s = this.elements, c = 1 / (t - e), l = 1 / (r - n), h = 1 / (a - o), u = (t + e) * c, p = (r + n) * l, m = (a + o) * h; return s[0] = 2 * c, s[4] = 0, s[8] = 0, s[12] = -u, s[1] = 0, s[5] = 2 * l, s[9] = 0, s[13] = -p, s[2] = 0, s[6] = 0, s[10] = -2 * h, s[14] = -m, s[3] = 0, s[7] = 0, s[11] = 0, s[15] = 1, this; } equals(e) { const t = this.elements, r = e.elements; for (let n = 0; n < 16; n++) if (t[n] !== r[n]) return !1; return !0; } fromArray(e, t = 0) { for (let r = 0; r < 16; r++) this.elements[r] = e[r + t]; return this; } toArray(e = [], t = 0) { const r = this.elements; return e[t] = r[0], e[t + 1] = r[1], e[t + 2] = r[2], e[t + 3] = r[3], e[t + 4] = r[4], e[t + 5] = r[5], e[t + 6] = r[6], e[t + 7] = r[7], e[t + 8] = r[8], e[t + 9] = r[9], e[t + 10] = r[10], e[t + 11] = r[11], e[t + 12] = r[12], e[t + 13] = r[13], e[t + 14] = r[14], e[t + 15] = r[15], e; } } $e.prototype.isMatrix4 = !0; const ia = /* @__PURE__ */ new Z(), ur = /* @__PURE__ */ new $e(), wO = /* @__PURE__ */ new Z(0, 0, 0), _O = /* @__PURE__ */ new Z(1, 1, 1), En = /* @__PURE__ */ new Z(), Xl = /* @__PURE__ */ new Z(), Gi = /* @__PURE__ */ new Z(), fg = /* @__PURE__ */ new $e(), mg = /* @__PURE__ */ new wi(); class Wo { constructor(e = 0, t = 0, r = 0, n = Wo.DefaultOrder) { this._x = e, this._y = t, this._z = r, this._order = n; } 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, r, n = this._order) { return this._x = e, this._y = t, this._z = r, this._order = n, 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, r = !0) { const n = e.elements, o = n[0], a = n[4], s = n[8], c = n[1], l = n[5], h = n[9], u = n[2], p = n[6], m = n[10]; switch (t) { case "XYZ": this._y = Math.asin(bi(s, -1, 1)), Math.abs(s) < 0.9999999 ? (this._x = Math.atan2(-h, m), this._z = Math.atan2(-a, o)) : (this._x = Math.atan2(p, l), this._z = 0); break; case "YXZ": this._x = Math.asin(-bi(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._y = Math.atan2(s, m), this._z = Math.atan2(c, l)) : (this._y = Math.atan2(-u, o), this._z = 0); break; case "ZXY": this._x = Math.asin(bi(p, -1, 1)), Math.abs(p) < 0.9999999 ? (this._y = Math.atan2(-u, m), this._z = Math.atan2(-a, l)) : (this._y = 0, this._z = Math.atan2(c, o)); break; case "ZYX": this._y = Math.asin(-bi(u, -1, 1)), Math.abs(u) < 0.9999999 ? (this._x = Math.atan2(p, m), this._z = Math.atan2(c, o)) : (this._x = 0, this._z = Math.atan2(-a, l)); break; case "YZX": this._z = Math.asin(bi(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._x = Math.atan2(-h, l), this._y = Math.atan2(-u, o)) : (this._x = 0, this._y = Math.atan2(s, m)); break; case "XZY": this._z = Math.asin(-bi(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(p, l), this._y = Math.atan2(s, o)) : (this._x = Math.atan2(-h, m), this._y = 0); break; default: console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + t); } return this._order = t, r === !0 && this._onChangeCallback(), this; } setFromQuaternion(e, t, r) { return fg.makeRotationFromQuaternion(e), this.setFromRotationMatrix(fg, t, r); } setFromVector3(e, t = this._order) { return this.set(e.x, e.y, e.z, t); } reorder(e) { return mg.setFromEuler(this), this.setFromQuaternion(mg, 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 Z(this._x, this._y, this._z); } _onChange(e) { return this._onChangeCallback = e, this; } _onChangeCallback() { } } Wo.prototype.isEuler = !0; Wo.DefaultOrder = "XYZ"; Wo.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"]; class Zp { 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 MO = 0; const gg = /* @__PURE__ */ new Z(), ra = /* @__PURE__ */ new wi(), qr = /* @__PURE__ */ new $e(), Zl = /* @__PURE__ */ new Z(), ws = /* @__PURE__ */ new Z(), SO = /* @__PURE__ */ new Z(), TO = /* @__PURE__ */ new wi(), vg = /* @__PURE__ */ new Z(1, 0, 0), yg = /* @__PURE__ */ new Z(0, 1, 0), bg = /* @__PURE__ */ new Z(0, 0, 1), EO = { type: "added" }, xg = { type: "removed" }; class ot extends io { constructor() { super(), Object.defineProperty(this, "id", { value: MO++ }), this.uuid = Zi(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = ot.DefaultUp.clone(); const e = new Z(), t = new Wo(), r = new wi(), n = new Z(1, 1, 1); function o() { r.setFromEuler(t, !1); } function a() { t.setFromQuaternion(r, void 0, !1); } t._onChange(o), r._onChange(a), Object.defineProperties(this, { position: { configurable: !0, enumerable: !0, value: e }, rotation: { configurable: !0, enumerable: !0, value: t }, quaternion: { configurable: !0, enumerable: !0, value: r }, scale: { configurable: !0, enumerable: !0, value: n }, modelViewMatrix: { value: new $e() }, normalMatrix: { value: new ai() } }), this.matrix = new $e(), this.matrixWorld = new $e(), this.matrixAutoUpdate = ot.DefaultMatrixAutoUpdate, this.matrixWorldNeedsUpdate = !1, this.layers = new Zp(), 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 ra.setFromAxisAngle(e, t), this.quaternion.multiply(ra), this; } rotateOnWorldAxis(e, t) { return ra.setFromAxisAngle(e, t), this.quaternion.premultiply(ra), this; } rotateX(e) { return this.rotateOnAxis(vg, e); } rotateY(e) { return this.rotateOnAxis(yg, e); } rotateZ(e) { return this.rotateOnAxis(bg, e); } translateOnAxis(e, t) { return gg.copy(e).applyQuaternion(this.quaternion), this.position.add(gg.multiplyScalar(t)), this; } translateX(e) { return this.translateOnAxis(vg, e); } translateY(e) { return this.translateOnAxis(yg, e); } translateZ(e) { return this.translateOnAxis(bg, e); } localToWorld(e) { return e.applyMatrix4(this.matrixWorld); } worldToLocal(e) { return e.applyMatrix4(qr.copy(this.matrixWorld).invert()); } lookAt(e, t, r) { e.isVector3 ? Zl.copy(e) : Zl.set(e, t, r); const n = this.parent; this.updateWorldMatrix(!0, !1), ws.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? qr.lookAt(ws, Zl, this.up) : qr.lookAt(Zl, ws, this.up), this.quaternion.setFromRotationMatrix(qr), n && (qr.extractRotation(n.matrixWorld), ra.setFromRotationMatrix(qr), this.quaternion.premultiply(ra.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(EO)) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this); } remove(e) { if (arguments.length > 1) { for (let r = 0; r < arguments.length; r++) this.remove(arguments[r]); return this; } const t = this.children.indexOf(e); return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(xg)), 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(xg); } return this.children.length = 0, this; } attach(e) { return this.updateWorldMatrix(!0, !1), qr.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), qr.multiply(e.parent.matrixWorld)), e.applyMatrix4(qr), 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 r = 0, n = this.children.length; r < n; r++) { const o = this.children[r].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(ws, e, SO), e; } getWorldScale(e) { return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(ws, TO, 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 r = 0, n = t.length; r < n; r++) t[r].traverse(e); } traverseVisible(e) { if (this.visible === !1) return; e(this); const t = this.children; for (let r = 0, n = t.length; r < n; r++) t[r].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 r = 0, n = t.length; r < n; r++) t[r].updateMatrixWorld(e); } updateWorldMatrix(e, t) { const r = this.parent; if (e === !0 && r !== null && r.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 n = this.children; for (let o = 0, a = n.length; o < a; o++) n[o].updateWorldMatrix(!1, !0); } } toJSON(e) { const t = e === void 0 || typeof e == "string", r = {}; t && (e = { geometries: {}, materials: {}, textures: {}, images: {}, shapes: {}, skeletons: {}, animations: {} }, r.metadata = { version: 4.5, type: "Object", generator: "Object3D.toJSON" }); const n = {}; n.uuid = this.uuid, n.type = this.type, this.name !== "" && (n.name = this.name), this.castShadow === !0 && (n.castShadow = !0), this.receiveShadow === !0 && (n.receiveShadow = !0), this.visible === !1 && (n.visible = !1), this.frustumCulled === !1 && (n.frustumCulled = !1), this.renderOrder !== 0 && (n.renderOrder = this.renderOrder), JSON.stringify(this.userData) !== "{}" && (n.userData = this.userData), n.layers = this.layers.mask, n.matrix = this.matrix.toArray(), this.matrixAutoUpdate === !1 && (n.matrixAutoUpdate = !1), this.isInstancedMesh && (n.type = "InstancedMesh", n.count = this.count, n.instanceMatrix = this.instanceMatrix.toJSON(), this.instanceColor !== null && (n.instanceColor = this.instanceColor.toJSON())); function o(s, c) { return s[c.uuid] === void 0 && (s[c.uuid] = c.toJSON(e)), c.uuid; } if (this.isScene) this.background && (this.background.isColor ? n.background = this.background.toJSON() : this.background.isTexture && (n.background = this.background.toJSON(e).uuid)), this.environment && this.environment.isTexture && (n.environment = this.environment.toJSON(e).uuid); else if (this.isMesh || this.isLine || this.isPoints) { n.geometry = o(e.geometries, this.geometry); const s = this.geometry.parameters; if (s !== void 0 && s.shapes !== void 0) { const c = s.shapes; if (Array.isArray(c)) for (let l = 0, h = c.length; l < h; l++) { const u = c[l]; o(e.shapes, u); } else o(e.shapes, c); } } if (this.isSkinnedMesh && (n.bindMode = this.bindMode, n.bindMatrix = this.bindMatrix.toArray(), this.skeleton !== void 0 && (o(e.skeletons, this.skeleton), n.skeleton = this.skeleton.uuid)), this.material !== void 0) if (Array.isArray(this.material)) { const s = []; for (let c = 0, l = this.material.length; c < l; c++) s.push(o(e.materials, this.material[c])); n.material = s; } else n.material = o(e.materials, this.material); if (this.children.length > 0) { n.children = []; for (let s = 0; s < this.children.length; s++) n.children.push(this.children[s].toJSON(e).object); } if (this.animations.length > 0) { n.animations = []; for (let s = 0; s < this.animations.length; s++) { const c = this.animations[s]; n.animations.push(o(e.animations, c)); } } if (t) { const s = a(e.geometries), c = a(e.materials), l = a(e.textures), h = a(e.images), u = a(e.shapes), p = a(e.skeletons), m = a(e.animations); s.length > 0 && (r.geometries = s), c.length > 0 && (r.materials = c), l.length > 0 && (r.textures = l), h.length > 0 && (r.images = h), u.length > 0 && (r.shapes = u), p.length > 0 && (r.skeletons = p), m.length > 0 && (r.animations = m); } return r.object = n, r; function a(s) { const c = []; for (const l in s) { const h = s[l]; delete h.metadata, c.push(h); } 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 r = 0; r < e.children.length; r++) { const n = e.children[r]; this.add(n.clone()); } return this; } } ot.DefaultUp = new Z(0, 1, 0); ot.DefaultMatrixAutoUpdate = !0; ot.prototype.isObject3D = !0; const hr = /* @__PURE__ */ new Z(), Xr = /* @__PURE__ */ new Z(), mh = /* @__PURE__ */ new Z(), Zr = /* @__PURE__ */ new Z(), na = /* @__PURE__ */ new Z(), oa = /* @__PURE__ */ new Z(), wg = /* @__PURE__ */ new Z(), gh = /* @__PURE__ */ new Z(), vh = /* @__PURE__ */ new Z(), yh = /* @__PURE__ */ new Z(); class Kt { constructor(e = new Z(), t = new Z(), r = new Z()) { this.a = e, this.b = t, this.c = r; } static getNormal(e, t, r, n) { n.subVectors(r, t), hr.subVectors(e, t), n.cross(hr); const o = n.lengthSq(); return o > 0 ? n.multiplyScalar(1 / Math.sqrt(o)) : n.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, r, n, o) { hr.subVectors(n, t), Xr.subVectors(r, t), mh.subVectors(e, t); const a = hr.dot(hr), s = hr.dot(Xr), c = hr.dot(mh), l = Xr.dot(Xr), h = Xr.dot(mh), u = a * l - s * s; if (u === 0) return o.set(-2, -1, -1); const p = 1 / u, m = (l * c - s * h) * p, g = (a * h - s * c) * p; return o.set(1 - m - g, g, m); } static containsPoint(e, t, r, n) { return this.getBarycoord(e, t, r, n, Zr), Zr.x >= 0 && Zr.y >= 0 && Zr.x + Zr.y <= 1; } static getUV(e, t, r, n, o, a, s, c) { return this.getBarycoord(e, t, r, n, Zr), c.set(0, 0), c.addScaledVector(o, Zr.x), c.addScaledVector(a, Zr.y), c.addScaledVector(s, Zr.z), c; } static isFrontFacing(e, t, r, n) { return hr.subVectors(r, t), Xr.subVectors(e, t), hr.cross(Xr).dot(n) < 0; } set(e, t, r) { return this.a.copy(e), this.b.copy(t), this.c.copy(r), this; } setFromPointsAndIndices(e, t, r, n) { return this.a.copy(e[t]), this.b.copy(e[r]), this.c.copy(e[n]), 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 hr.subVectors(this.c, this.b), Xr.subVectors(this.a, this.b), hr.cross(Xr).length() * 0.5; } getMidpoint(e) { return e.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3); } getNormal(e) { return Kt.getNormal(this.a, this.b, this.c, e); } getPlane(e) { return e.setFromCoplanarPoints(this.a, this.b, this.c); } getBarycoord(e, t) { return Kt.getBarycoord(e, this.a, this.b, this.c, t); } getUV(e, t, r, n, o) { return Kt.getUV(e, this.a, this.b, this.c, t, r, n, o); } containsPoint(e) { return Kt.containsPoint(e, this.a, this.b, this.c); } isFrontFacing(e) { return Kt.isFrontFacing(this.a, this.b, this.c, e); } intersectsBox(e) { return e.intersectsTriangle(this); } closestPointToPoint(e, t) { const r = this.a, n = this.b, o = this.c; let a, s; na.subVectors(n, r), oa.subVectors(o, r), gh.subVectors(e, r); const c = na.dot(gh), l = oa.dot(gh); if (c <= 0 && l <= 0) return t.copy(r); vh.subVectors(e, n); const h = na.dot(vh), u = oa.dot(vh); if (h >= 0 && u <= h) return t.copy(n); const p = c * u - h * l; if (p <= 0 && c >= 0 && h <= 0) return a = c / (c - h), t.copy(r).addScaledVector(na, a); yh.subVectors(e, o); const m = na.dot(yh), g = oa.dot(yh); if (g >= 0 && m <= g) return t.copy(o); const d = m * l - c * g; if (d <= 0 && l >= 0 && g <= 0) return s = l / (l - g), t.copy(r).addScaledVector(oa, s); const y = h * g - m * u; if (y <= 0 && u - h >= 0 && m - g >= 0) return wg.subVectors(o, n), s = (u - h) / (u - h + (m - g)), t.copy(n).addScaledVector(wg, s); const f = 1 / (y + d + p); return a = d * f, s = p * f, t.copy(r).addScaledVector(na, a).addScaledVector(oa, s); } equals(e) { return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c); } } let AO = 0; class ri extends io { constructor() { super(), Object.defineProperty(this, "id", { value: AO++ }), this.uuid = Zi(), this.name = "", this.type = "Material", this.fog = !0, this.blending = Sa, this.side = Xn, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.blendSrc = Up, this.blendDst = Vp, this.blendEquation = bo, 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 = Vc, this.stencilZFail = Vc, this.stencilZPass = Vc, 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 r = e[t]; if (r === 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 = r === zp; continue; } const n = this[t]; if (n === void 0) { console.warn("THREE." + this.type + ": '" + t + "' is not a property of this material."); continue; } n && n.isColor ? n.set(r) : n && n.isVector3 && r && r.isVector3 ? n.copy(r) : this[t] = r; } } toJSON(e) { const t = e === void 0 || typeof e == "string"; t && (e = { textures: {}, images: {} }); const r = { metadata: { version: 4.5, type: "Material", generator: "Material.toJSON" } }; r.uuid = this.uuid, r.type = this.type, this.name !== "" && (r.name = this.name), this.color && this.color.isColor && (r.color = this.color.getHex()), this.roughness !== void 0 && (r.roughness = this.roughness), this.metalness !== void 0 && (r.metalness = this.metalness), this.sheen && this.sheen.isColor && (r.sheen = this.sheen.getHex()), this.emissive && this.emissive.isColor && (r.emissive = this.emissive.getHex()), this.emissiveIntensity && this.emissiveIntensity !== 1 && (r.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (r.specular = this.specular.getHex()), this.shininess !== void 0 && (r.shininess = this.shininess), this.clearcoat !== void 0 && (r.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (r.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (r.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (r.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (r.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, r.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.map && this.map.isTexture && (r.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (r.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (r.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (r.lightMap = this.lightMap.toJSON(e).uuid, r.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (r.aoMap = this.aoMap.toJSON(e).uuid, r.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (r.bumpMap = this.bumpMap.toJSON(e).uuid, r.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (r.normalMap = this.normalMap.toJSON(e).uuid, r.normalMapType = this.normalMapType, r.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (r.displacementMap = this.displacementMap.toJSON(e).uuid, r.displacementScale = this.displacementScale, r.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (r.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (r.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (r.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (r.specularMap = this.specularMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (r.envMap = this.envMap.toJSON(e).uuid, this.combine !== void 0 && (r.combine = this.combine)), this.envMapIntensity !== void 0 && (r.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (r.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (r.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (r.gradientMap = this.gradientMap.toJSON(e).uuid), this.transmission !== void 0 && (r.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (r.transmissionMap = this.transmissionMap.toJSON(e).uuid), this.thickness !== void 0 && (r.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (r.thicknessMap = this.thicknessMap.toJSON(e).uuid), this.attenuationDistance !== void 0 && (r.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (r.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (r.size = this.size), this.shadowSide !== null && (r.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (r.sizeAttenuation = this.sizeAttenuation), this.blending !== Sa && (r.blending = this.blending), this.side !== Xn && (r.side = this.side), this.vertexColors && (r.vertexColors = !0), this.opacity < 1 && (r.opacity = this.opacity), this.transparent === !0 && (r.transparent = this.transparent), r.depthFunc = this.depthFunc, r.depthTest = this.depthTest, r.depthWrite = this.depthWrite, r.colorWrite = this.colorWrite, r.stencilWrite = this.stencilWrite, r.stencilWriteMask = this.stencilWriteMask, r.stencilFunc = this.stencilFunc, r.stencilRef = this.stencilRef, r.stencilFuncMask = this.stencilFuncMask, r.stencilFail = this.stencilFail, r.stencilZFail = this.stencilZFail, r.stencilZPass = this.stencilZPass, this.rotation && this.rotation !== 0 && (r.rotation = this.rotation), this.polygonOffset === !0 && (r.polygonOffset = !0), this.polygonOffsetFactor !== 0 && (r.polygonOffsetFactor = this.polygonOffsetFactor), this.polygonOffsetUnits !== 0 && (r.polygonOffsetUnits = this.polygonOffsetUnits), this.linewidth && this.linewidth !== 1 && (r.linewidth = this.linewidth), this.dashSize !== void 0 && (r.dashSize = this.dashSize), this.gapSize !== void 0 && (r.gapSize = this.gapSize), this.scale !== void 0 && (r.scale = this.scale), this.dithering === !0 && (r.dithering = !0), this.alphaTest > 0 && (r.alphaTest = this.alphaTest), this.alphaToCoverage === !0 && (r.alphaToCoverage = this.alphaToCoverage), this.premultipliedAlpha === !0 && (r.premultipliedAlpha = this.premultipliedAlpha), this.wireframe === !0 && (r.wireframe = this.wireframe), this.wireframeLinewidth > 1 && (r.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== "round" && (r.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== "round" && (r.wireframeLinejoin = this.wireframeLinejoin), this.morphTargets === !0 && (r.morphTargets = !0), this.morphNormals === !0 && (r.morphNormals = !0), this.flatShading === !0 && (r.flatShading = this.flatShading), this.visible === !1 && (r.visible = !1), this.toneMapped === !1 && (r.toneMapped = !1), JSON.stringify(this.userData) !== "{}" && (r.userData = this.userData); function n(o) { const a = []; for (const s in o) { const c = o[s]; delete c.metadata, a.push(c); } return a; } if (t) { const o = n(e.textures), a = n(e.images); o.length > 0 && (r.textures = o), a.length > 0 && (r.images = a); } return r; } 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 r = null; if (t !== null) { const n = t.length; r = new Array(n); for (let o = 0; o !== n; ++o) r[o] = t[o].clone(); } return this.clippingPlanes = r, 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++; } } ri.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 }, dr = { h: 0, s: 0, l: 0 }, Yl = { h: 0, s: 0, l: 0 }; function bh(i, e, t) { return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? i + (e - i) * 6 * t : t < 1 / 2 ? e : t < 2 / 3 ? i + (e - i) * 6 * (2 / 3 - t) : i; } function xh(i) { return i < 0.04045 ? i * 0.0773993808 : Math.pow(i * 0.9478672986 + 0.0521327014, 2.4); } function wh(i) { return i < 31308e-7 ? i * 12.92 : 1.055 * Math.pow(i, 0.41666) - 0.055; } class Be { constructor(e, t, r) { return t === void 0 && r === void 0 ? this.set(e) : this.setRGB(e, t, r); } 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, r) { return this.r = e, this.g = t, this.b = r, this; } setHSL(e, t, r) { if (e = qp(e, 1), t = bi(t, 0, 1), r = bi(r, 0, 1), t === 0) this.r = this.g = this.b = r; else { const n = r <= 0.5 ? r * (1 + t) : r + t - r * t, o = 2 * r - n; this.r = bh(o, n, e + 1 / 3), this.g = bh(o, n, e), this.b = bh(o, n, e - 1 / 3); } return this; } setStyle(e) { function t(n) { n !== void 0 && parseFloat(n) < 1 && console.warn("THREE.Color: Alpha component of " + e + " will be ignored."); } let r; if (r = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)) { let n; const o = r[1], a = r[2]; switch (o) { case "rgb": case "rgba": if (n = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)) return this.r = Math.min(255, parseInt(n[1], 10)) / 255, this.g = Math.min(255, parseInt(n[2], 10)) / 255, this.b = Math.min(255, parseInt(n[3], 10)) / 255, t(n[4]), this; if (n = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)) return this.r = Math.min(100, parseInt(n[1], 10)) / 100, this.g = Math.min(100, parseInt(n[2], 10)) / 100, this.b = Math.min(100, parseInt(n[3], 10)) / 100, t(n[4]), this; break; case "hsl": case "hsla": if (n = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)) { const s = parseFloat(n[1]) / 360, c = parseInt(n[2], 10) / 100, l = parseInt(n[3], 10) / 100; return t(n[4]), this.setHSL(s, c, l); } break; } } else if (r = /^\#([A-Fa-f\d]+)$/.exec(e)) { const n = r[1], o = n.length; if (o === 3) return this.r = parseInt(n.charAt(0) + n.charAt(0), 16) / 255, this.g = parseInt(n.charAt(1) + n.charAt(1), 16) / 255, this.b = parseInt(n.charAt(2) + n.charAt(2), 16) / 255, this; if (o === 6) return this.r = parseInt(n.charAt(0) + n.charAt(1), 16) / 255, this.g = parseInt(n.charAt(2) + n.charAt(3), 16) / 255, this.b = parseInt(n.charAt(4) + n.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 r = t > 0 ? 1 / t : 1; return this.r = Math.pow(e.r, r), this.g = Math.pow(e.g, r), this.b = Math.pow(e.b, r), this; } convertGammaToLinear(e) { return this.copyGammaToLinear(this, e), this; } convertLinearToGamma(e) { return this.copyLinearToGamma(this, e), this; } copySRGBToLinear(e) { return this.r = xh(e.r), this.g = xh(e.g), this.b = xh(e.b), this; } copyLinearToSRGB(e) { return this.r = wh(e.r), this.g = wh(e.g), this.b = wh(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, r = this.g, n = this.b, o = Math.max(t, r, n), a = Math.min(t, r, n); let s, c; const l = (a + o) / 2; if (a === o) s = 0, c = 0; else { const h = o - a; switch (c = l <= 0.5 ? h / (o + a) : h / (2 - o - a), o) { case t: s = (r - n) / h + (r < n ? 6 : 0); break; case r: s = (n - t) / h + 2; break; case n: s = (t - r) / h + 4; break; } s /= 6; } return e.h = s, 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, r) { return this.getHSL(dr), dr.h += e, dr.s += t, dr.l += r, this.setHSL(dr.h, dr.s, dr.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, r) { return this.r = e.r + (t.r - e.r) * r, this.g = e.g + (t.g - e.g) * r, this.b = e.b + (t.b - e.b) * r, this; } lerpHSL(e, t) { this.getHSL(dr), e.getHSL(Yl); const r = Vs(dr.h, Yl.h, t), n = Vs(dr.s, Yl.s, t), o = Vs(dr.l, Yl.l, t); return this.setHSL(r, n, o), 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(); } } Be.NAMES = mx; Be.prototype.isColor = !0; Be.prototype.r = 1; Be.prototype.g = 1; Be.prototype.b = 1; class Ui extends ri { constructor(e) { super(), this.type = "MeshBasicMaterial", this.color = new Be(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; } } Ui.prototype.isMeshBasicMaterial = !0; const At = /* @__PURE__ */ new Z(), Jl = /* @__PURE__ */ new Re(); class tt { constructor(e, t, r) { 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 = r === !0, this.usage = Fa, 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, r) { e *= this.itemSize, r *= t.itemSize; for (let n = 0, o = this.itemSize; n < o; n++) this.array[e + n] = t.array[r + n]; return this; } copyArray(e) { return this.array.set(e), this; } copyColorsArray(e) { const t = this.array; let r = 0; for (let n = 0, o = e.length; n < o; n++) { let a = e[n]; a === void 0 && (console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined", n), a = new Be()), t[r++] = a.r, t[r++] = a.g, t[r++] = a.b; } return this; } copyVector2sArray(e) { const t = this.array; let r = 0; for (let n = 0, o = e.length; n < o; n++) { let a = e[n]; a === void 0 && (console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined", n), a = new Re()), t[r++] = a.x, t[r++] = a.y; } return this; } copyVector3sArray(e) { const t = this.array; let r = 0; for (let n = 0, o = e.length; n < o; n++) { let a = e[n]; a === void 0 && (console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined", n), a = new Z()), t[r++] = a.x, t[r++] = a.y, t[r++] = a.z; } return this; } copyVector4sArray(e) { const t = this.array; let r = 0; for (let n = 0, o = e.length; n < o; n++) { let a = e[n]; a === void 0 && (console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined", n), a = new St()), t[r++] = a.x, t[r++] = a.y, t[r++] = a.z, t[r++] = a.w; } return this; } applyMatrix3(e) { if (this.itemSize === 2) for (let t = 0, r = this.count; t < r; t++) Jl.fromBufferAttribute(this, t), Jl.applyMatrix3(e), this.setXY(t, Jl.x, Jl.y); else if (this.itemSize === 3) for (let t = 0, r = this.count; t < r; 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, r = this.count; t < r; 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, r = this.count; t < r; 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, r = this.count; t < r; 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, r) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = r, this; } setXYZ(e, t, r, n) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = r, this.array[e + 2] = n, this; } setXYZW(e, t, r, n, o) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = r, this.array[e + 2] = n, this.array[e + 3] = o, 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 !== Fa && (e.usage = this.usage), (this.updateRange.offset !== 0 || this.updateRange.count !== -1) && (e.updateRange = this.updateRange), e; } } tt.prototype.isBufferAttribute = !0; class gx extends tt { constructor(e, t, r) { super(new Int8Array(e), t, r); } } class vx extends tt { constructor(e, t, r) { super(new Uint8Array(e), t, r); } } class yx extends tt { constructor(e, t, r) { super(new Uint8ClampedArray(e), t, r); } } class bx extends tt { constructor(e, t, r) { super(new Int16Array(e), t, r); } } class Lu extends tt { constructor(e, t, r) { super(new Uint16Array(e), t, r); } } class xx extends tt { constructor(e, t, r) { super(new Int32Array(e), t, r); } } class Ru extends tt { constructor(e, t, r) { super(new Uint32Array(e), t, r); } } class wx extends tt { constructor(e, t, r) { super(new Uint16Array(e), t, r); } } wx.prototype.isFloat16BufferAttribute = !0; class je extends tt { constructor(e, t, r) { super(new Float32Array(e), t, r); } } class _x extends tt { constructor(e, t, r) { super(new Float64Array(e), t, r); } } function Mx(i) { if (i.length === 0) return -1 / 0; let e = i[0]; for (let t = 1, r = i.length; t < r; ++t) i[t] > e && (e = i[t]); return e; } const CO = { Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array }; function _a(i, e) { return new CO[i](e); } let LO = 0; const er = /* @__PURE__ */ new $e(), _h = /* @__PURE__ */ new ot(), aa = /* @__PURE__ */ new Z(), Wi = /* @__PURE__ */ new ji(), _s = /* @__PURE__ */ new ji(), ci = /* @__PURE__ */ new Z(); class Ye extends io { constructor() { super(), Object.defineProperty(this, "id", { value: LO++ }), this.uuid = Zi(), 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 (Mx(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, r = 0) { this.groups.push({ start: e, count: t, materialIndex: r }); } 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 r = this.attributes.normal; if (r !== void 0) { const o = new ai().getNormalMatrix(e); r.applyNormalMatrix(o), r.needsUpdate = !0; } const n = this.attributes.tangent; return n !== void 0 && (n.transformDirection(e), n.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this; } applyQuaternion(e) { return er.makeRotationFromQuaternion(e), this.applyMatrix4(er), this; } rotateX(e) { return er.makeRotationX(e), this.applyMatrix4(er), this; } rotateY(e) { return er.makeRotationY(e), this.applyMatrix4(er), this; } rotateZ(e) { return er.makeRotationZ(e), this.applyMatrix4(er), this; } translate(e, t, r) { return er.makeTranslation(e, t, r), this.applyMatrix4(er), this; } scale(e, t, r) { return er.makeScale(e, t, r), this.applyMatrix4(er), this; } lookAt(e) { return _h.lookAt(e), _h.updateMatrix(), this.applyMatrix4(_h.matrix), this; } center() { return this.computeBoundingBox(), this.boundingBox.getCenter(aa).negate(), this.translate(aa.x, aa.y, aa.z), this; } setFromPoints(e) { const t = []; for (let r = 0, n = e.length; r < n; r++) { const o = e[r]; t.push(o.x, o.y, o.z || 0); } return this.setAttribute("position", new je(t, 3)), this; } computeBoundingBox() { this.boundingBox === null && (this.boundingBox = new ji()); 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 Z(-1 / 0, -1 / 0, -1 / 0), new Z(1 / 0, 1 / 0, 1 / 0) ); return; } if (e !== void 0) { if (this.boundingBox.setFromBufferAttribute(e), t) for (let r = 0, n = t.length; r < n; r++) { const o = t[r]; Wi.setFromBufferAttribute(o), this.morphTargetsRelative ? (ci.addVectors(this.boundingBox.min, Wi.min), this.boundingBox.expandByPoint(ci), ci.addVectors(this.boundingBox.max, Wi.max), this.boundingBox.expandByPoint(ci)) : (this.boundingBox.expandByPoint(Wi.min), this.boundingBox.expandByPoint(Wi.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 xn()); 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 Z(), 1 / 0); return; } if (e) { const r = this.boundingSphere.center; if (Wi.setFromBufferAttribute(e), t) for (let o = 0, a = t.length; o < a; o++) { const s = t[o]; _s.setFromBufferAttribute(s), this.morphTargetsRelative ? (ci.addVectors(Wi.min, _s.min), Wi.expandByPoint(ci), ci.addVectors(Wi.max, _s.max), Wi.expandByPoint(ci)) : (Wi.expandByPoint(_s.min), Wi.expandByPoint(_s.max)); } Wi.getCenter(r); let n = 0; for (let o = 0, a = e.count; o < a; o++) ci.fromBufferAttribute(e, o), n = Math.max(n, r.distanceToSquared(ci)); if (t) for (let o = 0, a = t.length; o < a; o++) { const s = t[o], c = this.morphTargetsRelative; for (let l = 0, h = s.count; l < h; l++) ci.fromBufferAttribute(s, l), c && (aa.fromBufferAttribute(e, l), ci.add(aa)), n = Math.max(n, r.distanceToSquared(ci)); } this.boundingSphere.radius = Math.sqrt(n), 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 r = e.array, n = t.position.array, o = t.normal.array, a = t.uv.array, s = n.length / 3; t.tangent === void 0 && this.setAttribute("tangent", new tt(new Float32Array(4 * s), 4)); const c = t.tangent.array, l = [], h = []; for (let C = 0; C < s; C++) l[C] = new Z(), h[C] = new Z(); const u = new Z(), p = new Z(), m = new Z(), g = new Re(), d = new Re(), y = new Re(), f = new Z(), v = new Z(); function _(C, R, L) { u.fromArray(n, C * 3), p.fromArray(n, R * 3), m.fromArray(n, L * 3), g.fromArray(a, C * 2), d.fromArray(a, R * 2), y.fromArray(a, L * 2), p.sub(u), m.sub(u), d.sub(g), y.sub(g); const A = 1 / (d.x * y.y - y.x * d.y); isFinite(A) && (f.copy(p).multiplyScalar(y.y).addScaledVector(m, -d.y).multiplyScalar(A), v.copy(m).multiplyScalar(d.x).addScaledVector(p, -y.x).multiplyScalar(A), l[C].add(f), l[R].add(f), l[L].add(f), h[C].add(v), h[R].add(v), h[L].add(v)); } let M = this.groups; M.length === 0 && (M = [{ start: 0, count: r.length }]); for (let C = 0, R = M.length; C < R; ++C) { const L = M[C], A = L.start, P = L.count; for (let O = A, x = A + P; O < x; O += 3) _( r[O + 0], r[O + 1], r[O + 2] ); } const T = new Z(), w = new Z(), b = new Z(), E = new Z(); function S(C) { b.fromArray(o, C * 3), E.copy(b); const R = l[C]; T.copy(R), T.sub(b.multiplyScalar(b.dot(R))).normalize(), w.crossVectors(E, R); const L = w.dot(h[C]) < 0 ? -1 : 1; c[C * 4] = T.x, c[C * 4 + 1] = T.y, c[C * 4 + 2] = T.z, c[C * 4 + 3] = L; } for (let C = 0, R = M.length; C < R; ++C) { const L = M[C], A = L.start, P = L.count; for (let O = A, x = A + P; O < x; O += 3) S(r[O + 0]), S(r[O + 1]), S(r[O + 2]); } } computeVertexNormals() { const e = this.index, t = this.getAttribute("position"); if (t !== void 0) { let r = this.getAttribute("normal"); if (r === void 0) r = new tt(new Float32Array(t.count * 3), 3), this.setAttribute("normal", r); else for (let p = 0, m = r.count; p < m; p++) r.setXYZ(p, 0, 0, 0); const n = new Z(), o = new Z(), a = new Z(), s = new Z(), c = new Z(), l = new Z(), h = new Z(), u = new Z(); if (e) for (let p = 0, m = e.count; p < m; p += 3) { const g = e.getX(p + 0), d = e.getX(p + 1), y = e.getX(p + 2); n.fromBufferAttribute(t, g), o.fromBufferAttribute(t, d), a.fromBufferAttribute(t, y), h.subVectors(a, o), u.subVectors(n, o), h.cross(u), s.fromBufferAttribute(r, g), c.fromBufferAttribute(r, d), l.fromBufferAttribute(r, y), s.add(h), c.add(h), l.add(h), r.setXYZ(g, s.x, s.y, s.z), r.setXYZ(d, c.x, c.y, c.z), r.setXYZ(y, l.x, l.y, l.z); } else for (let p = 0, m = t.count; p < m; p += 3) n.fromBufferAttribute(t, p + 0), o.fromBufferAttribute(t, p + 1), a.fromBufferAttribute(t, p + 2), h.subVectors(a, o), u.subVectors(n, o), h.cross(u), r.setXYZ(p + 0, h.x, h.y, h.z), r.setXYZ(p + 1, h.x, h.y, h.z), r.setXYZ(p + 2, h.x, h.y, h.z); this.normalizeNormals(), r.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 r = this.attributes; for (const n in r) { if (e.attributes[n] === void 0) continue; const o = r[n].array, a = e.attributes[n], s = a.array, c = a.itemSize * t, l = Math.min(s.length, o.length - c); for (let h = 0, u = c; h < l; h++, u++) o[u] = s[h]; } return this; } normalizeNormals() { const e = this.attributes.normal; for (let t = 0, r = e.count; t < r; t++) ci.fromBufferAttribute(e, t), ci.normalize(), e.setXYZ(t, ci.x, ci.y, ci.z); } toNonIndexed() { function e(s, c) { const l = s.array, h = s.itemSize, u = s.normalized, p = new l.constructor(c.length * h); let m = 0, g = 0; for (let d = 0, y = c.length; d < y; d++) { s.isInterleavedBufferAttribute ? m = c[d] * s.data.stride + s.offset : m = c[d] * h; for (let f = 0; f < h; f++) p[g++] = l[m++]; } return new tt(p, h, u); } if (this.index === null) return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."), this; const t = new Ye(), r = this.index.array, n = this.attributes; for (const s in n) { const c = n[s], l = e(c, r); t.setAttribute(s, l); } const o = this.morphAttributes; for (const s in o) { const c = [], l = o[s]; for (let h = 0, u = l.length; h < u; h++) { const p = l[h], m = e(p, r); c.push(m); } t.morphAttributes[s] = c; } t.morphTargetsRelative = this.morphTargetsRelative; const a = this.groups; for (let s = 0, c = a.length; s < c; s++) { const l = a[s]; 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 r = this.attributes; for (const c in r) { const l = r[c]; e.data.attributes[c] = l.toJSON(e.data); } const n = {}; let o = !1; for (const c in this.morphAttributes) { const l = this.morphAttributes[c], h = []; for (let u = 0, p = l.length; u < p; u++) { const m = l[u]; h.push(m.toJSON(e.data)); } h.length > 0 && (n[c] = h, o = !0); } o && (e.data.morphAttributes = n, e.data.morphTargetsRelative = this.morphTargetsRelative); const a = this.groups; a.length > 0 && (e.data.groups = JSON.parse(JSON.stringify(a))); const s = this.boundingSphere; return s !== null && (e.data.boundingSphere = { center: s.center.toArray(), radius: s.radius }), e; } clone() { return new Ye().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 r = e.index; r !== null && this.setIndex(r.clone(t)); const n = e.attributes; for (const l in n) { const h = n[l]; this.setAttribute(l, h.clone(t)); } const o = e.morphAttributes; for (const l in o) { const h = [], u = o[l]; for (let p = 0, m = u.length; p < m; p++) h.push(u[p].clone(t)); this.morphAttributes[l] = h; } this.morphTargetsRelative = e.morphTargetsRelative; const a = e.groups; for (let l = 0, h = a.length; l < h; l++) { const u = a[l]; this.addGroup(u.start, u.count, u.materialIndex); } const s = e.boundingBox; s !== null && (this.boundingBox = s.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" }); } } Ye.prototype.isBufferGeometry = !0; const _g = /* @__PURE__ */ new $e(), sa = /* @__PURE__ */ new ro(), Mh = /* @__PURE__ */ new xn(), An = /* @__PURE__ */ new Z(), Cn = /* @__PURE__ */ new Z(), Ln = /* @__PURE__ */ new Z(), Sh = /* @__PURE__ */ new Z(), Th = /* @__PURE__ */ new Z(), Eh = /* @__PURE__ */ new Z(), Kl = /* @__PURE__ */ new Z(), Ql = /* @__PURE__ */ new Z(), ec = /* @__PURE__ */ new Z(), tc = /* @__PURE__ */ new Re(), ic = /* @__PURE__ */ new Re(), rc = /* @__PURE__ */ new Re(), Ah = /* @__PURE__ */ new Z(), nc = /* @__PURE__ */ new Z(); class ei extends ot { constructor(e = new Ye(), t = new Ui()) { 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, r = Object.keys(t); if (r.length > 0) { const n = t[r[0]]; if (n !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (let o = 0, a = n.length; o < a; o++) { const s = n[o].name || String(o); this.morphTargetInfluences.push(0), this.morphTargetDictionary[s] = o; } } } } 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 r = this.geometry, n = this.material, o = this.matrixWorld; if (n === void 0 || (r.boundingSphere === null && r.computeBoundingSphere(), Mh.copy(r.boundingSphere), Mh.applyMatrix4(o), e.ray.intersectsSphere(Mh) === !1) || (_g.copy(o).invert(), sa.copy(e.ray).applyMatrix4(_g), r.boundingBox !== null && sa.intersectsBox(r.boundingBox) === !1)) return; let a; if (r.isBufferGeometry) { const s = r.index, c = r.attributes.position, l = r.morphAttributes.position, h = r.morphTargetsRelative, u = r.attributes.uv, p = r.attributes.uv2, m = r.groups, g = r.drawRange; if (s !== null) if (Array.isArray(n)) for (let d = 0, y = m.length; d < y; d++) { const f = m[d], v = n[f.materialIndex], _ = Math.max(f.start, g.start), M = Math.min(f.start + f.count, g.start + g.count); for (let T = _, w = M; T < w; T += 3) { const b = s.getX(T), E = s.getX(T + 1), S = s.getX(T + 2); a = oc(this, v, e, sa, c, l, h, u, p, b, E, S), a && (a.faceIndex = Math.floor(T / 3), a.face.materialIndex = f.materialIndex, t.push(a)); } } else { const d = Math.max(0, g.start), y = Math.min(s.count, g.start + g.count); for (let f = d, v = y; f < v; f += 3) { const _ = s.getX(f), M = s.getX(f + 1), T = s.getX(f + 2); a = oc(this, n, e, sa, c, l, h, u, p, _, M, T), a && (a.faceIndex = Math.floor(f / 3), t.push(a)); } } else if (c !== void 0) if (Array.isArray(n)) for (let d = 0, y = m.length; d < y; d++) { const f = m[d], v = n[f.materialIndex], _ = Math.max(f.start, g.start), M = Math.min(f.start + f.count, g.start + g.count); for (let T = _, w = M; T < w; T += 3) { const b = T, E = T + 1, S = T + 2; a = oc(this, v, e, sa, c, l, h, u, p, b, E, S), a && (a.faceIndex = Math.floor(T / 3), a.face.materialIndex = f.materialIndex, t.push(a)); } } else { const d = Math.max(0, g.start), y = Math.min(c.count, g.start + g.count); for (let f = d, v = y; f < v; f += 3) { const _ = f, M = f + 1, T = f + 2; a = oc(this, n, e, sa, c, l, h, u, p, _, M, T), a && (a.faceIndex = Math.floor(f / 3), t.push(a)); } } } else r.isGeometry && console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } } ei.prototype.isMesh = !0; function RO(i, e, t, r, n, o, a, s) { let c; if (e.side === Yt ? c = r.intersectTriangle(a, o, n, !0, s) : c = r.intersectTriangle(n, o, a, e.side !== Zn, s), c === null) return null; nc.copy(s), nc.applyMatrix4(i.matrixWorld); const l = t.ray.origin.distanceTo(nc); return l < t.near || l > t.far ? null : { distance: l, point: nc.clone(), object: i }; } function oc(i, e, t, r, n, o, a, s, c, l, h, u) { An.fromBufferAttribute(n, l), Cn.fromBufferAttribute(n, h), Ln.fromBufferAttribute(n, u); const p = i.morphTargetInfluences; if (e.morphTargets && o && p) { Kl.set(0, 0, 0), Ql.set(0, 0, 0), ec.set(0, 0, 0); for (let g = 0, d = o.length; g < d; g++) { const y = p[g], f = o[g]; y !== 0 && (Sh.fromBufferAttribute(f, l), Th.fromBufferAttribute(f, h), Eh.fromBufferAttribute(f, u), a ? (Kl.addScaledVector(Sh, y), Ql.addScaledVector(Th, y), ec.addScaledVector(Eh, y)) : (Kl.addScaledVector(Sh.sub(An), y), Ql.addScaledVector(Th.sub(Cn), y), ec.addScaledVector(Eh.sub(Ln), y))); } An.add(Kl), Cn.add(Ql), Ln.add(ec); } i.isSkinnedMesh && (i.boneTransform(l, An), i.boneTransform(h, Cn), i.boneTransform(u, Ln)); const m = RO(i, e, t, r, An, Cn, Ln, Ah); if (m) { s && (tc.fromBufferAttribute(s, l), ic.fromBufferAttribute(s, h), rc.fromBufferAttribute(s, u), m.uv = Kt.getUV(Ah, An, Cn, Ln, tc, ic, rc, new Re())), c && (tc.fromBufferAttribute(c, l), ic.fromBufferAttribute(c, h), rc.fromBufferAttribute(c, u), m.uv2 = Kt.getUV(Ah, An, Cn, Ln, tc, ic, rc, new Re())); const g = { a: l, b: h, c: u, normal: new Z(), materialIndex: 0 }; Kt.getNormal(An, Cn, Ln, g.normal), m.face = g; } return m; } class hn extends Ye { constructor(e = 1, t = 1, r = 1, n = 1, o = 1, a = 1) { super(), this.type = "BoxGeometry", this.parameters = { width: e, height: t, depth: r, widthSegments: n, heightSegments: o, depthSegments: a }; const s = this; n = Math.floor(n), o = Math.floor(o), a = Math.floor(a); const c = [], l = [], h = [], u = []; let p = 0, m = 0; g("z", "y", "x", -1, -1, r, t, e, a, o, 0), g("z", "y", "x", 1, -1, r, t, -e, a, o, 1), g("x", "z", "y", 1, 1, e, r, t, n, a, 2), g("x", "z", "y", 1, -1, e, r, -t, n, a, 3), g("x", "y", "z", 1, -1, e, t, r, n, o, 4), g("x", "y", "z", -1, -1, e, t, -r, n, o, 5), this.setIndex(c), this.setAttribute("position", new je(l, 3)), this.setAttribute("normal", new je(h, 3)), this.setAttribute("uv", new je(u, 2)); function g(d, y, f, v, _, M, T, w, b, E, S) { const C = M / b, R = T / E, L = M / 2, A = T / 2, P = w / 2, O = b + 1, x = E + 1; let I = 0, N = 0; const D = new Z(); for (let k = 0; k < x; k++) { const F = k * R - A; for (let W = 0; W < O; W++) { const K = W * C - L; D[d] = K * v, D[y] = F * _, D[f] = P, l.push(D.x, D.y, D.z), D[d] = 0, D[y] = 0, D[f] = w > 0 ? 1 : -1, h.push(D.x, D.y, D.z), u.push(W / b), u.push(1 - k / E), I += 1; } } for (let k = 0; k < E; k++) for (let F = 0; F < b; F++) { const W = p + F + O * k, K = p + F + O * (k + 1), ne = p + (F + 1) + O * (k + 1), q = p + (F + 1) + O * k; c.push(W, K, q), c.push(K, ne, q), N += 6; } s.addGroup(m, N, S), m += N, p += I; } } static fromJSON(e) { return new hn(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments); } } function Ua(i) { const e = {}; for (const t in i) { e[t] = {}; for (const r in i[t]) { const n = i[t][r]; n && (n.isColor || n.isMatrix3 || n.isMatrix4 || n.isVector2 || n.isVector3 || n.isVector4 || n.isTexture || n.isQuaternion) ? e[t][r] = n.clone() : Array.isArray(n) ? e[t][r] = n.slice() : e[t][r] = n; } } return e; } function Ti(i) { const e = {}; for (let t = 0; t < i.length; t++) { const r = Ua(i[t]); for (const n in r) e[n] = r[n]; } return e; } const Sx = { clone: Ua, merge: Ti }; var OO = `void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`, PO = `void main() { gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); }`; class dn extends ri { constructor(e) { super(), this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.vertexShader = OO, this.fragmentShader = PO, 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 = Ua(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 n in this.uniforms) { const o = this.uniforms[n].value; o && o.isTexture ? t.uniforms[n] = { type: "t", value: o.toJSON(e).uuid } : o && o.isColor ? t.uniforms[n] = { type: "c", value: o.getHex() } : o && o.isVector2 ? t.uniforms[n] = { type: "v2", value: o.toArray() } : o && o.isVector3 ? t.uniforms[n] = { type: "v3", value: o.toArray() } : o && o.isVector4 ? t.uniforms[n] = { type: "v4", value: o.toArray() } : o && o.isMatrix3 ? t.uniforms[n] = { type: "m3", value: o.toArray() } : o && o.isMatrix4 ? t.uniforms[n] = { type: "m4", value: o.toArray() } : t.uniforms[n] = { value: o }; } Object.keys(this.defines).length > 0 && (t.defines = this.defines), t.vertexShader = this.vertexShader, t.fragmentShader = this.fragmentShader; const r = {}; for (const n in this.extensions) this.extensions[n] === !0 && (r[n] = !0); return Object.keys(r).length > 0 && (t.extensions = r), t; } } dn.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 oi extends wl { constructor(e = 50, t = 1, r = 0.1, n = 2e3) { super(), this.type = "PerspectiveCamera", this.fov = e, this.zoom = 1, this.near = r, this.far = n, 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 = il * 2 * Math.atan(t), this.updateProjectionMatrix(); } /** * Calculates the focal length from the current .fov and .filmGauge. */ getFocalLength() { const e = Math.tan(Co * 0.5 * this.fov); return 0.5 * this.getFilmHeight() / e; } getEffectiveFOV() { return il * 2 * Math.atan( Math.tan(Co * 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, r, n, o, a) { 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 = r, this.view.offsetY = n, this.view.width = o, this.view.height = a, this.updateProjectionMatrix(); } clearViewOffset() { this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix(); } updateProjectionMatrix() { const e = this.near; let t = e * Math.tan(Co * 0.5 * this.fov) / this.zoom, r = 2 * t, n = this.aspect * r, o = -0.5 * n; const a = this.view; if (this.view !== null && this.view.enabled) { const c = a.fullWidth, l = a.fullHeight; o += a.offsetX * n / c, t -= a.offsetY * r / l, n *= a.width / c, r *= a.height / l; } const s = this.filmOffset; s !== 0 && (o += e * s / this.getFilmWidth()), this.projectionMatrix.makePerspective(o, o + n, t, t - r, 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; } } oi.prototype.isPerspectiveCamera = !0; const la = 90, ca = 1; class Ou extends ot { constructor(e, t, r) { if (super(), this.type = "CubeCamera", r.isWebGLCubeRenderTarget !== !0) { console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter."); return; } this.renderTarget = r; const n = new oi(la, ca, e, t); n.layers = this.layers, n.up.set(0, -1, 0), n.lookAt(new Z(1, 0, 0)), this.add(n); const o = new oi(la, ca, e, t); o.layers = this.layers, o.up.set(0, -1, 0), o.lookAt(new Z(-1, 0, 0)), this.add(o); const a = new oi(la, ca, e, t); a.layers = this.layers, a.up.set(0, 0, 1), a.lookAt(new Z(0, 1, 0)), this.add(a); const s = new oi(la, ca, e, t); s.layers = this.layers, s.up.set(0, 0, -1), s.lookAt(new Z(0, -1, 0)), this.add(s); const c = new oi(la, ca, e, t); c.layers = this.layers, c.up.set(0, -1, 0), c.lookAt(new Z(0, 0, 1)), this.add(c); const l = new oi(la, ca, e, t); l.layers = this.layers, l.up.set(0, -1, 0), l.lookAt(new Z(0, 0, -1)), this.add(l); } update(e, t) { this.parent === null && this.updateMatrixWorld(); const r = this.renderTarget, [n, o, a, s, c, l] = this.children, h = e.xr.enabled, u = e.getRenderTarget(); e.xr.enabled = !1; const p = r.texture.generateMipmaps; r.texture.generateMipmaps = !1, e.setRenderTarget(r, 0), e.render(t, n), e.setRenderTarget(r, 1), e.render(t, o), e.setRenderTarget(r, 2), e.render(t, a), e.setRenderTarget(r, 3), e.render(t, s), e.setRenderTarget(r, 4), e.render(t, c), r.texture.generateMipmaps = p, e.setRenderTarget(r, 5), e.render(t, l), e.setRenderTarget(u), e.xr.enabled = h; } } class cs extends ti { constructor(e, t, r, n, o, a, s, c, l, h) { e = e !== void 0 ? e : [], t = t !== void 0 ? t : yl, s = s !== void 0 ? s : sn, super(e, t, r, n, o, a, s, c, l, h), this._needsFlipEnvMap = !0, this.flipY = !1; } get images() { return this.image; } set images(e) { this.image = e; } } cs.prototype.isCubeTexture = !0; class Pu extends yr { constructor(e, t, r) { Number.isInteger(t) && (console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"), t = r), super(e, e, t), t = t || {}, this.texture = new cs(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 : Wt, this.texture._needsFlipEnvMap = !1; } fromEquirectangularTexture(e, t) { this.texture.type = t.type, this.texture.format = Xi, this.texture.encoding = t.encoding, this.texture.generateMipmaps = t.generateMipmaps, this.texture.minFilter = t.minFilter, this.texture.magFilter = t.magFilter; const r = { 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 ); } ` ) }, n = new hn(5, 5, 5), o = new dn({ name: "CubemapFromEquirect", uniforms: Ua(r.uniforms), vertexShader: r.vertexShader, fragmentShader: r.fragmentShader, side: Yt, blending: an }); o.uniforms.tEquirect.value = t; const a = new ei(n, o), s = t.minFilter; return t.minFilter === bn && (t.minFilter = Wt), new Ou(1, 10, this).update(e, a), t.minFilter = s, a.geometry.dispose(), a.material.dispose(), this; } clear(e, t, r, n) { const o = e.getRenderTarget(); for (let a = 0; a < 6; a++) e.setRenderTarget(this, a), e.clear(t, r, n); e.setRenderTarget(o); } } Pu.prototype.isWebGLCubeRenderTarget = !0; const Ch = /* @__PURE__ */ new Z(), IO = /* @__PURE__ */ new Z(), DO = /* @__PURE__ */ new ai(); class Cr { constructor(e = new Z(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, r, n) { return this.normal.set(e, t, r), this.constant = n, this; } setFromNormalAndCoplanarPoint(e, t) { return this.normal.copy(e), this.constant = -t.dot(this.normal), this; } setFromCoplanarPoints(e, t, r) { const n = Ch.subVectors(r, t).cross(IO.subVectors(e, t)).normalize(); return this.setFromNormalAndCoplanarPoint(n, 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 r = e.delta(Ch), n = this.normal.dot(r); if (n === 0) return this.distanceToPoint(e.start) === 0 ? t.copy(e.start) : null; const o = -(e.start.dot(this.normal) + this.constant) / n; return o < 0 || o > 1 ? null : t.copy(r).multiplyScalar(o).add(e.start); } intersectsLine(e) { const t = this.distanceToPoint(e.start), r = this.distanceToPoint(e.end); return t < 0 && r > 0 || r < 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 r = t || DO.getNormalMatrix(e), n = this.coplanarPoint(Ch).applyMatrix4(e), o = this.normal.applyMatrix3(r).normalize(); return this.constant = -n.dot(o), 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); } } Cr.prototype.isPlane = !0; const ua = /* @__PURE__ */ new xn(), ac = /* @__PURE__ */ new Z(); class _l { constructor(e = new Cr(), t = new Cr(), r = new Cr(), n = new Cr(), o = new Cr(), a = new Cr()) { this.planes = [e, t, r, n, o, a]; } set(e, t, r, n, o, a) { const s = this.planes; return s[0].copy(e), s[1].copy(t), s[2].copy(r), s[3].copy(n), s[4].copy(o), s[5].copy(a), this; } copy(e) { const t = this.planes; for (let r = 0; r < 6; r++) t[r].copy(e.planes[r]); return this; } setFromProjectionMatrix(e) { const t = this.planes, r = e.elements, n = r[0], o = r[1], a = r[2], s = r[3], c = r[4], l = r[5], h = r[6], u = r[7], p = r[8], m = r[9], g = r[10], d = r[11], y = r[12], f = r[13], v = r[14], _ = r[15]; return t[0].setComponents(s - n, u - c, d - p, _ - y).normalize(), t[1].setComponents(s + n, u + c, d + p, _ + y).normalize(), t[2].setComponents(s + o, u + l, d + m, _ + f).normalize(), t[3].setComponents(s - o, u - l, d - m, _ - f).normalize(), t[4].setComponents(s - a, u - h, d - g, _ - v).normalize(), t[5].setComponents(s + a, u + h, d + g, _ + v).normalize(), this; } intersectsObject(e) { const t = e.geometry; return t.boundingSphere === null && t.computeBoundingSphere(), ua.copy(t.boundingSphere).applyMatrix4(e.matrixWorld), this.intersectsSphere(ua); } intersectsSprite(e) { return ua.center.set(0, 0, 0), ua.radius = 0.7071067811865476, ua.applyMatrix4(e.matrixWorld), this.intersectsSphere(ua); } intersectsSphere(e) { const t = this.planes, r = e.center, n = -e.radius; for (let o = 0; o < 6; o++) if (t[o].distanceToPoint(r) < n) return !1; return !0; } intersectsBox(e) { const t = this.planes; for (let r = 0; r < 6; r++) { const n = t[r]; if (ac.x = n.normal.x > 0 ? e.max.x : e.min.x, ac.y = n.normal.y > 0 ? e.max.y : e.min.y, ac.z = n.normal.z > 0 ? e.max.z : e.min.z, n.distanceToPoint(ac) < 0) return !1; } return !0; } containsPoint(e) { const t = this.planes; for (let r = 0; r < 6; r++) if (t[r].distanceToPoint(e) < 0) return !1; return !0; } clone() { return new this.constructor().copy(this); } } function Tx() { let i = null, e = !1, t = null, r = null; function n(o, a) { t(o, a), r = i.requestAnimationFrame(n); } return { start: function() { e !== !0 && t !== null && (r = i.requestAnimationFrame(n), e = !0); }, stop: function() { i.cancelAnimationFrame(r), e = !1; }, setAnimationLoop: function(o) { t = o; }, setContext: function(o) { i = o; } }; } function NO(i, e) { const t = e.isWebGL2, r = /* @__PURE__ */ new WeakMap(); function n(l, h) { const u = l.array, p = l.usage, m = i.createBuffer(); i.bindBuffer(h, m), i.bufferData(h, u, p), l.onUploadCallback(); let g = 5126; return u instanceof Float32Array ? g = 5126 : u instanceof Float64Array ? console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.") : u instanceof Uint16Array ? l.isFloat16BufferAttribute ? t ? g = 5131 : console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.") : g = 5123 : u instanceof Int16Array ? g = 5122 : u instanceof Uint32Array ? g = 5125 : u instanceof Int32Array ? g = 5124 : u instanceof Int8Array ? g = 5120 : (u instanceof Uint8Array || u instanceof Uint8ClampedArray) && (g = 5121), { buffer: m, type: g, bytesPerElement: u.BYTES_PER_ELEMENT, version: l.version }; } function o(l, h, u) { const p = h.array, m = h.updateRange; i.bindBuffer(u, l), m.count === -1 ? i.bufferSubData(u, 0, p) : (t ? i.bufferSubData( u, m.offset * p.BYTES_PER_ELEMENT, p, m.offset, m.count ) : i.bufferSubData( u, m.offset * p.BYTES_PER_ELEMENT, p.subarray(m.offset, m.offset + m.count) ), m.count = -1); } function a(l) { return l.isInterleavedBufferAttribute && (l = l.data), r.get(l); } function s(l) { l.isInterleavedBufferAttribute && (l = l.data); const h = r.get(l); h && (i.deleteBuffer(h.buffer), r.delete(l)); } function c(l, h) { if (l.isGLBufferAttribute) { const p = r.get(l); (!p || p.version < l.version) && r.set(l, { buffer: l.buffer, type: l.type, bytesPerElement: l.elementSize, version: l.version }); return; } l.isInterleavedBufferAttribute && (l = l.data); const u = r.get(l); u === void 0 ? r.set(l, n(l, h)) : u.version < l.version && (o(u.buffer, l, h), u.version = l.version); } return { get: a, remove: s, update: c }; } class No extends Ye { constructor(e = 1, t = 1, r = 1, n = 1) { super(), this.type = "PlaneGeometry", this.parameters = { width: e, height: t, widthSegments: r, heightSegments: n }; const o = e / 2, a = t / 2, s = Math.floor(r), c = Math.floor(n), l = s + 1, h = c + 1, u = e / s, p = t / c, m = [], g = [], d = [], y = []; for (let f = 0; f < h; f++) { const v = f * p - a; for (let _ = 0; _ < l; _++) { const M = _ * u - o; g.push(M, -v, 0), d.push(0, 0, 1), y.push(_ / s), y.push(1 - f / c); } } for (let f = 0; f < c; f++) for (let v = 0; v < s; v++) { const _ = v + l * f, M = v + l * (f + 1), T = v + 1 + l * (f + 1), w = v + 1 + l * f; m.push(_, M, w), m.push(M, T, w); } this.setIndex(m), this.setAttribute("position", new je(g, 3)), this.setAttribute("normal", new je(d, 3)), this.setAttribute("uv", new je(y, 2)); } static fromJSON(e) { return new No(e.width, e.height, e.widthSegments, e.heightSegments); } } var BO = `#ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, vUv ).g; #endif`, kO = `#ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`, FO = `#ifdef ALPHATEST if ( diffuseColor.a < ALPHATEST ) discard; #endif`, zO = `#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`, UO = `#ifdef USE_AOMAP uniform sampler2D aoMap; uniform float aoMapIntensity; #endif`, VO = "vec3 transformed = vec3( position );", HO = `vec3 objectNormal = vec3( normal ); #ifdef USE_TANGENT vec3 objectTangent = vec3( tangent.xyz ); #endif`, jO = `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`, GO = `#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`, WO = `#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`, $O = `#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`, qO = `#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`, XO = `#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`, ZO = `#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`, YO = `#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`, JO = `#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`, KO = `#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`, QO = `#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 ); }`, eP = `#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`, tP = `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`, iP = `#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`, rP = `#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); #endif`, nP = `#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vUv ); emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb; totalEmissiveRadiance *= emissiveColor.rgb; #endif`, oP = `#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`, aP = "gl_FragColor = linearToOutputTexel( gl_FragColor );", sP = ` 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 ); }`, lP = `#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`, cP = `#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`, uP = `#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`, hP = `#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`, dP = `#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`, pP = `#ifdef USE_FOG fogDepth = - mvPosition.z; #endif`, fP = `#ifdef USE_FOG varying float fogDepth; #endif`, mP = `#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`, gP = `#ifdef USE_FOG uniform vec3 fogColor; varying float fogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`, vP = `#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 }`, yP = `#ifdef USE_LIGHTMAP vec4 lightMapTexel= texture2D( lightMap, vUv2 ); reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; #endif`, bP = `#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`, xP = `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`, wP = `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`, _P = `#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`, MP = `ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`, SP = `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)`, TP = `BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`, EP = `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)`, AP = `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`, CP = `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 ); }`, LP = ` 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`, RP = `#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`, OP = `#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); #endif`, PP = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`, IP = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`, DP = `#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`, NP = `#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`, BP = `#ifdef USE_MAP vec4 texelColor = texture2D( map, vUv ); texelColor = mapTexelToLinear( texelColor ); diffuseColor *= texelColor; #endif`, kP = `#ifdef USE_MAP uniform sampler2D map; #endif`, FP = `#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`, zP = `#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`, UP = `float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vUv ); metalnessFactor *= texelMetalness.b; #endif`, VP = `#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`, HP = `#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif`, jP = `#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifndef USE_MORPHNORMALS uniform float morphTargetInfluences[ 8 ]; #else uniform float morphTargetInfluences[ 4 ]; #endif #endif`, GP = `#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`, WP = `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;`, $P = `#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`, qP = `#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`, XP = `#ifdef CLEARCOAT vec3 clearcoatNormal = geometryNormal; #endif`, ZP = `#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`, YP = `#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`, JP = `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 ); }`, KP = `#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`, QP = `vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`, eI = `#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`, tI = `#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`, iI = `float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vUv ); roughnessFactor *= texelRoughness.g; #endif`, rI = `#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`, nI = `#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`, oI = `#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`, aI = `#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`, sI = `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; }`, lI = `#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`, cI = `#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`, uI = `#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`, hI = `#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`, dI = `float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`, pI = `#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`, fI = `#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`, mI = `#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; }`, gI = `#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`, vI = `#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`, yI = `#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) varying vec2 vUv; #endif`, bI = `#ifdef USE_UV #ifdef UVS_VERTEX_ONLY vec2 vUv; #else varying vec2 vUv; #endif uniform mat3 uvTransform; #endif`, xI = `#ifdef USE_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif`, wI = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) varying vec2 vUv2; #endif`, _I = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) attribute vec2 uv2; varying vec2 vUv2; uniform mat3 uv2Transform; #endif`, MI = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; #endif`, SI = `#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`, TI = `uniform sampler2D t2D; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); gl_FragColor = mapTexelToLinear( texColor ); #include #include }`, EI = `varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`, AI = `#include uniform float opacity; varying vec3 vWorldDirection; #include void main() { vec3 vReflect = vWorldDirection; #include gl_FragColor = envColor; gl_FragColor.a *= opacity; #include #include }`, CI = `varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`, LI = `#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 }`, RI = `#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; }`, OI = `#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 ); }`, PI = `#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; }`, II = `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 }`, DI = `varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`, NI = `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 }`, BI = `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 }`, kI = `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 }`, FI = `#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 }`, zI = `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 }`, UI = `#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 }`, VI = `#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 }`, HI = `#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; }`, jI = `#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 }`, GI = `#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 }`, WI = `#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 }`, $I = `#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 }`, qI = `#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 }`, XI = `#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 }`, ZI = `#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 ); }`, YI = `#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 }`, JI = `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 }`, KI = `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 }`, QI = `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 }`, eD = `#include #include #include void main() { #include #include #include #include #include #include #include #include #include #include }`, tD = `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 }`, iD = `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 lt = { alphamap_fragment: BO, alphamap_pars_fragment: kO, alphatest_fragment: FO, aomap_fragment: zO, aomap_pars_fragment: UO, begin_vertex: VO, beginnormal_vertex: HO, bsdfs: jO, bumpmap_pars_fragment: GO, clipping_planes_fragment: WO, clipping_planes_pars_fragment: $O, clipping_planes_pars_vertex: qO, clipping_planes_vertex: XO, color_fragment: ZO, color_pars_fragment: YO, color_pars_vertex: JO, color_vertex: KO, common: QO, cube_uv_reflection_fragment: eP, defaultnormal_vertex: tP, displacementmap_pars_vertex: iP, displacementmap_vertex: rP, emissivemap_fragment: nP, emissivemap_pars_fragment: oP, encodings_fragment: aP, encodings_pars_fragment: sP, envmap_fragment: lP, envmap_common_pars_fragment: cP, envmap_pars_fragment: uP, envmap_pars_vertex: hP, envmap_physical_pars_fragment: _P, envmap_vertex: dP, fog_vertex: pP, fog_pars_vertex: fP, fog_fragment: mP, fog_pars_fragment: gP, gradientmap_pars_fragment: vP, lightmap_fragment: yP, lightmap_pars_fragment: bP, lights_lambert_vertex: xP, lights_pars_begin: wP, lights_toon_fragment: MP, lights_toon_pars_fragment: SP, lights_phong_fragment: TP, lights_phong_pars_fragment: EP, lights_physical_fragment: AP, lights_physical_pars_fragment: CP, lights_fragment_begin: LP, lights_fragment_maps: RP, lights_fragment_end: OP, logdepthbuf_fragment: PP, logdepthbuf_pars_fragment: IP, logdepthbuf_pars_vertex: DP, logdepthbuf_vertex: NP, map_fragment: BP, map_pars_fragment: kP, map_particle_fragment: FP, map_particle_pars_fragment: zP, metalnessmap_fragment: UP, metalnessmap_pars_fragment: VP, morphnormal_vertex: HP, morphtarget_pars_vertex: jP, morphtarget_vertex: GP, normal_fragment_begin: WP, normal_fragment_maps: $P, normalmap_pars_fragment: qP, clearcoat_normal_fragment_begin: XP, clearcoat_normal_fragment_maps: ZP, clearcoat_pars_fragment: YP, packing: JP, premultiplied_alpha_fragment: KP, project_vertex: QP, dithering_fragment: eI, dithering_pars_fragment: tI, roughnessmap_fragment: iI, roughnessmap_pars_fragment: rI, shadowmap_pars_fragment: nI, shadowmap_pars_vertex: oI, shadowmap_vertex: aI, shadowmask_pars_fragment: sI, skinbase_vertex: lI, skinning_pars_vertex: cI, skinning_vertex: uI, skinnormal_vertex: hI, specularmap_fragment: dI, specularmap_pars_fragment: pI, tonemapping_fragment: fI, tonemapping_pars_fragment: mI, transmission_fragment: gI, transmission_pars_fragment: vI, uv_pars_fragment: yI, uv_pars_vertex: bI, uv_vertex: xI, uv2_pars_fragment: wI, uv2_pars_vertex: _I, uv2_vertex: MI, worldpos_vertex: SI, background_frag: TI, background_vert: EI, cube_frag: AI, cube_vert: CI, depth_frag: LI, depth_vert: RI, distanceRGBA_frag: OI, distanceRGBA_vert: PI, equirect_frag: II, equirect_vert: DI, linedashed_frag: NI, linedashed_vert: BI, meshbasic_frag: kI, meshbasic_vert: FI, meshlambert_frag: zI, meshlambert_vert: UI, meshmatcap_frag: VI, meshmatcap_vert: HI, meshtoon_frag: jI, meshtoon_vert: GI, meshphong_frag: WI, meshphong_vert: $I, meshphysical_frag: qI, meshphysical_vert: XI, normal_frag: ZI, normal_vert: YI, points_frag: JI, points_vert: KI, shadow_frag: QI, shadow_vert: eD, sprite_frag: tD, sprite_vert: iD }, Fe = { common: { diffuse: { value: new Be(16777215) }, opacity: { value: 1 }, map: { value: null }, uvTransform: { value: new ai() }, uv2Transform: { value: new ai() }, 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 Re(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 Be(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 Be(16777215) }, opacity: { value: 1 }, size: { value: 1 }, scale: { value: 1 }, map: { value: null }, alphaMap: { value: null }, uvTransform: { value: new ai() } }, sprite: { diffuse: { value: new Be(16777215) }, opacity: { value: 1 }, center: { value: new Re(0.5, 0.5) }, rotation: { value: 0 }, map: { value: null }, alphaMap: { value: null }, uvTransform: { value: new ai() } } }, mr = { basic: { uniforms: Ti([ Fe.common, Fe.specularmap, Fe.envmap, Fe.aomap, Fe.lightmap, Fe.fog ]), vertexShader: lt.meshbasic_vert, fragmentShader: lt.meshbasic_frag }, lambert: { uniforms: Ti([ Fe.common, Fe.specularmap, Fe.envmap, Fe.aomap, Fe.lightmap, Fe.emissivemap, Fe.fog, Fe.lights, { emissive: { value: new Be(0) } } ]), vertexShader: lt.meshlambert_vert, fragmentShader: lt.meshlambert_frag }, phong: { uniforms: Ti([ Fe.common, Fe.specularmap, Fe.envmap, Fe.aomap, Fe.lightmap, Fe.emissivemap, Fe.bumpmap, Fe.normalmap, Fe.displacementmap, Fe.fog, Fe.lights, { emissive: { value: new Be(0) }, specular: { value: new Be(1118481) }, shininess: { value: 30 } } ]), vertexShader: lt.meshphong_vert, fragmentShader: lt.meshphong_frag }, standard: { uniforms: Ti([ Fe.common, Fe.envmap, Fe.aomap, Fe.lightmap, Fe.emissivemap, Fe.bumpmap, Fe.normalmap, Fe.displacementmap, Fe.roughnessmap, Fe.metalnessmap, Fe.fog, Fe.lights, { emissive: { value: new Be(0) }, roughness: { value: 1 }, metalness: { value: 0 }, envMapIntensity: { value: 1 } // temporary } ]), vertexShader: lt.meshphysical_vert, fragmentShader: lt.meshphysical_frag }, toon: { uniforms: Ti([ Fe.common, Fe.aomap, Fe.lightmap, Fe.emissivemap, Fe.bumpmap, Fe.normalmap, Fe.displacementmap, Fe.gradientmap, Fe.fog, Fe.lights, { emissive: { value: new Be(0) } } ]), vertexShader: lt.meshtoon_vert, fragmentShader: lt.meshtoon_frag }, matcap: { uniforms: Ti([ Fe.common, Fe.bumpmap, Fe.normalmap, Fe.displacementmap, Fe.fog, { matcap: { value: null } } ]), vertexShader: lt.meshmatcap_vert, fragmentShader: lt.meshmatcap_frag }, points: { uniforms: Ti([ Fe.points, Fe.fog ]), vertexShader: lt.points_vert, fragmentShader: lt.points_frag }, dashed: { uniforms: Ti([ Fe.common, Fe.fog, { scale: { value: 1 }, dashSize: { value: 1 }, totalSize: { value: 2 } } ]), vertexShader: lt.linedashed_vert, fragmentShader: lt.linedashed_frag }, depth: { uniforms: Ti([ Fe.common, Fe.displacementmap ]), vertexShader: lt.depth_vert, fragmentShader: lt.depth_frag }, normal: { uniforms: Ti([ Fe.common, Fe.bumpmap, Fe.normalmap, Fe.displacementmap, { opacity: { value: 1 } } ]), vertexShader: lt.normal_vert, fragmentShader: lt.normal_frag }, sprite: { uniforms: Ti([ Fe.sprite, Fe.fog ]), vertexShader: lt.sprite_vert, fragmentShader: lt.sprite_frag }, background: { uniforms: { uvTransform: { value: new ai() }, t2D: { value: null } }, vertexShader: lt.background_vert, fragmentShader: lt.background_frag }, /* ------------------------------------------------------------------------- // Cube map shader ------------------------------------------------------------------------- */ cube: { uniforms: Ti([ Fe.envmap, { opacity: { value: 1 } } ]), vertexShader: lt.cube_vert, fragmentShader: lt.cube_frag }, equirect: { uniforms: { tEquirect: { value: null } }, vertexShader: lt.equirect_vert, fragmentShader: lt.equirect_frag }, distanceRGBA: { uniforms: Ti([ Fe.common, Fe.displacementmap, { referencePosition: { value: new Z() }, nearDistance: { value: 1 }, farDistance: { value: 1e3 } } ]), vertexShader: lt.distanceRGBA_vert, fragmentShader: lt.distanceRGBA_frag }, shadow: { uniforms: Ti([ Fe.lights, Fe.fog, { color: { value: new Be(0) }, opacity: { value: 1 } } ]), vertexShader: lt.shadow_vert, fragmentShader: lt.shadow_frag } }; mr.physical = { uniforms: Ti([ mr.standard.uniforms, { clearcoat: { value: 0 }, clearcoatMap: { value: null }, clearcoatRoughness: { value: 0 }, clearcoatRoughnessMap: { value: null }, clearcoatNormalScale: { value: new Re(1, 1) }, clearcoatNormalMap: { value: null }, sheen: { value: new Be(0) }, transmission: { value: 0 }, transmissionMap: { value: null }, transmissionSamplerSize: { value: new Re() }, transmissionSamplerMap: { value: null }, thickness: { value: 0 }, thicknessMap: { value: null }, attenuationDistance: { value: 0 }, attenuationColor: { value: new Be(0) } } ]), vertexShader: lt.meshphysical_vert, fragmentShader: lt.meshphysical_frag }; function rD(i, e, t, r, n) { const o = new Be(0); let a = 0, s, c, l = null, h = 0, u = null; function p(g, d) { let y = !1, f = d.isScene === !0 ? d.background : null; f && f.isTexture && (f = e.get(f)); const v = i.xr, _ = v.getSession && v.getSession(); _ && _.environmentBlendMode === "additive" && (f = null), f === null ? m(o, a) : f && f.isColor && (m(f, 1), y = !0), (i.autoClear || y) && i.clear(i.autoClearColor, i.autoClearDepth, i.autoClearStencil), f && (f.isCubeTexture || f.mapping === ls) ? (c === void 0 && (c = new ei( new hn(1, 1, 1), new dn({ name: "BackgroundCubeMaterial", uniforms: Ua(mr.cube.uniforms), vertexShader: mr.cube.vertexShader, fragmentShader: mr.cube.fragmentShader, side: Yt, depthTest: !1, depthWrite: !1, fog: !1 }) ), c.geometry.deleteAttribute("normal"), c.geometry.deleteAttribute("uv"), c.onBeforeRender = function(M, T, w) { this.matrixWorld.copyPosition(w.matrixWorld); }, Object.defineProperty(c.material, "envMap", { get: function() { return this.uniforms.envMap.value; } }), r.update(c)), c.material.uniforms.envMap.value = f, c.material.uniforms.flipEnvMap.value = f.isCubeTexture && f._needsFlipEnvMap ? -1 : 1, (l !== f || h !== f.version || u !== i.toneMapping) && (c.material.needsUpdate = !0, l = f, h = f.version, u = i.toneMapping), g.unshift(c, c.geometry, c.material, 0, 0, null)) : f && f.isTexture && (s === void 0 && (s = new ei( new No(2, 2), new dn({ name: "BackgroundMaterial", uniforms: Ua(mr.background.uniforms), vertexShader: mr.background.vertexShader, fragmentShader: mr.background.fragmentShader, side: Xn, depthTest: !1, depthWrite: !1, fog: !1 }) ), s.geometry.deleteAttribute("normal"), Object.defineProperty(s.material, "map", { get: function() { return this.uniforms.t2D.value; } }), r.update(s)), s.material.uniforms.t2D.value = f, f.matrixAutoUpdate === !0 && f.updateMatrix(), s.material.uniforms.uvTransform.value.copy(f.matrix), (l !== f || h !== f.version || u !== i.toneMapping) && (s.material.needsUpdate = !0, l = f, h = f.version, u = i.toneMapping), g.unshift(s, s.geometry, s.material, 0, 0, null)); } function m(g, d) { t.buffers.color.setClear(g.r, g.g, g.b, d, n); } return { getClearColor: function() { return o; }, setClearColor: function(g, d = 1) { o.set(g), a = d, m(o, a); }, getClearAlpha: function() { return a; }, setClearAlpha: function(g) { a = g, m(o, a); }, render: p }; } function nD(i, e, t, r) { const n = i.getParameter(34921), o = r.isWebGL2 ? null : e.get("OES_vertex_array_object"), a = r.isWebGL2 || o !== null, s = {}, c = d(null); let l = c; function h(A, P, O, x, I) { let N = !1; if (a) { const D = g(x, O, P); l !== D && (l = D, p(l.object)), N = y(x, I), N && f(x, I); } else { const D = P.wireframe === !0; (l.geometry !== x.id || l.program !== O.id || l.wireframe !== D) && (l.geometry = x.id, l.program = O.id, l.wireframe = D, N = !0); } A.isInstancedMesh === !0 && (N = !0), I !== null && t.update(I, 34963), N && (b(A, P, O, x), I !== null && i.bindBuffer(34963, t.get(I).buffer)); } function u() { return r.isWebGL2 ? i.createVertexArray() : o.createVertexArrayOES(); } function p(A) { return r.isWebGL2 ? i.bindVertexArray(A) : o.bindVertexArrayOES(A); } function m(A) { return r.isWebGL2 ? i.deleteVertexArray(A) : o.deleteVertexArrayOES(A); } function g(A, P, O) { const x = O.wireframe === !0; let I = s[A.id]; I === void 0 && (I = {}, s[A.id] = I); let N = I[P.id]; N === void 0 && (N = {}, I[P.id] = N); let D = N[x]; return D === void 0 && (D = d(u()), N[x] = D), D; } function d(A) { const P = [], O = [], x = []; for (let I = 0; I < n; I++) P[I] = 0, O[I] = 0, x[I] = 0; return { // for backward compatibility on non-VAO support browser geometry: null, program: null, wireframe: !1, newAttributes: P, enabledAttributes: O, attributeDivisors: x, object: A, attributes: {}, index: null }; } function y(A, P) { const O = l.attributes, x = A.attributes; let I = 0; for (const N in x) { const D = O[N], k = x[N]; if (D === void 0 || D.attribute !== k || D.data !== k.data) return !0; I++; } return l.attributesNum !== I || l.index !== P; } function f(A, P) { const O = {}, x = A.attributes; let I = 0; for (const N in x) { const D = x[N], k = {}; k.attribute = D, D.data && (k.data = D.data), O[N] = k, I++; } l.attributes = O, l.attributesNum = I, l.index = P; } function v() { const A = l.newAttributes; for (let P = 0, O = A.length; P < O; P++) A[P] = 0; } function _(A) { M(A, 0); } function M(A, P) { const O = l.newAttributes, x = l.enabledAttributes, I = l.attributeDivisors; O[A] = 1, x[A] === 0 && (i.enableVertexAttribArray(A), x[A] = 1), I[A] !== P && ((r.isWebGL2 ? i : e.get("ANGLE_instanced_arrays"))[r.isWebGL2 ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE"](A, P), I[A] = P); } function T() { const A = l.newAttributes, P = l.enabledAttributes; for (let O = 0, x = P.length; O < x; O++) P[O] !== A[O] && (i.disableVertexAttribArray(O), P[O] = 0); } function w(A, P, O, x, I, N) { r.isWebGL2 === !0 && (O === 5124 || O === 5125) ? i.vertexAttribIPointer(A, P, O, I, N) : i.vertexAttribPointer(A, P, O, x, I, N); } function b(A, P, O, x) { if (r.isWebGL2 === !1 && (A.isInstancedMesh || x.isInstancedBufferGeometry) && e.get("ANGLE_instanced_arrays") === null) return; v(); const I = x.attributes, N = O.getAttributes(), D = P.defaultAttributeValues; for (const k in N) { const F = N[k]; if (F >= 0) { const W = I[k]; if (W !== void 0) { const K = W.normalized, ne = W.itemSize, q = t.get(W); if (q === void 0) continue; const z = q.buffer, j = q.type, Q = q.bytesPerElement; if (W.isInterleavedBufferAttribute) { const Y = W.data, ee = Y.stride, G = W.offset; Y && Y.isInstancedInterleavedBuffer ? (M(F, Y.meshPerAttribute), x._maxInstanceCount === void 0 && (x._maxInstanceCount = Y.meshPerAttribute * Y.count)) : _(F), i.bindBuffer(34962, z), w(F, ne, j, K, ee * Q, G * Q); } else W.isInstancedBufferAttribute ? (M(F, W.meshPerAttribute), x._maxInstanceCount === void 0 && (x._maxInstanceCount = W.meshPerAttribute * W.count)) : _(F), i.bindBuffer(34962, z), w(F, ne, j, K, 0, 0); } else if (k === "instanceMatrix") { const K = t.get(A.instanceMatrix); if (K === void 0) continue; const ne = K.buffer, q = K.type; M(F + 0, 1), M(F + 1, 1), M(F + 2, 1), M(F + 3, 1), i.bindBuffer(34962, ne), i.vertexAttribPointer(F + 0, 4, q, !1, 64, 0), i.vertexAttribPointer(F + 1, 4, q, !1, 64, 16), i.vertexAttribPointer(F + 2, 4, q, !1, 64, 32), i.vertexAttribPointer(F + 3, 4, q, !1, 64, 48); } else if (k === "instanceColor") { const K = t.get(A.instanceColor); if (K === void 0) continue; const ne = K.buffer, q = K.type; M(F, 1), i.bindBuffer(34962, ne), i.vertexAttribPointer(F, 3, q, !1, 12, 0); } else if (D !== void 0) { const K = D[k]; if (K !== void 0) switch (K.length) { case 2: i.vertexAttrib2fv(F, K); break; case 3: i.vertexAttrib3fv(F, K); break; case 4: i.vertexAttrib4fv(F, K); break; default: i.vertexAttrib1fv(F, K); } } } } T(); } function E() { R(); for (const A in s) { const P = s[A]; for (const O in P) { const x = P[O]; for (const I in x) m(x[I].object), delete x[I]; delete P[O]; } delete s[A]; } } function S(A) { if (s[A.id] === void 0) return; const P = s[A.id]; for (const O in P) { const x = P[O]; for (const I in x) m(x[I].object), delete x[I]; delete P[O]; } delete s[A.id]; } function C(A) { for (const P in s) { const O = s[P]; if (O[A.id] === void 0) continue; const x = O[A.id]; for (const I in x) m(x[I].object), delete x[I]; delete O[A.id]; } } function R() { L(), l !== c && (l = c, p(l.object)); } function L() { c.geometry = null, c.program = null, c.wireframe = !1; } return { setup: h, reset: R, resetDefaultState: L, dispose: E, releaseStatesOfGeometry: S, releaseStatesOfProgram: C, initAttributes: v, enableAttribute: _, disableUnusedAttributes: T }; } function oD(i, e, t, r) { const n = r.isWebGL2; let o; function a(l) { o = l; } function s(l, h) { i.drawArrays(o, l, h), t.update(h, o, 1); } function c(l, h, u) { if (u === 0) return; let p, m; if (n) p = i, m = "drawArraysInstanced"; else if (p = e.get("ANGLE_instanced_arrays"), m = "drawArraysInstancedANGLE", p === null) { console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); return; } p[m](o, l, h, u), t.update(h, o, u); } this.setMode = a, this.render = s, this.renderInstances = c; } function aD(i, e, t) { let r; function n() { if (r !== void 0) return r; if (e.has("EXT_texture_filter_anisotropic") === !0) { const b = e.get("EXT_texture_filter_anisotropic"); r = i.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT); } else r = 0; return r; } function o(b) { if (b === "highp") { if (i.getShaderPrecisionFormat(35633, 36338).precision > 0 && i.getShaderPrecisionFormat(35632, 36338).precision > 0) return "highp"; b = "mediump"; } return b === "mediump" && i.getShaderPrecisionFormat(35633, 36337).precision > 0 && i.getShaderPrecisionFormat(35632, 36337).precision > 0 ? "mediump" : "lowp"; } const a = typeof WebGL2RenderingContext < "u" && i instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext < "u" && i instanceof WebGL2ComputeRenderingContext; let s = t.precision !== void 0 ? t.precision : "highp"; const c = o(s); c !== s && (console.warn("THREE.WebGLRenderer:", s, "not supported, using", c, "instead."), s = c); const l = a || e.has("WEBGL_draw_buffers"), h = t.logarithmicDepthBuffer === !0, u = i.getParameter(34930), p = i.getParameter(35660), m = i.getParameter(3379), g = i.getParameter(34076), d = i.getParameter(34921), y = i.getParameter(36347), f = i.getParameter(36348), v = i.getParameter(36349), _ = p > 0, M = a || e.has("OES_texture_float"), T = _ && M, w = a ? i.getParameter(36183) : 0; return { isWebGL2: a, drawBuffers: l, getMaxAnisotropy: n, getMaxPrecision: o, precision: s, logarithmicDepthBuffer: h, maxTextures: u, maxVertexTextures: p, maxTextureSize: m, maxCubemapSize: g, maxAttributes: d, maxVertexUniforms: y, maxVaryings: f, maxFragmentUniforms: v, vertexTextures: _, floatFragmentTextures: M, floatVertexTextures: T, maxSamples: w }; } function sD(i) { const e = this; let t = null, r = 0, n = !1, o = !1; const a = new Cr(), s = new ai(), c = { value: null, needsUpdate: !1 }; this.uniform = c, this.numPlanes = 0, this.numIntersection = 0, this.init = function(u, p, m) { const g = u.length !== 0 || p || // enable state of previous frame - the clipping code has to // run another frame in order to reset the state: r !== 0 || n; return n = p, t = h(u, m, 0), r = u.length, g; }, this.beginShadows = function() { o = !0, h(null); }, this.endShadows = function() { o = !1, l(); }, this.setState = function(u, p, m) { const g = u.clippingPlanes, d = u.clipIntersection, y = u.clipShadows, f = i.get(u); if (!n || g === null || g.length === 0 || o && !y) o ? h(null) : l(); else { const v = o ? 0 : r, _ = v * 4; let M = f.clippingState || null; c.value = M, M = h(g, p, _, m); for (let T = 0; T !== _; ++T) M[T] = t[T]; f.clippingState = M, this.numIntersection = d ? this.numPlanes : 0, this.numPlanes += v; } }; function l() { c.value !== t && (c.value = t, c.needsUpdate = r > 0), e.numPlanes = r, e.numIntersection = 0; } function h(u, p, m, g) { const d = u !== null ? u.length : 0; let y = null; if (d !== 0) { if (y = c.value, g !== !0 || y === null) { const f = m + d * 4, v = p.matrixWorldInverse; s.getNormalMatrix(v), (y === null || y.length < f) && (y = new Float32Array(f)); for (let _ = 0, M = m; _ !== d; ++_, M += 4) a.copy(u[_]).applyMatrix4(v, s), a.normal.toArray(y, M), y[M + 3] = a.constant; } c.value = y, c.needsUpdate = !0; } return e.numPlanes = d, e.numIntersection = 0, y; } } function lD(i) { let e = /* @__PURE__ */ new WeakMap(); function t(a, s) { return s === Qc ? a.mapping = yl : s === eu && (a.mapping = bl), a; } function r(a) { if (a && a.isTexture) { const s = a.mapping; if (s === Qc || s === eu) if (e.has(a)) { const c = e.get(a).texture; return t(c, a.mapping); } else { const c = a.image; if (c && c.height > 0) { const l = i.getRenderTarget(), h = new Pu(c.height / 2); return h.fromEquirectangularTexture(i, a), e.set(a, h), i.setRenderTarget(l), a.addEventListener("dispose", n), t(h.texture, a.mapping); } else return null; } } return a; } function n(a) { const s = a.target; s.removeEventListener("dispose", n); const c = e.get(s); c !== void 0 && (e.delete(s), c.dispose()); } function o() { e = /* @__PURE__ */ new WeakMap(); } return { get: r, dispose: o }; } function cD(i) { const e = {}; function t(r) { if (e[r] !== void 0) return e[r]; let n; switch (r) { case "WEBGL_depth_texture": n = i.getExtension("WEBGL_depth_texture") || i.getExtension("MOZ_WEBGL_depth_texture") || i.getExtension("WEBKIT_WEBGL_depth_texture"); break; case "EXT_texture_filter_anisotropic": n = i.getExtension("EXT_texture_filter_anisotropic") || i.getExtension("MOZ_EXT_texture_filter_anisotropic") || i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); break; case "WEBGL_compressed_texture_s3tc": n = i.getExtension("WEBGL_compressed_texture_s3tc") || i.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); break; case "WEBGL_compressed_texture_pvrtc": n = i.getExtension("WEBGL_compressed_texture_pvrtc") || i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"); break; default: n = i.getExtension(r); } return e[r] = n, n; } return { has: function(r) { return t(r) !== null; }, init: function(r) { r.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(r) { const n = t(r); return n === null && console.warn("THREE.WebGLRenderer: " + r + " extension not supported."), n; } }; } function uD(i, e, t, r) { const n = {}, o = /* @__PURE__ */ new WeakMap(); function a(u) { const p = u.target; p.index !== null && e.remove(p.index); for (const g in p.attributes) e.remove(p.attributes[g]); p.removeEventListener("dispose", a), delete n[p.id]; const m = o.get(p); m && (e.remove(m), o.delete(p)), r.releaseStatesOfGeometry(p), p.isInstancedBufferGeometry === !0 && delete p._maxInstanceCount, t.memory.geometries--; } function s(u, p) { return n[p.id] === !0 || (p.addEventListener("dispose", a), n[p.id] = !0, t.memory.geometries++), p; } function c(u) { const p = u.attributes; for (const g in p) e.update(p[g], 34962); const m = u.morphAttributes; for (const g in m) { const d = m[g]; for (let y = 0, f = d.length; y < f; y++) e.update(d[y], 34962); } } function l(u) { const p = [], m = u.index, g = u.attributes.position; let d = 0; if (m !== null) { const v = m.array; d = m.version; for (let _ = 0, M = v.length; _ < M; _ += 3) { const T = v[_ + 0], w = v[_ + 1], b = v[_ + 2]; p.push(T, w, w, b, b, T); } } else { const v = g.array; d = g.version; for (let _ = 0, M = v.length / 3 - 1; _ < M; _ += 3) { const T = _ + 0, w = _ + 1, b = _ + 2; p.push(T, w, w, b, b, T); } } const y = new (Mx(p) > 65535 ? Ru : Lu)(p, 1); y.version = d; const f = o.get(u); f && e.remove(f), o.set(u, y); } function h(u) { const p = o.get(u); if (p) { const m = u.index; m !== null && p.version < m.version && l(u); } else l(u); return o.get(u); } return { get: s, update: c, getWireframeAttribute: h }; } function hD(i, e, t, r) { const n = r.isWebGL2; let o; function a(p) { o = p; } let s, c; function l(p) { s = p.type, c = p.bytesPerElement; } function h(p, m) { i.drawElements(o, m, s, p * c), t.update(m, o, 1); } function u(p, m, g) { if (g === 0) return; let d, y; if (n) d = i, y = "drawElementsInstanced"; else if (d = e.get("ANGLE_instanced_arrays"), y = "drawElementsInstancedANGLE", d === null) { console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); return; } d[y](o, m, s, p * c, g), t.update(m, o, g); } this.setMode = a, this.setIndex = l, this.render = h, this.renderInstances = u; } function dD(i) { const e = { geometries: 0, textures: 0 }, t = { frame: 0, calls: 0, triangles: 0, points: 0, lines: 0 }; function r(o, a, s) { switch (t.calls++, a) { case 4: t.triangles += s * (o / 3); break; case 1: t.lines += s * (o / 2); break; case 3: t.lines += s * (o - 1); break; case 2: t.lines += s * o; break; case 0: t.points += s * o; break; default: console.error("THREE.WebGLInfo: Unknown draw mode:", a); break; } } function n() { t.frame++, t.calls = 0, t.triangles = 0, t.points = 0, t.lines = 0; } return { memory: e, render: t, programs: null, autoReset: !0, reset: n, update: r }; } function pD(i, e) { return i[0] - e[0]; } function fD(i, e) { return Math.abs(e[1]) - Math.abs(i[1]); } function mD(i) { const e = {}, t = new Float32Array(8), r = []; for (let o = 0; o < 8; o++) r[o] = [o, 0]; function n(o, a, s, c) { const l = o.morphTargetInfluences, h = l === void 0 ? 0 : l.length; let u = e[a.id]; if (u === void 0 || u.length !== h) { u = []; for (let y = 0; y < h; y++) u[y] = [y, 0]; e[a.id] = u; } for (let y = 0; y < h; y++) { const f = u[y]; f[0] = y, f[1] = l[y]; } u.sort(fD); for (let y = 0; y < 8; y++) y < h && u[y][1] ? (r[y][0] = u[y][0], r[y][1] = u[y][1]) : (r[y][0] = Number.MAX_SAFE_INTEGER, r[y][1] = 0); r.sort(pD); const p = s.morphTargets && a.morphAttributes.position, m = s.morphNormals && a.morphAttributes.normal; let g = 0; for (let y = 0; y < 8; y++) { const f = r[y], v = f[0], _ = f[1]; v !== Number.MAX_SAFE_INTEGER && _ ? (p && a.getAttribute("morphTarget" + y) !== p[v] && a.setAttribute("morphTarget" + y, p[v]), m && a.getAttribute("morphNormal" + y) !== m[v] && a.setAttribute("morphNormal" + y, m[v]), t[y] = _, g += _) : (p && a.hasAttribute("morphTarget" + y) === !0 && a.deleteAttribute("morphTarget" + y), m && a.hasAttribute("morphNormal" + y) === !0 && a.deleteAttribute("morphNormal" + y), t[y] = 0); } const d = a.morphTargetsRelative ? 1 : 1 - g; c.getUniforms().setValue(i, "morphTargetBaseInfluence", d), c.getUniforms().setValue(i, "morphTargetInfluences", t); } return { update: n }; } function gD(i, e, t, r) { let n = /* @__PURE__ */ new WeakMap(); function o(c) { const l = r.render.frame, h = c.geometry, u = e.get(c, h); return n.get(u) !== l && (e.update(u), n.set(u, l)), c.isInstancedMesh && (c.hasEventListener("dispose", s) === !1 && c.addEventListener("dispose", s), t.update(c.instanceMatrix, 34962), c.instanceColor !== null && t.update(c.instanceColor, 34962)), u; } function a() { n = /* @__PURE__ */ new WeakMap(); } function s(c) { const l = c.target; l.removeEventListener("dispose", s), t.remove(l.instanceMatrix), l.instanceColor !== null && t.remove(l.instanceColor); } return { update: o, dispose: a }; } class Yp extends ti { constructor(e = null, t = 1, r = 1, n = 1) { super(null), this.image = { data: e, width: t, height: r, depth: n }, this.magFilter = Jt, this.minFilter = Jt, this.wrapR = di, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0; } } Yp.prototype.isDataTexture2DArray = !0; class Jp extends ti { constructor(e = null, t = 1, r = 1, n = 1) { super(null), this.image = { data: e, width: t, height: r, depth: n }, this.magFilter = Jt, this.minFilter = Jt, this.wrapR = di, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0; } } Jp.prototype.isDataTexture3D = !0; const Ex = new ti(), vD = new Yp(), yD = new Jp(), Ax = new cs(), Mg = [], Sg = [], Tg = new Float32Array(16), Eg = new Float32Array(9), Ag = new Float32Array(4); function us(i, e, t) { const r = i[0]; if (r <= 0 || r > 0) return i; const n = e * t; let o = Mg[n]; if (o === void 0 && (o = new Float32Array(n), Mg[n] = o), e !== 0) { r.toArray(o, 0); for (let a = 1, s = 0; a !== e; ++a) s += t, i[a].toArray(o, s); } return o; } function Ni(i, e) { if (i.length !== e.length) return !1; for (let t = 0, r = i.length; t < r; t++) if (i[t] !== e[t]) return !1; return !0; } function Li(i, e) { for (let t = 0, r = e.length; t < r; t++) i[t] = e[t]; } function Cx(i, e) { let t = Sg[e]; t === void 0 && (t = new Int32Array(e), Sg[e] = t); for (let r = 0; r !== e; ++r) t[r] = i.allocateTextureUnit(); return t; } function bD(i, e) { const t = this.cache; t[0] !== e && (i.uniform1f(this.addr, e), t[0] = e); } function xD(i, e) { const t = this.cache; if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y) && (i.uniform2f(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y); else { if (Ni(t, e)) return; i.uniform2fv(this.addr, e), Li(t, e); } } function wD(i, e) { const t = this.cache; if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (i.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) && (i.uniform3f(this.addr, e.r, e.g, e.b), t[0] = e.r, t[1] = e.g, t[2] = e.b); else { if (Ni(t, e)) return; i.uniform3fv(this.addr, e), Li(t, e); } } function _D(i, 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) && (i.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 (Ni(t, e)) return; i.uniform4fv(this.addr, e), Li(t, e); } } function MD(i, e) { const t = this.cache, r = e.elements; if (r === void 0) { if (Ni(t, e)) return; i.uniformMatrix2fv(this.addr, !1, e), Li(t, e); } else { if (Ni(t, r)) return; Ag.set(r), i.uniformMatrix2fv(this.addr, !1, Ag), Li(t, r); } } function SD(i, e) { const t = this.cache, r = e.elements; if (r === void 0) { if (Ni(t, e)) return; i.uniformMatrix3fv(this.addr, !1, e), Li(t, e); } else { if (Ni(t, r)) return; Eg.set(r), i.uniformMatrix3fv(this.addr, !1, Eg), Li(t, r); } } function TD(i, e) { const t = this.cache, r = e.elements; if (r === void 0) { if (Ni(t, e)) return; i.uniformMatrix4fv(this.addr, !1, e), Li(t, e); } else { if (Ni(t, r)) return; Tg.set(r), i.uniformMatrix4fv(this.addr, !1, Tg), Li(t, r); } } function ED(i, e) { const t = this.cache; t[0] !== e && (i.uniform1i(this.addr, e), t[0] = e); } function AD(i, e) { const t = this.cache; Ni(t, e) || (i.uniform2iv(this.addr, e), Li(t, e)); } function CD(i, e) { const t = this.cache; Ni(t, e) || (i.uniform3iv(this.addr, e), Li(t, e)); } function LD(i, e) { const t = this.cache; Ni(t, e) || (i.uniform4iv(this.addr, e), Li(t, e)); } function RD(i, e) { const t = this.cache; t[0] !== e && (i.uniform1ui(this.addr, e), t[0] = e); } function OD(i, e) { const t = this.cache; Ni(t, e) || (i.uniform2uiv(this.addr, e), Li(t, e)); } function PD(i, e) { const t = this.cache; Ni(t, e) || (i.uniform3uiv(this.addr, e), Li(t, e)); } function ID(i, e) { const t = this.cache; Ni(t, e) || (i.uniform4uiv(this.addr, e), Li(t, e)); } function DD(i, e, t) { const r = this.cache, n = t.allocateTextureUnit(); r[0] !== n && (i.uniform1i(this.addr, n), r[0] = n), t.safeSetTexture2D(e || Ex, n); } function ND(i, e, t) { const r = this.cache, n = t.allocateTextureUnit(); r[0] !== n && (i.uniform1i(this.addr, n), r[0] = n), t.setTexture3D(e || yD, n); } function BD(i, e, t) { const r = this.cache, n = t.allocateTextureUnit(); r[0] !== n && (i.uniform1i(this.addr, n), r[0] = n), t.safeSetTextureCube(e || Ax, n); } function kD(i, e, t) { const r = this.cache, n = t.allocateTextureUnit(); r[0] !== n && (i.uniform1i(this.addr, n), r[0] = n), t.setTexture2DArray(e || vD, n); } function FD(i) { switch (i) { case 5126: return bD; case 35664: return xD; case 35665: return wD; case 35666: return _D; case 35674: return MD; case 35675: return SD; case 35676: return TD; case 5124: case 35670: return ED; case 35667: case 35671: return AD; case 35668: case 35672: return CD; case 35669: case 35673: return LD; case 5125: return RD; case 36294: return OD; case 36295: return PD; case 36296: return ID; case 35678: case 36198: case 36298: case 36306: case 35682: return DD; case 35679: case 36299: case 36307: return ND; case 35680: case 36300: case 36308: case 36293: return BD; case 36289: case 36303: case 36311: case 36292: return kD; } } function zD(i, e) { i.uniform1fv(this.addr, e); } function UD(i, e) { const t = us(e, this.size, 2); i.uniform2fv(this.addr, t); } function VD(i, e) { const t = us(e, this.size, 3); i.uniform3fv(this.addr, t); } function HD(i, e) { const t = us(e, this.size, 4); i.uniform4fv(this.addr, t); } function jD(i, e) { const t = us(e, this.size, 4); i.uniformMatrix2fv(this.addr, !1, t); } function GD(i, e) { const t = us(e, this.size, 9); i.uniformMatrix3fv(this.addr, !1, t); } function WD(i, e) { const t = us(e, this.size, 16); i.uniformMatrix4fv(this.addr, !1, t); } function $D(i, e) { i.uniform1iv(this.addr, e); } function qD(i, e) { i.uniform2iv(this.addr, e); } function XD(i, e) { i.uniform3iv(this.addr, e); } function ZD(i, e) { i.uniform4iv(this.addr, e); } function YD(i, e) { i.uniform1uiv(this.addr, e); } function JD(i, e) { i.uniform2uiv(this.addr, e); } function KD(i, e) { i.uniform3uiv(this.addr, e); } function QD(i, e) { i.uniform4uiv(this.addr, e); } function eN(i, e, t) { const r = e.length, n = Cx(t, r); i.uniform1iv(this.addr, n); for (let o = 0; o !== r; ++o) t.safeSetTexture2D(e[o] || Ex, n[o]); } function tN(i, e, t) { const r = e.length, n = Cx(t, r); i.uniform1iv(this.addr, n); for (let o = 0; o !== r; ++o) t.safeSetTextureCube(e[o] || Ax, n[o]); } function iN(i) { switch (i) { case 5126: return zD; case 35664: return UD; case 35665: return VD; case 35666: return HD; case 35674: return jD; case 35675: return GD; case 35676: return WD; case 5124: case 35670: return $D; case 35667: case 35671: return qD; case 35668: case 35672: return XD; case 35669: case 35673: return ZD; case 5125: return YD; case 36294: return JD; case 36295: return KD; case 36296: return QD; case 35678: case 36198: case 36298: case 36306: case 35682: return eN; case 35680: case 36300: case 36308: case 36293: return tN; } } function rN(i, e, t) { this.id = i, this.addr = t, this.cache = [], this.setValue = FD(e.type); } function Lx(i, e, t) { this.id = i, this.addr = t, this.cache = [], this.size = e.size, this.setValue = iN(e.type); } Lx.prototype.updateCache = function(i) { const e = this.cache; i instanceof Float32Array && e.length !== i.length && (this.cache = new Float32Array(i.length)), Li(e, i); }; function Rx(i) { this.id = i, this.seq = [], this.map = {}; } Rx.prototype.setValue = function(i, e, t) { const r = this.seq; for (let n = 0, o = r.length; n !== o; ++n) { const a = r[n]; a.setValue(i, e[a.id], t); } }; const Lh = /(\w+)(\])?(\[|\.)?/g; function Cg(i, e) { i.seq.push(e), i.map[e.id] = e; } function nN(i, e, t) { const r = i.name, n = r.length; for (Lh.lastIndex = 0; ; ) { const o = Lh.exec(r), a = Lh.lastIndex; let s = o[1]; const c = o[2] === "]", l = o[3]; if (c && (s = s | 0), l === void 0 || l === "[" && a + 2 === n) { Cg(t, l === void 0 ? new rN(s, i, e) : new Lx(s, i, e)); break; } else { let h = t.map[s]; h === void 0 && (h = new Rx(s), Cg(t, h)), t = h; } } } function Vn(i, e) { this.seq = [], this.map = {}; const t = i.getProgramParameter(e, 35718); for (let r = 0; r < t; ++r) { const n = i.getActiveUniform(e, r), o = i.getUniformLocation(e, n.name); nN(n, o, this); } } Vn.prototype.setValue = function(i, e, t, r) { const n = this.map[e]; n !== void 0 && n.setValue(i, t, r); }; Vn.prototype.setOptional = function(i, e, t) { const r = e[t]; r !== void 0 && this.setValue(i, t, r); }; Vn.upload = function(i, e, t, r) { for (let n = 0, o = e.length; n !== o; ++n) { const a = e[n], s = t[a.id]; s.needsUpdate !== !1 && a.setValue(i, s.value, r); } }; Vn.seqWithValue = function(i, e) { const t = []; for (let r = 0, n = i.length; r !== n; ++r) { const o = i[r]; o.id in e && t.push(o); } return t; }; function Lg(i, e, t) { const r = i.createShader(e); return i.shaderSource(r, t), i.compileShader(r), r; } let oN = 0; function aN(i) { const e = i.split(` `); for (let t = 0; t < e.length; t++) e[t] = t + 1 + ": " + e[t]; return e.join(` `); } function Ox(i) { switch (i) { case Di: return ["Linear", "( value )"]; case Do: return ["sRGB", "( value )"]; case Cu: return ["RGBE", "( value )"]; case Gp: return ["RGBM", "( value, 7.0 )"]; case Wp: return ["RGBM", "( value, 16.0 )"]; case $p: return ["RGBD", "( value, 256.0 )"]; case Au: return ["Gamma", "( value, float( GAMMA_FACTOR ) )"]; case sx: return ["LogLuv", "( value )"]; default: return console.warn("THREE.WebGLProgram: Unsupported encoding:", i), ["Linear", "( value )"]; } } function Rg(i, e, t) { const r = i.getShaderParameter(e, 35713), n = i.getShaderInfoLog(e).trim(); if (r && n === "") return ""; const o = i.getShaderSource(e); return "THREE.WebGLShader: gl.getShaderInfoLog() " + t + ` ` + n + aN(o); } function Ms(i, e) { const t = Ox(e); return "vec4 " + i + "( vec4 value ) { return " + t[0] + "ToLinear" + t[1] + "; }"; } function sN(i, e) { const t = Ox(e); return "vec4 " + i + "( vec4 value ) { return LinearTo" + t[0] + t[1] + "; }"; } function lN(i, e) { let t; switch (e) { case ob: t = "Linear"; break; case ab: t = "Reinhard"; break; case sb: 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 " + i + "( vec3 color ) { return " + t + "ToneMapping( color ); }"; } function cN(i) { return [ i.extensionDerivatives || i.envMapCubeUV || i.bumpMap || i.tangentSpaceNormalMap || i.clearcoatNormalMap || i.flatShading || i.shaderID === "physical" ? "#extension GL_OES_standard_derivatives : enable" : "", (i.extensionFragDepth || i.logarithmicDepthBuffer) && i.rendererExtensionFragDepth ? "#extension GL_EXT_frag_depth : enable" : "", i.extensionDrawBuffers && i.rendererExtensionDrawBuffers ? "#extension GL_EXT_draw_buffers : require" : "", (i.extensionShaderTextureLOD || i.envMap || i.transmission > 0) && i.rendererExtensionShaderTextureLod ? "#extension GL_EXT_shader_texture_lod : enable" : "" ].filter(Ds).join(` `); } function uN(i) { const e = []; for (const t in i) { const r = i[t]; r !== !1 && e.push("#define " + t + " " + r); } return e.join(` `); } function hN(i, e) { const t = {}, r = i.getProgramParameter(e, 35721); for (let n = 0; n < r; n++) { const o = i.getActiveAttrib(e, n).name; t[o] = i.getAttribLocation(e, o); } return t; } function Ds(i) { return i !== ""; } function Og(i, e) { return i.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 Pg(i, e) { return i.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection); } const dN = /^[ \t]*#include +<([\w\d./]+)>/gm; function Bd(i) { return i.replace(dN, pN); } function pN(i, e) { const t = lt[e]; if (t === void 0) throw new Error("Can not resolve #include <" + e + ">"); return Bd(t); } const fN = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g, mN = /#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 Ig(i) { return i.replace(mN, Px).replace(fN, gN); } function gN(i, e, t, r) { return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."), Px(i, e, t, r); } function Px(i, e, t, r) { let n = ""; for (let o = parseInt(e); o < parseInt(t); o++) n += r.replace(/\[\s*i\s*\]/g, "[ " + o + " ]").replace(/UNROLLED_LOOP_INDEX/g, o); return n; } function Dg(i) { let e = "precision " + i.precision + ` float; precision ` + i.precision + " int;"; return i.precision === "highp" ? e += ` #define HIGH_PRECISION` : i.precision === "mediump" ? e += ` #define MEDIUM_PRECISION` : i.precision === "lowp" && (e += ` #define LOW_PRECISION`), e; } function vN(i) { let e = "SHADOWMAP_TYPE_BASIC"; return i.shadowMapType === Fp ? e = "SHADOWMAP_TYPE_PCF" : i.shadowMapType === ky ? e = "SHADOWMAP_TYPE_PCF_SOFT" : i.shadowMapType === wa && (e = "SHADOWMAP_TYPE_VSM"), e; } function yN(i) { let e = "ENVMAP_TYPE_CUBE"; if (i.envMap) switch (i.envMapMode) { case yl: case bl: e = "ENVMAP_TYPE_CUBE"; break; case ls: case xl: e = "ENVMAP_TYPE_CUBE_UV"; break; } return e; } function bN(i) { let e = "ENVMAP_MODE_REFLECTION"; if (i.envMap) switch (i.envMapMode) { case bl: case xl: e = "ENVMAP_MODE_REFRACTION"; break; } return e; } function xN(i) { let e = "ENVMAP_BLENDING_NONE"; if (i.envMap) switch (i.combine) { case vl: e = "ENVMAP_BLENDING_MULTIPLY"; break; case rb: e = "ENVMAP_BLENDING_MIX"; break; case nb: e = "ENVMAP_BLENDING_ADD"; break; } return e; } function wN(i, e, t, r) { const n = i.getContext(), o = t.defines; let a = t.vertexShader, s = t.fragmentShader; const c = vN(t), l = yN(t), h = bN(t), u = xN(t), p = i.gammaFactor > 0 ? i.gammaFactor : 1, m = t.isWebGL2 ? "" : cN(t), g = uN(o), d = n.createProgram(); let y, f, v = t.glslVersion ? "#version " + t.glslVersion + ` ` : ""; t.isRawShaderMaterial ? (y = [ g ].filter(Ds).join(` `), y.length > 0 && (y += ` `), f = [ m, g ].filter(Ds).join(` `), f.length > 0 && (f += ` `)) : (y = [ Dg(t), "#define SHADER_NAME " + t.shaderName, g, 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 " + 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.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(Ds).join(` `), f = [ m, Dg(t), "#define SHADER_NAME " + t.shaderName, g, 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 " + h : "", t.envMap ? "#define " + u : "", 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 !== Un ? "#define TONE_MAPPING" : "", t.toneMapping !== Un ? lt.tonemapping_pars_fragment : "", // this code is required here because it is used by the toneMapping() function defined below t.toneMapping !== Un ? lN("toneMapping", t.toneMapping) : "", t.dithering ? "#define DITHERING" : "", lt.encodings_pars_fragment, // this code is required here because it is used by the various encoding/decoding function defined below t.map ? Ms("mapTexelToLinear", t.mapEncoding) : "", t.matcap ? Ms("matcapTexelToLinear", t.matcapEncoding) : "", t.envMap ? Ms("envMapTexelToLinear", t.envMapEncoding) : "", t.emissiveMap ? Ms("emissiveMapTexelToLinear", t.emissiveMapEncoding) : "", t.lightMap ? Ms("lightMapTexelToLinear", t.lightMapEncoding) : "", sN("linearToOutputTexel", t.outputEncoding), t.depthPacking ? "#define DEPTH_PACKING " + t.depthPacking : "", ` ` ].filter(Ds).join(` `)), a = Bd(a), a = Og(a, t), a = Pg(a, t), s = Bd(s), s = Og(s, t), s = Pg(s, t), a = Ig(a), s = Ig(s), t.isWebGL2 && t.isRawShaderMaterial !== !0 && (v = `#version 300 es `, y = [ "#define attribute in", "#define varying out", "#define texture2D texture" ].join(` `) + ` ` + y, f = [ "#define varying in", t.glslVersion === Id ? "" : "out highp vec4 pc_fragColor;", t.glslVersion === Id ? "" : "#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(` `) + ` ` + f); const _ = v + y + a, M = v + f + s, T = Lg(n, 35633, _), w = Lg(n, 35632, M); if (n.attachShader(d, T), n.attachShader(d, w), t.index0AttributeName !== void 0 ? n.bindAttribLocation(d, 0, t.index0AttributeName) : t.morphTargets === !0 && n.bindAttribLocation(d, 0, "position"), n.linkProgram(d), i.debug.checkShaderErrors) { const S = n.getProgramInfoLog(d).trim(), C = n.getShaderInfoLog(T).trim(), R = n.getShaderInfoLog(w).trim(); let L = !0, A = !0; if (n.getProgramParameter(d, 35714) === !1) { L = !1; const P = Rg(n, T, "vertex"), O = Rg(n, w, "fragment"); console.error("THREE.WebGLProgram: shader error: ", n.getError(), "35715", n.getProgramParameter(d, 35715), "gl.getProgramInfoLog", S, P, O); } else S !== "" ? console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", S) : (C === "" || R === "") && (A = !1); A && (this.diagnostics = { runnable: L, programLog: S, vertexShader: { log: C, prefix: y }, fragmentShader: { log: R, prefix: f } }); } n.deleteShader(T), n.deleteShader(w); let b; this.getUniforms = function() { return b === void 0 && (b = new Vn(n, d)), b; }; let E; return this.getAttributes = function() { return E === void 0 && (E = hN(n, d)), E; }, this.destroy = function() { r.releaseStatesOfProgram(this), n.deleteProgram(d), this.program = void 0; }, this.name = t.shaderName, this.id = oN++, this.cacheKey = e, this.usedTimes = 1, this.program = d, this.vertexShader = T, this.fragmentShader = w, this; } function _N(i, e, t, r, n, o) { const a = [], s = r.isWebGL2, c = r.logarithmicDepthBuffer, l = r.floatVertexTextures, h = r.maxVertexUniforms, u = r.vertexTextures; let p = r.precision; const m = { 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" }, g = [ "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 d(w) { const b = w.skeleton.bones; if (l) return 1024; { const E = Math.floor((h - 20) / 4), S = Math.min(E, b.length); return S < b.length ? (console.warn("THREE.WebGLRenderer: Skeleton has " + b.length + " bones. This GPU supports " + S + "."), 0) : S; } } function y(w) { let b; return w && w.isTexture ? b = w.encoding : w && w.isWebGLRenderTarget ? (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."), b = w.texture.encoding) : b = Di, b; } function f(w, b, E, S, C) { const R = S.fog, L = w.isMeshStandardMaterial ? S.environment : null, A = e.get(w.envMap || L), P = m[w.type], O = C.isSkinnedMesh ? d(C) : 0; w.precision !== null && (p = r.getMaxPrecision(w.precision), p !== w.precision && console.warn("THREE.WebGLProgram.getParameters:", w.precision, "not supported, using", p, "instead.")); let x, I; if (P) { const D = mr[P]; x = D.vertexShader, I = D.fragmentShader; } else x = w.vertexShader, I = w.fragmentShader; const N = i.getRenderTarget(); return { isWebGL2: s, shaderID: P, shaderName: w.type, vertexShader: x, fragmentShader: I, defines: w.defines, isRawShaderMaterial: w.isRawShaderMaterial === !0, glslVersion: w.glslVersion, precision: p, instancing: C.isInstancedMesh === !0, instancingColor: C.isInstancedMesh === !0 && C.instanceColor !== null, supportsVertexTextures: u, outputEncoding: N !== null ? y(N.texture) : i.outputEncoding, map: !!w.map, mapEncoding: y(w.map), matcap: !!w.matcap, matcapEncoding: y(w.matcap), envMap: !!A, envMapMode: A && A.mapping, envMapEncoding: y(A), envMapCubeUV: !!A && (A.mapping === ls || A.mapping === xl), lightMap: !!w.lightMap, lightMapEncoding: y(w.lightMap), aoMap: !!w.aoMap, emissiveMap: !!w.emissiveMap, emissiveMapEncoding: y(w.emissiveMap), bumpMap: !!w.bumpMap, normalMap: !!w.normalMap, objectSpaceNormalMap: w.normalMapType === ux, tangentSpaceNormalMap: w.normalMapType === to, clearcoatMap: !!w.clearcoatMap, clearcoatRoughnessMap: !!w.clearcoatRoughnessMap, clearcoatNormalMap: !!w.clearcoatNormalMap, displacementMap: !!w.displacementMap, roughnessMap: !!w.roughnessMap, metalnessMap: !!w.metalnessMap, specularMap: !!w.specularMap, alphaMap: !!w.alphaMap, gradientMap: !!w.gradientMap, sheen: !!w.sheen, transmission: !!w.transmission, transmissionMap: !!w.transmissionMap, thicknessMap: !!w.thicknessMap, combine: w.combine, vertexTangents: w.normalMap && w.vertexTangents, vertexColors: w.vertexColors, vertexAlphas: w.vertexColors === !0 && C.geometry && C.geometry.attributes.color && C.geometry.attributes.color.itemSize === 4, vertexUvs: !!w.map || !!w.bumpMap || !!w.normalMap || !!w.specularMap || !!w.alphaMap || !!w.emissiveMap || !!w.roughnessMap || !!w.metalnessMap || !!w.clearcoatMap || !!w.clearcoatRoughnessMap || !!w.clearcoatNormalMap || !!w.displacementMap || !!w.transmissionMap || !!w.thicknessMap, uvsVertexOnly: !(w.map || w.bumpMap || w.normalMap || w.specularMap || w.alphaMap || w.emissiveMap || w.roughnessMap || w.metalnessMap || w.clearcoatNormalMap || w.transmission || w.transmissionMap || w.thicknessMap) && !!w.displacementMap, fog: !!R, useFog: w.fog, fogExp2: R && R.isFogExp2, flatShading: !!w.flatShading, sizeAttenuation: w.sizeAttenuation, logarithmicDepthBuffer: c, skinning: C.isSkinnedMesh === !0 && O > 0, maxBones: O, useVertexTexture: l, morphTargets: w.morphTargets, morphNormals: w.morphNormals, numDirLights: b.directional.length, numPointLights: b.point.length, numSpotLights: b.spot.length, numRectAreaLights: b.rectArea.length, numHemiLights: b.hemi.length, numDirLightShadows: b.directionalShadowMap.length, numPointLightShadows: b.pointShadowMap.length, numSpotLightShadows: b.spotShadowMap.length, numClippingPlanes: o.numPlanes, numClipIntersection: o.numIntersection, dithering: w.dithering, shadowMapEnabled: i.shadowMap.enabled && E.length > 0, shadowMapType: i.shadowMap.type, toneMapping: w.toneMapped ? i.toneMapping : Un, physicallyCorrectLights: i.physicallyCorrectLights, premultipliedAlpha: w.premultipliedAlpha, alphaTest: w.alphaTest, doubleSided: w.side === Zn, flipSided: w.side === Yt, depthPacking: w.depthPacking !== void 0 ? w.depthPacking : !1, index0AttributeName: w.index0AttributeName, extensionDerivatives: w.extensions && w.extensions.derivatives, extensionFragDepth: w.extensions && w.extensions.fragDepth, extensionDrawBuffers: w.extensions && w.extensions.drawBuffers, extensionShaderTextureLOD: w.extensions && w.extensions.shaderTextureLOD, rendererExtensionFragDepth: s || t.has("EXT_frag_depth"), rendererExtensionDrawBuffers: s || t.has("WEBGL_draw_buffers"), rendererExtensionShaderTextureLod: s || t.has("EXT_shader_texture_lod"), customProgramCacheKey: w.customProgramCacheKey() }; } function v(w) { const b = []; if (w.shaderID ? b.push(w.shaderID) : (b.push(w.fragmentShader), b.push(w.vertexShader)), w.defines !== void 0) for (const E in w.defines) b.push(E), b.push(w.defines[E]); if (w.isRawShaderMaterial === !1) { for (let E = 0; E < g.length; E++) b.push(w[g[E]]); b.push(i.outputEncoding), b.push(i.gammaFactor); } return b.push(w.customProgramCacheKey), b.join(); } function _(w) { const b = m[w.type]; let E; if (b) { const S = mr[b]; E = Sx.clone(S.uniforms); } else E = w.uniforms; return E; } function M(w, b) { let E; for (let S = 0, C = a.length; S < C; S++) { const R = a[S]; if (R.cacheKey === b) { E = R, ++E.usedTimes; break; } } return E === void 0 && (E = new wN(i, b, w, n), a.push(E)), E; } function T(w) { if (--w.usedTimes === 0) { const b = a.indexOf(w); a[b] = a[a.length - 1], a.pop(), w.destroy(); } } return { getParameters: f, getProgramCacheKey: v, getUniforms: _, acquireProgram: M, releaseProgram: T, // Exposed for resource monitoring & error feedback via renderer.info: programs: a }; } function MN() { let i = /* @__PURE__ */ new WeakMap(); function e(o) { let a = i.get(o); return a === void 0 && (a = {}, i.set(o, a)), a; } function t(o) { i.delete(o); } function r(o, a, s) { i.get(o)[a] = s; } function n() { i = /* @__PURE__ */ new WeakMap(); } return { get: e, remove: t, update: r, dispose: n }; } function SN(i, e) { return i.groupOrder !== e.groupOrder ? i.groupOrder - e.groupOrder : i.renderOrder !== e.renderOrder ? i.renderOrder - e.renderOrder : i.program !== e.program ? i.program.id - e.program.id : i.material.id !== e.material.id ? i.material.id - e.material.id : i.z !== e.z ? i.z - e.z : i.id - e.id; } function Ng(i, e) { return i.groupOrder !== e.groupOrder ? i.groupOrder - e.groupOrder : i.renderOrder !== e.renderOrder ? i.renderOrder - e.renderOrder : i.z !== e.z ? e.z - i.z : i.id - e.id; } function Bg(i) { const e = []; let t = 0; const r = [], n = [], o = [], a = { id: -1 }; function s() { t = 0, r.length = 0, n.length = 0, o.length = 0; } function c(m, g, d, y, f, v) { let _ = e[t]; const M = i.get(d); return _ === void 0 ? (_ = { id: m.id, object: m, geometry: g, material: d, program: M.program || a, groupOrder: y, renderOrder: m.renderOrder, z: f, group: v }, e[t] = _) : (_.id = m.id, _.object = m, _.geometry = g, _.material = d, _.program = M.program || a, _.groupOrder = y, _.renderOrder = m.renderOrder, _.z = f, _.group = v), t++, _; } function l(m, g, d, y, f, v) { const _ = c(m, g, d, y, f, v); d.transmission > 0 ? n.push(_) : d.transparent === !0 ? o.push(_) : r.push(_); } function h(m, g, d, y, f, v) { const _ = c(m, g, d, y, f, v); d.transmission > 0 ? n.unshift(_) : d.transparent === !0 ? o.unshift(_) : r.unshift(_); } function u(m, g) { r.length > 1 && r.sort(m || SN), n.length > 1 && n.sort(g || Ng), o.length > 1 && o.sort(g || Ng); } function p() { for (let m = t, g = e.length; m < g; m++) { const d = e[m]; if (d.id === null) break; d.id = null, d.object = null, d.geometry = null, d.material = null, d.program = null, d.group = null; } } return { opaque: r, transmissive: n, transparent: o, init: s, push: l, unshift: h, finish: p, sort: u }; } function TN(i) { let e = /* @__PURE__ */ new WeakMap(); function t(n, o) { let a; return e.has(n) === !1 ? (a = new Bg(i), e.set(n, [a])) : o >= e.get(n).length ? (a = new Bg(i), e.get(n).push(a)) : a = e.get(n)[o], a; } function r() { e = /* @__PURE__ */ new WeakMap(); } return { get: t, dispose: r }; } function EN() { const i = {}; return { get: function(e) { if (i[e.id] !== void 0) return i[e.id]; let t; switch (e.type) { case "DirectionalLight": t = { direction: new Z(), color: new Be() }; break; case "SpotLight": t = { position: new Z(), direction: new Z(), color: new Be(), distance: 0, coneCos: 0, penumbraCos: 0, decay: 0 }; break; case "PointLight": t = { position: new Z(), color: new Be(), distance: 0, decay: 0 }; break; case "HemisphereLight": t = { direction: new Z(), skyColor: new Be(), groundColor: new Be() }; break; case "RectAreaLight": t = { color: new Be(), position: new Z(), halfWidth: new Z(), halfHeight: new Z() }; break; } return i[e.id] = t, t; } }; } function AN() { const i = {}; return { get: function(e) { if (i[e.id] !== void 0) return i[e.id]; let t; switch (e.type) { case "DirectionalLight": t = { shadowBias: 0, shadowNormalBias: 0, shadowRadius: 1, shadowMapSize: new Re() }; break; case "SpotLight": t = { shadowBias: 0, shadowNormalBias: 0, shadowRadius: 1, shadowMapSize: new Re() }; break; case "PointLight": t = { shadowBias: 0, shadowNormalBias: 0, shadowRadius: 1, shadowMapSize: new Re(), shadowCameraNear: 1, shadowCameraFar: 1e3 }; break; } return i[e.id] = t, t; } }; } let CN = 0; function LN(i, e) { return (e.castShadow ? 1 : 0) - (i.castShadow ? 1 : 0); } function RN(i, e) { const t = new EN(), r = AN(), n = { 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 h = 0; h < 9; h++) n.probe.push(new Z()); const o = new Z(), a = new $e(), s = new $e(); function c(h) { let u = 0, p = 0, m = 0; for (let b = 0; b < 9; b++) n.probe[b].set(0, 0, 0); let g = 0, d = 0, y = 0, f = 0, v = 0, _ = 0, M = 0, T = 0; h.sort(LN); for (let b = 0, E = h.length; b < E; b++) { const S = h[b], C = S.color, R = S.intensity, L = S.distance, A = S.shadow && S.shadow.map ? S.shadow.map.texture : null; if (S.isAmbientLight) u += C.r * R, p += C.g * R, m += C.b * R; else if (S.isLightProbe) for (let P = 0; P < 9; P++) n.probe[P].addScaledVector(S.sh.coefficients[P], R); else if (S.isDirectionalLight) { const P = t.get(S); if (P.color.copy(S.color).multiplyScalar(S.intensity), S.castShadow) { const O = S.shadow, x = r.get(S); x.shadowBias = O.bias, x.shadowNormalBias = O.normalBias, x.shadowRadius = O.radius, x.shadowMapSize = O.mapSize, n.directionalShadow[g] = x, n.directionalShadowMap[g] = A, n.directionalShadowMatrix[g] = S.shadow.matrix, _++; } n.directional[g] = P, g++; } else if (S.isSpotLight) { const P = t.get(S); if (P.position.setFromMatrixPosition(S.matrixWorld), P.color.copy(C).multiplyScalar(R), P.distance = L, P.coneCos = Math.cos(S.angle), P.penumbraCos = Math.cos(S.angle * (1 - S.penumbra)), P.decay = S.decay, S.castShadow) { const O = S.shadow, x = r.get(S); x.shadowBias = O.bias, x.shadowNormalBias = O.normalBias, x.shadowRadius = O.radius, x.shadowMapSize = O.mapSize, n.spotShadow[y] = x, n.spotShadowMap[y] = A, n.spotShadowMatrix[y] = S.shadow.matrix, T++; } n.spot[y] = P, y++; } else if (S.isRectAreaLight) { const P = t.get(S); P.color.copy(C).multiplyScalar(R), P.halfWidth.set(S.width * 0.5, 0, 0), P.halfHeight.set(0, S.height * 0.5, 0), n.rectArea[f] = P, f++; } else if (S.isPointLight) { const P = t.get(S); if (P.color.copy(S.color).multiplyScalar(S.intensity), P.distance = S.distance, P.decay = S.decay, S.castShadow) { const O = S.shadow, x = r.get(S); x.shadowBias = O.bias, x.shadowNormalBias = O.normalBias, x.shadowRadius = O.radius, x.shadowMapSize = O.mapSize, x.shadowCameraNear = O.camera.near, x.shadowCameraFar = O.camera.far, n.pointShadow[d] = x, n.pointShadowMap[d] = A, n.pointShadowMatrix[d] = S.shadow.matrix, M++; } n.point[d] = P, d++; } else if (S.isHemisphereLight) { const P = t.get(S); P.skyColor.copy(S.color).multiplyScalar(R), P.groundColor.copy(S.groundColor).multiplyScalar(R), n.hemi[v] = P, v++; } } f > 0 && (e.isWebGL2 || i.has("OES_texture_float_linear") === !0 ? (n.rectAreaLTC1 = Fe.LTC_FLOAT_1, n.rectAreaLTC2 = Fe.LTC_FLOAT_2) : i.has("OES_texture_half_float_linear") === !0 ? (n.rectAreaLTC1 = Fe.LTC_HALF_1, n.rectAreaLTC2 = Fe.LTC_HALF_2) : console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")), n.ambient[0] = u, n.ambient[1] = p, n.ambient[2] = m; const w = n.hash; (w.directionalLength !== g || w.pointLength !== d || w.spotLength !== y || w.rectAreaLength !== f || w.hemiLength !== v || w.numDirectionalShadows !== _ || w.numPointShadows !== M || w.numSpotShadows !== T) && (n.directional.length = g, n.spot.length = y, n.rectArea.length = f, n.point.length = d, n.hemi.length = v, n.directionalShadow.length = _, n.directionalShadowMap.length = _, n.pointShadow.length = M, n.pointShadowMap.length = M, n.spotShadow.length = T, n.spotShadowMap.length = T, n.directionalShadowMatrix.length = _, n.pointShadowMatrix.length = M, n.spotShadowMatrix.length = T, w.directionalLength = g, w.pointLength = d, w.spotLength = y, w.rectAreaLength = f, w.hemiLength = v, w.numDirectionalShadows = _, w.numPointShadows = M, w.numSpotShadows = T, n.version = CN++); } function l(h, u) { let p = 0, m = 0, g = 0, d = 0, y = 0; const f = u.matrixWorldInverse; for (let v = 0, _ = h.length; v < _; v++) { const M = h[v]; if (M.isDirectionalLight) { const T = n.directional[p]; T.direction.setFromMatrixPosition(M.matrixWorld), o.setFromMatrixPosition(M.target.matrixWorld), T.direction.sub(o), T.direction.transformDirection(f), p++; } else if (M.isSpotLight) { const T = n.spot[g]; T.position.setFromMatrixPosition(M.matrixWorld), T.position.applyMatrix4(f), T.direction.setFromMatrixPosition(M.matrixWorld), o.setFromMatrixPosition(M.target.matrixWorld), T.direction.sub(o), T.direction.transformDirection(f), g++; } else if (M.isRectAreaLight) { const T = n.rectArea[d]; T.position.setFromMatrixPosition(M.matrixWorld), T.position.applyMatrix4(f), s.identity(), a.copy(M.matrixWorld), a.premultiply(f), s.extractRotation(a), T.halfWidth.set(M.width * 0.5, 0, 0), T.halfHeight.set(0, M.height * 0.5, 0), T.halfWidth.applyMatrix4(s), T.halfHeight.applyMatrix4(s), d++; } else if (M.isPointLight) { const T = n.point[m]; T.position.setFromMatrixPosition(M.matrixWorld), T.position.applyMatrix4(f), m++; } else if (M.isHemisphereLight) { const T = n.hemi[y]; T.direction.setFromMatrixPosition(M.matrixWorld), T.direction.transformDirection(f), T.direction.normalize(), y++; } } } return { setup: c, setupView: l, state: n }; } function kg(i, e) { const t = new RN(i, e), r = [], n = []; function o() { r.length = 0, n.length = 0; } function a(h) { r.push(h); } function s(h) { n.push(h); } function c() { t.setup(r); } function l(h) { t.setupView(r, h); } return { init: o, state: { lightsArray: r, shadowsArray: n, lights: t }, setupLights: c, setupLightsView: l, pushLight: a, pushShadow: s }; } function ON(i, e) { let t = /* @__PURE__ */ new WeakMap(); function r(o, a = 0) { let s; return t.has(o) === !1 ? (s = new kg(i, e), t.set(o, [s])) : a >= t.get(o).length ? (s = new kg(i, e), t.get(o).push(s)) : s = t.get(o)[a], s; } function n() { t = /* @__PURE__ */ new WeakMap(); } return { get: r, dispose: n }; } class Iu extends ri { 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; } } Iu.prototype.isMeshDepthMaterial = !0; class Du extends ri { constructor(e) { super(), this.type = "MeshDistanceMaterial", this.referencePosition = new Z(), 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 PN = `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 ) ); }`, IN = `void main() { gl_Position = vec4( position, 1.0 ); }`; function Ix(i, e, t) { let r = new _l(); const n = new Re(), o = new Re(), a = new St(), s = [], c = [], l = {}, h = t.maxTextureSize, u = { 0: Yt, 1: Xn, 2: Zn }, p = new dn({ defines: { SAMPLE_RATE: 2 / 8, HALF_SAMPLE_RATE: 1 / 8 }, uniforms: { shadow_pass: { value: null }, resolution: { value: new Re() }, radius: { value: 4 } }, vertexShader: IN, fragmentShader: PN }), m = p.clone(); m.defines.HORIZONTAL_PASS = 1; const g = new Ye(); g.setAttribute( "position", new tt( new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]), 3 ) ); const d = new ei(g, p), y = this; this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = Fp, this.render = function(w, b, E) { if (y.enabled === !1 || y.autoUpdate === !1 && y.needsUpdate === !1 || w.length === 0) return; const S = i.getRenderTarget(), C = i.getActiveCubeFace(), R = i.getActiveMipmapLevel(), L = i.state; L.setBlending(an), L.buffers.color.setClear(1, 1, 1, 1), L.buffers.depth.setTest(!0), L.setScissorTest(!1); for (let A = 0, P = w.length; A < P; A++) { const O = w[A], x = O.shadow; if (x === void 0) { console.warn("THREE.WebGLShadowMap:", O, "has no shadow."); continue; } if (x.autoUpdate === !1 && x.needsUpdate === !1) continue; n.copy(x.mapSize); const I = x.getFrameExtents(); if (n.multiply(I), o.copy(x.mapSize), (n.x > h || n.y > h) && (n.x > h && (o.x = Math.floor(h / I.x), n.x = o.x * I.x, x.mapSize.x = o.x), n.y > h && (o.y = Math.floor(h / I.y), n.y = o.y * I.y, x.mapSize.y = o.y)), x.map === null && !x.isPointLightShadow && this.type === wa) { const D = { minFilter: Wt, magFilter: Wt, format: Xi }; x.map = new yr(n.x, n.y, D), x.map.texture.name = O.name + ".shadowMap", x.mapPass = new yr(n.x, n.y, D), x.camera.updateProjectionMatrix(); } if (x.map === null) { const D = { minFilter: Jt, magFilter: Jt, format: Xi }; x.map = new yr(n.x, n.y, D), x.map.texture.name = O.name + ".shadowMap", x.camera.updateProjectionMatrix(); } i.setRenderTarget(x.map), i.clear(); const N = x.getViewportCount(); for (let D = 0; D < N; D++) { const k = x.getViewport(D); a.set( o.x * k.x, o.y * k.y, o.x * k.z, o.y * k.w ), L.viewport(a), x.updateMatrices(O, D), r = x.getFrustum(), T(b, E, x.camera, O, this.type); } !x.isPointLightShadow && this.type === wa && f(x, E), x.needsUpdate = !1; } y.needsUpdate = !1, i.setRenderTarget(S, C, R); }; function f(w, b) { const E = e.update(d); p.uniforms.shadow_pass.value = w.map.texture, p.uniforms.resolution.value = w.mapSize, p.uniforms.radius.value = w.radius, i.setRenderTarget(w.mapPass), i.clear(), i.renderBufferDirect(b, null, E, p, d, null), m.uniforms.shadow_pass.value = w.mapPass.texture, m.uniforms.resolution.value = w.mapSize, m.uniforms.radius.value = w.radius, i.setRenderTarget(w.map), i.clear(), i.renderBufferDirect(b, null, E, m, d, null); } function v(w) { const b = w << 0; let E = s[b]; return E === void 0 && (E = new Iu({ depthPacking: cx, morphTargets: w }), s[b] = E), E; } function _(w) { const b = w << 0; let E = c[b]; return E === void 0 && (E = new Du({ morphTargets: w }), c[b] = E), E; } function M(w, b, E, S, C, R, L) { let A = null, P = v, O = w.customDepthMaterial; if (S.isPointLight === !0 && (P = _, O = w.customDistanceMaterial), O === void 0) { let x = !1; E.morphTargets === !0 && (x = b.morphAttributes && b.morphAttributes.position && b.morphAttributes.position.length > 0), A = P(x); } else A = O; if (i.localClippingEnabled && E.clipShadows === !0 && E.clippingPlanes.length !== 0) { const x = A.uuid, I = E.uuid; let N = l[x]; N === void 0 && (N = {}, l[x] = N); let D = N[I]; D === void 0 && (D = A.clone(), N[I] = D), A = D; } return A.visible = E.visible, A.wireframe = E.wireframe, L === wa ? A.side = E.shadowSide !== null ? E.shadowSide : E.side : A.side = E.shadowSide !== null ? E.shadowSide : u[E.side], A.clipShadows = E.clipShadows, A.clippingPlanes = E.clippingPlanes, A.clipIntersection = E.clipIntersection, A.wireframeLinewidth = E.wireframeLinewidth, A.linewidth = E.linewidth, S.isPointLight === !0 && A.isMeshDistanceMaterial === !0 && (A.referencePosition.setFromMatrixPosition(S.matrixWorld), A.nearDistance = C, A.farDistance = R), A; } function T(w, b, E, S, C) { if (w.visible === !1) return; if (w.layers.test(b.layers) && (w.isMesh || w.isLine || w.isPoints) && (w.castShadow || w.receiveShadow && C === wa) && (!w.frustumCulled || r.intersectsObject(w))) { w.modelViewMatrix.multiplyMatrices(E.matrixWorldInverse, w.matrixWorld); const L = e.update(w), A = w.material; if (Array.isArray(A)) { const P = L.groups; for (let O = 0, x = P.length; O < x; O++) { const I = P[O], N = A[I.materialIndex]; if (N && N.visible) { const D = M(w, L, N, S, E.near, E.far, C); i.renderBufferDirect(E, null, L, D, w, I); } } } else if (A.visible) { const P = M(w, L, A, S, E.near, E.far, C); i.renderBufferDirect(E, null, L, P, w, null); } } const R = w.children; for (let L = 0, A = R.length; L < A; L++) T(R[L], b, E, S, C); } } function DN(i, e, t) { const r = t.isWebGL2; function n() { let oe = !1; const Me = new St(); let ge = null; const xe = new St(0, 0, 0, 0); return { setMask: function(Oe) { ge !== Oe && !oe && (i.colorMask(Oe, Oe, Oe, Oe), ge = Oe); }, setLocked: function(Oe) { oe = Oe; }, setClear: function(Oe, ut, mt, ze, bt) { bt === !0 && (Oe *= ze, ut *= ze, mt *= ze), Me.set(Oe, ut, mt, ze), xe.equals(Me) === !1 && (i.clearColor(Oe, ut, mt, ze), xe.copy(Me)); }, reset: function() { oe = !1, ge = null, xe.set(-1, 0, 0, 0); } }; } function o() { let oe = !1, Me = null, ge = null, xe = null; return { setTest: function(Oe) { Oe ? ne(2929) : q(2929); }, setMask: function(Oe) { Me !== Oe && !oe && (i.depthMask(Oe), Me = Oe); }, setFunc: function(Oe) { if (ge !== Oe) { if (Oe) switch (Oe) { case Yy: i.depthFunc(512); break; case Jy: i.depthFunc(519); break; case Ky: i.depthFunc(513); break; case Kc: i.depthFunc(515); break; case Qy: i.depthFunc(514); break; case eb: i.depthFunc(518); break; case tb: i.depthFunc(516); break; case ib: i.depthFunc(517); break; default: i.depthFunc(515); } else i.depthFunc(515); ge = Oe; } }, setLocked: function(Oe) { oe = Oe; }, setClear: function(Oe) { xe !== Oe && (i.clearDepth(Oe), xe = Oe); }, reset: function() { oe = !1, Me = null, ge = null, xe = null; } }; } function a() { let oe = !1, Me = null, ge = null, xe = null, Oe = null, ut = null, mt = null, ze = null, bt = null; return { setTest: function(Ue) { oe || (Ue ? ne(2960) : q(2960)); }, setMask: function(Ue) { Me !== Ue && !oe && (i.stencilMask(Ue), Me = Ue); }, setFunc: function(Ue, st, et) { (ge !== Ue || xe !== st || Oe !== et) && (i.stencilFunc(Ue, st, et), ge = Ue, xe = st, Oe = et); }, setOp: function(Ue, st, et) { (ut !== Ue || mt !== st || ze !== et) && (i.stencilOp(Ue, st, et), ut = Ue, mt = st, ze = et); }, setLocked: function(Ue) { oe = Ue; }, setClear: function(Ue) { bt !== Ue && (i.clearStencil(Ue), bt = Ue); }, reset: function() { oe = !1, Me = null, ge = null, xe = null, Oe = null, ut = null, mt = null, ze = null, bt = null; } }; } const s = new n(), c = new o(), l = new a(); let h = {}, u = null, p = {}, m = null, g = !1, d = null, y = null, f = null, v = null, _ = null, M = null, T = null, w = !1, b = null, E = null, S = null, C = null, R = null; const L = i.getParameter(35661); let A = !1, P = 0; const O = i.getParameter(7938); O.indexOf("WebGL") !== -1 ? (P = parseFloat(/^WebGL (\d)/.exec(O)[1]), A = P >= 1) : O.indexOf("OpenGL ES") !== -1 && (P = parseFloat(/^OpenGL ES (\d)/.exec(O)[1]), A = P >= 2); let x = null, I = {}; const N = i.getParameter(3088), D = i.getParameter(2978), k = new St().fromArray(N), F = new St().fromArray(D); function W(oe, Me, ge) { const xe = new Uint8Array(4), Oe = i.createTexture(); i.bindTexture(oe, Oe), i.texParameteri(oe, 10241, 9728), i.texParameteri(oe, 10240, 9728); for (let ut = 0; ut < ge; ut++) i.texImage2D(Me + ut, 0, 6408, 1, 1, 0, 6408, 5121, xe); return Oe; } const K = {}; K[3553] = W(3553, 3553, 1), K[34067] = W(34067, 34069, 6), s.setClear(0, 0, 0, 1), c.setClear(1), l.setClear(0), ne(2929), c.setFunc(Kc), re(!1), B(vd), ne(2884), G(an); function ne(oe) { h[oe] !== !0 && (i.enable(oe), h[oe] = !0); } function q(oe) { h[oe] !== !1 && (i.disable(oe), h[oe] = !1); } function z(oe) { oe !== u && (i.bindFramebuffer(36160, oe), u = oe); } function j(oe, Me) { return Me === null && u !== null && (Me = u), p[oe] !== Me ? (i.bindFramebuffer(oe, Me), p[oe] = Me, r && (oe === 36009 && (p[36160] = Me), oe === 36160 && (p[36009] = Me)), !0) : !1; } function Q(oe) { return m !== oe ? (i.useProgram(oe), m = oe, !0) : !1; } const Y = { [bo]: 32774, [zy]: 32778, [Uy]: 32779 }; if (r) Y[wd] = 32775, Y[_d] = 32776; else { const oe = e.get("EXT_blend_minmax"); oe !== null && (Y[wd] = oe.MIN_EXT, Y[_d] = oe.MAX_EXT); } const ee = { [Vy]: 0, [Hy]: 1, [jy]: 768, [Up]: 770, [Zy]: 776, [qy]: 774, [Wy]: 772, [Gy]: 769, [Vp]: 771, [Xy]: 775, [$y]: 773 }; function G(oe, Me, ge, xe, Oe, ut, mt, ze) { if (oe === an) { g === !0 && (q(3042), g = !1); return; } if (g === !1 && (ne(3042), g = !0), oe !== Fy) { if (oe !== d || ze !== w) { if ((y !== bo || _ !== bo) && (i.blendEquation(32774), y = bo, _ = bo), ze) switch (oe) { case Sa: i.blendFuncSeparate(1, 771, 1, 771); break; case yd: i.blendFunc(1, 1); break; case bd: i.blendFuncSeparate(0, 0, 769, 771); break; case xd: i.blendFuncSeparate(0, 768, 0, 770); break; default: console.error("THREE.WebGLState: Invalid blending: ", oe); break; } else switch (oe) { case Sa: i.blendFuncSeparate(770, 771, 1, 771); break; case yd: i.blendFunc(770, 1); break; case bd: i.blendFunc(0, 769); break; case xd: i.blendFunc(0, 768); break; default: console.error("THREE.WebGLState: Invalid blending: ", oe); break; } f = null, v = null, M = null, T = null, d = oe, w = ze; } return; } Oe = Oe || Me, ut = ut || ge, mt = mt || xe, (Me !== y || Oe !== _) && (i.blendEquationSeparate(Y[Me], Y[Oe]), y = Me, _ = Oe), (ge !== f || xe !== v || ut !== M || mt !== T) && (i.blendFuncSeparate(ee[ge], ee[xe], ee[ut], ee[mt]), f = ge, v = xe, M = ut, T = mt), d = oe, w = null; } function J(oe, Me) { oe.side === Zn ? q(2884) : ne(2884); let ge = oe.side === Yt; Me && (ge = !ge), re(ge), oe.blending === Sa && oe.transparent === !1 ? G(an) : G(oe.blending, oe.blendEquation, oe.blendSrc, oe.blendDst, oe.blendEquationAlpha, oe.blendSrcAlpha, oe.blendDstAlpha, oe.premultipliedAlpha), c.setFunc(oe.depthFunc), c.setTest(oe.depthTest), c.setMask(oe.depthWrite), s.setMask(oe.colorWrite); const xe = oe.stencilWrite; l.setTest(xe), xe && (l.setMask(oe.stencilWriteMask), l.setFunc(oe.stencilFunc, oe.stencilRef, oe.stencilFuncMask), l.setOp(oe.stencilFail, oe.stencilZFail, oe.stencilZPass)), te(oe.polygonOffset, oe.polygonOffsetFactor, oe.polygonOffsetUnits), oe.alphaToCoverage === !0 ? ne(32926) : q(32926); } function re(oe) { b !== oe && (oe ? i.frontFace(2304) : i.frontFace(2305), b = oe); } function B(oe) { oe !== Ny ? (ne(2884), oe !== E && (oe === vd ? i.cullFace(1029) : oe === By ? i.cullFace(1028) : i.cullFace(1032))) : q(2884), E = oe; } function $(oe) { oe !== S && (A && i.lineWidth(oe), S = oe); } function te(oe, Me, ge) { oe ? (ne(32823), (C !== Me || R !== ge) && (i.polygonOffset(Me, ge), C = Me, R = ge)) : q(32823); } function U(oe) { oe ? ne(3089) : q(3089); } function V(oe) { oe === void 0 && (oe = 33984 + L - 1), x !== oe && (i.activeTexture(oe), x = oe); } function ae(oe, Me) { x === null && V(); let ge = I[x]; ge === void 0 && (ge = { type: void 0, texture: void 0 }, I[x] = ge), (ge.type !== oe || ge.texture !== Me) && (i.bindTexture(oe, Me || K[oe]), ge.type = oe, ge.texture = Me); } function ue() { const oe = I[x]; oe !== void 0 && oe.type !== void 0 && (i.bindTexture(oe.type, null), oe.type = void 0, oe.texture = void 0); } function de() { try { i.compressedTexImage2D.apply(i, arguments); } catch (oe) { console.error("THREE.WebGLState:", oe); } } function ve() { try { i.texImage2D.apply(i, arguments); } catch (oe) { console.error("THREE.WebGLState:", oe); } } function ye() { try { i.texImage3D.apply(i, arguments); } catch (oe) { console.error("THREE.WebGLState:", oe); } } function le(oe) { k.equals(oe) === !1 && (i.scissor(oe.x, oe.y, oe.z, oe.w), k.copy(oe)); } function Se(oe) { F.equals(oe) === !1 && (i.viewport(oe.x, oe.y, oe.z, oe.w), F.copy(oe)); } function Te() { i.disable(3042), i.disable(2884), i.disable(2929), i.disable(32823), i.disable(3089), i.disable(2960), i.disable(32926), i.blendEquation(32774), i.blendFunc(1, 0), i.blendFuncSeparate(1, 0, 1, 0), i.colorMask(!0, !0, !0, !0), i.clearColor(0, 0, 0, 0), i.depthMask(!0), i.depthFunc(513), i.clearDepth(1), i.stencilMask(4294967295), i.stencilFunc(519, 0, 4294967295), i.stencilOp(7680, 7680, 7680), i.clearStencil(0), i.cullFace(1029), i.frontFace(2305), i.polygonOffset(0, 0), i.activeTexture(33984), i.bindFramebuffer(36160, null), r === !0 && (i.bindFramebuffer(36009, null), i.bindFramebuffer(36008, null)), i.useProgram(null), i.lineWidth(1), i.scissor(0, 0, i.canvas.width, i.canvas.height), i.viewport(0, 0, i.canvas.width, i.canvas.height), h = {}, x = null, I = {}, u = null, p = {}, m = null, g = !1, d = null, y = null, f = null, v = null, _ = null, M = null, T = null, w = !1, b = null, E = null, S = null, C = null, R = null, k.set(0, 0, i.canvas.width, i.canvas.height), F.set(0, 0, i.canvas.width, i.canvas.height), s.reset(), c.reset(), l.reset(); } return { buffers: { color: s, depth: c, stencil: l }, enable: ne, disable: q, bindFramebuffer: j, bindXRFramebuffer: z, useProgram: Q, setBlending: G, setMaterial: J, setFlipSided: re, setCullFace: B, setLineWidth: $, setPolygonOffset: te, setScissorTest: U, activeTexture: V, bindTexture: ae, unbindTexture: ue, compressedTexImage2D: de, texImage2D: ve, texImage3D: ye, scissor: le, viewport: Se, reset: Te }; } function NN(i, e, t, r, n, o, a) { const s = n.isWebGL2, c = n.maxTextures, l = n.maxCubemapSize, h = n.maxTextureSize, u = n.maxSamples, p = /* @__PURE__ */ new WeakMap(); let m, g = !1; try { g = typeof OffscreenCanvas < "u" && new OffscreenCanvas(1, 1).getContext("2d") !== null; } catch { } function d(U, V) { return g ? new OffscreenCanvas(U, V) : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); } function y(U, V, ae, ue) { let de = 1; if ((U.width > ue || U.height > ue) && (de = ue / Math.max(U.width, U.height)), de < 1 || V === !0) if (typeof HTMLImageElement < "u" && U instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && U instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && U instanceof ImageBitmap) { const ve = V ? px : Math.floor, ye = ve(de * U.width), le = ve(de * U.height); m === void 0 && (m = d(ye, le)); const Se = ae ? d(ye, le) : m; return Se.width = ye, Se.height = le, Se.getContext("2d").drawImage(U, 0, 0, ye, le), console.warn("THREE.WebGLRenderer: Texture has been resized from (" + U.width + "x" + U.height + ") to (" + ye + "x" + le + ")."), Se; } else return "data" in U && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + U.width + "x" + U.height + ")."), U; return U; } function f(U) { return Dd(U.width) && Dd(U.height); } function v(U) { return s ? !1 : U.wrapS !== di || U.wrapT !== di || U.minFilter !== Jt && U.minFilter !== Wt; } function _(U, V) { return U.generateMipmaps && V && U.minFilter !== Jt && U.minFilter !== Wt; } function M(U, V, ae, ue, de = 1) { i.generateMipmap(U); const ve = r.get(V); ve.__maxMipLevel = Math.log2(Math.max(ae, ue, de)); } function T(U, V, ae) { if (s === !1) return V; if (U !== null) { if (i[U] !== void 0) return i[U]; console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + U + "'"); } let ue = V; return V === 6403 && (ae === 5126 && (ue = 33326), ae === 5131 && (ue = 33325), ae === 5121 && (ue = 33321)), V === 6407 && (ae === 5126 && (ue = 34837), ae === 5131 && (ue = 34843), ae === 5121 && (ue = 32849)), V === 6408 && (ae === 5126 && (ue = 34836), ae === 5131 && (ue = 34842), ae === 5121 && (ue = 32856)), (ue === 33325 || ue === 33326 || ue === 34842 || ue === 34836) && e.get("EXT_color_buffer_float"), ue; } function w(U) { return U === Jt || U === Ks || U === Qs ? 9728 : 9729; } function b(U) { const V = U.target; V.removeEventListener("dispose", b), S(V), V.isVideoTexture && p.delete(V), a.memory.textures--; } function E(U) { const V = U.target; V.removeEventListener("dispose", E), C(V); } function S(U) { const V = r.get(U); V.__webglInit !== void 0 && (i.deleteTexture(V.__webglTexture), r.remove(U)); } function C(U) { const V = U.texture, ae = r.get(U), ue = r.get(V); if (U) { if (ue.__webglTexture !== void 0 && (i.deleteTexture(ue.__webglTexture), a.memory.textures--), U.depthTexture && U.depthTexture.dispose(), U.isWebGLCubeRenderTarget) for (let de = 0; de < 6; de++) i.deleteFramebuffer(ae.__webglFramebuffer[de]), ae.__webglDepthbuffer && i.deleteRenderbuffer(ae.__webglDepthbuffer[de]); else i.deleteFramebuffer(ae.__webglFramebuffer), ae.__webglDepthbuffer && i.deleteRenderbuffer(ae.__webglDepthbuffer), ae.__webglMultisampledFramebuffer && i.deleteFramebuffer(ae.__webglMultisampledFramebuffer), ae.__webglColorRenderbuffer && i.deleteRenderbuffer(ae.__webglColorRenderbuffer), ae.__webglDepthRenderbuffer && i.deleteRenderbuffer(ae.__webglDepthRenderbuffer); if (U.isWebGLMultipleRenderTargets) for (let de = 0, ve = V.length; de < ve; de++) { const ye = r.get(V[de]); ye.__webglTexture && (i.deleteTexture(ye.__webglTexture), a.memory.textures--), r.remove(V[de]); } r.remove(V), r.remove(U); } } let R = 0; function L() { R = 0; } function A() { const U = R; return U >= c && console.warn("THREE.WebGLTextures: Trying to use " + U + " texture units while this GPU supports only " + c), R += 1, U; } function P(U, V) { const ae = r.get(U); if (U.isVideoTexture && J(U), U.version > 0 && ae.__version !== U.version) { const ue = U.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 { W(ae, U, V); return; } } t.activeTexture(33984 + V), t.bindTexture(3553, ae.__webglTexture); } function O(U, V) { const ae = r.get(U); if (U.version > 0 && ae.__version !== U.version) { W(ae, U, V); return; } t.activeTexture(33984 + V), t.bindTexture(35866, ae.__webglTexture); } function x(U, V) { const ae = r.get(U); if (U.version > 0 && ae.__version !== U.version) { W(ae, U, V); return; } t.activeTexture(33984 + V), t.bindTexture(32879, ae.__webglTexture); } function I(U, V) { const ae = r.get(U); if (U.version > 0 && ae.__version !== U.version) { K(ae, U, V); return; } t.activeTexture(33984 + V), t.bindTexture(34067, ae.__webglTexture); } const N = { [Yn]: 10497, [di]: 33071, [Na]: 33648 }, D = { [Jt]: 9728, [Ks]: 9984, [Qs]: 9986, [Wt]: 9729, [Tu]: 9985, [bn]: 9987 }; function k(U, V, ae) { if (ae ? (i.texParameteri(U, 10242, N[V.wrapS]), i.texParameteri(U, 10243, N[V.wrapT]), (U === 32879 || U === 35866) && i.texParameteri(U, 32882, N[V.wrapR]), i.texParameteri(U, 10240, D[V.magFilter]), i.texParameteri(U, 10241, D[V.minFilter])) : (i.texParameteri(U, 10242, 33071), i.texParameteri(U, 10243, 33071), (U === 32879 || U === 35866) && i.texParameteri(U, 32882, 33071), (V.wrapS !== di || V.wrapT !== di) && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."), i.texParameteri(U, 10240, w(V.magFilter)), i.texParameteri(U, 10241, w(V.minFilter)), V.minFilter !== Jt && V.minFilter !== Wt && 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 === tn && e.has("OES_texture_float_linear") === !1 || s === !1 && V.type === Eo && e.has("OES_texture_half_float_linear") === !1) return; (V.anisotropy > 1 || r.get(V).__currentAnisotropy) && (i.texParameterf(U, ue.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(V.anisotropy, n.getMaxAnisotropy())), r.get(V).__currentAnisotropy = V.anisotropy); } } function F(U, V) { U.__webglInit === void 0 && (U.__webglInit = !0, V.addEventListener("dispose", b), U.__webglTexture = i.createTexture(), a.memory.textures++); } function W(U, V, ae) { let ue = 3553; V.isDataTexture2DArray && (ue = 35866), V.isDataTexture3D && (ue = 32879), F(U, V), t.activeTexture(33984 + ae), t.bindTexture(ue, U.__webglTexture), i.pixelStorei(37440, V.flipY), i.pixelStorei(37441, V.premultiplyAlpha), i.pixelStorei(3317, V.unpackAlignment), i.pixelStorei(37443, 0); const de = v(V) && f(V.image) === !1, ve = y(V.image, de, !1, h), ye = f(ve) || s, le = o.convert(V.format); let Se = o.convert(V.type), Te = T(V.internalFormat, le, Se); k(ue, V, ye); let oe; const Me = V.mipmaps; if (V.isDepthTexture) Te = 6402, s ? V.type === tn ? Te = 36012 : V.type === Us ? Te = 33190 : V.type === Ta ? Te = 35056 : Te = 33189 : V.type === tn && console.error("WebGLRenderer: Floating point depth texture requires WebGL2."), V.format === Ao && Te === 6402 && V.type !== el && V.type !== Us && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."), V.type = el, Se = o.convert(V.type)), V.format === Ba && Te === 6402 && (Te = 34041, V.type !== Ta && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."), V.type = Ta, Se = o.convert(V.type))), t.texImage2D(3553, 0, Te, ve.width, ve.height, 0, le, Se, null); else if (V.isDataTexture) if (Me.length > 0 && ye) { for (let ge = 0, xe = Me.length; ge < xe; ge++) oe = Me[ge], t.texImage2D(3553, ge, Te, oe.width, oe.height, 0, le, Se, oe.data); V.generateMipmaps = !1, U.__maxMipLevel = Me.length - 1; } else t.texImage2D(3553, 0, Te, ve.width, ve.height, 0, le, Se, ve.data), U.__maxMipLevel = 0; else if (V.isCompressedTexture) { for (let ge = 0, xe = Me.length; ge < xe; ge++) oe = Me[ge], V.format !== Xi && V.format !== sn ? le !== null ? t.compressedTexImage2D(3553, ge, Te, oe.width, oe.height, 0, oe.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : t.texImage2D(3553, ge, Te, oe.width, oe.height, 0, le, Se, oe.data); U.__maxMipLevel = Me.length - 1; } else if (V.isDataTexture2DArray) t.texImage3D(35866, 0, Te, ve.width, ve.height, ve.depth, 0, le, Se, ve.data), U.__maxMipLevel = 0; else if (V.isDataTexture3D) t.texImage3D(32879, 0, Te, ve.width, ve.height, ve.depth, 0, le, Se, ve.data), U.__maxMipLevel = 0; else if (Me.length > 0 && ye) { for (let ge = 0, xe = Me.length; ge < xe; ge++) oe = Me[ge], t.texImage2D(3553, ge, Te, le, Se, oe); V.generateMipmaps = !1, U.__maxMipLevel = Me.length - 1; } else t.texImage2D(3553, 0, Te, le, Se, ve), U.__maxMipLevel = 0; _(V, ye) && M(ue, V, ve.width, ve.height), U.__version = V.version, V.onUpdate && V.onUpdate(V); } function K(U, V, ae) { if (V.image.length !== 6) return; F(U, V), t.activeTexture(33984 + ae), t.bindTexture(34067, U.__webglTexture), i.pixelStorei(37440, V.flipY), i.pixelStorei(37441, V.premultiplyAlpha), i.pixelStorei(3317, V.unpackAlignment), i.pixelStorei(37443, 0); const ue = V && (V.isCompressedTexture || V.image[0].isCompressedTexture), de = V.image[0] && V.image[0].isDataTexture, ve = []; for (let ge = 0; ge < 6; ge++) !ue && !de ? ve[ge] = y(V.image[ge], !1, !0, l) : ve[ge] = de ? V.image[ge].image : V.image[ge]; const ye = ve[0], le = f(ye) || s, Se = o.convert(V.format), Te = o.convert(V.type), oe = T(V.internalFormat, Se, Te); k(34067, V, le); let Me; if (ue) { for (let ge = 0; ge < 6; ge++) { Me = ve[ge].mipmaps; for (let xe = 0; xe < Me.length; xe++) { const Oe = Me[xe]; V.format !== Xi && V.format !== sn ? Se !== null ? t.compressedTexImage2D(34069 + ge, xe, oe, Oe.width, Oe.height, 0, Oe.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : t.texImage2D(34069 + ge, xe, oe, Oe.width, Oe.height, 0, Se, Te, Oe.data); } } U.__maxMipLevel = Me.length - 1; } else { Me = V.mipmaps; for (let ge = 0; ge < 6; ge++) if (de) { t.texImage2D(34069 + ge, 0, oe, ve[ge].width, ve[ge].height, 0, Se, Te, ve[ge].data); for (let xe = 0; xe < Me.length; xe++) { const Oe = Me[xe].image[ge].image; t.texImage2D(34069 + ge, xe + 1, oe, Oe.width, Oe.height, 0, Se, Te, Oe.data); } } else { t.texImage2D(34069 + ge, 0, oe, Se, Te, ve[ge]); for (let xe = 0; xe < Me.length; xe++) { const Oe = Me[xe]; t.texImage2D(34069 + ge, xe + 1, oe, Se, Te, Oe.image[ge]); } } U.__maxMipLevel = Me.length; } _(V, le) && M(34067, V, ye.width, ye.height), U.__version = V.version, V.onUpdate && V.onUpdate(V); } function ne(U, V, ae, ue, de) { const ve = o.convert(ae.format), ye = o.convert(ae.type), le = T(ae.internalFormat, ve, ye); de === 32879 || de === 35866 ? t.texImage3D(de, 0, le, V.width, V.height, V.depth, 0, ve, ye, null) : t.texImage2D(de, 0, le, V.width, V.height, 0, ve, ye, null), t.bindFramebuffer(36160, U), i.framebufferTexture2D(36160, ue, de, r.get(ae).__webglTexture, 0), t.bindFramebuffer(36160, null); } function q(U, V, ae) { if (i.bindRenderbuffer(36161, U), V.depthBuffer && !V.stencilBuffer) { let ue = 33189; if (ae) { const de = V.depthTexture; de && de.isDepthTexture && (de.type === tn ? ue = 36012 : de.type === Us && (ue = 33190)); const ve = G(V); i.renderbufferStorageMultisample(36161, ve, ue, V.width, V.height); } else i.renderbufferStorage(36161, ue, V.width, V.height); i.framebufferRenderbuffer(36160, 36096, 36161, U); } else if (V.depthBuffer && V.stencilBuffer) { if (ae) { const ue = G(V); i.renderbufferStorageMultisample(36161, ue, 35056, V.width, V.height); } else i.renderbufferStorage(36161, 34041, V.width, V.height); i.framebufferRenderbuffer(36160, 33306, 36161, U); } else { const ue = V.isWebGLMultipleRenderTargets === !0 ? V.texture[0] : V.texture, de = o.convert(ue.format), ve = o.convert(ue.type), ye = T(ue.internalFormat, de, ve); if (ae) { const le = G(V); i.renderbufferStorageMultisample(36161, le, ye, V.width, V.height); } else i.renderbufferStorage(36161, ye, V.width, V.height); } i.bindRenderbuffer(36161, null); } function z(U, V) { if (V && V.isWebGLCubeRenderTarget) throw new Error("Depth Texture with cube render targets is not supported"); if (t.bindFramebuffer(36160, U), !(V.depthTexture && V.depthTexture.isDepthTexture)) throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture"); (!r.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 ae = r.get(V.depthTexture).__webglTexture; if (V.depthTexture.format === Ao) i.framebufferTexture2D(36160, 36096, 3553, ae, 0); else if (V.depthTexture.format === Ba) i.framebufferTexture2D(36160, 33306, 3553, ae, 0); else throw new Error("Unknown depthTexture format"); } function j(U) { const V = r.get(U), ae = U.isWebGLCubeRenderTarget === !0; if (U.depthTexture) { if (ae) throw new Error("target.depthTexture not supported in Cube render targets"); z(V.__webglFramebuffer, U); } else if (ae) { V.__webglDepthbuffer = []; for (let ue = 0; ue < 6; ue++) t.bindFramebuffer(36160, V.__webglFramebuffer[ue]), V.__webglDepthbuffer[ue] = i.createRenderbuffer(), q(V.__webglDepthbuffer[ue], U, !1); } else t.bindFramebuffer(36160, V.__webglFramebuffer), V.__webglDepthbuffer = i.createRenderbuffer(), q(V.__webglDepthbuffer, U, !1); t.bindFramebuffer(36160, null); } function Q(U) { const V = U.texture, ae = r.get(U), ue = r.get(V); U.addEventListener("dispose", E), U.isWebGLMultipleRenderTargets !== !0 && (ue.__webglTexture = i.createTexture(), ue.__version = V.version, a.memory.textures++); const de = U.isWebGLCubeRenderTarget === !0, ve = U.isWebGLMultipleRenderTargets === !0, ye = U.isWebGLMultisampleRenderTarget === !0, le = V.isDataTexture3D || V.isDataTexture2DArray, Se = f(U) || s; if (s && V.format === sn && (V.type === tn || V.type === Eo) && (V.format = Xi, console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")), de) { ae.__webglFramebuffer = []; for (let Te = 0; Te < 6; Te++) ae.__webglFramebuffer[Te] = i.createFramebuffer(); } else if (ae.__webglFramebuffer = i.createFramebuffer(), ve) if (n.drawBuffers) { const Te = U.texture; for (let oe = 0, Me = Te.length; oe < Me; oe++) { const ge = r.get(Te[oe]); ge.__webglTexture === void 0 && (ge.__webglTexture = i.createTexture(), a.memory.textures++); } } else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension."); else if (ye) if (s) { ae.__webglMultisampledFramebuffer = i.createFramebuffer(), ae.__webglColorRenderbuffer = i.createRenderbuffer(), i.bindRenderbuffer(36161, ae.__webglColorRenderbuffer); const Te = o.convert(V.format), oe = o.convert(V.type), Me = T(V.internalFormat, Te, oe), ge = G(U); i.renderbufferStorageMultisample(36161, ge, Me, U.width, U.height), t.bindFramebuffer(36160, ae.__webglMultisampledFramebuffer), i.framebufferRenderbuffer(36160, 36064, 36161, ae.__webglColorRenderbuffer), i.bindRenderbuffer(36161, null), U.depthBuffer && (ae.__webglDepthRenderbuffer = i.createRenderbuffer(), q(ae.__webglDepthRenderbuffer, U, !0)), t.bindFramebuffer(36160, null); } else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."); if (de) { t.bindTexture(34067, ue.__webglTexture), k(34067, V, Se); for (let Te = 0; Te < 6; Te++) ne(ae.__webglFramebuffer[Te], U, V, 36064, 34069 + Te); _(V, Se) && M(34067, V, U.width, U.height), t.bindTexture(34067, null); } else if (ve) { const Te = U.texture; for (let oe = 0, Me = Te.length; oe < Me; oe++) { const ge = Te[oe], xe = r.get(ge); t.bindTexture(3553, xe.__webglTexture), k(3553, ge, Se), ne(ae.__webglFramebuffer, U, ge, 36064 + oe, 3553), _(ge, Se) && M(3553, ge, U.width, U.height); } t.bindTexture(3553, null); } else { let Te = 3553; le && (s ? Te = V.isDataTexture3D ? 32879 : 35866 : console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")), t.bindTexture(Te, ue.__webglTexture), k(Te, V, Se), ne(ae.__webglFramebuffer, U, V, 36064, Te), _(V, Se) && M(Te, V, U.width, U.height, U.depth), t.bindTexture(Te, null); } U.depthBuffer && j(U); } function Y(U) { const V = f(U) || s, ae = U.isWebGLMultipleRenderTargets === !0 ? U.texture : [U.texture]; for (let ue = 0, de = ae.length; ue < de; ue++) { const ve = ae[ue]; if (_(ve, V)) { const ye = U.isWebGLCubeRenderTarget ? 34067 : 3553, le = r.get(ve).__webglTexture; t.bindTexture(ye, le), M(ye, ve, U.width, U.height), t.bindTexture(ye, null); } } } function ee(U) { if (U.isWebGLMultisampleRenderTarget) if (s) { const V = U.width, ae = U.height; let ue = 16384; U.depthBuffer && (ue |= 256), U.stencilBuffer && (ue |= 1024); const de = r.get(U); t.bindFramebuffer(36008, de.__webglMultisampledFramebuffer), t.bindFramebuffer(36009, de.__webglFramebuffer), i.blitFramebuffer(0, 0, V, ae, 0, 0, V, ae, ue, 9728), t.bindFramebuffer(36008, null), t.bindFramebuffer(36009, de.__webglMultisampledFramebuffer); } else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."); } function G(U) { return s && U.isWebGLMultisampleRenderTarget ? Math.min(u, U.samples) : 0; } function J(U) { const V = a.render.frame; p.get(U) !== V && (p.set(U, V), U.update()); } let re = !1, B = !1; function $(U, V) { U && U.isWebGLRenderTarget && (re === !1 && (console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."), re = !0), U = U.texture), P(U, V); } function te(U, V) { U && U.isWebGLCubeRenderTarget && (B === !1 && (console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), B = !0), U = U.texture), I(U, V); } this.allocateTextureUnit = A, this.resetTextureUnits = L, this.setTexture2D = P, this.setTexture2DArray = O, this.setTexture3D = x, this.setTextureCube = I, this.setupRenderTarget = Q, this.updateRenderTargetMipmap = Y, this.updateMultisampleRenderTarget = ee, this.safeSetTexture2D = $, this.safeSetTextureCube = te; } function Dx(i, e, t) { const r = t.isWebGL2; function n(o) { let a; if (o === Po) return 5121; if (o === pb) return 32819; if (o === fb) return 32820; if (o === mb) return 33635; if (o === ub) return 5120; if (o === hb) return 5122; if (o === el) return 5123; if (o === db) return 5124; if (o === Us) return 5125; if (o === tn) return 5126; if (o === Eo) return r ? 5131 : (a = e.get("OES_texture_half_float"), a !== null ? a.HALF_FLOAT_OES : null); if (o === gb) return 6406; if (o === sn) return 6407; if (o === Xi) return 6408; if (o === vb) return 6409; if (o === yb) return 6410; if (o === Ao) return 6402; if (o === Ba) return 34041; if (o === xb) return 6403; if (o === wb) return 36244; if (o === _b) return 33319; if (o === Mb) return 33320; if (o === Sb) return 36248; if (o === Tb) return 36249; if (o === Md || o === Sd || o === Td || o === Ed) if (a = e.get("WEBGL_compressed_texture_s3tc"), a !== null) { if (o === Md) return a.COMPRESSED_RGB_S3TC_DXT1_EXT; if (o === Sd) return a.COMPRESSED_RGBA_S3TC_DXT1_EXT; if (o === Td) return a.COMPRESSED_RGBA_S3TC_DXT3_EXT; if (o === Ed) return a.COMPRESSED_RGBA_S3TC_DXT5_EXT; } else return null; if (o === Ad || o === Cd || o === Ld || o === Rd) if (a = e.get("WEBGL_compressed_texture_pvrtc"), a !== null) { if (o === Ad) return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; if (o === Cd) return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; if (o === Ld) return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; if (o === Rd) return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; } else return null; if (o === Eb) return a = e.get("WEBGL_compressed_texture_etc1"), a !== null ? a.COMPRESSED_RGB_ETC1_WEBGL : null; if ((o === Od || o === Pd) && (a = e.get("WEBGL_compressed_texture_etc"), a !== null)) { if (o === Od) return a.COMPRESSED_RGB8_ETC2; if (o === Pd) return a.COMPRESSED_RGBA8_ETC2_EAC; } if (o === Ab || o === Cb || o === Lb || o === Rb || o === Ob || o === Pb || o === Ib || o === Db || o === Nb || o === Bb || o === kb || o === Fb || o === zb || o === Ub || o === Hb || o === jb || o === Gb || o === Wb || o === $b || o === qb || o === Xb || o === Zb || o === Yb || o === Jb || o === Kb || o === Qb || o === ex || o === tx) return a = e.get("WEBGL_compressed_texture_astc"), a !== null ? o : null; if (o === Vb) return a = e.get("EXT_texture_compression_bptc"), a !== null ? o : null; if (o === Ta) return r ? 34042 : (a = e.get("WEBGL_depth_texture"), a !== null ? a.UNSIGNED_INT_24_8_WEBGL : null); } return { convert: n }; } class Kp extends oi { constructor(e = []) { super(), this.cameras = e; } } Kp.prototype.isArrayCamera = !0; class Rr extends ot { constructor() { super(), this.type = "Group"; } } Rr.prototype.isGroup = !0; const BN = { type: "move" }; class Rh { constructor() { this._targetRay = null, this._grip = null, this._hand = null; } getHandSpace() { return this._hand === null && (this._hand = new Rr(), 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 Rr(), this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new Z(), this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new Z()), this._targetRay; } getGripSpace() { return this._grip === null && (this._grip = new Rr(), this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new Z(), this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new Z()), 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, r) { let n = null, o = null, a = null; const s = this._targetRay, c = this._grip, l = this._hand; if (e && t.session.visibilityState !== "visible-blurred") if (s !== null && (n = t.getPose(e.targetRaySpace, r), n !== null && (s.matrix.fromArray(n.transform.matrix), s.matrix.decompose(s.position, s.rotation, s.scale), n.linearVelocity ? (s.hasLinearVelocity = !0, s.linearVelocity.copy(n.linearVelocity)) : s.hasLinearVelocity = !1, n.angularVelocity ? (s.hasAngularVelocity = !0, s.angularVelocity.copy(n.angularVelocity)) : s.hasAngularVelocity = !1, this.dispatchEvent(BN))), l && e.hand) { a = !0; for (const d of e.hand.values()) { const y = t.getJointPose(d, r); if (l.joints[d.jointName] === void 0) { const v = new Rr(); v.matrixAutoUpdate = !1, v.visible = !1, l.joints[d.jointName] = v, l.add(v); } const f = l.joints[d.jointName]; y !== null && (f.matrix.fromArray(y.transform.matrix), f.matrix.decompose(f.position, f.rotation, f.scale), f.jointRadius = y.radius), f.visible = y !== null; } const h = l.joints["index-finger-tip"], u = l.joints["thumb-tip"], p = h.position.distanceTo(u.position), m = 0.02, g = 5e-3; l.inputState.pinching && p > m + g ? (l.inputState.pinching = !1, this.dispatchEvent({ type: "pinchend", handedness: e.handedness, target: this })) : !l.inputState.pinching && p <= m - g && (l.inputState.pinching = !0, this.dispatchEvent({ type: "pinchstart", handedness: e.handedness, target: this })); } else c !== null && e.gripSpace && (o = t.getPose(e.gripSpace, r), o !== null && (c.matrix.fromArray(o.transform.matrix), c.matrix.decompose(c.position, c.rotation, c.scale), o.linearVelocity ? (c.hasLinearVelocity = !0, c.linearVelocity.copy(o.linearVelocity)) : c.hasLinearVelocity = !1, o.angularVelocity ? (c.hasAngularVelocity = !0, c.angularVelocity.copy(o.angularVelocity)) : c.hasAngularVelocity = !1)); return s !== null && (s.visible = n !== null), c !== null && (c.visible = o !== null), l !== null && (l.visible = a !== null), this; } } class kN extends io { constructor(e, t) { super(); const r = this, n = e.state; let o = null, a = 1, s = null, c = "local-floor", l = null, h = null, u = null, p = null; const m = [], g = /* @__PURE__ */ new Map(), d = new oi(); d.layers.enable(1), d.viewport = new St(); const y = new oi(); y.layers.enable(2), y.viewport = new St(); const f = [d, y], v = new Kp(); v.layers.enable(1), v.layers.enable(2); let _ = null, M = null; this.cameraAutoUpdate = !0, this.enabled = !1, this.isPresenting = !1, this.getController = function(O) { let x = m[O]; return x === void 0 && (x = new Rh(), m[O] = x), x.getTargetRaySpace(); }, this.getControllerGrip = function(O) { let x = m[O]; return x === void 0 && (x = new Rh(), m[O] = x), x.getGripSpace(); }, this.getHand = function(O) { let x = m[O]; return x === void 0 && (x = new Rh(), m[O] = x), x.getHandSpace(); }; function T(O) { const x = g.get(O.inputSource); x && x.dispatchEvent({ type: O.type, data: O.inputSource }); } function w() { g.forEach(function(O, x) { O.disconnect(x); }), g.clear(), _ = null, M = null, n.bindXRFramebuffer(null), e.setRenderTarget(e.getRenderTarget()), P.stop(), r.isPresenting = !1, r.dispatchEvent({ type: "sessionend" }); } this.setFramebufferScaleFactor = function(O) { a = O, r.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting."); }, this.setReferenceSpaceType = function(O) { c = O, r.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change reference space type while presenting."); }, this.getReferenceSpace = function() { return s; }, this.getSession = function() { return o; }, this.setSession = async function(O) { if (o = O, o !== null) { o.addEventListener("select", T), o.addEventListener("selectstart", T), o.addEventListener("selectend", T), o.addEventListener("squeeze", T), o.addEventListener("squeezestart", T), o.addEventListener("squeezeend", T), o.addEventListener("end", w), o.addEventListener("inputsourceschange", b); const x = t.getContextAttributes(); if (x.xrCompatible !== !0 && await t.makeXRCompatible(), o.renderState.layers === void 0) { const I = { antialias: x.antialias, alpha: x.alpha, depth: x.depth, stencil: x.stencil, framebufferScaleFactor: a }, N = new XRWebGLLayer(o, t, I); o.updateRenderState({ baseLayer: N }); } else { let I = 0; x.depth && (I = x.stencil ? 34041 : 6402); const N = { colorFormat: x.alpha ? 6408 : 6407, depthFormat: I, scaleFactor: a }; h = new XRWebGLBinding(o, t), p = h.createProjectionLayer(N), u = t.createFramebuffer(), o.updateRenderState({ layers: [p] }); } s = await o.requestReferenceSpace(c), P.setContext(o), P.start(), r.isPresenting = !0, r.dispatchEvent({ type: "sessionstart" }); } }; function b(O) { const x = o.inputSources; for (let I = 0; I < m.length; I++) g.set(x[I], m[I]); for (let I = 0; I < O.removed.length; I++) { const N = O.removed[I], D = g.get(N); D && (D.dispatchEvent({ type: "disconnected", data: N }), g.delete(N)); } for (let I = 0; I < O.added.length; I++) { const N = O.added[I], D = g.get(N); D && D.dispatchEvent({ type: "connected", data: N }); } } const E = new Z(), S = new Z(); function C(O, x, I) { E.setFromMatrixPosition(x.matrixWorld), S.setFromMatrixPosition(I.matrixWorld); const N = E.distanceTo(S), D = x.projectionMatrix.elements, k = I.projectionMatrix.elements, F = D[14] / (D[10] - 1), W = D[14] / (D[10] + 1), K = (D[9] + 1) / D[5], ne = (D[9] - 1) / D[5], q = (D[8] - 1) / D[0], z = (k[8] + 1) / k[0], j = F * q, Q = F * z, Y = N / (-q + z), ee = Y * -q; x.matrixWorld.decompose(O.position, O.quaternion, O.scale), O.translateX(ee), O.translateZ(Y), O.matrixWorld.compose(O.position, O.quaternion, O.scale), O.matrixWorldInverse.copy(O.matrixWorld).invert(); const G = F + Y, J = W + Y, re = j - ee, B = Q + (N - ee), $ = K * W / J * G, te = ne * W / J * G; O.projectionMatrix.makePerspective(re, B, $, te, G, J); } function R(O, x) { x === null ? O.matrixWorld.copy(O.matrix) : O.matrixWorld.multiplyMatrices(x.matrixWorld, O.matrix), O.matrixWorldInverse.copy(O.matrixWorld).invert(); } this.updateCamera = function(O) { if (o === null) return; v.near = y.near = d.near = O.near, v.far = y.far = d.far = O.far, (_ !== v.near || M !== v.far) && (o.updateRenderState({ depthNear: v.near, depthFar: v.far }), _ = v.near, M = v.far); const x = O.parent, I = v.cameras; R(v, x); for (let D = 0; D < I.length; D++) R(I[D], x); v.matrixWorld.decompose(v.position, v.quaternion, v.scale), O.position.copy(v.position), O.quaternion.copy(v.quaternion), O.scale.copy(v.scale), O.matrix.copy(v.matrix), O.matrixWorld.copy(v.matrixWorld); const N = O.children; for (let D = 0, k = N.length; D < k; D++) N[D].updateMatrixWorld(!0); I.length === 2 ? C(v, d, y) : v.projectionMatrix.copy(d.projectionMatrix); }, this.getCamera = function() { return v; }; let L = null; function A(O, x) { if (l = x.getViewerPose(s), l !== null) { const N = l.views, D = o.renderState.baseLayer; o.renderState.layers === void 0 && n.bindXRFramebuffer(D.framebuffer); let k = !1; N.length !== v.cameras.length && (v.cameras.length = 0, k = !0); for (let F = 0; F < N.length; F++) { const W = N[F]; let K = null; if (o.renderState.layers === void 0) K = D.getViewport(W); else { const q = h.getViewSubImage(p, W); n.bindXRFramebuffer(u), t.framebufferTexture2D(36160, 36064, 3553, q.colorTexture, 0), q.depthStencilTexture !== void 0 && t.framebufferTexture2D(36160, 36096, 3553, q.depthStencilTexture, 0), K = q.viewport; } const ne = f[F]; ne.matrix.fromArray(W.transform.matrix), ne.projectionMatrix.fromArray(W.projectionMatrix), ne.viewport.set(K.x, K.y, K.width, K.height), F === 0 && v.matrix.copy(ne.matrix), k === !0 && v.cameras.push(ne); } } const I = o.inputSources; for (let N = 0; N < m.length; N++) { const D = m[N], k = I[N]; D.update(k, x, s); } L && L(O, x); } const P = new Tx(); P.setAnimationLoop(A), this.setAnimationLoop = function(O) { L = O; }, this.dispose = function() { }; } } function FN(i) { function e(f, v) { f.fogColor.value.copy(v.color), v.isFog ? (f.fogNear.value = v.near, f.fogFar.value = v.far) : v.isFogExp2 && (f.fogDensity.value = v.density); } function t(f, v, _, M, T) { v.isMeshBasicMaterial ? r(f, v) : v.isMeshLambertMaterial ? (r(f, v), c(f, v)) : v.isMeshToonMaterial ? (r(f, v), h(f, v)) : v.isMeshPhongMaterial ? (r(f, v), l(f, v)) : v.isMeshStandardMaterial ? (r(f, v), v.isMeshPhysicalMaterial ? p(f, v, T) : u(f, v)) : v.isMeshMatcapMaterial ? (r(f, v), m(f, v)) : v.isMeshDepthMaterial ? (r(f, v), g(f, v)) : v.isMeshDistanceMaterial ? (r(f, v), d(f, v)) : v.isMeshNormalMaterial ? (r(f, v), y(f, v)) : v.isLineBasicMaterial ? (n(f, v), v.isLineDashedMaterial && o(f, v)) : v.isPointsMaterial ? a(f, v, _, M) : v.isSpriteMaterial ? s(f, v) : v.isShadowMaterial ? (f.color.value.copy(v.color), f.opacity.value = v.opacity) : v.isShaderMaterial && (v.uniformsNeedUpdate = !1); } function r(f, v) { f.opacity.value = v.opacity, v.color && f.diffuse.value.copy(v.color), v.emissive && f.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity), v.map && (f.map.value = v.map), v.alphaMap && (f.alphaMap.value = v.alphaMap), v.specularMap && (f.specularMap.value = v.specularMap); const _ = i.get(v).envMap; if (_) { f.envMap.value = _, f.flipEnvMap.value = _.isCubeTexture && _._needsFlipEnvMap ? -1 : 1, f.reflectivity.value = v.reflectivity, f.refractionRatio.value = v.refractionRatio; const w = i.get(_).__maxMipLevel; w !== void 0 && (f.maxMipLevel.value = w); } v.lightMap && (f.lightMap.value = v.lightMap, f.lightMapIntensity.value = v.lightMapIntensity), v.aoMap && (f.aoMap.value = v.aoMap, f.aoMapIntensity.value = v.aoMapIntensity); let M; v.map ? M = v.map : v.specularMap ? M = v.specularMap : v.displacementMap ? M = v.displacementMap : v.normalMap ? M = v.normalMap : v.bumpMap ? M = v.bumpMap : v.roughnessMap ? M = v.roughnessMap : v.metalnessMap ? M = v.metalnessMap : v.alphaMap ? M = v.alphaMap : v.emissiveMap ? M = v.emissiveMap : v.clearcoatMap ? M = v.clearcoatMap : v.clearcoatNormalMap ? M = v.clearcoatNormalMap : v.clearcoatRoughnessMap && (M = v.clearcoatRoughnessMap), M !== void 0 && (M.isWebGLRenderTarget && (M = M.texture), M.matrixAutoUpdate === !0 && M.updateMatrix(), f.uvTransform.value.copy(M.matrix)); let T; v.aoMap ? T = v.aoMap : v.lightMap && (T = v.lightMap), T !== void 0 && (T.isWebGLRenderTarget && (T = T.texture), T.matrixAutoUpdate === !0 && T.updateMatrix(), f.uv2Transform.value.copy(T.matrix)); } function n(f, v) { f.diffuse.value.copy(v.color), f.opacity.value = v.opacity; } function o(f, v) { f.dashSize.value = v.dashSize, f.totalSize.value = v.dashSize + v.gapSize, f.scale.value = v.scale; } function a(f, v, _, M) { f.diffuse.value.copy(v.color), f.opacity.value = v.opacity, f.size.value = v.size * _, f.scale.value = M * 0.5, v.map && (f.map.value = v.map), v.alphaMap && (f.alphaMap.value = v.alphaMap); let T; v.map ? T = v.map : v.alphaMap && (T = v.alphaMap), T !== void 0 && (T.matrixAutoUpdate === !0 && T.updateMatrix(), f.uvTransform.value.copy(T.matrix)); } function s(f, v) { f.diffuse.value.copy(v.color), f.opacity.value = v.opacity, f.rotation.value = v.rotation, v.map && (f.map.value = v.map), v.alphaMap && (f.alphaMap.value = v.alphaMap); let _; v.map ? _ = v.map : v.alphaMap && (_ = v.alphaMap), _ !== void 0 && (_.matrixAutoUpdate === !0 && _.updateMatrix(), f.uvTransform.value.copy(_.matrix)); } function c(f, v) { v.emissiveMap && (f.emissiveMap.value = v.emissiveMap); } function l(f, v) { f.specular.value.copy(v.specular), f.shininess.value = Math.max(v.shininess, 1e-4), v.emissiveMap && (f.emissiveMap.value = v.emissiveMap), v.bumpMap && (f.bumpMap.value = v.bumpMap, f.bumpScale.value = v.bumpScale, v.side === Yt && (f.bumpScale.value *= -1)), v.normalMap && (f.normalMap.value = v.normalMap, f.normalScale.value.copy(v.normalScale), v.side === Yt && f.normalScale.value.negate()), v.displacementMap && (f.displacementMap.value = v.displacementMap, f.displacementScale.value = v.displacementScale, f.displacementBias.value = v.displacementBias); } function h(f, v) { v.gradientMap && (f.gradientMap.value = v.gradientMap), v.emissiveMap && (f.emissiveMap.value = v.emissiveMap), v.bumpMap && (f.bumpMap.value = v.bumpMap, f.bumpScale.value = v.bumpScale, v.side === Yt && (f.bumpScale.value *= -1)), v.normalMap && (f.normalMap.value = v.normalMap, f.normalScale.value.copy(v.normalScale), v.side === Yt && f.normalScale.value.negate()), v.displacementMap && (f.displacementMap.value = v.displacementMap, f.displacementScale.value = v.displacementScale, f.displacementBias.value = v.displacementBias); } function u(f, v) { f.roughness.value = v.roughness, f.metalness.value = v.metalness, v.roughnessMap && (f.roughnessMap.value = v.roughnessMap), v.metalnessMap && (f.metalnessMap.value = v.metalnessMap), v.emissiveMap && (f.emissiveMap.value = v.emissiveMap), v.bumpMap && (f.bumpMap.value = v.bumpMap, f.bumpScale.value = v.bumpScale, v.side === Yt && (f.bumpScale.value *= -1)), v.normalMap && (f.normalMap.value = v.normalMap, f.normalScale.value.copy(v.normalScale), v.side === Yt && f.normalScale.value.negate()), v.displacementMap && (f.displacementMap.value = v.displacementMap, f.displacementScale.value = v.displacementScale, f.displacementBias.value = v.displacementBias), i.get(v).envMap && (f.envMapIntensity.value = v.envMapIntensity); } function p(f, v, _) { u(f, v), f.reflectivity.value = v.reflectivity, f.clearcoat.value = v.clearcoat, f.clearcoatRoughness.value = v.clearcoatRoughness, v.sheen && f.sheen.value.copy(v.sheen), v.clearcoatMap && (f.clearcoatMap.value = v.clearcoatMap), v.clearcoatRoughnessMap && (f.clearcoatRoughnessMap.value = v.clearcoatRoughnessMap), v.clearcoatNormalMap && (f.clearcoatNormalScale.value.copy(v.clearcoatNormalScale), f.clearcoatNormalMap.value = v.clearcoatNormalMap, v.side === Yt && f.clearcoatNormalScale.value.negate()), f.transmission.value = v.transmission, v.transmissionMap && (f.transmissionMap.value = v.transmissionMap), v.transmission > 0 && (f.transmissionSamplerMap.value = _.texture, f.transmissionSamplerSize.value.set(_.width, _.height)), f.thickness.value = v.thickness, v.thicknessMap && (f.thicknessMap.value = v.thicknessMap), f.attenuationDistance.value = v.attenuationDistance, f.attenuationColor.value.copy(v.attenuationColor); } function m(f, v) { v.matcap && (f.matcap.value = v.matcap), v.bumpMap && (f.bumpMap.value = v.bumpMap, f.bumpScale.value = v.bumpScale, v.side === Yt && (f.bumpScale.value *= -1)), v.normalMap && (f.normalMap.value = v.normalMap, f.normalScale.value.copy(v.normalScale), v.side === Yt && f.normalScale.value.negate()), v.displacementMap && (f.displacementMap.value = v.displacementMap, f.displacementScale.value = v.displacementScale, f.displacementBias.value = v.displacementBias); } function g(f, v) { v.displacementMap && (f.displacementMap.value = v.displacementMap, f.displacementScale.value = v.displacementScale, f.displacementBias.value = v.displacementBias); } function d(f, v) { v.displacementMap && (f.displacementMap.value = v.displacementMap, f.displacementScale.value = v.displacementScale, f.displacementBias.value = v.displacementBias), f.referencePosition.value.copy(v.referencePosition), f.nearDistance.value = v.nearDistance, f.farDistance.value = v.farDistance; } function y(f, v) { v.bumpMap && (f.bumpMap.value = v.bumpMap, f.bumpScale.value = v.bumpScale, v.side === Yt && (f.bumpScale.value *= -1)), v.normalMap && (f.normalMap.value = v.normalMap, f.normalScale.value.copy(v.normalScale), v.side === Yt && f.normalScale.value.negate()), v.displacementMap && (f.displacementMap.value = v.displacementMap, f.displacementScale.value = v.displacementScale, f.displacementBias.value = v.displacementBias); } return { refreshFogUniforms: e, refreshMaterialUniforms: t }; } function zN() { const i = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); return i.style.display = "block", i; } function Et(i = {}) { const e = i.canvas !== void 0 ? i.canvas : zN(), t = i.context !== void 0 ? i.context : null, r = i.alpha !== void 0 ? i.alpha : !1, n = i.depth !== void 0 ? i.depth : !0, o = i.stencil !== void 0 ? i.stencil : !0, a = i.antialias !== void 0 ? i.antialias : !1, s = i.premultipliedAlpha !== void 0 ? i.premultipliedAlpha : !0, c = i.preserveDrawingBuffer !== void 0 ? i.preserveDrawingBuffer : !1, l = i.powerPreference !== void 0 ? i.powerPreference : "default", h = i.failIfMajorPerformanceCaveat !== void 0 ? i.failIfMajorPerformanceCaveat : !1; let u = null, p = null; const m = [], g = []; 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 = Di, this.physicallyCorrectLights = !1, this.toneMapping = Un, this.toneMappingExposure = 1; const d = this; let y = !1, f = 0, v = 0, _ = null, M = -1, T = null; const w = new St(), b = new St(); let E = null, S = e.width, C = e.height, R = 1, L = null, A = null; const P = new St(0, 0, S, C), O = new St(0, 0, S, C); let x = !1; const I = [], N = new _l(); let D = !1, k = !1, F = null; const W = new $e(), K = new Z(), ne = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: !0 }; function q() { return _ === null ? R : 1; } let z = t; function j(X, be) { for (let me = 0; me < X.length; me++) { const _e = X[me], Pe = e.getContext(_e, be); if (Pe !== null) return Pe; } return null; } try { const X = { alpha: r, depth: n, stencil: o, antialias: a, premultipliedAlpha: s, preserveDrawingBuffer: c, powerPreference: l, failIfMajorPerformanceCaveat: h }; if (e.addEventListener("webglcontextlost", ut, !1), e.addEventListener("webglcontextrestored", mt, !1), z === null) { const be = ["webgl2", "webgl", "experimental-webgl"]; if (d.isWebGL1Renderer === !0 && be.shift(), z = j(be, X), z === null) throw j(be) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context."); } z.getShaderPrecisionFormat === void 0 && (z.getShaderPrecisionFormat = function() { return { rangeMin: 1, rangeMax: 1, precision: 1 }; }); } catch (X) { throw console.error("THREE.WebGLRenderer: " + X.message), X; } let Q, Y, ee, G, J, re, B, $, te, U, V, ae, ue, de, ve, ye, le, Se, Te, oe, Me, ge; function xe() { Q = new cD(z), Y = new aD(z, Q, i), Q.init(Y), Me = new Dx(z, Q, Y), ee = new DN(z, Q, Y), I[0] = 1029, G = new dD(), J = new MN(), re = new NN(z, Q, ee, J, Y, Me, G), B = new lD(d), $ = new NO(z, Y), ge = new nD(z, Q, $, Y), te = new uD(z, $, G, ge), U = new gD(z, te, $, G), Se = new mD(z), ve = new sD(J), V = new _N(d, B, Q, Y, ge, ve), ae = new FN(J), ue = new TN(J), de = new ON(Q, Y), le = new rD(d, B, ee, U, s), ye = new Ix(d, U, Y), Te = new oD(z, Q, G, Y), oe = new hD(z, Q, G, Y), G.programs = V.programs, d.capabilities = Y, d.extensions = Q, d.properties = J, d.renderLists = ue, d.shadowMap = ye, d.state = ee, d.info = G; } xe(); const Oe = new kN(d, z); this.xr = Oe, this.getContext = function() { return z; }, this.getContextAttributes = function() { return z.getContextAttributes(); }, this.forceContextLoss = function() { const X = Q.get("WEBGL_lose_context"); X && X.loseContext(); }, this.forceContextRestore = function() { const X = Q.get("WEBGL_lose_context"); X && X.restoreContext(); }, this.getPixelRatio = function() { return R; }, this.setPixelRatio = function(X) { X !== void 0 && (R = X, this.setSize(S, C, !1)); }, this.getSize = function(X) { return X.set(S, C); }, this.setSize = function(X, be, me) { if (Oe.isPresenting) { console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."); return; } S = X, C = be, e.width = Math.floor(X * R), e.height = Math.floor(be * R), me !== !1 && (e.style.width = X + "px", e.style.height = be + "px"), this.setViewport(0, 0, X, be); }, this.getDrawingBufferSize = function(X) { return X.set(S * R, C * R).floor(); }, this.setDrawingBufferSize = function(X, be, me) { S = X, C = be, R = me, e.width = Math.floor(X * me), e.height = Math.floor(be * me), this.setViewport(0, 0, X, be); }, this.getCurrentViewport = function(X) { return X.copy(w); }, this.getViewport = function(X) { return X.copy(P); }, this.setViewport = function(X, be, me, _e) { X.isVector4 ? P.set(X.x, X.y, X.z, X.w) : P.set(X, be, me, _e), ee.viewport(w.copy(P).multiplyScalar(R).floor()); }, this.getScissor = function(X) { return X.copy(O); }, this.setScissor = function(X, be, me, _e) { X.isVector4 ? O.set(X.x, X.y, X.z, X.w) : O.set(X, be, me, _e), ee.scissor(b.copy(O).multiplyScalar(R).floor()); }, this.getScissorTest = function() { return x; }, this.setScissorTest = function(X) { ee.setScissorTest(x = X); }, this.setOpaqueSort = function(X) { L = X; }, this.setTransparentSort = function(X) { A = X; }, this.getClearColor = function(X) { return X.copy(le.getClearColor()); }, this.setClearColor = function() { le.setClearColor.apply(le, arguments); }, this.getClearAlpha = function() { return le.getClearAlpha(); }, this.setClearAlpha = function() { le.setClearAlpha.apply(le, arguments); }, this.clear = function(X, be, me) { let _e = 0; (X === void 0 || X) && (_e |= 16384), (be === void 0 || be) && (_e |= 256), (me === void 0 || me) && (_e |= 1024), z.clear(_e); }, 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", ut, !1), e.removeEventListener("webglcontextrestored", mt, !1), ue.dispose(), de.dispose(), J.dispose(), B.dispose(), U.dispose(), ge.dispose(), Oe.dispose(), Oe.removeEventListener("sessionstart", ft), Oe.removeEventListener("sessionend", Ut), F && (F.dispose(), F = null), Nt.stop(); }; function ut(X) { X.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), y = !0; } function mt() { console.log("THREE.WebGLRenderer: Context Restored."), y = !1; const X = G.autoReset, be = ye.enabled, me = ye.autoUpdate, _e = ye.needsUpdate, Pe = ye.type; xe(), G.autoReset = X, ye.enabled = be, ye.autoUpdate = me, ye.needsUpdate = _e, ye.type = Pe; } function ze(X) { const be = X.target; be.removeEventListener("dispose", ze), bt(be); } function bt(X) { Ue(X), J.remove(X); } function Ue(X) { const be = J.get(X).programs; be !== void 0 && be.forEach(function(me) { V.releaseProgram(me); }); } function st(X, be) { X.render(function(me) { d.renderBufferImmediate(me, be); }); } this.renderBufferImmediate = function(X, be) { ge.initAttributes(); const me = J.get(X); X.hasPositions && !me.position && (me.position = z.createBuffer()), X.hasNormals && !me.normal && (me.normal = z.createBuffer()), X.hasUvs && !me.uv && (me.uv = z.createBuffer()), X.hasColors && !me.color && (me.color = z.createBuffer()); const _e = be.getAttributes(); X.hasPositions && (z.bindBuffer(34962, me.position), z.bufferData(34962, X.positionArray, 35048), ge.enableAttribute(_e.position), z.vertexAttribPointer(_e.position, 3, 5126, !1, 0, 0)), X.hasNormals && (z.bindBuffer(34962, me.normal), z.bufferData(34962, X.normalArray, 35048), ge.enableAttribute(_e.normal), z.vertexAttribPointer(_e.normal, 3, 5126, !1, 0, 0)), X.hasUvs && (z.bindBuffer(34962, me.uv), z.bufferData(34962, X.uvArray, 35048), ge.enableAttribute(_e.uv), z.vertexAttribPointer(_e.uv, 2, 5126, !1, 0, 0)), X.hasColors && (z.bindBuffer(34962, me.color), z.bufferData(34962, X.colorArray, 35048), ge.enableAttribute(_e.color), z.vertexAttribPointer(_e.color, 3, 5126, !1, 0, 0)), ge.disableUnusedAttributes(), z.drawArrays(4, 0, X.count), X.count = 0; }, this.renderBufferDirect = function(X, be, me, _e, Pe, he) { be === null && (be = ne); const we = Pe.isMesh && Pe.matrixWorld.determinant() < 0, De = Tt(X, be, _e, Pe); ee.setMaterial(_e, we); let We = me.index; const Ze = me.attributes.position; if (We === null) { if (Ze === void 0 || Ze.count === 0) return; } else if (We.count === 0) return; let Qe = 1; _e.wireframe === !0 && (We = te.getWireframeAttribute(me), Qe = 2), (_e.morphTargets || _e.morphNormals) && Se.update(Pe, me, _e, De), ge.setup(Pe, _e, De, me, We); let Ke, dt = Te; We !== null && (Ke = $.get(We), dt = oe, dt.setIndex(Ke)); const Mi = We !== null ? We.count : Ze.count, mi = me.drawRange.start * Qe, ao = me.drawRange.count * Qe, Rt = he !== null ? he.start * Qe : 0, so = he !== null ? he.count * Qe : 1 / 0, Si = Math.max(mi, Rt), J1 = Math.min(Mi, mi + ao, Rt + so) - 1, Dl = Math.max(0, J1 - Si + 1); if (Dl !== 0) { if (Pe.isMesh) _e.wireframe === !0 ? (ee.setLineWidth(_e.wireframeLinewidth * q()), dt.setMode(1)) : dt.setMode(4); else if (Pe.isLine) { let ms = _e.linewidth; ms === void 0 && (ms = 1), ee.setLineWidth(ms * q()), Pe.isLineSegments ? dt.setMode(1) : Pe.isLineLoop ? dt.setMode(2) : dt.setMode(3); } else Pe.isPoints ? dt.setMode(0) : Pe.isSprite && dt.setMode(4); if (Pe.isInstancedMesh) dt.renderInstances(Si, Dl, Pe.count); else if (me.isInstancedBufferGeometry) { const ms = Math.min(me.instanceCount, me._maxInstanceCount); dt.renderInstances(Si, Dl, ms); } else dt.render(Si, Dl); } }, this.compile = function(X, be) { p = de.get(X), p.init(), X.traverseVisible(function(me) { me.isLight && me.layers.test(be.layers) && (p.pushLight(me), me.castShadow && p.pushShadow(me)); }), p.setupLights(), X.traverse(function(me) { const _e = me.material; if (_e) if (Array.isArray(_e)) for (let Pe = 0; Pe < _e.length; Pe++) { const he = _e[Pe]; rt(he, X, me); } else rt(_e, X, me); }); }; let et = null; function xt(X) { et && et(X); } function ft() { Nt.stop(); } function Ut() { Nt.start(); } const Nt = new Tx(); Nt.setAnimationLoop(xt), typeof window < "u" && Nt.setContext(window), this.setAnimationLoop = function(X) { et = X, Oe.setAnimationLoop(X), X === null ? Nt.stop() : Nt.start(); }, Oe.addEventListener("sessionstart", ft), Oe.addEventListener("sessionend", Ut), this.render = function(X, be) { if (be !== void 0 && be.isCamera !== !0) { console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera."); return; } if (y === !0) return; X.autoUpdate === !0 && X.updateMatrixWorld(), be.parent === null && be.updateMatrixWorld(), Oe.enabled === !0 && Oe.isPresenting === !0 && (Oe.cameraAutoUpdate === !0 && Oe.updateCamera(be), be = Oe.getCamera()), X.isScene === !0 && X.onBeforeRender(d, X, be, _), p = de.get(X, g.length), p.init(), g.push(p), W.multiplyMatrices(be.projectionMatrix, be.matrixWorldInverse), N.setFromProjectionMatrix(W), k = this.localClippingEnabled, D = ve.init(this.clippingPlanes, k, be), u = ue.get(X, m.length), u.init(), m.push(u), ie(X, be, 0, d.sortObjects), u.finish(), d.sortObjects === !0 && u.sort(L, A), D === !0 && ve.beginShadows(); const me = p.state.shadowsArray; ye.render(me, X, be), p.setupLights(), p.setupLightsView(be), D === !0 && ve.endShadows(), this.info.autoReset === !0 && this.info.reset(), le.render(u, X); const _e = u.opaque, Pe = u.transmissive, he = u.transparent; _e.length > 0 && Ne(_e, X, be), Pe.length > 0 && Ee(_e, Pe, X, be), he.length > 0 && Ne(he, X, be), _ !== null && (re.updateMultisampleRenderTarget(_), re.updateRenderTargetMipmap(_)), X.isScene === !0 && X.onAfterRender(d, X, be), ee.buffers.depth.setTest(!0), ee.buffers.depth.setMask(!0), ee.buffers.color.setMask(!0), ee.setPolygonOffset(!1), ge.resetDefaultState(), M = -1, T = null, g.pop(), g.length > 0 ? p = g[g.length - 1] : p = null, m.pop(), m.length > 0 ? u = m[m.length - 1] : u = null; }; function ie(X, be, me, _e) { if (X.visible === !1) return; if (X.layers.test(be.layers)) { if (X.isGroup) me = X.renderOrder; else if (X.isLOD) X.autoUpdate === !0 && X.update(be); else if (X.isLight) p.pushLight(X), X.castShadow && p.pushShadow(X); else if (X.isSprite) { if (!X.frustumCulled || N.intersectsSprite(X)) { _e && K.setFromMatrixPosition(X.matrixWorld).applyMatrix4(W); const he = U.update(X), we = X.material; we.visible && u.push(X, he, we, me, K.z, null); } } else if (X.isImmediateRenderObject) _e && K.setFromMatrixPosition(X.matrixWorld).applyMatrix4(W), u.push(X, null, X.material, me, K.z, null); else if ((X.isMesh || X.isLine || X.isPoints) && (X.isSkinnedMesh && X.skeleton.frame !== G.render.frame && (X.skeleton.update(), X.skeleton.frame = G.render.frame), !X.frustumCulled || N.intersectsObject(X))) { _e && K.setFromMatrixPosition(X.matrixWorld).applyMatrix4(W); const he = U.update(X), we = X.material; if (Array.isArray(we)) { const De = he.groups; for (let We = 0, Ze = De.length; We < Ze; We++) { const Qe = De[We], Ke = we[Qe.materialIndex]; Ke && Ke.visible && u.push(X, he, Ke, me, K.z, Qe); } } else we.visible && u.push(X, he, we, me, K.z, null); } } const Pe = X.children; for (let he = 0, we = Pe.length; he < we; he++) ie(Pe[he], be, me, _e); } function Ee(X, be, me, _e) { if (F === null) { const we = a === !0 && Y.isWebGL2 === !0 ? Xp : yr; F = new we(1024, 1024, { generateMipmaps: !0, type: Me.convert(Eo) !== null ? Eo : Po, minFilter: bn, magFilter: Jt, wrapS: di, wrapT: di }); } const Pe = d.getRenderTarget(); d.setRenderTarget(F), d.clear(); const he = d.toneMapping; d.toneMapping = Un, Ne(X, me, _e), d.toneMapping = he, re.updateMultisampleRenderTarget(F), re.updateRenderTargetMipmap(F), d.setRenderTarget(Pe), Ne(be, me, _e); } function Ne(X, be, me) { const _e = be.isScene === !0 ? be.overrideMaterial : null; for (let Pe = 0, he = X.length; Pe < he; Pe++) { const we = X[Pe], De = we.object, We = we.geometry, Ze = _e === null ? we.material : _e, Qe = we.group; if (me.isArrayCamera) { const Ke = me.cameras; for (let dt = 0, Mi = Ke.length; dt < Mi; dt++) { const mi = Ke[dt]; De.layers.test(mi.layers) && (ee.viewport(w.copy(mi.viewport)), p.setupLightsView(mi), Ge(De, be, mi, We, Ze, Qe)); } } else Ge(De, be, me, We, Ze, Qe); } } function Ge(X, be, me, _e, Pe, he) { if (X.onBeforeRender(d, be, me, _e, Pe, he), X.modelViewMatrix.multiplyMatrices(me.matrixWorldInverse, X.matrixWorld), X.normalMatrix.getNormalMatrix(X.modelViewMatrix), X.isImmediateRenderObject) { const we = Tt(me, be, Pe, X); ee.setMaterial(Pe), ge.reset(), st(X, we); } else Pe.transparent === !0 && Pe.side === Zn ? (Pe.side = Yt, Pe.needsUpdate = !0, d.renderBufferDirect(me, be, _e, Pe, X, he), Pe.side = Xn, Pe.needsUpdate = !0, d.renderBufferDirect(me, be, _e, Pe, X, he), Pe.side = Zn) : d.renderBufferDirect(me, be, _e, Pe, X, he); X.onAfterRender(d, be, me, _e, Pe, he); } function rt(X, be, me) { be.isScene !== !0 && (be = ne); const _e = J.get(X), Pe = p.state.lights, he = p.state.shadowsArray, we = Pe.state.version, De = V.getParameters(X, Pe.state, he, be, me), We = V.getProgramCacheKey(De); let Ze = _e.programs; _e.environment = X.isMeshStandardMaterial ? be.environment : null, _e.fog = be.fog, _e.envMap = B.get(X.envMap || _e.environment), Ze === void 0 && (X.addEventListener("dispose", ze), Ze = /* @__PURE__ */ new Map(), _e.programs = Ze); let Qe = Ze.get(We); if (Qe !== void 0) { if (_e.currentProgram === Qe && _e.lightsStateVersion === we) return gt(X, De), Qe; } else De.uniforms = V.getUniforms(X), X.onBuild(De, d), X.onBeforeCompile(De, d), Qe = V.acquireProgram(De, We), Ze.set(We, Qe), _e.uniforms = De.uniforms; const Ke = _e.uniforms; (!X.isShaderMaterial && !X.isRawShaderMaterial || X.clipping === !0) && (Ke.clippingPlanes = ve.uniform), gt(X, De), _e.needsLights = Vt(X), _e.lightsStateVersion = we, _e.needsLights && (Ke.ambientLightColor.value = Pe.state.ambient, Ke.lightProbe.value = Pe.state.probe, Ke.directionalLights.value = Pe.state.directional, Ke.directionalLightShadows.value = Pe.state.directionalShadow, Ke.spotLights.value = Pe.state.spot, Ke.spotLightShadows.value = Pe.state.spotShadow, Ke.rectAreaLights.value = Pe.state.rectArea, Ke.ltc_1.value = Pe.state.rectAreaLTC1, Ke.ltc_2.value = Pe.state.rectAreaLTC2, Ke.pointLights.value = Pe.state.point, Ke.pointLightShadows.value = Pe.state.pointShadow, Ke.hemisphereLights.value = Pe.state.hemi, Ke.directionalShadowMap.value = Pe.state.directionalShadowMap, Ke.directionalShadowMatrix.value = Pe.state.directionalShadowMatrix, Ke.spotShadowMap.value = Pe.state.spotShadowMap, Ke.spotShadowMatrix.value = Pe.state.spotShadowMatrix, Ke.pointShadowMap.value = Pe.state.pointShadowMap, Ke.pointShadowMatrix.value = Pe.state.pointShadowMatrix); const dt = Qe.getUniforms(), Mi = Vn.seqWithValue(dt.seq, Ke); return _e.currentProgram = Qe, _e.uniformsList = Mi, Qe; } function gt(X, be) { const me = J.get(X); me.outputEncoding = be.outputEncoding, me.instancing = be.instancing, me.skinning = be.skinning, me.numClippingPlanes = be.numClippingPlanes, me.numIntersection = be.numClipIntersection, me.vertexAlphas = be.vertexAlphas; } function Tt(X, be, me, _e) { be.isScene !== !0 && (be = ne), re.resetTextureUnits(); const Pe = be.fog, he = me.isMeshStandardMaterial ? be.environment : null, we = _ === null ? d.outputEncoding : _.texture.encoding, De = B.get(me.envMap || he), We = me.vertexColors === !0 && _e.geometry && _e.geometry.attributes.color && _e.geometry.attributes.color.itemSize === 4, Ze = J.get(me), Qe = p.state.lights; if (D === !0 && (k === !0 || X !== T)) { const Si = X === T && me.id === M; ve.setState(me, X, Si); } let Ke = !1; me.version === Ze.__version ? (Ze.needsLights && Ze.lightsStateVersion !== Qe.state.version || Ze.outputEncoding !== we || _e.isInstancedMesh && Ze.instancing === !1 || !_e.isInstancedMesh && Ze.instancing === !0 || _e.isSkinnedMesh && Ze.skinning === !1 || !_e.isSkinnedMesh && Ze.skinning === !0 || Ze.envMap !== De || me.fog && Ze.fog !== Pe || Ze.numClippingPlanes !== void 0 && (Ze.numClippingPlanes !== ve.numPlanes || Ze.numIntersection !== ve.numIntersection) || Ze.vertexAlphas !== We) && (Ke = !0) : (Ke = !0, Ze.__version = me.version); let dt = Ze.currentProgram; Ke === !0 && (dt = rt(me, be, _e)); let Mi = !1, mi = !1, ao = !1; const Rt = dt.getUniforms(), so = Ze.uniforms; if (ee.useProgram(dt.program) && (Mi = !0, mi = !0, ao = !0), me.id !== M && (M = me.id, mi = !0), Mi || T !== X) { if (Rt.setValue(z, "projectionMatrix", X.projectionMatrix), Y.logarithmicDepthBuffer && Rt.setValue( z, "logDepthBufFC", 2 / (Math.log(X.far + 1) / Math.LN2) ), T !== X && (T = X, mi = !0, ao = !0), me.isShaderMaterial || me.isMeshPhongMaterial || me.isMeshToonMaterial || me.isMeshStandardMaterial || me.envMap) { const Si = Rt.map.cameraPosition; Si !== void 0 && Si.setValue( z, K.setFromMatrixPosition(X.matrixWorld) ); } (me.isMeshPhongMaterial || me.isMeshToonMaterial || me.isMeshLambertMaterial || me.isMeshBasicMaterial || me.isMeshStandardMaterial || me.isShaderMaterial) && Rt.setValue(z, "isOrthographic", X.isOrthographicCamera === !0), (me.isMeshPhongMaterial || me.isMeshToonMaterial || me.isMeshLambertMaterial || me.isMeshBasicMaterial || me.isMeshStandardMaterial || me.isShaderMaterial || me.isShadowMaterial || _e.isSkinnedMesh) && Rt.setValue(z, "viewMatrix", X.matrixWorldInverse); } if (_e.isSkinnedMesh) { Rt.setOptional(z, _e, "bindMatrix"), Rt.setOptional(z, _e, "bindMatrixInverse"); const Si = _e.skeleton; Si && (Y.floatVertexTextures ? (Si.boneTexture === null && Si.computeBoneTexture(), Rt.setValue(z, "boneTexture", Si.boneTexture, re), Rt.setValue(z, "boneTextureSize", Si.boneTextureSize)) : Rt.setOptional(z, Si, "boneMatrices")); } return (mi || Ze.receiveShadow !== _e.receiveShadow) && (Ze.receiveShadow = _e.receiveShadow, Rt.setValue(z, "receiveShadow", _e.receiveShadow)), mi && (Rt.setValue(z, "toneMappingExposure", d.toneMappingExposure), Ze.needsLights && Lt(so, ao), Pe && me.fog && ae.refreshFogUniforms(so, Pe), ae.refreshMaterialUniforms(so, me, R, C, F), Vn.upload(z, Ze.uniformsList, so, re)), me.isShaderMaterial && me.uniformsNeedUpdate === !0 && (Vn.upload(z, Ze.uniformsList, so, re), me.uniformsNeedUpdate = !1), me.isSpriteMaterial && Rt.setValue(z, "center", _e.center), Rt.setValue(z, "modelViewMatrix", _e.modelViewMatrix), Rt.setValue(z, "normalMatrix", _e.normalMatrix), Rt.setValue(z, "modelMatrix", _e.matrixWorld), dt; } function Lt(X, be) { X.ambientLightColor.needsUpdate = be, X.lightProbe.needsUpdate = be, X.directionalLights.needsUpdate = be, X.directionalLightShadows.needsUpdate = be, X.pointLights.needsUpdate = be, X.pointLightShadows.needsUpdate = be, X.spotLights.needsUpdate = be, X.spotLightShadows.needsUpdate = be, X.rectAreaLights.needsUpdate = be, X.hemisphereLights.needsUpdate = be; } function Vt(X) { return X.isMeshLambertMaterial || X.isMeshToonMaterial || X.isMeshPhongMaterial || X.isMeshStandardMaterial || X.isShadowMaterial || X.isShaderMaterial && X.lights === !0; } this.getActiveCubeFace = function() { return f; }, this.getActiveMipmapLevel = function() { return v; }, this.getRenderTarget = function() { return _; }, this.setRenderTarget = function(X, be = 0, me = 0) { _ = X, f = be, v = me, X && J.get(X).__webglFramebuffer === void 0 && re.setupRenderTarget(X); let _e = null, Pe = !1, he = !1; if (X) { const we = X.texture; (we.isDataTexture3D || we.isDataTexture2DArray) && (he = !0); const De = J.get(X).__webglFramebuffer; X.isWebGLCubeRenderTarget ? (_e = De[be], Pe = !0) : X.isWebGLMultisampleRenderTarget ? _e = J.get(X).__webglMultisampledFramebuffer : _e = De, w.copy(X.viewport), b.copy(X.scissor), E = X.scissorTest; } else w.copy(P).multiplyScalar(R).floor(), b.copy(O).multiplyScalar(R).floor(), E = x; if (ee.bindFramebuffer(36160, _e) && Y.drawBuffers) { let we = !1; if (X) if (X.isWebGLMultipleRenderTargets) { const De = X.texture; if (I.length !== De.length || I[0] !== 36064) { for (let We = 0, Ze = De.length; We < Ze; We++) I[We] = 36064 + We; I.length = De.length, we = !0; } } else (I.length !== 1 || I[0] !== 36064) && (I[0] = 36064, I.length = 1, we = !0); else (I.length !== 1 || I[0] !== 1029) && (I[0] = 1029, I.length = 1, we = !0); we && (Y.isWebGL2 ? z.drawBuffers(I) : Q.get("WEBGL_draw_buffers").drawBuffersWEBGL(I)); } if (ee.viewport(w), ee.scissor(b), ee.setScissorTest(E), Pe) { const we = J.get(X.texture); z.framebufferTexture2D(36160, 36064, 34069 + be, we.__webglTexture, me); } else if (he) { const we = J.get(X.texture), De = be || 0; z.framebufferTextureLayer(36160, 36064, we.__webglTexture, me || 0, De); } }, this.readRenderTargetPixels = function(X, be, me, _e, Pe, he, we) { if (!(X && X.isWebGLRenderTarget)) { console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); return; } let De = J.get(X).__webglFramebuffer; if (X.isWebGLCubeRenderTarget && we !== void 0 && (De = De[we]), De) { ee.bindFramebuffer(36160, De); try { const We = X.texture, Ze = We.format, Qe = We.type; if (Ze !== Xi && Me.convert(Ze) !== z.getParameter(35739)) { console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."); return; } const Ke = Qe === Eo && (Q.has("EXT_color_buffer_half_float") || Y.isWebGL2 && Q.has("EXT_color_buffer_float")); if (Qe !== Po && Me.convert(Qe) !== z.getParameter(35738) && // Edge and Chrome Mac < 52 (#9513) !(Qe === tn && (Y.isWebGL2 || Q.has("OES_texture_float") || Q.has("WEBGL_color_buffer_float"))) && // Chrome Mac >= 52 and Firefox !Ke) { console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type."); return; } z.checkFramebufferStatus(36160) === 36053 ? be >= 0 && be <= X.width - _e && me >= 0 && me <= X.height - Pe && z.readPixels(be, me, _e, Pe, Me.convert(Ze), Me.convert(Qe), he) : console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."); } finally { const We = _ !== null ? J.get(_).__webglFramebuffer : null; ee.bindFramebuffer(36160, We); } } }, this.copyFramebufferToTexture = function(X, be, me = 0) { const _e = Math.pow(2, -me), Pe = Math.floor(be.image.width * _e), he = Math.floor(be.image.height * _e); let we = Me.convert(be.format); Y.isWebGL2 && (we === 6407 && (we = 32849), we === 6408 && (we = 32856)), re.setTexture2D(be, 0), z.copyTexImage2D(3553, me, we, X.x, X.y, Pe, he, 0), ee.unbindTexture(); }, this.copyTextureToTexture = function(X, be, me, _e = 0) { const Pe = be.image.width, he = be.image.height, we = Me.convert(me.format), De = Me.convert(me.type); re.setTexture2D(me, 0), z.pixelStorei(37440, me.flipY), z.pixelStorei(37441, me.premultiplyAlpha), z.pixelStorei(3317, me.unpackAlignment), be.isDataTexture ? z.texSubImage2D(3553, _e, X.x, X.y, Pe, he, we, De, be.image.data) : be.isCompressedTexture ? z.compressedTexSubImage2D(3553, _e, X.x, X.y, be.mipmaps[0].width, be.mipmaps[0].height, we, be.mipmaps[0].data) : z.texSubImage2D(3553, _e, X.x, X.y, we, De, be.image), _e === 0 && me.generateMipmaps && z.generateMipmap(3553), ee.unbindTexture(); }, this.copyTextureToTexture3D = function(X, be, me, _e, Pe = 0) { if (d.isWebGL1Renderer) { console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2."); return; } const he = X.max.x - X.min.x + 1, we = X.max.y - X.min.y + 1, De = X.max.z - X.min.z + 1, We = Me.convert(_e.format), Ze = Me.convert(_e.type); let Qe; if (_e.isDataTexture3D) re.setTexture3D(_e, 0), Qe = 32879; else if (_e.isDataTexture2DArray) re.setTexture2DArray(_e, 0), Qe = 35866; else { console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray."); return; } z.pixelStorei(37440, _e.flipY), z.pixelStorei(37441, _e.premultiplyAlpha), z.pixelStorei(3317, _e.unpackAlignment); const Ke = z.getParameter(3314), dt = z.getParameter(32878), Mi = z.getParameter(3316), mi = z.getParameter(3315), ao = z.getParameter(32877), Rt = me.isCompressedTexture ? me.mipmaps[0] : me.image; z.pixelStorei(3314, Rt.width), z.pixelStorei(32878, Rt.height), z.pixelStorei(3316, X.min.x), z.pixelStorei(3315, X.min.y), z.pixelStorei(32877, X.min.z), me.isDataTexture || me.isDataTexture3D ? z.texSubImage3D(Qe, Pe, be.x, be.y, be.z, he, we, De, We, Ze, Rt.data) : me.isCompressedTexture ? (console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."), z.compressedTexSubImage3D(Qe, Pe, be.x, be.y, be.z, he, we, De, We, Rt.data)) : z.texSubImage3D(Qe, Pe, be.x, be.y, be.z, he, we, De, We, Ze, Rt), z.pixelStorei(3314, Ke), z.pixelStorei(32878, dt), z.pixelStorei(3316, Mi), z.pixelStorei(3315, mi), z.pixelStorei(32877, ao), Pe === 0 && _e.generateMipmaps && z.generateMipmap(Qe), ee.unbindTexture(); }, this.initTexture = function(X) { re.setTexture2D(X, 0), ee.unbindTexture(); }, this.resetState = function() { f = 0, v = 0, _ = 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 Ml { constructor(e, t = 25e-5) { this.name = "", this.color = new Be(e), this.density = t; } clone() { return new Ml(this.color, this.density); } toJSON() { return { type: "FogExp2", color: this.color.getHex(), density: this.density }; } } Ml.prototype.isFogExp2 = !0; class Sl { constructor(e, t = 1, r = 1e3) { this.name = "", this.color = new Be(e), this.near = t, this.far = r; } clone() { return new Sl(this.color, this.near, this.far); } toJSON() { return { type: "Fog", color: this.color.getHex(), near: this.near, far: this.far }; } } Sl.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 no { constructor(e, t) { this.array = e, this.stride = t, this.count = e !== void 0 ? e.length / t : 0, this.usage = Fa, this.updateRange = { offset: 0, count: -1 }, this.version = 0, this.uuid = Zi(); } 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, r) { e *= this.stride, r *= t.stride; for (let n = 0, o = this.stride; n < o; n++) this.array[e + n] = t.array[r + n]; 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 = Zi()), 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]), r = new this.constructor(t, this.stride); return r.setUsage(this.usage), r; } 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 = Zi()), 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 }; } } no.prototype.isInterleavedBuffer = !0; const qt = /* @__PURE__ */ new Z(); class pn { constructor(e, t, r, n = !1) { this.name = "", this.data = e, this.itemSize = t, this.offset = r, this.normalized = n === !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, r = this.data.count; t < r; t++) qt.x = this.getX(t), qt.y = this.getY(t), qt.z = this.getZ(t), qt.applyMatrix4(e), this.setXYZ(t, qt.x, qt.y, qt.z); return this; } applyNormalMatrix(e) { for (let t = 0, r = this.count; t < r; t++) qt.x = this.getX(t), qt.y = this.getY(t), qt.z = this.getZ(t), qt.applyNormalMatrix(e), this.setXYZ(t, qt.x, qt.y, qt.z); return this; } transformDirection(e) { for (let t = 0, r = this.count; t < r; t++) qt.x = this.getX(t), qt.y = this.getY(t), qt.z = this.getZ(t), qt.transformDirection(e), this.setXYZ(t, qt.x, qt.y, qt.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, r) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = r, this; } setXYZ(e, t, r, n) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = r, this.data.array[e + 2] = n, this; } setXYZW(e, t, r, n, o) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = r, this.data.array[e + 2] = n, this.data.array[e + 3] = o, 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 r = 0; r < this.count; r++) { const n = r * this.data.stride + this.offset; for (let o = 0; o < this.itemSize; o++) t.push(this.data.array[n + o]); } return new tt(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 pn(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 r = 0; r < this.count; r++) { const n = r * this.data.stride + this.offset; for (let o = 0; o < this.itemSize; o++) t.push(this.data.array[n + o]); } 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 }; } } pn.prototype.isInterleavedBufferAttribute = !0; class Tl extends ri { constructor(e) { super(), this.type = "SpriteMaterial", this.color = new Be(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 ha; const Ss = /* @__PURE__ */ new Z(), da = /* @__PURE__ */ new Z(), pa = /* @__PURE__ */ new Z(), fa = /* @__PURE__ */ new Re(), Ts = /* @__PURE__ */ new Re(), Bx = /* @__PURE__ */ new $e(), sc = /* @__PURE__ */ new Z(), Es = /* @__PURE__ */ new Z(), lc = /* @__PURE__ */ new Z(), Fg = /* @__PURE__ */ new Re(), Oh = /* @__PURE__ */ new Re(), zg = /* @__PURE__ */ new Re(); class El extends ot { constructor(e) { if (super(), this.type = "Sprite", ha === void 0) { ha = new Ye(); 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 ]), r = new no(t, 5); ha.setIndex([0, 1, 2, 0, 2, 3]), ha.setAttribute("position", new pn(r, 3, 0, !1)), ha.setAttribute("uv", new pn(r, 2, 3, !1)); } this.geometry = ha, this.material = e !== void 0 ? e : new Tl(), this.center = new Re(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.'), da.setFromMatrixScale(this.matrixWorld), Bx.copy(e.camera.matrixWorld), this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse, this.matrixWorld), pa.setFromMatrixPosition(this.modelViewMatrix), e.camera.isPerspectiveCamera && this.material.sizeAttenuation === !1 && da.multiplyScalar(-pa.z); const r = this.material.rotation; let n, o; r !== 0 && (o = Math.cos(r), n = Math.sin(r)); const a = this.center; cc(sc.set(-0.5, -0.5, 0), pa, a, da, n, o), cc(Es.set(0.5, -0.5, 0), pa, a, da, n, o), cc(lc.set(0.5, 0.5, 0), pa, a, da, n, o), Fg.set(0, 0), Oh.set(1, 0), zg.set(1, 1); let s = e.ray.intersectTriangle(sc, Es, lc, !1, Ss); if (s === null && (cc(Es.set(-0.5, 0.5, 0), pa, a, da, n, o), Oh.set(0, 1), s = e.ray.intersectTriangle(sc, lc, Es, !1, Ss), s === null)) return; const c = e.ray.origin.distanceTo(Ss); c < e.near || c > e.far || t.push({ distance: c, point: Ss.clone(), uv: Kt.getUV(Ss, sc, Es, lc, Fg, Oh, zg, new Re()), 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(i, e, t, r, n, o) { fa.subVectors(i, t).addScalar(0.5).multiply(r), n !== void 0 ? (Ts.x = o * fa.x - n * fa.y, Ts.y = n * fa.x + o * fa.y) : Ts.copy(fa), i.copy(e), i.x += Ts.x, i.y += Ts.y, i.applyMatrix4(Bx); } const uc = /* @__PURE__ */ new Z(), Ug = /* @__PURE__ */ new Z(); class kx 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 r = 0, n = t.length; r < n; r++) { const o = t[r]; this.addLevel(o.object.clone(), o.distance); } return this.autoUpdate = e.autoUpdate, this; } addLevel(e, t = 0) { t = Math.abs(t); const r = this.levels; let n; for (n = 0; n < r.length && !(t < r[n].distance); n++) ; return r.splice(n, 0, { distance: t, object: e }), this.add(e), this; } getCurrentLevel() { return this._currentLevel; } getObjectForDistance(e) { const t = this.levels; if (t.length > 0) { let r, n; for (r = 1, n = t.length; r < n && !(e < t[r].distance); r++) ; return t[r - 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), Ug.setFromMatrixPosition(this.matrixWorld); const r = uc.distanceTo(Ug) / e.zoom; t[0].object.visible = !0; let n, o; for (n = 1, o = t.length; n < o && r >= t[n].distance; n++) t[n - 1].object.visible = !1, t[n].object.visible = !0; for (this._currentLevel = n - 1; n < o; n++) t[n].object.visible = !1; } } toJSON(e) { const t = super.toJSON(e); this.autoUpdate === !1 && (t.object.autoUpdate = !1), t.object.levels = []; const r = this.levels; for (let n = 0, o = r.length; n < o; n++) { const a = r[n]; t.object.levels.push({ object: a.object.uuid, distance: a.distance }); } return t; } } const Vg = /* @__PURE__ */ new Z(), Hg = /* @__PURE__ */ new St(), jg = /* @__PURE__ */ new St(), UN = /* @__PURE__ */ new Z(), Gg = /* @__PURE__ */ new $e(); class Al extends ei { 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 St(), t = this.geometry.attributes.skinWeight; for (let r = 0, n = t.count; r < n; r++) { e.x = t.getX(r), e.y = t.getY(r), e.z = t.getZ(r), e.w = t.getW(r); const o = 1 / e.manhattanLength(); o !== 1 / 0 ? e.multiplyScalar(o) : e.set(1, 0, 0, 0), t.setXYZW(r, 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 r = this.skeleton, n = this.geometry; Hg.fromBufferAttribute(n.attributes.skinIndex, e), jg.fromBufferAttribute(n.attributes.skinWeight, e), Vg.fromBufferAttribute(n.attributes.position, e).applyMatrix4(this.bindMatrix), t.set(0, 0, 0); for (let o = 0; o < 4; o++) { const a = jg.getComponent(o); if (a !== 0) { const s = Hg.getComponent(o); Gg.multiplyMatrices(r.bones[s].matrixWorld, r.boneInverses[s]), t.addScaledVector(UN.copy(Vg).applyMatrix4(Gg), a); } } return t.applyMatrix4(this.bindMatrixInverse); } } Al.prototype.isSkinnedMesh = !0; class Cl extends ot { constructor() { super(), this.type = "Bone"; } } Cl.prototype.isBone = !0; class Lo extends ti { constructor(e = null, t = 1, r = 1, n, o, a, s, c, l = Jt, h = Jt, u, p) { super(null, a, s, c, l, h, n, o, u, p), this.image = { data: e, width: t, height: r }, this.magFilter = l, this.minFilter = h, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0; } } Lo.prototype.isDataTexture = !0; const Wg = /* @__PURE__ */ new $e(), VN = /* @__PURE__ */ new $e(); class Ll { constructor(e = [], t = []) { this.uuid = Zi(), 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 r = 0, n = this.bones.length; r < n; r++) this.boneInverses.push(new $e()); } } calculateInverses() { this.boneInverses.length = 0; for (let e = 0, t = this.bones.length; e < t; e++) { const r = new $e(); this.bones[e] && r.copy(this.bones[e].matrixWorld).invert(), this.boneInverses.push(r); } } pose() { for (let e = 0, t = this.bones.length; e < t; e++) { const r = this.bones[e]; r && r.matrixWorld.copy(this.boneInverses[e]).invert(); } for (let e = 0, t = this.bones.length; e < t; e++) { const r = this.bones[e]; r && (r.parent && r.parent.isBone ? (r.matrix.copy(r.parent.matrixWorld).invert(), r.matrix.multiply(r.matrixWorld)) : r.matrix.copy(r.matrixWorld), r.matrix.decompose(r.position, r.quaternion, r.scale)); } } update() { const e = this.bones, t = this.boneInverses, r = this.boneMatrices, n = this.boneTexture; for (let o = 0, a = e.length; o < a; o++) { const s = e[o] ? e[o].matrixWorld : VN; Wg.multiplyMatrices(s, t[o]), Wg.toArray(r, o * 16); } n !== null && (n.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 r = new Lo(t, e, e, Xi, tn); return this.boneMatrices = t, this.boneTexture = r, this.boneTextureSize = e, this; } getBoneByName(e) { for (let t = 0, r = this.bones.length; t < r; t++) { const n = this.bones[t]; if (n.name === e) return n; } } dispose() { this.boneTexture !== null && (this.boneTexture.dispose(), this.boneTexture = null); } fromJSON(e, t) { this.uuid = e.uuid; for (let r = 0, n = e.bones.length; r < n; r++) { const o = e.bones[r]; let a = t[o]; a === void 0 && (console.warn("THREE.Skeleton: No bone found with UUID:", o), a = new Cl()), this.bones.push(a), this.boneInverses.push(new $e().fromArray(e.boneInverses[r])); } 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, r = this.boneInverses; for (let n = 0, o = t.length; n < o; n++) { const a = t[n]; e.bones.push(a.uuid); const s = r[n]; e.boneInverses.push(s.toArray()); } return e; } } const $g = /* @__PURE__ */ new $e(), qg = /* @__PURE__ */ new $e(), hc = [], As = /* @__PURE__ */ new ei(); class Qp extends ei { constructor(e, t, r) { super(e, t), this.instanceMatrix = new tt(new Float32Array(r * 16), 16), this.instanceColor = null, this.count = r, 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 r = this.matrixWorld, n = this.count; if (As.geometry = this.geometry, As.material = this.material, As.material !== void 0) for (let o = 0; o < n; o++) { this.getMatrixAt(o, $g), qg.multiplyMatrices(r, $g), As.matrixWorld = qg, As.raycast(e, hc); for (let a = 0, s = hc.length; a < s; a++) { const c = hc[a]; c.instanceId = o, c.object = this, t.push(c); } hc.length = 0; } } setColorAt(e, t) { this.instanceColor === null && (this.instanceColor = new tt(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" }); } } Qp.prototype.isInstancedMesh = !0; class li extends ri { constructor(e) { super(), this.type = "LineBasicMaterial", this.color = new Be(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; } } li.prototype.isLineBasicMaterial = !0; const Xg = /* @__PURE__ */ new Z(), Zg = /* @__PURE__ */ new Z(), Yg = /* @__PURE__ */ new $e(), Ph = /* @__PURE__ */ new ro(), dc = /* @__PURE__ */ new xn(); class Fr extends ot { constructor(e = new Ye(), t = new li()) { 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, r = [0]; for (let n = 1, o = t.count; n < o; n++) Xg.fromBufferAttribute(t, n - 1), Zg.fromBufferAttribute(t, n), r[n] = r[n - 1], r[n] += Xg.distanceTo(Zg); e.setAttribute("lineDistance", new je(r, 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 r = this.geometry, n = this.matrixWorld, o = e.params.Line.threshold, a = r.drawRange; if (r.boundingSphere === null && r.computeBoundingSphere(), dc.copy(r.boundingSphere), dc.applyMatrix4(n), dc.radius += o, e.ray.intersectsSphere(dc) === !1) return; Yg.copy(n).invert(), Ph.copy(e.ray).applyMatrix4(Yg); const s = o / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = s * s, l = new Z(), h = new Z(), u = new Z(), p = new Z(), m = this.isLineSegments ? 2 : 1; if (r.isBufferGeometry) { const g = r.index, d = r.attributes.position; if (g !== null) { const y = Math.max(0, a.start), f = Math.min(g.count, a.start + a.count); for (let v = y, _ = f - 1; v < _; v += m) { const M = g.getX(v), T = g.getX(v + 1); if (l.fromBufferAttribute(d, M), h.fromBufferAttribute(d, T), Ph.distanceSqToSegment(l, h, p, u) > c) continue; p.applyMatrix4(this.matrixWorld); const w = e.ray.origin.distanceTo(p); w < e.near || w > e.far || t.push({ distance: w, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: u.clone().applyMatrix4(this.matrixWorld), index: v, face: null, faceIndex: null, object: this }); } } else { const y = Math.max(0, a.start), f = Math.min(d.count, a.start + a.count); for (let v = y, _ = f - 1; v < _; v += m) { if (l.fromBufferAttribute(d, v), h.fromBufferAttribute(d, v + 1), Ph.distanceSqToSegment(l, h, p, u) > 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: u.clone().applyMatrix4(this.matrixWorld), index: v, face: null, faceIndex: null, object: this }); } } } else r.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, r = Object.keys(t); if (r.length > 0) { const n = t[r[0]]; if (n !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (let o = 0, a = n.length; o < a; o++) { const s = n[o].name || String(o); this.morphTargetInfluences.push(0), this.morphTargetDictionary[s] = o; } } } } 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."); } } } Fr.prototype.isLine = !0; const Jg = /* @__PURE__ */ new Z(), Kg = /* @__PURE__ */ new Z(); class Bi extends Fr { 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, r = []; for (let n = 0, o = t.count; n < o; n += 2) Jg.fromBufferAttribute(t, n), Kg.fromBufferAttribute(t, n + 1), r[n] = n === 0 ? 0 : r[n - 1], r[n + 1] = r[n] + Jg.distanceTo(Kg); e.setAttribute("lineDistance", new je(r, 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; } } Bi.prototype.isLineSegments = !0; class Bu extends Fr { constructor(e, t) { super(e, t), this.type = "LineLoop"; } } Bu.prototype.isLineLoop = !0; class oo extends ri { constructor(e) { super(), this.type = "PointsMaterial", this.color = new Be(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; } } oo.prototype.isPointsMaterial = !0; const Qg = /* @__PURE__ */ new $e(), kd = /* @__PURE__ */ new ro(), pc = /* @__PURE__ */ new xn(), fc = /* @__PURE__ */ new Z(); class hs extends ot { constructor(e = new Ye(), t = new oo()) { 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 r = this.geometry, n = this.matrixWorld, o = e.params.Points.threshold, a = r.drawRange; if (r.boundingSphere === null && r.computeBoundingSphere(), pc.copy(r.boundingSphere), pc.applyMatrix4(n), pc.radius += o, e.ray.intersectsSphere(pc) === !1) return; Qg.copy(n).invert(), kd.copy(e.ray).applyMatrix4(Qg); const s = o / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = s * s; if (r.isBufferGeometry) { const l = r.index, h = r.attributes.position; if (l !== null) { const u = Math.max(0, a.start), p = Math.min(l.count, a.start + a.count); for (let m = u, g = p; m < g; m++) { const d = l.getX(m); fc.fromBufferAttribute(h, d), ev(fc, d, c, n, e, t, this); } } else { const u = Math.max(0, a.start), p = Math.min(h.count, a.start + a.count); for (let m = u, g = p; m < g; m++) fc.fromBufferAttribute(h, m), ev(fc, m, c, n, 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, r = Object.keys(t); if (r.length > 0) { const n = t[r[0]]; if (n !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (let o = 0, a = n.length; o < a; o++) { const s = n[o].name || String(o); this.morphTargetInfluences.push(0), this.morphTargetDictionary[s] = o; } } } } 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."); } } } hs.prototype.isPoints = !0; function ev(i, e, t, r, n, o, a) { const s = kd.distanceSqToPoint(i); if (s < t) { const c = new Z(); kd.closestPointToPoint(i, c), c.applyMatrix4(r); const l = n.ray.origin.distanceTo(c); if (l < n.near || l > n.far) return; o.push({ distance: l, distanceToRay: Math.sqrt(s), point: c, index: e, face: null, object: a }); } } class Fx extends ti { constructor(e, t, r, n, o, a, s, c, l) { super(e, t, r, n, o, a, s, c, l), this.format = s !== void 0 ? s : sn, this.minFilter = a !== void 0 ? a : Wt, this.magFilter = o !== void 0 ? o : Wt, this.generateMipmaps = !1; const h = this; function u() { h.needsUpdate = !0, e.requestVideoFrameCallback(u); } "requestVideoFrameCallback" in e && e.requestVideoFrameCallback(u); } clone() { return new this.constructor(this.image).copy(this); } update() { const e = this.image; !("requestVideoFrameCallback" in e) && e.readyState >= e.HAVE_CURRENT_DATA && (this.needsUpdate = !0); } } Fx.prototype.isVideoTexture = !0; class ef extends ti { constructor(e, t, r, n, o, a, s, c, l, h, u, p) { super(null, a, s, c, l, h, n, o, u, p), this.image = { width: t, height: r }, this.mipmaps = e, this.flipY = !1, this.generateMipmaps = !1; } } ef.prototype.isCompressedTexture = !0; class zx extends ti { constructor(e, t, r, n, o, a, s, c, l) { super(e, t, r, n, o, a, s, c, l), this.needsUpdate = !0; } } zx.prototype.isCanvasTexture = !0; class Ux extends ti { constructor(e, t, r, n, o, a, s, c, l, h) { if (h = h !== void 0 ? h : Ao, h !== Ao && h !== Ba) throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat"); r === void 0 && h === Ao && (r = el), r === void 0 && h === Ba && (r = Ta), super(null, n, o, a, s, c, h, r, l), this.image = { width: e, height: t }, this.magFilter = s !== void 0 ? s : Jt, this.minFilter = c !== void 0 ? c : Jt, this.flipY = !1, this.generateMipmaps = !1; } } Ux.prototype.isDepthTexture = !0; class Va extends Ye { constructor(e = 1, t = 8, r = 0, n = Math.PI * 2) { super(), this.type = "CircleGeometry", this.parameters = { radius: e, segments: t, thetaStart: r, thetaLength: n }, t = Math.max(3, t); const o = [], a = [], s = [], c = [], l = new Z(), h = new Re(); a.push(0, 0, 0), s.push(0, 0, 1), c.push(0.5, 0.5); for (let u = 0, p = 3; u <= t; u++, p += 3) { const m = r + u / t * n; l.x = e * Math.cos(m), l.y = e * Math.sin(m), a.push(l.x, l.y, l.z), s.push(0, 0, 1), h.x = (a[p] / e + 1) / 2, h.y = (a[p + 1] / e + 1) / 2, c.push(h.x, h.y); } for (let u = 1; u <= t; u++) o.push(u, u + 1, 0); this.setIndex(o), this.setAttribute("position", new je(a, 3)), this.setAttribute("normal", new je(s, 3)), this.setAttribute("uv", new je(c, 2)); } static fromJSON(e) { return new Va(e.radius, e.segments, e.thetaStart, e.thetaLength); } } class Jn extends Ye { constructor(e = 1, t = 1, r = 1, n = 8, o = 1, a = !1, s = 0, c = Math.PI * 2) { super(), this.type = "CylinderGeometry", this.parameters = { radiusTop: e, radiusBottom: t, height: r, radialSegments: n, heightSegments: o, openEnded: a, thetaStart: s, thetaLength: c }; const l = this; n = Math.floor(n), o = Math.floor(o); const h = [], u = [], p = [], m = []; let g = 0; const d = [], y = r / 2; let f = 0; v(), a === !1 && (e > 0 && _(!0), t > 0 && _(!1)), this.setIndex(h), this.setAttribute("position", new je(u, 3)), this.setAttribute("normal", new je(p, 3)), this.setAttribute("uv", new je(m, 2)); function v() { const M = new Z(), T = new Z(); let w = 0; const b = (t - e) / r; for (let E = 0; E <= o; E++) { const S = [], C = E / o, R = C * (t - e) + e; for (let L = 0; L <= n; L++) { const A = L / n, P = A * c + s, O = Math.sin(P), x = Math.cos(P); T.x = R * O, T.y = -C * r + y, T.z = R * x, u.push(T.x, T.y, T.z), M.set(O, b, x).normalize(), p.push(M.x, M.y, M.z), m.push(A, 1 - C), S.push(g++); } d.push(S); } for (let E = 0; E < n; E++) for (let S = 0; S < o; S++) { const C = d[S][E], R = d[S + 1][E], L = d[S + 1][E + 1], A = d[S][E + 1]; h.push(C, R, A), h.push(R, L, A), w += 6; } l.addGroup(f, w, 0), f += w; } function _(M) { const T = g, w = new Re(), b = new Z(); let E = 0; const S = M === !0 ? e : t, C = M === !0 ? 1 : -1; for (let L = 1; L <= n; L++) u.push(0, y * C, 0), p.push(0, C, 0), m.push(0.5, 0.5), g++; const R = g; for (let L = 0; L <= n; L++) { const A = L / n * c + s, P = Math.cos(A), O = Math.sin(A); b.x = S * O, b.y = y * C, b.z = S * P, u.push(b.x, b.y, b.z), p.push(0, C, 0), w.x = P * 0.5 + 0.5, w.y = O * 0.5 * C + 0.5, m.push(w.x, w.y), g++; } for (let L = 0; L < n; L++) { const A = T + L, P = R + L; M === !0 ? h.push(P, P + 1, A) : h.push(P + 1, P, A), E += 3; } l.addGroup(f, E, M === !0 ? 1 : 2), f += E; } } static fromJSON(e) { return new Jn(e.radiusTop, e.radiusBottom, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength); } } class Ha extends Jn { constructor(e = 1, t = 1, r = 8, n = 1, o = !1, a = 0, s = Math.PI * 2) { super(0, e, t, r, n, o, a, s), this.type = "ConeGeometry", this.parameters = { radius: e, height: t, radialSegments: r, heightSegments: n, openEnded: o, thetaStart: a, thetaLength: s }; } static fromJSON(e) { return new Ha(e.radius, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength); } } class zr extends Ye { constructor(e, t, r = 1, n = 0) { super(), this.type = "PolyhedronGeometry", this.parameters = { vertices: e, indices: t, radius: r, detail: n }; const o = [], a = []; s(n), l(r), h(), this.setAttribute("position", new je(o, 3)), this.setAttribute("normal", new je(o.slice(), 3)), this.setAttribute("uv", new je(a, 2)), n === 0 ? this.computeVertexNormals() : this.normalizeNormals(); function s(v) { const _ = new Z(), M = new Z(), T = new Z(); for (let w = 0; w < t.length; w += 3) m(t[w + 0], _), m(t[w + 1], M), m(t[w + 2], T), c(_, M, T, v); } function c(v, _, M, T) { const w = T + 1, b = []; for (let E = 0; E <= w; E++) { b[E] = []; const S = v.clone().lerp(M, E / w), C = _.clone().lerp(M, E / w), R = w - E; for (let L = 0; L <= R; L++) L === 0 && E === w ? b[E][L] = S : b[E][L] = S.clone().lerp(C, L / R); } for (let E = 0; E < w; E++) for (let S = 0; S < 2 * (w - E) - 1; S++) { const C = Math.floor(S / 2); S % 2 === 0 ? (p(b[E][C + 1]), p(b[E + 1][C]), p(b[E][C])) : (p(b[E][C + 1]), p(b[E + 1][C + 1]), p(b[E + 1][C])); } } function l(v) { const _ = new Z(); for (let M = 0; M < o.length; M += 3) _.x = o[M + 0], _.y = o[M + 1], _.z = o[M + 2], _.normalize().multiplyScalar(v), o[M + 0] = _.x, o[M + 1] = _.y, o[M + 2] = _.z; } function h() { const v = new Z(); for (let _ = 0; _ < o.length; _ += 3) { v.x = o[_ + 0], v.y = o[_ + 1], v.z = o[_ + 2]; const M = y(v) / 2 / Math.PI + 0.5, T = f(v) / Math.PI + 0.5; a.push(M, 1 - T); } g(), u(); } function u() { for (let v = 0; v < a.length; v += 6) { const _ = a[v + 0], M = a[v + 2], T = a[v + 4], w = Math.max(_, M, T), b = Math.min(_, M, T); w > 0.9 && b < 0.1 && (_ < 0.2 && (a[v + 0] += 1), M < 0.2 && (a[v + 2] += 1), T < 0.2 && (a[v + 4] += 1)); } } function p(v) { o.push(v.x, v.y, v.z); } function m(v, _) { const M = v * 3; _.x = e[M + 0], _.y = e[M + 1], _.z = e[M + 2]; } function g() { const v = new Z(), _ = new Z(), M = new Z(), T = new Z(), w = new Re(), b = new Re(), E = new Re(); for (let S = 0, C = 0; S < o.length; S += 9, C += 6) { v.set(o[S + 0], o[S + 1], o[S + 2]), _.set(o[S + 3], o[S + 4], o[S + 5]), M.set(o[S + 6], o[S + 7], o[S + 8]), w.set(a[C + 0], a[C + 1]), b.set(a[C + 2], a[C + 3]), E.set(a[C + 4], a[C + 5]), T.copy(v).add(_).add(M).divideScalar(3); const R = y(T); d(w, C + 0, v, R), d(b, C + 2, _, R), d(E, C + 4, M, R); } } function d(v, _, M, T) { T < 0 && v.x === 1 && (a[_] = v.x - 1), M.x === 0 && M.z === 0 && (a[_] = T / 2 / Math.PI + 0.5); } function y(v) { return Math.atan2(v.z, -v.x); } function f(v) { return Math.atan2(-v.y, Math.sqrt(v.x * v.x + v.z * v.z)); } } static fromJSON(e) { return new zr(e.vertices, e.indices, e.radius, e.details); } } class ja extends zr { constructor(e = 1, t = 0) { const r = (1 + Math.sqrt(5)) / 2, n = 1 / r, o = [ // (±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, -n, -r, 0, -n, r, 0, n, -r, 0, n, r, // (±1/φ, ±φ, 0) -n, -r, 0, -n, r, 0, n, -r, 0, n, r, 0, // (±φ, 0, ±1/φ) -r, 0, -n, r, 0, -n, -r, 0, n, r, 0, n ], a = [ 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(o, a, e, t), this.type = "DodecahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new ja(e.radius, e.detail); } } const mc = new Z(), gc = new Z(), Ih = new Z(), vc = new Kt(); class tf extends Ye { 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), n = Math.cos(Co * t), o = e.getIndex(), a = e.getAttribute("position"), s = o ? o.count : a.count, c = [0, 0, 0], l = ["a", "b", "c"], h = new Array(3), u = {}, p = []; for (let m = 0; m < s; m += 3) { o ? (c[0] = o.getX(m), c[1] = o.getX(m + 1), c[2] = o.getX(m + 2)) : (c[0] = m, c[1] = m + 1, c[2] = m + 2); const { a: g, b: d, c: y } = vc; if (g.fromBufferAttribute(a, c[0]), d.fromBufferAttribute(a, c[1]), y.fromBufferAttribute(a, c[2]), vc.getNormal(Ih), h[0] = `${Math.round(g.x * r)},${Math.round(g.y * r)},${Math.round(g.z * r)}`, h[1] = `${Math.round(d.x * r)},${Math.round(d.y * r)},${Math.round(d.z * r)}`, h[2] = `${Math.round(y.x * r)},${Math.round(y.y * r)},${Math.round(y.z * r)}`, !(h[0] === h[1] || h[1] === h[2] || h[2] === h[0])) for (let f = 0; f < 3; f++) { const v = (f + 1) % 3, _ = h[f], M = h[v], T = vc[l[f]], w = vc[l[v]], b = `${_}_${M}`, E = `${M}_${_}`; E in u && u[E] ? (Ih.dot(u[E].normal) <= n && (p.push(T.x, T.y, T.z), p.push(w.x, w.y, w.z)), u[E] = null) : b in u || (u[b] = { index0: c[f], index1: c[v], normal: Ih.clone() }); } } for (const m in u) if (u[m]) { const { index0: g, index1: d } = u[m]; mc.fromBufferAttribute(a, g), gc.fromBufferAttribute(a, d), p.push(mc.x, mc.y, mc.z), p.push(gc.x, gc.y, gc.z); } this.setAttribute("position", new je(p, 3)); } } class Ji { 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 r = this.getUtoTmapping(e); return this.getPoint(r, t); } // Get sequence of points using getPoint( t ) getPoints(e = 5) { const t = []; for (let r = 0; r <= e; r++) t.push(this.getPoint(r / e)); return t; } // Get sequence of points using getPointAt( u ) getSpacedPoints(e = 5) { const t = []; for (let r = 0; r <= e; r++) t.push(this.getPointAt(r / 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 r, n = this.getPoint(0), o = 0; t.push(0); for (let a = 1; a <= e; a++) r = this.getPoint(a / e), o += r.distanceTo(n), t.push(o), n = r; 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 r = this.getLengths(); let n = 0; const o = r.length; let a; t ? a = t : a = e * r[o - 1]; let s = 0, c = o - 1, l; for (; s <= c; ) if (n = Math.floor(s + (c - s) / 2), l = r[n] - a, l < 0) s = n + 1; else if (l > 0) c = n - 1; else { c = n; break; } if (n = c, r[n] === a) return n / (o - 1); const h = r[n], u = r[n + 1] - h, p = (a - h) / u; return (n + p) / (o - 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, n = e + 1e-4; r < 0 && (r = 0), n > 1 && (n = 1); const o = this.getPoint(r), a = this.getPoint(n), s = t || (o.isVector2 ? new Re() : new Z()); return s.copy(a).sub(o).normalize(), s; } getTangentAt(e, t) { const r = this.getUtoTmapping(e); return this.getTangent(r, t); } computeFrenetFrames(e, t) { const r = new Z(), n = [], o = [], a = [], s = new Z(), c = new $e(); for (let m = 0; m <= e; m++) { const g = m / e; n[m] = this.getTangentAt(g, new Z()), n[m].normalize(); } o[0] = new Z(), a[0] = new Z(); let l = Number.MAX_VALUE; const h = Math.abs(n[0].x), u = Math.abs(n[0].y), p = Math.abs(n[0].z); h <= l && (l = h, r.set(1, 0, 0)), u <= l && (l = u, r.set(0, 1, 0)), p <= l && r.set(0, 0, 1), s.crossVectors(n[0], r).normalize(), o[0].crossVectors(n[0], s), a[0].crossVectors(n[0], o[0]); for (let m = 1; m <= e; m++) { if (o[m] = o[m - 1].clone(), a[m] = a[m - 1].clone(), s.crossVectors(n[m - 1], n[m]), s.length() > Number.EPSILON) { s.normalize(); const g = Math.acos(bi(n[m - 1].dot(n[m]), -1, 1)); o[m].applyMatrix4(c.makeRotationAxis(s, g)); } a[m].crossVectors(n[m], o[m]); } if (t === !0) { let m = Math.acos(bi(o[0].dot(o[e]), -1, 1)); m /= e, n[0].dot(s.crossVectors(o[0], o[e])) > 0 && (m = -m); for (let g = 1; g <= e; g++) o[g].applyMatrix4(c.makeRotationAxis(n[g], m * g)), a[g].crossVectors(n[g], o[g]); } return { tangents: n, normals: o, binormals: a }; } 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 Ji { constructor(e = 0, t = 0, r = 1, n = 1, o = 0, a = Math.PI * 2, s = !1, c = 0) { super(), this.type = "EllipseCurve", this.aX = e, this.aY = t, this.xRadius = r, this.yRadius = n, this.aStartAngle = o, this.aEndAngle = a, this.aClockwise = s, this.aRotation = c; } getPoint(e, t) { const r = t || new Re(), n = Math.PI * 2; let o = this.aEndAngle - this.aStartAngle; const a = Math.abs(o) < Number.EPSILON; for (; o < 0; ) o += n; for (; o > n; ) o -= n; o < Number.EPSILON && (a ? o = 0 : o = n), this.aClockwise === !0 && !a && (o === n ? o = -n : o = o - n); const s = this.aStartAngle + e * o; let c = this.aX + this.xRadius * Math.cos(s), l = this.aY + this.yRadius * Math.sin(s); if (this.aRotation !== 0) { const h = Math.cos(this.aRotation), u = Math.sin(this.aRotation), p = c - this.aX, m = l - this.aY; c = p * h - m * u + this.aX, l = p * u + m * h + this.aY; } return r.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 rf extends Rl { constructor(e, t, r, n, o, a) { super(e, t, r, r, n, o, a), this.type = "ArcCurve"; } } rf.prototype.isArcCurve = !0; function nf() { let i = 0, e = 0, t = 0, r = 0; function n(o, a, s, c) { i = o, e = s, t = -3 * o + 3 * a - 2 * s - c, r = 2 * o - 2 * a + s + c; } return { initCatmullRom: function(o, a, s, c, l) { n(a, s, l * (s - o), l * (c - a)); }, initNonuniformCatmullRom: function(o, a, s, c, l, h, u) { let p = (a - o) / l - (s - o) / (l + h) + (s - a) / h, m = (s - a) / h - (c - a) / (h + u) + (c - s) / u; p *= h, m *= h, n(a, s, p, m); }, calc: function(o) { const a = o * o, s = a * o; return i + e * o + t * a + r * s; } }; } const yc = new Z(), Dh = new nf(), Nh = new nf(), Bh = new nf(); class of extends Ji { constructor(e = [], t = !1, r = "centripetal", n = 0.5) { super(), this.type = "CatmullRomCurve3", this.points = e, this.closed = t, this.curveType = r, this.tension = n; } getPoint(e, t = new Z()) { const r = t, n = this.points, o = n.length, a = (o - (this.closed ? 0 : 1)) * e; let s = Math.floor(a), c = a - s; this.closed ? s += s > 0 ? 0 : (Math.floor(Math.abs(s) / o) + 1) * o : c === 0 && s === o - 1 && (s = o - 2, c = 1); let l, h; this.closed || s > 0 ? l = n[(s - 1) % o] : (yc.subVectors(n[0], n[1]).add(n[0]), l = yc); const u = n[s % o], p = n[(s + 1) % o]; if (this.closed || s + 2 < o ? h = n[(s + 2) % o] : (yc.subVectors(n[o - 1], n[o - 2]).add(n[o - 1]), h = yc), this.curveType === "centripetal" || this.curveType === "chordal") { const m = this.curveType === "chordal" ? 0.5 : 0.25; let g = Math.pow(l.distanceToSquared(u), m), d = Math.pow(u.distanceToSquared(p), m), y = Math.pow(p.distanceToSquared(h), m); d < 1e-4 && (d = 1), g < 1e-4 && (g = d), y < 1e-4 && (y = d), Dh.initNonuniformCatmullRom(l.x, u.x, p.x, h.x, g, d, y), Nh.initNonuniformCatmullRom(l.y, u.y, p.y, h.y, g, d, y), Bh.initNonuniformCatmullRom(l.z, u.z, p.z, h.z, g, d, y); } else this.curveType === "catmullrom" && (Dh.initCatmullRom(l.x, u.x, p.x, h.x, this.tension), Nh.initCatmullRom(l.y, u.y, p.y, h.y, this.tension), Bh.initCatmullRom(l.z, u.z, p.z, h.z, this.tension)); return r.set( Dh.calc(c), Nh.calc(c), Bh.calc(c) ), r; } copy(e) { super.copy(e), this.points = []; for (let t = 0, r = e.points.length; t < r; t++) { const n = e.points[t]; this.points.push(n.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, r = this.points.length; t < r; t++) { const n = this.points[t]; e.points.push(n.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, r = e.points.length; t < r; t++) { const n = e.points[t]; this.points.push(new Z().fromArray(n)); } return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this; } } of.prototype.isCatmullRomCurve3 = !0; function tv(i, e, t, r, n) { const o = (r - e) * 0.5, a = (n - t) * 0.5, s = i * i, c = i * s; return (2 * t - 2 * r + o + a) * c + (-3 * t + 3 * r - 2 * o - a) * s + o * i + t; } function HN(i, e) { const t = 1 - i; return t * t * e; } function jN(i, e) { return 2 * (1 - i) * i * e; } function GN(i, e) { return i * i * e; } function Hs(i, e, t, r) { return HN(i, e) + jN(i, t) + GN(i, r); } function WN(i, e) { const t = 1 - i; return t * t * t * e; } function $N(i, e) { const t = 1 - i; return 3 * t * t * i * e; } function qN(i, e) { return 3 * (1 - i) * i * i * e; } function XN(i, e) { return i * i * i * e; } function js(i, e, t, r, n) { return WN(i, e) + $N(i, t) + qN(i, r) + XN(i, n); } class ku extends Ji { constructor(e = new Re(), t = new Re(), r = new Re(), n = new Re()) { super(), this.type = "CubicBezierCurve", this.v0 = e, this.v1 = t, this.v2 = r, this.v3 = n; } getPoint(e, t = new Re()) { const r = t, n = this.v0, o = this.v1, a = this.v2, s = this.v3; return r.set( js(e, n.x, o.x, a.x, s.x), js(e, n.y, o.y, a.y, s.y) ), r; } 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; } } ku.prototype.isCubicBezierCurve = !0; class af extends Ji { constructor(e = new Z(), t = new Z(), r = new Z(), n = new Z()) { super(), this.type = "CubicBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = r, this.v3 = n; } getPoint(e, t = new Z()) { const r = t, n = this.v0, o = this.v1, a = this.v2, s = this.v3; return r.set( js(e, n.x, o.x, a.x, s.x), js(e, n.y, o.y, a.y, s.y), js(e, n.z, o.z, a.z, s.z) ), r; } 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; } } af.prototype.isCubicBezierCurve3 = !0; class Ol extends Ji { constructor(e = new Re(), t = new Re()) { super(), this.type = "LineCurve", this.v1 = e, this.v2 = t; } getPoint(e, t = new Re()) { const r = t; return e === 1 ? r.copy(this.v2) : (r.copy(this.v2).sub(this.v1), r.multiplyScalar(e).add(this.v1)), r; } // Line curve is linear, so we can overwrite default getPointAt getPointAt(e, t) { return this.getPoint(e, t); } getTangent(e, t) { const r = t || new Re(); return r.copy(this.v2).sub(this.v1).normalize(), r; } 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; } } Ol.prototype.isLineCurve = !0; class Vx extends Ji { constructor(e = new Z(), t = new Z()) { super(), this.type = "LineCurve3", this.isLineCurve3 = !0, this.v1 = e, this.v2 = t; } getPoint(e, t = new Z()) { const r = t; return e === 1 ? r.copy(this.v2) : (r.copy(this.v2).sub(this.v1), r.multiplyScalar(e).add(this.v1)), r; } // 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 Fu extends Ji { constructor(e = new Re(), t = new Re(), r = new Re()) { super(), this.type = "QuadraticBezierCurve", this.v0 = e, this.v1 = t, this.v2 = r; } getPoint(e, t = new Re()) { const r = t, n = this.v0, o = this.v1, a = this.v2; return r.set( Hs(e, n.x, o.x, a.x), Hs(e, n.y, o.y, a.y) ), r; } 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; } } Fu.prototype.isQuadraticBezierCurve = !0; class sf extends Ji { constructor(e = new Z(), t = new Z(), r = new Z()) { super(), this.type = "QuadraticBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = r; } getPoint(e, t = new Z()) { const r = t, n = this.v0, o = this.v1, a = this.v2; return r.set( Hs(e, n.x, o.x, a.x), Hs(e, n.y, o.y, a.y), Hs(e, n.z, o.z, a.z) ), r; } 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; } } sf.prototype.isQuadraticBezierCurve3 = !0; class zu extends Ji { constructor(e = []) { super(), this.type = "SplineCurve", this.points = e; } getPoint(e, t = new Re()) { const r = t, n = this.points, o = (n.length - 1) * e, a = Math.floor(o), s = o - a, c = n[a === 0 ? a : a - 1], l = n[a], h = n[a > n.length - 2 ? n.length - 1 : a + 1], u = n[a > n.length - 3 ? n.length - 1 : a + 2]; return r.set( tv(s, c.x, l.x, h.x, u.x), tv(s, c.y, l.y, h.y, u.y) ), r; } copy(e) { super.copy(e), this.points = []; for (let t = 0, r = e.points.length; t < r; t++) { const n = e.points[t]; this.points.push(n.clone()); } return this; } toJSON() { const e = super.toJSON(); e.points = []; for (let t = 0, r = this.points.length; t < r; t++) { const n = this.points[t]; e.points.push(n.toArray()); } return e; } fromJSON(e) { super.fromJSON(e), this.points = []; for (let t = 0, r = e.points.length; t < r; t++) { const n = e.points[t]; this.points.push(new Re().fromArray(n)); } return this; } } zu.prototype.isSplineCurve = !0; var lf = /* @__PURE__ */ Object.freeze({ __proto__: null, ArcCurve: rf, CatmullRomCurve3: of, CubicBezierCurve: ku, CubicBezierCurve3: af, EllipseCurve: Rl, LineCurve: Ol, LineCurve3: Vx, QuadraticBezierCurve: Fu, QuadraticBezierCurve3: sf, SplineCurve: zu }); const ZN = { triangulate: function(i, e, t = 2) { const r = e && e.length, n = r ? e[0] * t : i.length; let o = Hx(i, 0, n, t, !0); const a = []; if (!o || o.next === o.prev) return a; let s, c, l, h, u, p, m; if (r && (o = eB(i, e, o, t)), i.length > 80 * t) { s = l = i[0], c = h = i[1]; for (let g = t; g < n; g += t) u = i[g], p = i[g + 1], u < s && (s = u), p < c && (c = p), u > l && (l = u), p > h && (h = p); m = Math.max(l - s, h - c), m = m !== 0 ? 1 / m : 0; } return rl(o, a, t, s, c, m), a; } }; function Hx(i, e, t, r, n) { let o, a; if (n === hB(i, e, t, r) > 0) for (o = e; o < t; o += r) a = iv(o, i[o], i[o + 1], a); else for (o = t - r; o >= e; o -= r) a = iv(o, i[o], i[o + 1], a); return a && Uu(a, a.next) && (ol(a), a = a.next), a; } function Kn(i, e) { if (!i) return i; e || (e = i); let t = i, r; do if (r = !1, !t.steiner && (Uu(t, t.next) || Ft(t.prev, t, t.next) === 0)) { if (ol(t), t = e = t.prev, t === t.next) break; r = !0; } else t = t.next; while (r || t !== e); return e; } function rl(i, e, t, r, n, o, a) { if (!i) return; !a && o && oB(i, r, n, o); let s = i, c, l; for (; i.prev !== i.next; ) { if (c = i.prev, l = i.next, o ? JN(i, r, n, o) : YN(i)) { e.push(c.i / t), e.push(i.i / t), e.push(l.i / t), ol(i), i = l.next, s = l.next; continue; } if (i = l, i === s) { a ? a === 1 ? (i = KN(Kn(i), e, t), rl(i, e, t, r, n, o, 2)) : a === 2 && QN(i, e, t, r, n, o) : rl(Kn(i), e, t, r, n, o, 1); break; } } } function YN(i) { const e = i.prev, t = i, r = i.next; if (Ft(e, t, r) >= 0) return !1; let n = i.next.next; for (; n !== i.prev; ) { if (Ma(e.x, e.y, t.x, t.y, r.x, r.y, n.x, n.y) && Ft(n.prev, n, n.next) >= 0) return !1; n = n.next; } return !0; } function JN(i, e, t, r) { const n = i.prev, o = i, a = i.next; if (Ft(n, o, a) >= 0) return !1; const s = n.x < o.x ? n.x < a.x ? n.x : a.x : o.x < a.x ? o.x : a.x, c = n.y < o.y ? n.y < a.y ? n.y : a.y : o.y < a.y ? o.y : a.y, l = n.x > o.x ? n.x > a.x ? n.x : a.x : o.x > a.x ? o.x : a.x, h = n.y > o.y ? n.y > a.y ? n.y : a.y : o.y > a.y ? o.y : a.y, u = Fd(s, c, e, t, r), p = Fd(l, h, e, t, r); let m = i.prevZ, g = i.nextZ; for (; m && m.z >= u && g && g.z <= p; ) { if (m !== i.prev && m !== i.next && Ma(n.x, n.y, o.x, o.y, a.x, a.y, m.x, m.y) && Ft(m.prev, m, m.next) >= 0 || (m = m.prevZ, g !== i.prev && g !== i.next && Ma(n.x, n.y, o.x, o.y, a.x, a.y, g.x, g.y) && Ft(g.prev, g, g.next) >= 0)) return !1; g = g.nextZ; } for (; m && m.z >= u; ) { if (m !== i.prev && m !== i.next && Ma(n.x, n.y, o.x, o.y, a.x, a.y, m.x, m.y) && Ft(m.prev, m, m.next) >= 0) return !1; m = m.prevZ; } for (; g && g.z <= p; ) { if (g !== i.prev && g !== i.next && Ma(n.x, n.y, o.x, o.y, a.x, a.y, g.x, g.y) && Ft(g.prev, g, g.next) >= 0) return !1; g = g.nextZ; } return !0; } function KN(i, e, t) { let r = i; do { const n = r.prev, o = r.next.next; !Uu(n, o) && jx(n, r, r.next, o) && nl(n, o) && nl(o, n) && (e.push(n.i / t), e.push(r.i / t), e.push(o.i / t), ol(r), ol(r.next), r = i = o), r = r.next; } while (r !== i); return Kn(r); } function QN(i, e, t, r, n, o) { let a = i; do { let s = a.next.next; for (; s !== a.prev; ) { if (a.i !== s.i && lB(a, s)) { let c = Gx(a, s); a = Kn(a, a.next), c = Kn(c, c.next), rl(a, e, t, r, n, o), rl(c, e, t, r, n, o); return; } s = s.next; } a = a.next; } while (a !== i); } function eB(i, e, t, r) { const n = []; let o, a, s, c, l; for (o = 0, a = e.length; o < a; o++) s = e[o] * r, c = o < a - 1 ? e[o + 1] * r : i.length, l = Hx(i, s, c, r, !1), l === l.next && (l.steiner = !0), n.push(sB(l)); for (n.sort(tB), o = 0; o < n.length; o++) iB(n[o], t), t = Kn(t, t.next); return t; } function tB(i, e) { return i.x - e.x; } function iB(i, e) { if (e = rB(i, e), e) { const t = Gx(e, i); Kn(e, e.next), Kn(t, t.next); } } function rB(i, e) { let t = e; const r = i.x, n = i.y; let o = -1 / 0, a; do { if (n <= t.y && n >= t.next.y && t.next.y !== t.y) { const p = t.x + (n - t.y) * (t.next.x - t.x) / (t.next.y - t.y); if (p <= r && p > o) { if (o = p, p === r) { if (n === t.y) return t; if (n === t.next.y) return t.next; } a = t.x < t.next.x ? t : t.next; } } t = t.next; } while (t !== e); if (!a) return null; if (r === o) return a; const s = a, c = a.x, l = a.y; let h = 1 / 0, u; t = a; do r >= t.x && t.x >= c && r !== t.x && Ma(n < l ? r : o, n, c, l, n < l ? o : r, n, t.x, t.y) && (u = Math.abs(n - t.y) / (r - t.x), nl(t, i) && (u < h || u === h && (t.x > a.x || t.x === a.x && nB(a, t))) && (a = t, h = u)), t = t.next; while (t !== s); return a; } function nB(i, e) { return Ft(i.prev, i, e.prev) < 0 && Ft(e.next, i, i.next) < 0; } function oB(i, e, t, r) { let n = i; do n.z === null && (n.z = Fd(n.x, n.y, e, t, r)), n.prevZ = n.prev, n.nextZ = n.next, n = n.next; while (n !== i); n.prevZ.nextZ = null, n.prevZ = null, aB(n); } function aB(i) { let e, t, r, n, o, a, s, c, l = 1; do { for (t = i, i = null, o = null, a = 0; t; ) { for (a++, r = t, s = 0, e = 0; e < l && (s++, r = r.nextZ, !!r); e++) ; for (c = l; s > 0 || c > 0 && r; ) s !== 0 && (c === 0 || !r || t.z <= r.z) ? (n = t, t = t.nextZ, s--) : (n = r, r = r.nextZ, c--), o ? o.nextZ = n : i = n, n.prevZ = o, o = n; t = r; } o.nextZ = null, l *= 2; } while (a > 1); return i; } function Fd(i, e, t, r, n) { return i = 32767 * (i - t) * n, e = 32767 * (e - r) * n, i = (i | i << 8) & 16711935, i = (i | i << 4) & 252645135, i = (i | i << 2) & 858993459, i = (i | i << 1) & 1431655765, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, i | e << 1; } function sB(i) { let e = i, t = i; do (e.x < t.x || e.x === t.x && e.y < t.y) && (t = e), e = e.next; while (e !== i); return t; } function Ma(i, e, t, r, n, o, a, s) { return (n - a) * (e - s) - (i - a) * (o - s) >= 0 && (i - a) * (r - s) - (t - a) * (e - s) >= 0 && (t - a) * (o - s) - (n - a) * (r - s) >= 0; } function lB(i, e) { return i.next.i !== e.i && i.prev.i !== e.i && !cB(i, e) && // dones't intersect other edges (nl(i, e) && nl(e, i) && uB(i, e) && // locally visible (Ft(i.prev, i, e.prev) || Ft(i, e.prev, e)) || // does not create opposite-facing sectors Uu(i, e) && Ft(i.prev, i, i.next) > 0 && Ft(e.prev, e, e.next) > 0); } function Ft(i, e, t) { return (e.y - i.y) * (t.x - e.x) - (e.x - i.x) * (t.y - e.y); } function Uu(i, e) { return i.x === e.x && i.y === e.y; } function jx(i, e, t, r) { const n = xc(Ft(i, e, t)), o = xc(Ft(i, e, r)), a = xc(Ft(t, r, i)), s = xc(Ft(t, r, e)); return !!(n !== o && a !== s || n === 0 && bc(i, t, e) || o === 0 && bc(i, r, e) || a === 0 && bc(t, i, r) || s === 0 && bc(t, e, r)); } function bc(i, e, t) { return e.x <= Math.max(i.x, t.x) && e.x >= Math.min(i.x, t.x) && e.y <= Math.max(i.y, t.y) && e.y >= Math.min(i.y, t.y); } function xc(i) { return i > 0 ? 1 : i < 0 ? -1 : 0; } function cB(i, e) { let t = i; do { if (t.i !== i.i && t.next.i !== i.i && t.i !== e.i && t.next.i !== e.i && jx(t, t.next, i, e)) return !0; t = t.next; } while (t !== i); return !1; } function nl(i, e) { return Ft(i.prev, i, i.next) < 0 ? Ft(i, e, i.next) >= 0 && Ft(i, i.prev, e) >= 0 : Ft(i, e, i.prev) < 0 || Ft(i, i.next, e) < 0; } function uB(i, e) { let t = i, r = !1; const n = (i.x + e.x) / 2, o = (i.y + e.y) / 2; do t.y > o != t.next.y > o && t.next.y !== t.y && n < (t.next.x - t.x) * (o - t.y) / (t.next.y - t.y) + t.x && (r = !r), t = t.next; while (t !== i); return r; } function Gx(i, e) { const t = new zd(i.i, i.x, i.y), r = new zd(e.i, e.x, e.y), n = i.next, o = e.prev; return i.next = e, e.prev = i, t.next = n, n.prev = t, r.next = t, t.prev = r, o.next = r, r.prev = o, r; } function iv(i, e, t, r) { const n = new zd(i, e, t); return r ? (n.next = r.next, n.prev = r, r.next.prev = n, r.next = n) : (n.prev = n, n.next = n), n; } function ol(i) { i.next.prev = i.prev, i.prev.next = i.next, i.prevZ && (i.prevZ.nextZ = i.nextZ), i.nextZ && (i.nextZ.prevZ = i.prevZ); } function zd(i, e, t) { this.i = i, 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 hB(i, e, t, r) { let n = 0; for (let o = e, a = t - r; o < t; o += r) n += (i[a] - i[o]) * (i[o + 1] + i[a + 1]), a = o; return n; } class Nr { // calculate area of the contour polygon static area(e) { const t = e.length; let r = 0; for (let n = t - 1, o = 0; o < t; n = o++) r += e[n].x * e[o].y - e[o].x * e[n].y; return r * 0.5; } static isClockWise(e) { return Nr.area(e) < 0; } static triangulateShape(e, t) { const r = [], n = [], o = []; rv(e), nv(r, e); let a = e.length; t.forEach(rv); for (let c = 0; c < t.length; c++) n.push(a), a += t[c].length, nv(r, t[c]); const s = ZN.triangulate(r, n); for (let c = 0; c < s.length; c += 3) o.push(s.slice(c, c + 3)); return o; } } function rv(i) { const e = i.length; e > 2 && i[e - 1].equals(i[0]) && i.pop(); } function nv(i, e) { for (let t = 0; t < e.length; t++) i.push(e[t].x), i.push(e[t].y); } class xr extends Ye { constructor(e, t) { super(), this.type = "ExtrudeGeometry", this.parameters = { shapes: e, options: t }, e = Array.isArray(e) ? e : [e]; const r = this, n = [], o = []; for (let s = 0, c = e.length; s < c; s++) { const l = e[s]; a(l); } this.setAttribute("position", new je(n, 3)), this.setAttribute("uv", new je(o, 2)), this.computeVertexNormals(); function a(s) { const c = [], l = t.curveSegments !== void 0 ? t.curveSegments : 12, h = t.steps !== void 0 ? t.steps : 1; let u = t.depth !== void 0 ? t.depth : 100, p = t.bevelEnabled !== void 0 ? t.bevelEnabled : !0, m = t.bevelThickness !== void 0 ? t.bevelThickness : 6, g = t.bevelSize !== void 0 ? t.bevelSize : m - 2, d = t.bevelOffset !== void 0 ? t.bevelOffset : 0, y = t.bevelSegments !== void 0 ? t.bevelSegments : 3; const f = t.extrudePath, v = t.UVGenerator !== void 0 ? t.UVGenerator : dB; t.amount !== void 0 && (console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."), u = t.amount); let _, M = !1, T, w, b, E; f && (_ = f.getSpacedPoints(h), M = !0, p = !1, T = f.computeFrenetFrames(h, !1), w = new Z(), b = new Z(), E = new Z()), p || (y = 0, m = 0, g = 0, d = 0); const S = s.extractPoints(l); let C = S.shape; const R = S.holes; if (!Nr.isClockWise(C)) { C = C.reverse(); for (let G = 0, J = R.length; G < J; G++) { const re = R[G]; Nr.isClockWise(re) && (R[G] = re.reverse()); } } const L = Nr.triangulateShape(C, R), A = C; for (let G = 0, J = R.length; G < J; G++) { const re = R[G]; C = C.concat(re); } function P(G, J, re) { return J || console.error("THREE.ExtrudeGeometry: vec does not exist"), J.clone().multiplyScalar(re).add(G); } const O = C.length, x = L.length; function I(G, J, re) { let B, $, te; const U = G.x - J.x, V = G.y - J.y, ae = re.x - G.x, ue = re.y - G.y, de = U * U + V * V, ve = U * ue - V * ae; if (Math.abs(ve) > Number.EPSILON) { const ye = Math.sqrt(de), le = Math.sqrt(ae * ae + ue * ue), Se = J.x - V / ye, Te = J.y + U / ye, oe = re.x - ue / le, Me = re.y + ae / le, ge = ((oe - Se) * ue - (Me - Te) * ae) / (U * ue - V * ae); B = Se + U * ge - G.x, $ = Te + V * ge - G.y; const xe = B * B + $ * $; if (xe <= 2) return new Re(B, $); te = Math.sqrt(xe / 2); } else { let ye = !1; U > Number.EPSILON ? ae > Number.EPSILON && (ye = !0) : U < -Number.EPSILON ? ae < -Number.EPSILON && (ye = !0) : Math.sign(V) === Math.sign(ue) && (ye = !0), ye ? (B = -V, $ = U, te = Math.sqrt(de)) : (B = U, $ = V, te = Math.sqrt(de / 2)); } return new Re(B / te, $ / te); } const N = []; for (let G = 0, J = A.length, re = J - 1, B = G + 1; G < J; G++, re++, B++) re === J && (re = 0), B === J && (B = 0), N[G] = I(A[G], A[re], A[B]); const D = []; let k, F = N.concat(); for (let G = 0, J = R.length; G < J; G++) { const re = R[G]; k = []; for (let B = 0, $ = re.length, te = $ - 1, U = B + 1; B < $; B++, te++, U++) te === $ && (te = 0), U === $ && (U = 0), k[B] = I(re[B], re[te], re[U]); D.push(k), F = F.concat(k); } for (let G = 0; G < y; G++) { const J = G / y, re = m * Math.cos(J * Math.PI / 2), B = g * Math.sin(J * Math.PI / 2) + d; for (let $ = 0, te = A.length; $ < te; $++) { const U = P(A[$], N[$], B); z(U.x, U.y, -re); } for (let $ = 0, te = R.length; $ < te; $++) { const U = R[$]; k = D[$]; for (let V = 0, ae = U.length; V < ae; V++) { const ue = P(U[V], k[V], B); z(ue.x, ue.y, -re); } } } const W = g + d; for (let G = 0; G < O; G++) { const J = p ? P(C[G], F[G], W) : C[G]; M ? (b.copy(T.normals[0]).multiplyScalar(J.x), w.copy(T.binormals[0]).multiplyScalar(J.y), E.copy(_[0]).add(b).add(w), z(E.x, E.y, E.z)) : z(J.x, J.y, 0); } for (let G = 1; G <= h; G++) for (let J = 0; J < O; J++) { const re = p ? P(C[J], F[J], W) : C[J]; M ? (b.copy(T.normals[G]).multiplyScalar(re.x), w.copy(T.binormals[G]).multiplyScalar(re.y), E.copy(_[G]).add(b).add(w), z(E.x, E.y, E.z)) : z(re.x, re.y, u / h * G); } for (let G = y - 1; G >= 0; G--) { const J = G / y, re = m * Math.cos(J * Math.PI / 2), B = g * Math.sin(J * Math.PI / 2) + d; for (let $ = 0, te = A.length; $ < te; $++) { const U = P(A[$], N[$], B); z(U.x, U.y, u + re); } for (let $ = 0, te = R.length; $ < te; $++) { const U = R[$]; k = D[$]; for (let V = 0, ae = U.length; V < ae; V++) { const ue = P(U[V], k[V], B); M ? z(ue.x, ue.y + _[h - 1].y, _[h - 1].x + re) : z(ue.x, ue.y, u + re); } } } K(), ne(); function K() { const G = n.length / 3; if (p) { let J = 0, re = O * J; for (let B = 0; B < x; B++) { const $ = L[B]; j($[2] + re, $[1] + re, $[0] + re); } J = h + y * 2, re = O * J; for (let B = 0; B < x; B++) { const $ = L[B]; j($[0] + re, $[1] + re, $[2] + re); } } else { for (let J = 0; J < x; J++) { const re = L[J]; j(re[2], re[1], re[0]); } for (let J = 0; J < x; J++) { const re = L[J]; j(re[0] + O * h, re[1] + O * h, re[2] + O * h); } } r.addGroup(G, n.length / 3 - G, 0); } function ne() { const G = n.length / 3; let J = 0; q(A, J), J += A.length; for (let re = 0, B = R.length; re < B; re++) { const $ = R[re]; q($, J), J += $.length; } r.addGroup(G, n.length / 3 - G, 1); } function q(G, J) { let re = G.length; for (; --re >= 0; ) { const B = re; let $ = re - 1; $ < 0 && ($ = G.length - 1); for (let te = 0, U = h + y * 2; te < U; te++) { const V = O * te, ae = O * (te + 1), ue = J + B + V, de = J + $ + V, ve = J + $ + ae, ye = J + B + ae; Q(ue, de, ve, ye); } } } function z(G, J, re) { c.push(G), c.push(J), c.push(re); } function j(G, J, re) { Y(G), Y(J), Y(re); const B = n.length / 3, $ = v.generateTopUV(r, n, B - 3, B - 2, B - 1); ee($[0]), ee($[1]), ee($[2]); } function Q(G, J, re, B) { Y(G), Y(J), Y(B), Y(J), Y(re), Y(B); const $ = n.length / 3, te = v.generateSideWallUV(r, n, $ - 6, $ - 3, $ - 2, $ - 1); ee(te[0]), ee(te[1]), ee(te[3]), ee(te[1]), ee(te[2]), ee(te[3]); } function Y(G) { n.push(c[G * 3 + 0]), n.push(c[G * 3 + 1]), n.push(c[G * 3 + 2]); } function ee(G) { o.push(G.x), o.push(G.y); } } } toJSON() { const e = super.toJSON(), t = this.parameters.shapes, r = this.parameters.options; return pB(t, r, e); } static fromJSON(e, t) { const r = []; for (let o = 0, a = e.shapes.length; o < a; o++) { const s = t[e.shapes[o]]; r.push(s); } const n = e.options.extrudePath; return n !== void 0 && (e.options.extrudePath = new lf[n.type]().fromJSON(n)), new xr(r, e.options); } } const dB = { generateTopUV: function(i, e, t, r, n) { const o = e[t * 3], a = e[t * 3 + 1], s = e[r * 3], c = e[r * 3 + 1], l = e[n * 3], h = e[n * 3 + 1]; return [ new Re(o, a), new Re(s, c), new Re(l, h) ]; }, generateSideWallUV: function(i, e, t, r, n, o) { const a = e[t * 3], s = e[t * 3 + 1], c = e[t * 3 + 2], l = e[r * 3], h = e[r * 3 + 1], u = e[r * 3 + 2], p = e[n * 3], m = e[n * 3 + 1], g = e[n * 3 + 2], d = e[o * 3], y = e[o * 3 + 1], f = e[o * 3 + 2]; return Math.abs(s - h) < Math.abs(a - l) ? [ new Re(a, 1 - c), new Re(l, 1 - u), new Re(p, 1 - g), new Re(d, 1 - f) ] : [ new Re(s, 1 - c), new Re(h, 1 - u), new Re(m, 1 - g), new Re(y, 1 - f) ]; } }; function pB(i, e, t) { if (t.shapes = [], Array.isArray(i)) for (let r = 0, n = i.length; r < n; r++) { const o = i[r]; t.shapes.push(o.uuid); } else t.shapes.push(i.uuid); return e.extrudePath !== void 0 && (t.options.extrudePath = e.extrudePath.toJSON()), t; } class Ga extends zr { constructor(e = 1, t = 0) { const r = (1 + Math.sqrt(5)) / 2, n = [ -1, r, 0, 1, r, 0, -1, -r, 0, 1, -r, 0, 0, -1, r, 0, 1, r, 0, -1, -r, 0, 1, -r, r, 0, -1, r, 0, 1, -r, 0, -1, -r, 0, 1 ], o = [ 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(n, o, e, t), this.type = "IcosahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new Ga(e.radius, e.detail); } } class Wa extends Ye { constructor(e, t = 12, r = 0, n = Math.PI * 2) { super(), this.type = "LatheGeometry", this.parameters = { points: e, segments: t, phiStart: r, phiLength: n }, t = Math.floor(t), n = bi(n, 0, Math.PI * 2); const o = [], a = [], s = [], c = 1 / t, l = new Z(), h = new Re(); for (let u = 0; u <= t; u++) { const p = r + u * c * n, m = Math.sin(p), g = Math.cos(p); for (let d = 0; d <= e.length - 1; d++) l.x = e[d].x * m, l.y = e[d].y, l.z = e[d].x * g, a.push(l.x, l.y, l.z), h.x = u / t, h.y = d / (e.length - 1), s.push(h.x, h.y); } for (let u = 0; u < t; u++) for (let p = 0; p < e.length - 1; p++) { const m = p + u * e.length, g = m, d = m + e.length, y = m + e.length + 1, f = m + 1; o.push(g, d, f), o.push(d, y, f); } if (this.setIndex(o), this.setAttribute("position", new je(a, 3)), this.setAttribute("uv", new je(s, 2)), this.computeVertexNormals(), n === Math.PI * 2) { const u = this.attributes.normal.array, p = new Z(), m = new Z(), g = new Z(), d = t * e.length * 3; for (let y = 0, f = 0; y < e.length; y++, f += 3) p.x = u[f + 0], p.y = u[f + 1], p.z = u[f + 2], m.x = u[d + f + 0], m.y = u[d + f + 1], m.z = u[d + f + 2], g.addVectors(p, m).normalize(), u[f + 0] = u[d + f + 0] = g.x, u[f + 1] = u[d + f + 1] = g.y, u[f + 2] = u[d + f + 2] = g.z; } } static fromJSON(e) { return new Wa(e.points, e.segments, e.phiStart, e.phiLength); } } class Bo extends zr { constructor(e = 1, t = 0) { const r = [ 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1 ], n = [ 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(r, n, e, t), this.type = "OctahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new Bo(e.radius, e.detail); } } class tu extends Ye { constructor(e, t, r) { super(), this.type = "ParametricGeometry", this.parameters = { func: e, slices: t, stacks: r }; const n = [], o = [], a = [], s = [], c = 1e-5, l = new Z(), h = new Z(), u = new Z(), p = new Z(), m = new Z(); e.length < 3 && console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter."); const g = t + 1; for (let d = 0; d <= r; d++) { const y = d / r; for (let f = 0; f <= t; f++) { const v = f / t; e(v, y, h), o.push(h.x, h.y, h.z), v - c >= 0 ? (e(v - c, y, u), p.subVectors(h, u)) : (e(v + c, y, u), p.subVectors(u, h)), y - c >= 0 ? (e(v, y - c, u), m.subVectors(h, u)) : (e(v, y + c, u), m.subVectors(u, h)), l.crossVectors(p, m).normalize(), a.push(l.x, l.y, l.z), s.push(v, y); } } for (let d = 0; d < r; d++) for (let y = 0; y < t; y++) { const f = d * g + y, v = d * g + y + 1, _ = (d + 1) * g + y + 1, M = (d + 1) * g + y; n.push(f, v, M), n.push(v, _, M); } this.setIndex(n), this.setAttribute("position", new je(o, 3)), this.setAttribute("normal", new je(a, 3)), this.setAttribute("uv", new je(s, 2)); } } class $a extends Ye { constructor(e = 0.5, t = 1, r = 8, n = 1, o = 0, a = Math.PI * 2) { super(), this.type = "RingGeometry", this.parameters = { innerRadius: e, outerRadius: t, thetaSegments: r, phiSegments: n, thetaStart: o, thetaLength: a }, r = Math.max(3, r), n = Math.max(1, n); const s = [], c = [], l = [], h = []; let u = e; const p = (t - e) / n, m = new Z(), g = new Re(); for (let d = 0; d <= n; d++) { for (let y = 0; y <= r; y++) { const f = o + y / r * a; m.x = u * Math.cos(f), m.y = u * Math.sin(f), c.push(m.x, m.y, m.z), l.push(0, 0, 1), g.x = (m.x / t + 1) / 2, g.y = (m.y / t + 1) / 2, h.push(g.x, g.y); } u += p; } for (let d = 0; d < n; d++) { const y = d * (r + 1); for (let f = 0; f < r; f++) { const v = f + y, _ = v, M = v + r + 1, T = v + r + 2, w = v + 1; s.push(_, M, w), s.push(M, T, w); } } this.setIndex(s), this.setAttribute("position", new je(c, 3)), this.setAttribute("normal", new je(l, 3)), this.setAttribute("uv", new je(h, 2)); } static fromJSON(e) { return new $a(e.innerRadius, e.outerRadius, e.thetaSegments, e.phiSegments, e.thetaStart, e.thetaLength); } } class ko extends Ye { constructor(e, t = 12) { super(), this.type = "ShapeGeometry", this.parameters = { shapes: e, curveSegments: t }; const r = [], n = [], o = [], a = []; let s = 0, c = 0; if (Array.isArray(e) === !1) l(e); else for (let h = 0; h < e.length; h++) l(e[h]), this.addGroup(s, c, h), s += c, c = 0; this.setIndex(r), this.setAttribute("position", new je(n, 3)), this.setAttribute("normal", new je(o, 3)), this.setAttribute("uv", new je(a, 2)); function l(h) { const u = n.length / 3, p = h.extractPoints(t); let m = p.shape; const g = p.holes; Nr.isClockWise(m) === !1 && (m = m.reverse()); for (let y = 0, f = g.length; y < f; y++) { const v = g[y]; Nr.isClockWise(v) === !0 && (g[y] = v.reverse()); } const d = Nr.triangulateShape(m, g); for (let y = 0, f = g.length; y < f; y++) { const v = g[y]; m = m.concat(v); } for (let y = 0, f = m.length; y < f; y++) { const v = m[y]; n.push(v.x, v.y, 0), o.push(0, 0, 1), a.push(v.x, v.y); } for (let y = 0, f = d.length; y < f; y++) { const v = d[y], _ = v[0] + u, M = v[1] + u, T = v[2] + u; r.push(_, M, T), c += 3; } } } toJSON() { const e = super.toJSON(), t = this.parameters.shapes; return fB(t, e); } static fromJSON(e, t) { const r = []; for (let n = 0, o = e.shapes.length; n < o; n++) { const a = t[e.shapes[n]]; r.push(a); } return new ko(r, e.curveSegments); } } function fB(i, e) { if (e.shapes = [], Array.isArray(i)) for (let t = 0, r = i.length; t < r; t++) { const n = i[t]; e.shapes.push(n.uuid); } else e.shapes.push(i.uuid); return e; } class Fo extends Ye { constructor(e = 1, t = 8, r = 6, n = 0, o = Math.PI * 2, a = 0, s = Math.PI) { super(), this.type = "SphereGeometry", this.parameters = { radius: e, widthSegments: t, heightSegments: r, phiStart: n, phiLength: o, thetaStart: a, thetaLength: s }, t = Math.max(3, Math.floor(t)), r = Math.max(2, Math.floor(r)); const c = Math.min(a + s, Math.PI); let l = 0; const h = [], u = new Z(), p = new Z(), m = [], g = [], d = [], y = []; for (let f = 0; f <= r; f++) { const v = [], _ = f / r; let M = 0; f == 0 && a == 0 ? M = 0.5 / t : f == r && c == Math.PI && (M = -0.5 / t); for (let T = 0; T <= t; T++) { const w = T / t; u.x = -e * Math.cos(n + w * o) * Math.sin(a + _ * s), u.y = e * Math.cos(a + _ * s), u.z = e * Math.sin(n + w * o) * Math.sin(a + _ * s), g.push(u.x, u.y, u.z), p.copy(u).normalize(), d.push(p.x, p.y, p.z), y.push(w + M, 1 - _), v.push(l++); } h.push(v); } for (let f = 0; f < r; f++) for (let v = 0; v < t; v++) { const _ = h[f][v + 1], M = h[f][v], T = h[f + 1][v], w = h[f + 1][v + 1]; (f !== 0 || a > 0) && m.push(_, M, w), (f !== r - 1 || c < Math.PI) && m.push(M, T, w); } this.setIndex(m), this.setAttribute("position", new je(g, 3)), this.setAttribute("normal", new je(d, 3)), this.setAttribute("uv", new je(y, 2)); } static fromJSON(e) { return new Fo(e.radius, e.widthSegments, e.heightSegments, e.phiStart, e.phiLength, e.thetaStart, e.thetaLength); } } class qa extends zr { constructor(e = 1, t = 0) { const r = [ 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1 ], n = [ 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1 ]; super(r, n, e, t), this.type = "TetrahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new qa(e.radius, e.detail); } } class iu extends xr { constructor(e, t = {}) { const r = t.font; if (!(r && r.isFont)) return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."), new Ye(); const n = r.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(n, t), this.type = "TextGeometry"; } } class Xa extends Ye { constructor(e = 1, t = 0.4, r = 8, n = 6, o = Math.PI * 2) { super(), this.type = "TorusGeometry", this.parameters = { radius: e, tube: t, radialSegments: r, tubularSegments: n, arc: o }, r = Math.floor(r), n = Math.floor(n); const a = [], s = [], c = [], l = [], h = new Z(), u = new Z(), p = new Z(); for (let m = 0; m <= r; m++) for (let g = 0; g <= n; g++) { const d = g / n * o, y = m / r * Math.PI * 2; u.x = (e + t * Math.cos(y)) * Math.cos(d), u.y = (e + t * Math.cos(y)) * Math.sin(d), u.z = t * Math.sin(y), s.push(u.x, u.y, u.z), h.x = e * Math.cos(d), h.y = e * Math.sin(d), p.subVectors(u, h).normalize(), c.push(p.x, p.y, p.z), l.push(g / n), l.push(m / r); } for (let m = 1; m <= r; m++) for (let g = 1; g <= n; g++) { const d = (n + 1) * m + g - 1, y = (n + 1) * (m - 1) + g - 1, f = (n + 1) * (m - 1) + g, v = (n + 1) * m + g; a.push(d, y, v), a.push(y, f, v); } this.setIndex(a), this.setAttribute("position", new je(s, 3)), this.setAttribute("normal", new je(c, 3)), this.setAttribute("uv", new je(l, 2)); } static fromJSON(e) { return new Xa(e.radius, e.tube, e.radialSegments, e.tubularSegments, e.arc); } } class Za extends Ye { constructor(e = 1, t = 0.4, r = 64, n = 8, o = 2, a = 3) { super(), this.type = "TorusKnotGeometry", this.parameters = { radius: e, tube: t, tubularSegments: r, radialSegments: n, p: o, q: a }, r = Math.floor(r), n = Math.floor(n); const s = [], c = [], l = [], h = [], u = new Z(), p = new Z(), m = new Z(), g = new Z(), d = new Z(), y = new Z(), f = new Z(); for (let _ = 0; _ <= r; ++_) { const M = _ / r * o * Math.PI * 2; v(M, o, a, e, m), v(M + 0.01, o, a, e, g), y.subVectors(g, m), f.addVectors(g, m), d.crossVectors(y, f), f.crossVectors(d, y), d.normalize(), f.normalize(); for (let T = 0; T <= n; ++T) { const w = T / n * Math.PI * 2, b = -t * Math.cos(w), E = t * Math.sin(w); u.x = m.x + (b * f.x + E * d.x), u.y = m.y + (b * f.y + E * d.y), u.z = m.z + (b * f.z + E * d.z), c.push(u.x, u.y, u.z), p.subVectors(u, m).normalize(), l.push(p.x, p.y, p.z), h.push(_ / r), h.push(T / n); } } for (let _ = 1; _ <= r; _++) for (let M = 1; M <= n; M++) { const T = (n + 1) * (_ - 1) + (M - 1), w = (n + 1) * _ + (M - 1), b = (n + 1) * _ + M, E = (n + 1) * (_ - 1) + M; s.push(T, w, E), s.push(w, b, E); } this.setIndex(s), this.setAttribute("position", new je(c, 3)), this.setAttribute("normal", new je(l, 3)), this.setAttribute("uv", new je(h, 2)); function v(_, M, T, w, b) { const E = Math.cos(_), S = Math.sin(_), C = T / M * _, R = Math.cos(C); b.x = w * (2 + R) * 0.5 * E, b.y = w * (2 + R) * S * 0.5, b.z = w * Math.sin(C) * 0.5; } } static fromJSON(e) { return new Za(e.radius, e.tube, e.tubularSegments, e.radialSegments, e.p, e.q); } } class Ya extends Ye { constructor(e, t = 64, r = 1, n = 8, o = !1) { super(), this.type = "TubeGeometry", this.parameters = { path: e, tubularSegments: t, radius: r, radialSegments: n, closed: o }; const a = e.computeFrenetFrames(t, o); this.tangents = a.tangents, this.normals = a.normals, this.binormals = a.binormals; const s = new Z(), c = new Z(), l = new Re(); let h = new Z(); const u = [], p = [], m = [], g = []; d(), this.setIndex(g), this.setAttribute("position", new je(u, 3)), this.setAttribute("normal", new je(p, 3)), this.setAttribute("uv", new je(m, 2)); function d() { for (let _ = 0; _ < t; _++) y(_); y(o === !1 ? t : 0), v(), f(); } function y(_) { h = e.getPointAt(_ / t, h); const M = a.normals[_], T = a.binormals[_]; for (let w = 0; w <= n; w++) { const b = w / n * Math.PI * 2, E = Math.sin(b), S = -Math.cos(b); c.x = S * M.x + E * T.x, c.y = S * M.y + E * T.y, c.z = S * M.z + E * T.z, c.normalize(), p.push(c.x, c.y, c.z), s.x = h.x + r * c.x, s.y = h.y + r * c.y, s.z = h.z + r * c.z, u.push(s.x, s.y, s.z); } } function f() { for (let _ = 1; _ <= t; _++) for (let M = 1; M <= n; M++) { const T = (n + 1) * (_ - 1) + (M - 1), w = (n + 1) * _ + (M - 1), b = (n + 1) * _ + M, E = (n + 1) * (_ - 1) + M; g.push(T, w, E), g.push(w, b, E); } } function v() { for (let _ = 0; _ <= t; _++) for (let M = 0; M <= n; M++) l.x = _ / t, l.y = M / n, m.push(l.x, l.y); } } toJSON() { const e = super.toJSON(); return e.path = this.parameters.path.toJSON(), e; } static fromJSON(e) { return new Ya( new lf[e.path.type]().fromJSON(e.path), e.tubularSegments, e.radius, e.radialSegments, e.closed ); } } class cf extends Ye { 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 = [], r = [0, 0], n = {}, o = new Z(); if (e.index !== null) { const a = e.attributes.position, s = e.index; let c = e.groups; c.length === 0 && (c = [{ start: 0, count: s.count, materialIndex: 0 }]); for (let l = 0, h = c.length; l < h; ++l) { const u = c[l], p = u.start, m = u.count; for (let g = p, d = p + m; g < d; g += 3) for (let y = 0; y < 3; y++) { const f = s.getX(g + y), v = s.getX(g + (y + 1) % 3); r[0] = Math.min(f, v), r[1] = Math.max(f, v); const _ = r[0] + "," + r[1]; n[_] === void 0 && (n[_] = { index1: r[0], index2: r[1] }); } } for (const l in n) { const h = n[l]; o.fromBufferAttribute(a, h.index1), t.push(o.x, o.y, o.z), o.fromBufferAttribute(a, h.index2), t.push(o.x, o.y, o.z); } } else { const a = e.attributes.position; for (let s = 0, c = a.count / 3; s < c; s++) for (let l = 0; l < 3; l++) { const h = 3 * s + l; o.fromBufferAttribute(a, h), t.push(o.x, o.y, o.z); const u = 3 * s + (l + 1) % 3; o.fromBufferAttribute(a, u), t.push(o.x, o.y, o.z); } } this.setAttribute("position", new je(t, 3)); } } var ov = /* @__PURE__ */ Object.freeze({ __proto__: null, BoxGeometry: hn, BoxBufferGeometry: hn, CircleGeometry: Va, CircleBufferGeometry: Va, ConeGeometry: Ha, ConeBufferGeometry: Ha, CylinderGeometry: Jn, CylinderBufferGeometry: Jn, DodecahedronGeometry: ja, DodecahedronBufferGeometry: ja, EdgesGeometry: tf, ExtrudeGeometry: xr, ExtrudeBufferGeometry: xr, IcosahedronGeometry: Ga, IcosahedronBufferGeometry: Ga, LatheGeometry: Wa, LatheBufferGeometry: Wa, OctahedronGeometry: Bo, OctahedronBufferGeometry: Bo, ParametricGeometry: tu, ParametricBufferGeometry: tu, PlaneGeometry: No, PlaneBufferGeometry: No, PolyhedronGeometry: zr, PolyhedronBufferGeometry: zr, RingGeometry: $a, RingBufferGeometry: $a, ShapeGeometry: ko, ShapeBufferGeometry: ko, SphereGeometry: Fo, SphereBufferGeometry: Fo, TetrahedronGeometry: qa, TetrahedronBufferGeometry: qa, TextGeometry: iu, TextBufferGeometry: iu, TorusGeometry: Xa, TorusBufferGeometry: Xa, TorusKnotGeometry: Za, TorusKnotBufferGeometry: Za, TubeGeometry: Ya, TubeBufferGeometry: Ya, WireframeGeometry: cf }); class uf extends ri { constructor(e) { super(), this.type = "ShadowMaterial", this.color = new Be(0), this.transparent = !0, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this; } } uf.prototype.isShadowMaterial = !0; class ds extends dn { constructor(e) { super(e), this.type = "RawShaderMaterial"; } } ds.prototype.isRawShaderMaterial = !0; class $o extends ri { constructor(e) { super(), this.defines = { STANDARD: "" }, this.type = "MeshStandardMaterial", this.color = new Be(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 Be(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = to, this.normalScale = new Re(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; } } $o.prototype.isMeshStandardMaterial = !0; class Pl extends $o { 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 Re(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 = bi(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 Be(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 Be()).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; } } Pl.prototype.isMeshPhysicalMaterial = !0; class hf extends ri { constructor(e) { super(), this.type = "MeshPhongMaterial", this.color = new Be(16777215), this.specular = new Be(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Be(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = to, this.normalScale = new Re(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; } } hf.prototype.isMeshPhongMaterial = !0; class df extends ri { constructor(e) { super(), this.defines = { TOON: "" }, this.type = "MeshToonMaterial", this.color = new Be(16777215), this.map = null, this.gradientMap = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Be(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = to, this.normalScale = new Re(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; } } df.prototype.isMeshToonMaterial = !0; class pf extends ri { constructor(e) { super(), this.type = "MeshNormalMaterial", this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = to, this.normalScale = new Re(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; } } pf.prototype.isMeshNormalMaterial = !0; class ff extends ri { constructor(e) { super(), this.type = "MeshLambertMaterial", this.color = new Be(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Be(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; } } ff.prototype.isMeshLambertMaterial = !0; class mf extends ri { constructor(e) { super(), this.defines = { MATCAP: "" }, this.type = "MeshMatcapMaterial", this.color = new Be(16777215), this.matcap = null, this.map = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = to, this.normalScale = new Re(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; } } mf.prototype.isMeshMatcapMaterial = !0; class gf extends li { 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; } } gf.prototype.isLineDashedMaterial = !0; var mB = /* @__PURE__ */ Object.freeze({ __proto__: null, ShadowMaterial: uf, SpriteMaterial: Tl, RawShaderMaterial: ds, ShaderMaterial: dn, PointsMaterial: oo, MeshPhysicalMaterial: Pl, MeshStandardMaterial: $o, MeshPhongMaterial: hf, MeshToonMaterial: df, MeshNormalMaterial: pf, MeshLambertMaterial: ff, MeshDepthMaterial: Iu, MeshDistanceMaterial: Du, MeshBasicMaterial: Ui, MeshMatcapMaterial: mf, LineDashedMaterial: gf, LineBasicMaterial: li, Material: ri }); const Pt = { // same as Array.prototype.slice, but also works on typed arrays arraySlice: function(i, e, t) { return Pt.isTypedArray(i) ? new i.constructor(i.subarray(e, t !== void 0 ? t : i.length)) : i.slice(e, t); }, // converts an array to a specific type convertArray: function(i, e, t) { return !i || // let 'undefined' and 'null' pass !t && i.constructor === e ? i : typeof e.BYTES_PER_ELEMENT == "number" ? new e(i) : Array.prototype.slice.call(i); }, isTypedArray: function(i) { return ArrayBuffer.isView(i) && !(i instanceof DataView); }, // returns an array by which times and values can be sorted getKeyframeOrder: function(i) { function e(n, o) { return i[n] - i[o]; } const t = i.length, r = new Array(t); for (let n = 0; n !== t; ++n) r[n] = n; return r.sort(e), r; }, // uses the array previously returned by 'getKeyframeOrder' to sort data sortedArray: function(i, e, t) { const r = i.length, n = new i.constructor(r); for (let o = 0, a = 0; a !== r; ++o) { const s = t[o] * e; for (let c = 0; c !== e; ++c) n[a++] = i[s + c]; } return n; }, // function for parsing AOS keyframe formats flattenJSON: function(i, e, t, r) { let n = 1, o = i[0]; for (; o !== void 0 && o[r] === void 0; ) o = i[n++]; if (o === void 0) return; let a = o[r]; if (a !== void 0) if (Array.isArray(a)) do a = o[r], a !== void 0 && (e.push(o.time), t.push.apply(t, a)), o = i[n++]; while (o !== void 0); else if (a.toArray !== void 0) do a = o[r], a !== void 0 && (e.push(o.time), a.toArray(t, t.length)), o = i[n++]; while (o !== void 0); else do a = o[r], a !== void 0 && (e.push(o.time), t.push(a)), o = i[n++]; while (o !== void 0); }, subclip: function(i, e, t, r, n = 30) { const o = i.clone(); o.name = e; const a = []; for (let c = 0; c < o.tracks.length; ++c) { const l = o.tracks[c], h = l.getValueSize(), u = [], p = []; for (let m = 0; m < l.times.length; ++m) { const g = l.times[m] * n; if (!(g < t || g >= r)) { u.push(l.times[m]); for (let d = 0; d < h; ++d) p.push(l.values[m * h + d]); } } u.length !== 0 && (l.times = Pt.convertArray(u, l.times.constructor), l.values = Pt.convertArray(p, l.values.constructor), a.push(l)); } o.tracks = a; let s = 1 / 0; for (let c = 0; c < o.tracks.length; ++c) s > o.tracks[c].times[0] && (s = o.tracks[c].times[0]); for (let c = 0; c < o.tracks.length; ++c) o.tracks[c].shift(-1 * s); return o.resetDuration(), o; }, makeClipAdditive: function(i, e = 0, t = i, r = 30) { r <= 0 && (r = 30); const n = t.tracks.length, o = e / r; for (let a = 0; a < n; ++a) { const s = t.tracks[a], c = s.ValueTypeName; if (c === "bool" || c === "string") continue; const l = i.tracks.find(function(f) { return f.name === s.name && f.ValueTypeName === c; }); if (l === void 0) continue; let h = 0; const u = s.getValueSize(); s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (h = u / 3); let p = 0; const m = l.getValueSize(); l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (p = m / 3); const g = s.times.length - 1; let d; if (o <= s.times[0]) { const f = h, v = u - h; d = Pt.arraySlice(s.values, f, v); } else if (o >= s.times[g]) { const f = g * u + h, v = f + u - h; d = Pt.arraySlice(s.values, f, v); } else { const f = s.createInterpolant(), v = h, _ = u - h; f.evaluate(o), d = Pt.arraySlice(f.resultBuffer, v, _); } c === "quaternion" && new wi().fromArray(d).normalize().conjugate().toArray(d); const y = l.times.length; for (let f = 0; f < y; ++f) { const v = f * m + p; if (c === "quaternion") wi.multiplyQuaternionsFlat( l.values, v, d, 0, l.values, v ); else { const _ = m - p * 2; for (let M = 0; M < _; ++M) l.values[v + M] -= d[M]; } } } return i.blendMode = Hp, i; } }; class Ur { constructor(e, t, r, n) { this.parameterPositions = e, this._cachedIndex = 0, this.resultBuffer = n !== void 0 ? n : new t.constructor(r), this.sampleValues = t, this.valueSize = r, this.settings = null, this.DefaultSettings_ = {}; } evaluate(e) { const t = this.parameterPositions; let r = this._cachedIndex, n = t[r], o = t[r - 1]; e: { t: { let a; i: { r: if (!(e < n)) { for (let s = r + 2; ; ) { if (n === void 0) { if (e < o) break r; return r = t.length, this._cachedIndex = r, this.afterEnd_(r - 1, e, o); } if (r === s) break; if (o = n, n = t[++r], e < n) break t; } a = t.length; break i; } if (!(e >= o)) { const s = t[1]; e < s && (r = 2, o = s); for (let c = r - 2; ; ) { if (o === void 0) return this._cachedIndex = 0, this.beforeStart_(0, e, n); if (r === c) break; if (n = o, o = t[--r - 1], e >= o) break t; } a = r, r = 0; break i; } break e; } for (; r < a; ) { const s = r + a >>> 1; e < t[s] ? a = s : r = s + 1; } if (n = t[r], o = t[r - 1], o === void 0) return this._cachedIndex = 0, this.beforeStart_(0, e, n); if (n === void 0) return r = t.length, this._cachedIndex = r, this.afterEnd_(r - 1, o, e); } this._cachedIndex = r, this.intervalChanged_(r, o, n); } return this.interpolate_(r, o, e, n); } getSettings_() { return this.settings || this.DefaultSettings_; } copySampleValue_(e) { const t = this.resultBuffer, r = this.sampleValues, n = this.valueSize, o = e * n; for (let a = 0; a !== n; ++a) t[a] = r[o + a]; return t; } // Template methods for derived classes: interpolate_() { throw new Error("call to abstract method"); } intervalChanged_() { } } Ur.prototype.beforeStart_ = Ur.prototype.copySampleValue_; Ur.prototype.afterEnd_ = Ur.prototype.copySampleValue_; class Wx extends Ur { constructor(e, t, r, n) { super(e, t, r, n), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0, this.DefaultSettings_ = { endingStart: wo, endingEnd: wo }; } intervalChanged_(e, t, r) { const n = this.parameterPositions; let o = e - 2, a = e + 1, s = n[o], c = n[a]; if (s === void 0) switch (this.getSettings_().endingStart) { case _o: o = e, s = 2 * t - r; break; case tl: o = n.length - 2, s = t + n[o] - n[o + 1]; break; default: o = e, s = r; } if (c === void 0) switch (this.getSettings_().endingEnd) { case _o: a = e, c = 2 * r - t; break; case tl: a = 1, c = r + n[1] - n[0]; break; default: a = e - 1, c = t; } const l = (r - t) * 0.5, h = this.valueSize; this._weightPrev = l / (t - s), this._weightNext = l / (c - r), this._offsetPrev = o * h, this._offsetNext = a * h; } interpolate_(e, t, r, n) { const o = this.resultBuffer, a = this.sampleValues, s = this.valueSize, c = e * s, l = c - s, h = this._offsetPrev, u = this._offsetNext, p = this._weightPrev, m = this._weightNext, g = (r - t) / (n - t), d = g * g, y = d * g, f = -p * y + 2 * p * d - p * g, v = (1 + p) * y + (-1.5 - 2 * p) * d + (-0.5 + p) * g + 1, _ = (-1 - m) * y + (1.5 + m) * d + 0.5 * g, M = m * y - m * d; for (let T = 0; T !== s; ++T) o[T] = f * a[h + T] + v * a[l + T] + _ * a[c + T] + M * a[u + T]; return o; } } class vf extends Ur { constructor(e, t, r, n) { super(e, t, r, n); } interpolate_(e, t, r, n) { const o = this.resultBuffer, a = this.sampleValues, s = this.valueSize, c = e * s, l = c - s, h = (r - t) / (n - t), u = 1 - h; for (let p = 0; p !== s; ++p) o[p] = a[l + p] * u + a[c + p] * h; return o; } } class $x extends Ur { constructor(e, t, r, n) { super(e, t, r, n); } interpolate_(e) { return this.copySampleValue_(e - 1); } } class Sr { constructor(e, t, r, n) { 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 = Pt.convertArray(t, this.TimeBufferType), this.values = Pt.convertArray(r, this.ValueBufferType), this.setInterpolation(n || this.DefaultInterpolation); } // Serialization (in static context, because of constructor invocation // and automatic invocation of .toJSON): static toJSON(e) { const t = e.constructor; let r; if (t.toJSON !== this.toJSON) r = t.toJSON(e); else { r = { name: e.name, times: Pt.convertArray(e.times, Array), values: Pt.convertArray(e.values, Array) }; const n = e.getInterpolation(); n !== e.DefaultInterpolation && (r.interpolation = n); } return r.type = e.ValueTypeName, r; } InterpolantFactoryMethodDiscrete(e) { return new $x(this.times, this.values, this.getValueSize(), e); } InterpolantFactoryMethodLinear(e) { return new vf(this.times, this.values, this.getValueSize(), e); } InterpolantFactoryMethodSmooth(e) { return new Wx(this.times, this.values, this.getValueSize(), e); } setInterpolation(e) { let t; switch (e) { case ka: t = this.InterpolantFactoryMethodDiscrete; break; case Io: t = this.InterpolantFactoryMethodLinear; break; case Uc: t = this.InterpolantFactoryMethodSmooth; break; } if (t === void 0) { const r = "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(r); return console.warn("THREE.KeyframeTrack:", r), this; } return this.createInterpolant = t, this; } getInterpolation() { switch (this.createInterpolant) { case this.InterpolantFactoryMethodDiscrete: return ka; case this.InterpolantFactoryMethodLinear: return Io; case this.InterpolantFactoryMethodSmooth: return Uc; } } 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 r = 0, n = t.length; r !== n; ++r) t[r] += 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 r = 0, n = t.length; r !== n; ++r) t[r] *= 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 r = this.times, n = r.length; let o = 0, a = n - 1; for (; o !== n && r[o] < e; ) ++o; for (; a !== -1 && r[a] > t; ) --a; if (++a, o !== 0 || a !== n) { o >= a && (a = Math.max(a, 1), o = a - 1); const s = this.getValueSize(); this.times = Pt.arraySlice(r, o, a), this.values = Pt.arraySlice(this.values, o * s, a * s); } 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 r = this.times, n = this.values, o = r.length; o === 0 && (console.error("THREE.KeyframeTrack: Track is empty.", this), e = !1); let a = null; for (let s = 0; s !== o; s++) { const c = r[s]; if (typeof c == "number" && isNaN(c)) { console.error("THREE.KeyframeTrack: Time is not a valid number.", this, s, c), e = !1; break; } if (a !== null && a > c) { console.error("THREE.KeyframeTrack: Out of order keys.", this, s, c, a), e = !1; break; } a = c; } if (n !== void 0 && Pt.isTypedArray(n)) for (let s = 0, c = n.length; s !== c; ++s) { const l = n[s]; if (isNaN(l)) { console.error("THREE.KeyframeTrack: Value is not a valid number.", this, s, 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 = Pt.arraySlice(this.times), t = Pt.arraySlice(this.values), r = this.getValueSize(), n = this.getInterpolation() === Uc, o = e.length - 1; let a = 1; for (let s = 1; s < o; ++s) { let c = !1; const l = e[s], h = e[s + 1]; if (l !== h && (s !== 1 || l !== e[0])) if (n) c = !0; else { const u = s * r, p = u - r, m = u + r; for (let g = 0; g !== r; ++g) { const d = t[u + g]; if (d !== t[p + g] || d !== t[m + g]) { c = !0; break; } } } if (c) { if (s !== a) { e[a] = e[s]; const u = s * r, p = a * r; for (let m = 0; m !== r; ++m) t[p + m] = t[u + m]; } ++a; } } if (o > 0) { e[a] = e[o]; for (let s = o * r, c = a * r, l = 0; l !== r; ++l) t[c + l] = t[s + l]; ++a; } return a !== e.length ? (this.times = Pt.arraySlice(e, 0, a), this.values = Pt.arraySlice(t, 0, a * r)) : (this.times = e, this.values = t), this; } clone() { const e = Pt.arraySlice(this.times, 0), t = Pt.arraySlice(this.values, 0), r = this.constructor, n = new r(this.name, e, t); return n.createInterpolant = this.createInterpolant, n; } } Sr.prototype.TimeBufferType = Float32Array; Sr.prototype.ValueBufferType = Float32Array; Sr.prototype.DefaultInterpolation = Io; class qo extends Sr { } qo.prototype.ValueTypeName = "bool"; qo.prototype.ValueBufferType = Array; qo.prototype.DefaultInterpolation = ka; qo.prototype.InterpolantFactoryMethodLinear = void 0; qo.prototype.InterpolantFactoryMethodSmooth = void 0; class yf extends Sr { } yf.prototype.ValueTypeName = "color"; class Ja extends Sr { } Ja.prototype.ValueTypeName = "number"; class qx extends Ur { constructor(e, t, r, n) { super(e, t, r, n); } interpolate_(e, t, r, n) { const o = this.resultBuffer, a = this.sampleValues, s = this.valueSize, c = (r - t) / (n - t); let l = e * s; for (let h = l + s; l !== h; l += 4) wi.slerpFlat(o, 0, a, l - s, a, l, c); return o; } } class Xo extends Sr { InterpolantFactoryMethodLinear(e) { return new qx(this.times, this.values, this.getValueSize(), e); } } Xo.prototype.ValueTypeName = "quaternion"; Xo.prototype.DefaultInterpolation = Io; Xo.prototype.InterpolantFactoryMethodSmooth = void 0; class Zo extends Sr { } Zo.prototype.ValueTypeName = "string"; Zo.prototype.ValueBufferType = Array; Zo.prototype.DefaultInterpolation = ka; Zo.prototype.InterpolantFactoryMethodLinear = void 0; Zo.prototype.InterpolantFactoryMethodSmooth = void 0; class Ka extends Sr { } Ka.prototype.ValueTypeName = "vector"; class Qa { constructor(e, t = -1, r, n = Eu) { this.name = e, this.tracks = r, this.duration = t, this.blendMode = n, this.uuid = Zi(), this.duration < 0 && this.resetDuration(); } static parse(e) { const t = [], r = e.tracks, n = 1 / (e.fps || 1); for (let a = 0, s = r.length; a !== s; ++a) t.push(vB(r[a]).scale(n)); const o = new this(e.name, e.duration, t, e.blendMode); return o.uuid = e.uuid, o; } static toJSON(e) { const t = [], r = e.tracks, n = { name: e.name, duration: e.duration, tracks: t, uuid: e.uuid, blendMode: e.blendMode }; for (let o = 0, a = r.length; o !== a; ++o) t.push(Sr.toJSON(r[o])); return n; } static CreateFromMorphTargetSequence(e, t, r, n) { const o = t.length, a = []; for (let s = 0; s < o; s++) { let c = [], l = []; c.push( (s + o - 1) % o, s, (s + 1) % o ), l.push(0, 1, 0); const h = Pt.getKeyframeOrder(c); c = Pt.sortedArray(c, 1, h), l = Pt.sortedArray(l, 1, h), !n && c[0] === 0 && (c.push(o), l.push(l[0])), a.push( new Ja( ".morphTargetInfluences[" + t[s].name + "]", c, l ).scale(1 / r) ); } return new this(e, -1, a); } static findByName(e, t) { let r = e; if (!Array.isArray(e)) { const n = e; r = n.geometry && n.geometry.animations || n.animations; } for (let n = 0; n < r.length; n++) if (r[n].name === t) return r[n]; return null; } static CreateClipsFromMorphTargetSequences(e, t, r) { const n = {}, o = /^([\w-]*?)([\d]+)$/; for (let s = 0, c = e.length; s < c; s++) { const l = e[s], h = l.name.match(o); if (h && h.length > 1) { const u = h[1]; let p = n[u]; p || (n[u] = p = []), p.push(l); } } const a = []; for (const s in n) a.push(this.CreateFromMorphTargetSequence(s, n[s], t, r)); return a; } // parse the animation.hierarchy format static parseAnimation(e, t) { if (!e) return console.error("THREE.AnimationClip: No animation in JSONLoader data."), null; const r = function(h, u, p, m, g) { if (p.length !== 0) { const d = [], y = []; Pt.flattenJSON(p, d, y, m), d.length !== 0 && g.push(new h(u, d, y)); } }, n = [], o = e.name || "default", a = e.fps || 30, s = e.blendMode; let c = e.length || -1; const l = e.hierarchy || []; for (let h = 0; h < l.length; h++) { const u = l[h].keys; if (!(!u || u.length === 0)) if (u[0].morphTargets) { const p = {}; let m; for (m = 0; m < u.length; m++) if (u[m].morphTargets) for (let g = 0; g < u[m].morphTargets.length; g++) p[u[m].morphTargets[g]] = -1; for (const g in p) { const d = [], y = []; for (let f = 0; f !== u[m].morphTargets.length; ++f) { const v = u[m]; d.push(v.time), y.push(v.morphTarget === g ? 1 : 0); } n.push(new Ja(".morphTargetInfluence[" + g + "]", d, y)); } c = p.length * (a || 1); } else { const p = ".bones[" + t[h].name + "]"; r( Ka, p + ".position", u, "pos", n ), r( Xo, p + ".quaternion", u, "rot", n ), r( Ka, p + ".scale", u, "scl", n ); } } return n.length === 0 ? null : new this(o, c, n, s); } resetDuration() { const e = this.tracks; let t = 0; for (let r = 0, n = e.length; r !== n; ++r) { const o = this.tracks[r]; t = Math.max(t, o.times[o.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 gB(i) { switch (i.toLowerCase()) { case "scalar": case "double": case "float": case "number": case "integer": return Ja; case "vector": case "vector2": case "vector3": case "vector4": return Ka; case "color": return yf; case "quaternion": return Xo; case "bool": case "boolean": return qo; case "string": return Zo; } throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + i); } function vB(i) { if (i.type === void 0) throw new Error("THREE.KeyframeTrack: track type undefined, can not parse"); const e = gB(i.type); if (i.times === void 0) { const t = [], r = []; Pt.flattenJSON(i.keys, t, r, "value"), i.times = t, i.values = r; } return e.parse !== void 0 ? e.parse(i) : new e(i.name, i.times, i.values, i.interpolation); } const zo = { enabled: !1, files: {}, add: function(i, e) { this.enabled !== !1 && (this.files[i] = e); }, get: function(i) { if (this.enabled !== !1) return this.files[i]; }, remove: function(i) { delete this.files[i]; }, clear: function() { this.files = {}; } }; class bf { constructor(e, t, r) { const n = this; let o = !1, a = 0, s = 0, c; const l = []; this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = r, this.itemStart = function(h) { s++, o === !1 && n.onStart !== void 0 && n.onStart(h, a, s), o = !0; }, this.itemEnd = function(h) { a++, n.onProgress !== void 0 && n.onProgress(h, a, s), a === s && (o = !1, n.onLoad !== void 0 && n.onLoad()); }, this.itemError = function(h) { n.onError !== void 0 && n.onError(h); }, this.resolveURL = function(h) { return c ? c(h) : h; }, this.setURLModifier = function(h) { return c = h, this; }, this.addHandler = function(h, u) { return l.push(h, u), this; }, this.removeHandler = function(h) { const u = l.indexOf(h); return u !== -1 && l.splice(u, 2), this; }, this.getHandler = function(h) { for (let u = 0, p = l.length; u < p; u += 2) { const m = l[u], g = l[u + 1]; if (m.global && (m.lastIndex = 0), m.test(h)) return g; } return null; }; } } const Xx = new bf(); class _i { 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 r = this; return new Promise(function(n, o) { r.load(e, n, t, o); }); } 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 pr = {}; class Ki extends _i { constructor(e) { super(e); } load(e, t, r, n) { e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e); const o = this, a = zo.get(e); if (a !== void 0) return o.manager.itemStart(e), setTimeout(function() { t && t(a), o.manager.itemEnd(e); }, 0), a; if (pr[e] !== void 0) { pr[e].push({ onLoad: t, onProgress: r, onError: n }); return; } const s = /^data:(.*?)(;base64)?,(.*)$/, c = e.match(s); let l; if (c) { const h = c[1], u = !!c[2]; let p = c[3]; p = decodeURIComponent(p), u && (p = atob(p)); try { let m; const g = (this.responseType || "").toLowerCase(); switch (g) { case "arraybuffer": case "blob": const d = new Uint8Array(p.length); for (let y = 0; y < p.length; y++) d[y] = p.charCodeAt(y); g === "blob" ? m = new Blob([d.buffer], { type: h }) : m = d.buffer; break; case "document": m = new DOMParser().parseFromString(p, h); break; case "json": m = JSON.parse(p); break; default: m = p; break; } setTimeout(function() { t && t(m), o.manager.itemEnd(e); }, 0); } catch (m) { setTimeout(function() { n && n(m), o.manager.itemError(e), o.manager.itemEnd(e); }, 0); } } else { pr[e] = [], pr[e].push({ onLoad: t, onProgress: r, onError: n }), l = new XMLHttpRequest(), l.open("GET", e, !0), l.addEventListener("load", function(h) { const u = this.response, p = pr[e]; if (delete pr[e], this.status === 200 || this.status === 0) { this.status === 0 && console.warn("THREE.FileLoader: HTTP Status 0 received."), zo.add(e, u); for (let m = 0, g = p.length; m < g; m++) { const d = p[m]; d.onLoad && d.onLoad(u); } o.manager.itemEnd(e); } else { for (let m = 0, g = p.length; m < g; m++) { const d = p[m]; d.onError && d.onError(h); } o.manager.itemError(e), o.manager.itemEnd(e); } }, !1), l.addEventListener("progress", function(h) { const u = pr[e]; for (let p = 0, m = u.length; p < m; p++) { const g = u[p]; g.onProgress && g.onProgress(h); } }, !1), l.addEventListener("error", function(h) { const u = pr[e]; delete pr[e]; for (let p = 0, m = u.length; p < m; p++) { const g = u[p]; g.onError && g.onError(h); } o.manager.itemError(e), o.manager.itemEnd(e); }, !1), l.addEventListener("abort", function(h) { const u = pr[e]; delete pr[e]; for (let p = 0, m = u.length; p < m; p++) { const g = u[p]; g.onError && g.onError(h); } o.manager.itemError(e), o.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 h in this.requestHeader) l.setRequestHeader(h, this.requestHeader[h]); l.send(null); } return o.manager.itemStart(e), l; } setResponseType(e) { return this.responseType = e, this; } setMimeType(e) { return this.mimeType = e, this; } } class yB extends _i { constructor(e) { super(e); } load(e, t, r, n) { const o = this, a = new Ki(this.manager); a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(s) { try { t(o.parse(JSON.parse(s))); } catch (c) { n ? n(c) : console.error(c), o.manager.itemError(e); } }, r, n); } parse(e) { const t = []; for (let r = 0; r < e.length; r++) { const n = Qa.parse(e[r]); t.push(n); } return t; } } class bB extends _i { constructor(e) { super(e); } load(e, t, r, n) { const o = this, a = [], s = new ef(), c = new Ki(this.manager); c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(o.withCredentials); let l = 0; function h(u) { c.load(e[u], function(p) { const m = o.parse(p, !0); a[u] = { width: m.width, height: m.height, format: m.format, mipmaps: m.mipmaps }, l += 1, l === 6 && (m.mipmapCount === 1 && (s.minFilter = Wt), s.image = a, s.format = m.format, s.needsUpdate = !0, t && t(s)); }, r, n); } if (Array.isArray(e)) for (let u = 0, p = e.length; u < p; ++u) h(u); else c.load(e, function(u) { const p = o.parse(u, !0); if (p.isCubemap) { const m = p.mipmaps.length / p.mipmapCount; for (let g = 0; g < m; g++) { a[g] = { mipmaps: [] }; for (let d = 0; d < p.mipmapCount; d++) a[g].mipmaps.push(p.mipmaps[g * p.mipmapCount + d]), a[g].format = p.format, a[g].width = p.width, a[g].height = p.height; } s.image = a; } else s.image.width = p.width, s.image.height = p.height, s.mipmaps = p.mipmaps; p.mipmapCount === 1 && (s.minFilter = Wt), s.format = p.format, s.needsUpdate = !0, t && t(s); }, r, n); return s; } } class al extends _i { constructor(e) { super(e); } load(e, t, r, n) { this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e); const o = this, a = zo.get(e); if (a !== void 0) return o.manager.itemStart(e), setTimeout(function() { t && t(a), o.manager.itemEnd(e); }, 0), a; const s = document.createElementNS("http://www.w3.org/1999/xhtml", "img"); function c() { s.removeEventListener("load", c, !1), s.removeEventListener("error", l, !1), zo.add(e, this), t && t(this), o.manager.itemEnd(e); } function l(h) { s.removeEventListener("load", c, !1), s.removeEventListener("error", l, !1), n && n(h), o.manager.itemError(e), o.manager.itemEnd(e); } return s.addEventListener("load", c, !1), s.addEventListener("error", l, !1), e.substr(0, 5) !== "data:" && this.crossOrigin !== void 0 && (s.crossOrigin = this.crossOrigin), o.manager.itemStart(e), s.src = e, s; } } class Zx extends _i { constructor(e) { super(e); } load(e, t, r, n) { const o = new cs(), a = new al(this.manager); a.setCrossOrigin(this.crossOrigin), a.setPath(this.path); let s = 0; function c(l) { a.load(e[l], function(h) { o.images[l] = h, s++, s === 6 && (o.needsUpdate = !0, t && t(o)); }, void 0, n); } for (let l = 0; l < e.length; ++l) c(l); return o; } } class Yx extends _i { constructor(e) { super(e); } load(e, t, r, n) { const o = this, a = new Lo(), s = new Ki(this.manager); return s.setResponseType("arraybuffer"), s.setRequestHeader(this.requestHeader), s.setPath(this.path), s.setWithCredentials(o.withCredentials), s.load(e, function(c) { const l = o.parse(c); l && (l.image !== void 0 ? a.image = l.image : l.data !== void 0 && (a.image.width = l.width, a.image.height = l.height, a.image.data = l.data), a.wrapS = l.wrapS !== void 0 ? l.wrapS : di, a.wrapT = l.wrapT !== void 0 ? l.wrapT : di, a.magFilter = l.magFilter !== void 0 ? l.magFilter : Wt, a.minFilter = l.minFilter !== void 0 ? l.minFilter : Wt, a.anisotropy = l.anisotropy !== void 0 ? l.anisotropy : 1, l.encoding !== void 0 && (a.encoding = l.encoding), l.flipY !== void 0 && (a.flipY = l.flipY), l.format !== void 0 && (a.format = l.format), l.type !== void 0 && (a.type = l.type), l.mipmaps !== void 0 && (a.mipmaps = l.mipmaps, a.minFilter = bn), l.mipmapCount === 1 && (a.minFilter = Wt), l.generateMipmaps !== void 0 && (a.generateMipmaps = l.generateMipmaps), a.needsUpdate = !0, t && t(a, l)); }, r, n), a; } } class xf extends _i { constructor(e) { super(e); } load(e, t, r, n) { const o = new ti(), a = new al(this.manager); return a.setCrossOrigin(this.crossOrigin), a.setPath(this.path), a.load(e, function(s) { o.image = s; const c = e.search(/\.jpe?g($|\?)/i) > 0 || e.search(/^data\:image\/jpeg/) === 0; o.format = c ? sn : Xi, o.needsUpdate = !0, t !== void 0 && t(o); }, r, n), o; } } class Jx extends Ji { 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 Ol(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(), r = this.getCurveLengths(); let n = 0; for (; n < r.length; ) { if (r[n] >= t) { const o = r[n] - t, a = this.curves[n], s = a.getLength(), c = s === 0 ? 0 : 1 - o / s; return a.getPointAt(c); } n++; } 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 r = 0, n = this.curves.length; r < n; r++) t += this.curves[r].getLength(), e.push(t); return this.cacheLengths = e, e; } getSpacedPoints(e = 40) { const t = []; for (let r = 0; r <= e; r++) t.push(this.getPoint(r / e)); return this.autoClose && t.push(t[0]), t; } getPoints(e = 12) { const t = []; let r; for (let n = 0, o = this.curves; n < o.length; n++) { const a = o[n], s = a && a.isEllipseCurve ? e * 2 : a && (a.isLineCurve || a.isLineCurve3) ? 1 : a && a.isSplineCurve ? e * a.points.length : e, c = a.getPoints(s); for (let l = 0; l < c.length; l++) { const h = c[l]; r && r.equals(h) || (t.push(h), r = h); } } 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, r = e.curves.length; t < r; t++) { const n = e.curves[t]; this.curves.push(n.clone()); } return this.autoClose = e.autoClose, this; } toJSON() { const e = super.toJSON(); e.autoClose = this.autoClose, e.curves = []; for (let t = 0, r = this.curves.length; t < r; t++) { const n = this.curves[t]; e.curves.push(n.toJSON()); } return e; } fromJSON(e) { super.fromJSON(e), this.autoClose = e.autoClose, this.curves = []; for (let t = 0, r = e.curves.length; t < r; t++) { const n = e.curves[t]; this.curves.push(new lf[n.type]().fromJSON(n)); } return this; } } class sl extends Jx { constructor(e) { super(), this.type = "Path", this.currentPoint = new Re(), e && this.setFromPoints(e); } setFromPoints(e) { this.moveTo(e[0].x, e[0].y); for (let t = 1, r = e.length; t < r; 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 r = new Ol(this.currentPoint.clone(), new Re(e, t)); return this.curves.push(r), this.currentPoint.set(e, t), this; } quadraticCurveTo(e, t, r, n) { const o = new Fu( this.currentPoint.clone(), new Re(e, t), new Re(r, n) ); return this.curves.push(o), this.currentPoint.set(r, n), this; } bezierCurveTo(e, t, r, n, o, a) { const s = new ku( this.currentPoint.clone(), new Re(e, t), new Re(r, n), new Re(o, a) ); return this.curves.push(s), this.currentPoint.set(o, a), this; } splineThru(e) { const t = [this.currentPoint.clone()].concat(e), r = new zu(t); return this.curves.push(r), this.currentPoint.copy(e[e.length - 1]), this; } arc(e, t, r, n, o, a) { const s = this.currentPoint.x, c = this.currentPoint.y; return this.absarc( e + s, t + c, r, n, o, a ), this; } absarc(e, t, r, n, o, a) { return this.absellipse(e, t, r, r, n, o, a), this; } ellipse(e, t, r, n, o, a, s, c) { const l = this.currentPoint.x, h = this.currentPoint.y; return this.absellipse(e + l, t + h, r, n, o, a, s, c), this; } absellipse(e, t, r, n, o, a, s, c) { const l = new Rl(e, t, r, n, o, a, s, c); if (this.curves.length > 0) { const u = l.getPoint(0); u.equals(this.currentPoint) || this.lineTo(u.x, u.y); } this.curves.push(l); const h = l.getPoint(1); return this.currentPoint.copy(h), 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 Hn extends sl { constructor(e) { super(e), this.uuid = Zi(), this.type = "Shape", this.holes = []; } getPointsHoles(e) { const t = []; for (let r = 0, n = this.holes.length; r < n; r++) t[r] = this.holes[r].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, r = e.holes.length; t < r; t++) { const n = e.holes[t]; this.holes.push(n.clone()); } return this; } toJSON() { const e = super.toJSON(); e.uuid = this.uuid, e.holes = []; for (let t = 0, r = this.holes.length; t < r; t++) { const n = this.holes[t]; e.holes.push(n.toJSON()); } return e; } fromJSON(e) { super.fromJSON(e), this.uuid = e.uuid, this.holes = []; for (let t = 0, r = e.holes.length; t < r; t++) { const n = e.holes[t]; this.holes.push(new sl().fromJSON(n)); } return this; } } class wr extends ot { constructor(e, t = 1) { super(), this.type = "Light", this.color = new Be(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; } } wr.prototype.isLight = !0; class wf extends wr { constructor(e, t, r) { super(e, r), this.type = "HemisphereLight", this.position.copy(ot.DefaultUp), this.updateMatrix(), this.groundColor = new Be(t); } copy(e) { return wr.prototype.copy.call(this, e), this.groundColor.copy(e.groundColor), this; } } wf.prototype.isHemisphereLight = !0; const av = /* @__PURE__ */ new $e(), sv = /* @__PURE__ */ new Z(), lv = /* @__PURE__ */ new Z(); class _f { constructor(e) { this.camera = e, this.bias = 0, this.normalBias = 0, this.radius = 1, this.mapSize = new Re(512, 512), this.map = null, this.mapPass = null, this.matrix = new $e(), this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new _l(), this._frameExtents = new Re(1, 1), this._viewportCount = 1, this._viewports = [ new St(0, 0, 1, 1) ]; } getViewportCount() { return this._viewportCount; } getFrustum() { return this._frustum; } updateMatrices(e) { const t = this.camera, r = this.matrix; sv.setFromMatrixPosition(e.matrixWorld), t.position.copy(sv), lv.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(lv), t.updateMatrixWorld(), av.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(av), r.set( 0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1 ), r.multiply(t.projectionMatrix), r.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 _f { constructor() { super(new oi(50, 1, 0.5, 500)), this.focus = 1; } updateMatrices(e) { const t = this.camera, r = il * 2 * e.angle * this.focus, n = this.mapSize.width / this.mapSize.height, o = e.distance || t.far; (r !== t.fov || n !== t.aspect || o !== t.far) && (t.fov = r, t.aspect = n, t.far = o, t.updateProjectionMatrix()), super.updateMatrices(e); } copy(e) { return super.copy(e), this.focus = e.focus, this; } } Kx.prototype.isSpotLightShadow = !0; class Vu extends wr { constructor(e, t, r = 0, n = Math.PI / 3, o = 0, a = 1) { super(e, t), this.type = "SpotLight", this.position.copy(ot.DefaultUp), this.updateMatrix(), this.target = new ot(), this.distance = r, this.angle = n, this.penumbra = o, this.decay = a, 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; } } Vu.prototype.isSpotLight = !0; const cv = /* @__PURE__ */ new $e(), Cs = /* @__PURE__ */ new Z(), kh = /* @__PURE__ */ new Z(); class Qx extends _f { constructor() { super(new oi(90, 1, 0.5, 500)), this._frameExtents = new Re(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 St(2, 1, 1, 1), // negative X new St(0, 1, 1, 1), // positive Z new St(3, 1, 1, 1), // negative Z new St(1, 1, 1, 1), // positive Y new St(3, 0, 1, 1), // negative Y new St(1, 0, 1, 1) ], this._cubeDirections = [ new Z(1, 0, 0), new Z(-1, 0, 0), new Z(0, 0, 1), new Z(0, 0, -1), new Z(0, 1, 0), new Z(0, -1, 0) ], this._cubeUps = [ new Z(0, 1, 0), new Z(0, 1, 0), new Z(0, 1, 0), new Z(0, 1, 0), new Z(0, 0, 1), new Z(0, 0, -1) ]; } updateMatrices(e, t = 0) { const r = this.camera, n = this.matrix, o = e.distance || r.far; o !== r.far && (r.far = o, r.updateProjectionMatrix()), Cs.setFromMatrixPosition(e.matrixWorld), r.position.copy(Cs), kh.copy(r.position), kh.add(this._cubeDirections[t]), r.up.copy(this._cubeUps[t]), r.lookAt(kh), r.updateMatrixWorld(), n.makeTranslation(-Cs.x, -Cs.y, -Cs.z), cv.multiplyMatrices(r.projectionMatrix, r.matrixWorldInverse), this._frustum.setFromProjectionMatrix(cv); } } Qx.prototype.isPointLightShadow = !0; class Hu extends wr { constructor(e, t, r = 0, n = 1) { super(e, t), this.type = "PointLight", this.distance = r, this.decay = n, 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; } } Hu.prototype.isPointLight = !0; class ps extends wl { constructor(e = -1, t = 1, r = 1, n = -1, o = 0.1, a = 2e3) { super(), this.type = "OrthographicCamera", this.zoom = 1, this.view = null, this.left = e, this.right = t, this.top = r, this.bottom = n, this.near = o, this.far = a, 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, r, n, o, a) { 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 = r, this.view.offsetY = n, this.view.width = o, this.view.height = a, 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), r = (this.right + this.left) / 2, n = (this.top + this.bottom) / 2; let o = r - e, a = r + e, s = n + t, c = n - t; if (this.view !== null && this.view.enabled) { const l = (this.right - this.left) / this.view.fullWidth / this.zoom, h = (this.top - this.bottom) / this.view.fullHeight / this.zoom; o += l * this.view.offsetX, a = o + l * this.view.width, s -= h * this.view.offsetY, c = s - h * this.view.height; } this.projectionMatrix.makeOrthographic(o, a, s, 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; } } ps.prototype.isOrthographicCamera = !0; class e1 extends _f { constructor() { super(new ps(-5, 5, 5, -5, 0.5, 500)); } } e1.prototype.isDirectionalLightShadow = !0; class ju extends wr { constructor(e, t) { super(e, t), this.type = "DirectionalLight", this.position.copy(ot.DefaultUp), this.updateMatrix(), this.target = new ot(), this.shadow = new e1(); } dispose() { this.shadow.dispose(); } copy(e) { return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this; } } ju.prototype.isDirectionalLight = !0; class Mf extends wr { constructor(e, t) { super(e, t), this.type = "AmbientLight"; } } Mf.prototype.isAmbientLight = !0; class Sf extends wr { constructor(e, t, r = 10, n = 10) { super(e, t), this.type = "RectAreaLight", this.width = r, this.height = n; } 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; } } Sf.prototype.isRectAreaLight = !0; class Tf { constructor() { this.coefficients = []; for (let e = 0; e < 9; e++) this.coefficients.push(new Z()); } 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 r = e.x, n = e.y, o = e.z, a = this.coefficients; return t.copy(a[0]).multiplyScalar(0.282095), t.addScaledVector(a[1], 0.488603 * n), t.addScaledVector(a[2], 0.488603 * o), t.addScaledVector(a[3], 0.488603 * r), t.addScaledVector(a[4], 1.092548 * (r * n)), t.addScaledVector(a[5], 1.092548 * (n * o)), t.addScaledVector(a[6], 0.315392 * (3 * o * o - 1)), t.addScaledVector(a[7], 1.092548 * (r * o)), t.addScaledVector(a[8], 0.546274 * (r * r - n * n)), 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 r = e.x, n = e.y, o = e.z, a = this.coefficients; return t.copy(a[0]).multiplyScalar(0.886227), t.addScaledVector(a[1], 2 * 0.511664 * n), t.addScaledVector(a[2], 2 * 0.511664 * o), t.addScaledVector(a[3], 2 * 0.511664 * r), t.addScaledVector(a[4], 2 * 0.429043 * r * n), t.addScaledVector(a[5], 2 * 0.429043 * n * o), t.addScaledVector(a[6], 0.743125 * o * o - 0.247708), t.addScaledVector(a[7], 2 * 0.429043 * r * o), t.addScaledVector(a[8], 0.429043 * (r * r - n * n)), t; } add(e) { for (let t = 0; t < 9; t++) this.coefficients[t].add(e.coefficients[t]); return this; } addScaledSH(e, t) { for (let r = 0; r < 9; r++) this.coefficients[r].addScaledVector(e.coefficients[r], t); return this; } scale(e) { for (let t = 0; t < 9; t++) this.coefficients[t].multiplyScalar(e); return this; } lerp(e, t) { for (let r = 0; r < 9; r++) this.coefficients[r].lerp(e.coefficients[r], 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 r = this.coefficients; for (let n = 0; n < 9; n++) r[n].fromArray(e, t + n * 3); return this; } toArray(e = [], t = 0) { const r = this.coefficients; for (let n = 0; n < 9; n++) r[n].toArray(e, t + n * 3); return e; } // evaluate the basis functions // shBasis is an Array[ 9 ] static getBasisAt(e, t) { const r = e.x, n = e.y, o = e.z; t[0] = 0.282095, t[1] = 0.488603 * n, t[2] = 0.488603 * o, t[3] = 0.488603 * r, t[4] = 1.092548 * r * n, t[5] = 1.092548 * n * o, t[6] = 0.315392 * (3 * o * o - 1), t[7] = 1.092548 * r * o, t[8] = 0.546274 * (r * r - n * n); } } Tf.prototype.isSphericalHarmonics3 = !0; class Il extends wr { constructor(e = new Tf(), 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; } } Il.prototype.isLightProbe = !0; class t1 extends _i { constructor(e) { super(e), this.textures = {}; } load(e, t, r, n) { const o = this, a = new Ki(o.manager); a.setPath(o.path), a.setRequestHeader(o.requestHeader), a.setWithCredentials(o.withCredentials), a.load(e, function(s) { try { t(o.parse(JSON.parse(s))); } catch (c) { n ? n(c) : console.error(c), o.manager.itemError(e); } }, r, n); } parse(e) { const t = this.textures; function r(o) { return t[o] === void 0 && console.warn("THREE.MaterialLoader: Undefined texture", o), t[o]; } const n = new mB[e.type](); if (e.uuid !== void 0 && (n.uuid = e.uuid), e.name !== void 0 && (n.name = e.name), e.color !== void 0 && n.color !== void 0 && n.color.setHex(e.color), e.roughness !== void 0 && (n.roughness = e.roughness), e.metalness !== void 0 && (n.metalness = e.metalness), e.sheen !== void 0 && (n.sheen = new Be().setHex(e.sheen)), e.emissive !== void 0 && n.emissive !== void 0 && n.emissive.setHex(e.emissive), e.specular !== void 0 && n.specular !== void 0 && n.specular.setHex(e.specular), e.shininess !== void 0 && (n.shininess = e.shininess), e.clearcoat !== void 0 && (n.clearcoat = e.clearcoat), e.clearcoatRoughness !== void 0 && (n.clearcoatRoughness = e.clearcoatRoughness), e.transmission !== void 0 && (n.transmission = e.transmission), e.thickness !== void 0 && (n.thickness = e.thickness), e.attenuationDistance !== void 0 && (n.attenuationDistance = e.attenuationDistance), e.attenuationColor !== void 0 && n.attenuationColor !== void 0 && n.attenuationColor.setHex(e.attenuationColor), e.fog !== void 0 && (n.fog = e.fog), e.flatShading !== void 0 && (n.flatShading = e.flatShading), e.blending !== void 0 && (n.blending = e.blending), e.combine !== void 0 && (n.combine = e.combine), e.side !== void 0 && (n.side = e.side), e.shadowSide !== void 0 && (n.shadowSide = e.shadowSide), e.opacity !== void 0 && (n.opacity = e.opacity), e.transparent !== void 0 && (n.transparent = e.transparent), e.alphaTest !== void 0 && (n.alphaTest = e.alphaTest), e.depthTest !== void 0 && (n.depthTest = e.depthTest), e.depthWrite !== void 0 && (n.depthWrite = e.depthWrite), e.colorWrite !== void 0 && (n.colorWrite = e.colorWrite), e.stencilWrite !== void 0 && (n.stencilWrite = e.stencilWrite), e.stencilWriteMask !== void 0 && (n.stencilWriteMask = e.stencilWriteMask), e.stencilFunc !== void 0 && (n.stencilFunc = e.stencilFunc), e.stencilRef !== void 0 && (n.stencilRef = e.stencilRef), e.stencilFuncMask !== void 0 && (n.stencilFuncMask = e.stencilFuncMask), e.stencilFail !== void 0 && (n.stencilFail = e.stencilFail), e.stencilZFail !== void 0 && (n.stencilZFail = e.stencilZFail), e.stencilZPass !== void 0 && (n.stencilZPass = e.stencilZPass), e.wireframe !== void 0 && (n.wireframe = e.wireframe), e.wireframeLinewidth !== void 0 && (n.wireframeLinewidth = e.wireframeLinewidth), e.wireframeLinecap !== void 0 && (n.wireframeLinecap = e.wireframeLinecap), e.wireframeLinejoin !== void 0 && (n.wireframeLinejoin = e.wireframeLinejoin), e.rotation !== void 0 && (n.rotation = e.rotation), e.linewidth !== 1 && (n.linewidth = e.linewidth), e.dashSize !== void 0 && (n.dashSize = e.dashSize), e.gapSize !== void 0 && (n.gapSize = e.gapSize), e.scale !== void 0 && (n.scale = e.scale), e.polygonOffset !== void 0 && (n.polygonOffset = e.polygonOffset), e.polygonOffsetFactor !== void 0 && (n.polygonOffsetFactor = e.polygonOffsetFactor), e.polygonOffsetUnits !== void 0 && (n.polygonOffsetUnits = e.polygonOffsetUnits), e.morphTargets !== void 0 && (n.morphTargets = e.morphTargets), e.morphNormals !== void 0 && (n.morphNormals = e.morphNormals), e.dithering !== void 0 && (n.dithering = e.dithering), e.alphaToCoverage !== void 0 && (n.alphaToCoverage = e.alphaToCoverage), e.premultipliedAlpha !== void 0 && (n.premultipliedAlpha = e.premultipliedAlpha), e.vertexTangents !== void 0 && (n.vertexTangents = e.vertexTangents), e.visible !== void 0 && (n.visible = e.visible), e.toneMapped !== void 0 && (n.toneMapped = e.toneMapped), e.userData !== void 0 && (n.userData = e.userData), e.vertexColors !== void 0 && (typeof e.vertexColors == "number" ? n.vertexColors = e.vertexColors > 0 : n.vertexColors = e.vertexColors), e.uniforms !== void 0) for (const o in e.uniforms) { const a = e.uniforms[o]; switch (n.uniforms[o] = {}, a.type) { case "t": n.uniforms[o].value = r(a.value); break; case "c": n.uniforms[o].value = new Be().setHex(a.value); break; case "v2": n.uniforms[o].value = new Re().fromArray(a.value); break; case "v3": n.uniforms[o].value = new Z().fromArray(a.value); break; case "v4": n.uniforms[o].value = new St().fromArray(a.value); break; case "m3": n.uniforms[o].value = new ai().fromArray(a.value); break; case "m4": n.uniforms[o].value = new $e().fromArray(a.value); break; default: n.uniforms[o].value = a.value; } } if (e.defines !== void 0 && (n.defines = e.defines), e.vertexShader !== void 0 && (n.vertexShader = e.vertexShader), e.fragmentShader !== void 0 && (n.fragmentShader = e.fragmentShader), e.extensions !== void 0) for (const o in e.extensions) n.extensions[o] = e.extensions[o]; if (e.shading !== void 0 && (n.flatShading = e.shading === 1), e.size !== void 0 && (n.size = e.size), e.sizeAttenuation !== void 0 && (n.sizeAttenuation = e.sizeAttenuation), e.map !== void 0 && (n.map = r(e.map)), e.matcap !== void 0 && (n.matcap = r(e.matcap)), e.alphaMap !== void 0 && (n.alphaMap = r(e.alphaMap)), e.bumpMap !== void 0 && (n.bumpMap = r(e.bumpMap)), e.bumpScale !== void 0 && (n.bumpScale = e.bumpScale), e.normalMap !== void 0 && (n.normalMap = r(e.normalMap)), e.normalMapType !== void 0 && (n.normalMapType = e.normalMapType), e.normalScale !== void 0) { let o = e.normalScale; Array.isArray(o) === !1 && (o = [o, o]), n.normalScale = new Re().fromArray(o); } return e.displacementMap !== void 0 && (n.displacementMap = r(e.displacementMap)), e.displacementScale !== void 0 && (n.displacementScale = e.displacementScale), e.displacementBias !== void 0 && (n.displacementBias = e.displacementBias), e.roughnessMap !== void 0 && (n.roughnessMap = r(e.roughnessMap)), e.metalnessMap !== void 0 && (n.metalnessMap = r(e.metalnessMap)), e.emissiveMap !== void 0 && (n.emissiveMap = r(e.emissiveMap)), e.emissiveIntensity !== void 0 && (n.emissiveIntensity = e.emissiveIntensity), e.specularMap !== void 0 && (n.specularMap = r(e.specularMap)), e.envMap !== void 0 && (n.envMap = r(e.envMap)), e.envMapIntensity !== void 0 && (n.envMapIntensity = e.envMapIntensity), e.reflectivity !== void 0 && (n.reflectivity = e.reflectivity), e.refractionRatio !== void 0 && (n.refractionRatio = e.refractionRatio), e.lightMap !== void 0 && (n.lightMap = r(e.lightMap)), e.lightMapIntensity !== void 0 && (n.lightMapIntensity = e.lightMapIntensity), e.aoMap !== void 0 && (n.aoMap = r(e.aoMap)), e.aoMapIntensity !== void 0 && (n.aoMapIntensity = e.aoMapIntensity), e.gradientMap !== void 0 && (n.gradientMap = r(e.gradientMap)), e.clearcoatMap !== void 0 && (n.clearcoatMap = r(e.clearcoatMap)), e.clearcoatRoughnessMap !== void 0 && (n.clearcoatRoughnessMap = r(e.clearcoatRoughnessMap)), e.clearcoatNormalMap !== void 0 && (n.clearcoatNormalMap = r(e.clearcoatNormalMap)), e.clearcoatNormalScale !== void 0 && (n.clearcoatNormalScale = new Re().fromArray(e.clearcoatNormalScale)), e.transmissionMap !== void 0 && (n.transmissionMap = r(e.transmissionMap)), e.thicknessMap !== void 0 && (n.thicknessMap = r(e.thicknessMap)), n; } setTextures(e) { return this.textures = e, this; } } class ln { static decodeText(e) { if (typeof TextDecoder < "u") return new TextDecoder().decode(e); let t = ""; for (let r = 0, n = e.length; r < n; r++) t += String.fromCharCode(e[r]); try { return decodeURIComponent(escape(t)); } catch { return t; } } static extractUrlBase(e) { const t = e.lastIndexOf("/"); return t === -1 ? "./" : e.substr(0, t + 1); } } class Ef extends Ye { 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; } } Ef.prototype.isInstancedBufferGeometry = !0; class Af extends tt { constructor(e, t, r, n = 1) { typeof r == "number" && (n = r, r = !1, console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")), super(e, t, r), this.meshPerAttribute = n; } 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; } } Af.prototype.isInstancedBufferAttribute = !0; class i1 extends _i { constructor(e) { super(e); } load(e, t, r, n) { const o = this, a = new Ki(o.manager); a.setPath(o.path), a.setRequestHeader(o.requestHeader), a.setWithCredentials(o.withCredentials), a.load(e, function(s) { try { t(o.parse(JSON.parse(s))); } catch (c) { n ? n(c) : console.error(c), o.manager.itemError(e); } }, r, n); } parse(e) { const t = {}, r = {}; function n(p, m) { if (t[m] !== void 0) return t[m]; const g = p.interleavedBuffers[m], d = o(p, g.buffer), y = _a(g.type, d), f = new no(y, g.stride); return f.uuid = g.uuid, t[m] = f, f; } function o(p, m) { if (r[m] !== void 0) return r[m]; const g = p.arrayBuffers[m], d = new Uint32Array(g).buffer; return r[m] = d, d; } const a = e.isInstancedBufferGeometry ? new Ef() : new Ye(), s = e.data.index; if (s !== void 0) { const p = _a(s.type, s.array); a.setIndex(new tt(p, 1)); } const c = e.data.attributes; for (const p in c) { const m = c[p]; let g; if (m.isInterleavedBufferAttribute) { const d = n(e.data, m.data); g = new pn(d, m.itemSize, m.offset, m.normalized); } else { const d = _a(m.type, m.array), y = m.isInstancedBufferAttribute ? Af : tt; g = new y(d, m.itemSize, m.normalized); } m.name !== void 0 && (g.name = m.name), m.usage !== void 0 && g.setUsage(m.usage), m.updateRange !== void 0 && (g.updateRange.offset = m.updateRange.offset, g.updateRange.count = m.updateRange.count), a.setAttribute(p, g); } const l = e.data.morphAttributes; if (l) for (const p in l) { const m = l[p], g = []; for (let d = 0, y = m.length; d < y; d++) { const f = m[d]; let v; if (f.isInterleavedBufferAttribute) { const _ = n(e.data, f.data); v = new pn(_, f.itemSize, f.offset, f.normalized); } else { const _ = _a(f.type, f.array); v = new tt(_, f.itemSize, f.normalized); } f.name !== void 0 && (v.name = f.name), g.push(v); } a.morphAttributes[p] = g; } e.data.morphTargetsRelative && (a.morphTargetsRelative = !0); const h = e.data.groups || e.data.drawcalls || e.data.offsets; if (h !== void 0) for (let p = 0, m = h.length; p !== m; ++p) { const g = h[p]; a.addGroup(g.start, g.count, g.materialIndex); } const u = e.data.boundingSphere; if (u !== void 0) { const p = new Z(); u.center !== void 0 && p.fromArray(u.center), a.boundingSphere = new xn(p, u.radius); } return e.name && (a.name = e.name), e.userData && (a.userData = e.userData), a; } } class xB extends _i { constructor(e) { super(e); } load(e, t, r, n) { const o = this, a = this.path === "" ? ln.extractUrlBase(e) : this.path; this.resourcePath = this.resourcePath || a; const s = new Ki(this.manager); s.setPath(this.path), s.setRequestHeader(this.requestHeader), s.setWithCredentials(this.withCredentials), s.load(e, function(c) { let l = null; try { l = JSON.parse(c); } catch (u) { n !== void 0 && n(u), console.error("THREE:ObjectLoader: Can't parse " + e + ".", u.message); return; } const h = l.metadata; if (h === void 0 || h.type === void 0 || h.type.toLowerCase() === "geometry") { console.error("THREE.ObjectLoader: Can't load " + e); return; } o.parse(l, t); }, r, n); } async loadAsync(e, t) { const r = this, n = this.path === "" ? ln.extractUrlBase(e) : this.path; this.resourcePath = this.resourcePath || n; const o = new Ki(this.manager); o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials); const a = await o.loadAsync(e, t), s = JSON.parse(a), c = s.metadata; if (c === void 0 || c.type === void 0 || c.type.toLowerCase() === "geometry") throw new Error("THREE.ObjectLoader: Can't load " + e); return await r.parseAsync(s); } parse(e, t) { const r = this.parseAnimations(e.animations), n = this.parseShapes(e.shapes), o = this.parseGeometries(e.geometries, n), a = this.parseImages(e.images, function() { t !== void 0 && t(l); }), s = this.parseTextures(e.textures, a), c = this.parseMaterials(e.materials, s), l = this.parseObject(e.object, o, c, s, r), h = this.parseSkeletons(e.skeletons, l); if (this.bindSkeletons(l, h), t !== void 0) { let u = !1; for (const p in a) if (a[p] instanceof HTMLImageElement) { u = !0; break; } u === !1 && t(l); } return l; } async parseAsync(e) { const t = this.parseAnimations(e.animations), r = this.parseShapes(e.shapes), n = this.parseGeometries(e.geometries, r), o = await this.parseImagesAsync(e.images), a = this.parseTextures(e.textures, o), s = this.parseMaterials(e.materials, a), c = this.parseObject(e.object, n, s, a, t), l = this.parseSkeletons(e.skeletons, c); return this.bindSkeletons(c, l), c; } parseShapes(e) { const t = {}; if (e !== void 0) for (let r = 0, n = e.length; r < n; r++) { const o = new Hn().fromJSON(e[r]); t[o.uuid] = o; } return t; } parseSkeletons(e, t) { const r = {}, n = {}; if (t.traverse(function(o) { o.isBone && (n[o.uuid] = o); }), e !== void 0) for (let o = 0, a = e.length; o < a; o++) { const s = new Ll().fromJSON(e[o], n); r[s.uuid] = s; } return r; } parseGeometries(e, t) { const r = {}; if (e !== void 0) { const n = new i1(); for (let o = 0, a = e.length; o < a; o++) { let s; const c = e[o]; switch (c.type) { case "BufferGeometry": case "InstancedBufferGeometry": s = n.parse(c); break; case "Geometry": console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported."); break; default: c.type in ov ? s = ov[c.type].fromJSON(c, t) : console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`); } s.uuid = c.uuid, c.name !== void 0 && (s.name = c.name), s.isBufferGeometry === !0 && c.userData !== void 0 && (s.userData = c.userData), r[c.uuid] = s; } } return r; } parseMaterials(e, t) { const r = {}, n = {}; if (e !== void 0) { const o = new t1(); o.setTextures(t); for (let a = 0, s = e.length; a < s; a++) { const c = e[a]; if (c.type === "MultiMaterial") { const l = []; for (let h = 0; h < c.materials.length; h++) { const u = c.materials[h]; r[u.uuid] === void 0 && (r[u.uuid] = o.parse(u)), l.push(r[u.uuid]); } n[c.uuid] = l; } else r[c.uuid] === void 0 && (r[c.uuid] = o.parse(c)), n[c.uuid] = r[c.uuid]; } } return n; } parseAnimations(e) { const t = {}; if (e !== void 0) for (let r = 0; r < e.length; r++) { const n = e[r], o = Qa.parse(n); t[o.uuid] = o; } return t; } parseImages(e, t) { const r = this, n = {}; let o; function a(c) { return r.manager.itemStart(c), o.load(c, function() { r.manager.itemEnd(c); }, void 0, function() { r.manager.itemError(c), r.manager.itemEnd(c); }); } function s(c) { if (typeof c == "string") { const l = c, h = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(l) ? l : r.resourcePath + l; return a(h); } else return c.data ? { data: _a(c.type, c.data), width: c.width, height: c.height } : null; } if (e !== void 0 && e.length > 0) { const c = new bf(t); o = new al(c), o.setCrossOrigin(this.crossOrigin); for (let l = 0, h = e.length; l < h; l++) { const u = e[l], p = u.url; if (Array.isArray(p)) { n[u.uuid] = []; for (let m = 0, g = p.length; m < g; m++) { const d = p[m], y = s(d); y !== null && (y instanceof HTMLImageElement ? n[u.uuid].push(y) : n[u.uuid].push(new Lo(y.data, y.width, y.height))); } } else { const m = s(u.url); m !== null && (n[u.uuid] = m); } } } return n; } async parseImagesAsync(e) { const t = this, r = {}; let n; async function o(a) { if (typeof a == "string") { const s = a, c = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(s) ? s : t.resourcePath + s; return await n.loadAsync(c); } else return a.data ? { data: _a(a.type, a.data), width: a.width, height: a.height } : null; } if (e !== void 0 && e.length > 0) { n = new al(this.manager), n.setCrossOrigin(this.crossOrigin); for (let a = 0, s = e.length; a < s; a++) { const c = e[a], l = c.url; if (Array.isArray(l)) { r[c.uuid] = []; for (let h = 0, u = l.length; h < u; h++) { const p = l[h], m = await o(p); m !== null && (m instanceof HTMLImageElement ? r[c.uuid].push(m) : r[c.uuid].push(new Lo(m.data, m.width, m.height))); } } else { const h = await o(c.url); h !== null && (r[c.uuid] = h); } } } return r; } parseTextures(e, t) { function r(o, a) { return typeof o == "number" ? o : (console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", o), a[o]); } const n = {}; if (e !== void 0) for (let o = 0, a = e.length; o < a; o++) { const s = e[o]; s.image === void 0 && console.warn('THREE.ObjectLoader: No "image" specified for', s.uuid), t[s.image] === void 0 && console.warn("THREE.ObjectLoader: Undefined image", s.image); let c; const l = t[s.image]; Array.isArray(l) ? (c = new cs(l), l.length === 6 && (c.needsUpdate = !0)) : (l && l.data ? c = new Lo(l.data, l.width, l.height) : c = new ti(l), l && (c.needsUpdate = !0)), c.uuid = s.uuid, s.name !== void 0 && (c.name = s.name), s.mapping !== void 0 && (c.mapping = r(s.mapping, wB)), s.offset !== void 0 && c.offset.fromArray(s.offset), s.repeat !== void 0 && c.repeat.fromArray(s.repeat), s.center !== void 0 && c.center.fromArray(s.center), s.rotation !== void 0 && (c.rotation = s.rotation), s.wrap !== void 0 && (c.wrapS = r(s.wrap[0], uv), c.wrapT = r(s.wrap[1], uv)), s.format !== void 0 && (c.format = s.format), s.type !== void 0 && (c.type = s.type), s.encoding !== void 0 && (c.encoding = s.encoding), s.minFilter !== void 0 && (c.minFilter = r(s.minFilter, hv)), s.magFilter !== void 0 && (c.magFilter = r(s.magFilter, hv)), s.anisotropy !== void 0 && (c.anisotropy = s.anisotropy), s.flipY !== void 0 && (c.flipY = s.flipY), s.premultiplyAlpha !== void 0 && (c.premultiplyAlpha = s.premultiplyAlpha), s.unpackAlignment !== void 0 && (c.unpackAlignment = s.unpackAlignment), n[s.uuid] = c; } return n; } parseObject(e, t, r, n, o) { let a; function s(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 m = []; for (let g = 0, d = p.length; g < d; g++) { const y = p[g]; r[y] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", y), m.push(r[y]); } return m; } return r[p] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", p), r[p]; } } function l(p) { return n[p] === void 0 && console.warn("THREE.ObjectLoader: Undefined texture", p), n[p]; } let h, u; switch (e.type) { case "Scene": a = new Nu(), e.background !== void 0 && (Number.isInteger(e.background) ? a.background = new Be(e.background) : a.background = l(e.background)), e.environment !== void 0 && (a.environment = l(e.environment)), e.fog !== void 0 && (e.fog.type === "Fog" ? a.fog = new Sl(e.fog.color, e.fog.near, e.fog.far) : e.fog.type === "FogExp2" && (a.fog = new Ml(e.fog.color, e.fog.density))); break; case "PerspectiveCamera": a = new oi(e.fov, e.aspect, e.near, e.far), e.focus !== void 0 && (a.focus = e.focus), e.zoom !== void 0 && (a.zoom = e.zoom), e.filmGauge !== void 0 && (a.filmGauge = e.filmGauge), e.filmOffset !== void 0 && (a.filmOffset = e.filmOffset), e.view !== void 0 && (a.view = Object.assign({}, e.view)); break; case "OrthographicCamera": a = new ps(e.left, e.right, e.top, e.bottom, e.near, e.far), e.zoom !== void 0 && (a.zoom = e.zoom), e.view !== void 0 && (a.view = Object.assign({}, e.view)); break; case "AmbientLight": a = new Mf(e.color, e.intensity); break; case "DirectionalLight": a = new ju(e.color, e.intensity); break; case "PointLight": a = new Hu(e.color, e.intensity, e.distance, e.decay); break; case "RectAreaLight": a = new Sf(e.color, e.intensity, e.width, e.height); break; case "SpotLight": a = new Vu(e.color, e.intensity, e.distance, e.angle, e.penumbra, e.decay); break; case "HemisphereLight": a = new wf(e.color, e.groundColor, e.intensity); break; case "LightProbe": a = new Il().fromJSON(e); break; case "SkinnedMesh": h = s(e.geometry), u = c(e.material), a = new Al(h, u), e.bindMode !== void 0 && (a.bindMode = e.bindMode), e.bindMatrix !== void 0 && a.bindMatrix.fromArray(e.bindMatrix), e.skeleton !== void 0 && (a.skeleton = e.skeleton); break; case "Mesh": h = s(e.geometry), u = c(e.material), a = new ei(h, u); break; case "InstancedMesh": h = s(e.geometry), u = c(e.material); const p = e.count, m = e.instanceMatrix, g = e.instanceColor; a = new Qp(h, u, p), a.instanceMatrix = new tt(new Float32Array(m.array), 16), g !== void 0 && (a.instanceColor = new tt(new Float32Array(g.array), g.itemSize)); break; case "LOD": a = new kx(); break; case "Line": a = new Fr(s(e.geometry), c(e.material)); break; case "LineLoop": a = new Bu(s(e.geometry), c(e.material)); break; case "LineSegments": a = new Bi(s(e.geometry), c(e.material)); break; case "PointCloud": case "Points": a = new hs(s(e.geometry), c(e.material)); break; case "Sprite": a = new El(c(e.material)); break; case "Group": a = new Rr(); break; case "Bone": a = new Cl(); break; default: a = new ot(); } if (a.uuid = e.uuid, e.name !== void 0 && (a.name = e.name), e.matrix !== void 0 ? (a.matrix.fromArray(e.matrix), e.matrixAutoUpdate !== void 0 && (a.matrixAutoUpdate = e.matrixAutoUpdate), a.matrixAutoUpdate && a.matrix.decompose(a.position, a.quaternion, a.scale)) : (e.position !== void 0 && a.position.fromArray(e.position), e.rotation !== void 0 && a.rotation.fromArray(e.rotation), e.quaternion !== void 0 && a.quaternion.fromArray(e.quaternion), e.scale !== void 0 && a.scale.fromArray(e.scale)), e.castShadow !== void 0 && (a.castShadow = e.castShadow), e.receiveShadow !== void 0 && (a.receiveShadow = e.receiveShadow), e.shadow && (e.shadow.bias !== void 0 && (a.shadow.bias = e.shadow.bias), e.shadow.normalBias !== void 0 && (a.shadow.normalBias = e.shadow.normalBias), e.shadow.radius !== void 0 && (a.shadow.radius = e.shadow.radius), e.shadow.mapSize !== void 0 && a.shadow.mapSize.fromArray(e.shadow.mapSize), e.shadow.camera !== void 0 && (a.shadow.camera = this.parseObject(e.shadow.camera))), e.visible !== void 0 && (a.visible = e.visible), e.frustumCulled !== void 0 && (a.frustumCulled = e.frustumCulled), e.renderOrder !== void 0 && (a.renderOrder = e.renderOrder), e.userData !== void 0 && (a.userData = e.userData), e.layers !== void 0 && (a.layers.mask = e.layers), e.children !== void 0) { const p = e.children; for (let m = 0; m < p.length; m++) a.add(this.parseObject(p[m], t, r, n, o)); } if (e.animations !== void 0) { const p = e.animations; for (let m = 0; m < p.length; m++) { const g = p[m]; a.animations.push(o[g]); } } if (e.type === "LOD") { e.autoUpdate !== void 0 && (a.autoUpdate = e.autoUpdate); const p = e.levels; for (let m = 0; m < p.length; m++) { const g = p[m], d = a.getObjectByProperty("uuid", g.object); d !== void 0 && a.addLevel(d, g.distance); } } return a; } bindSkeletons(e, t) { Object.keys(t).length !== 0 && e.traverse(function(r) { if (r.isSkinnedMesh === !0 && r.skeleton !== void 0) { const n = t[r.skeleton]; n === void 0 ? console.warn("THREE.ObjectLoader: No skeleton found with UUID:", r.skeleton) : r.bind(n, r.bindMatrix); } }); } /* DEPRECATED */ setTexturePath(e) { return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."), this.setResourcePath(e); } } const wB = { UVMapping: Su, CubeReflectionMapping: yl, CubeRefractionMapping: bl, EquirectangularReflectionMapping: Qc, EquirectangularRefractionMapping: eu, CubeUVReflectionMapping: ls, CubeUVRefractionMapping: xl }, uv = { RepeatWrapping: Yn, ClampToEdgeWrapping: di, MirroredRepeatWrapping: Na }, hv = { NearestFilter: Jt, NearestMipmapNearestFilter: Ks, NearestMipmapLinearFilter: Qs, LinearFilter: Wt, LinearMipmapNearestFilter: Tu, LinearMipmapLinearFilter: bn }; class Cf extends _i { 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, r, n) { e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e); const o = this, a = zo.get(e); if (a !== void 0) return o.manager.itemStart(e), setTimeout(function() { t && t(a), o.manager.itemEnd(e); }, 0), a; const s = {}; s.credentials = this.crossOrigin === "anonymous" ? "same-origin" : "include", s.headers = this.requestHeader, fetch(e, s).then(function(c) { return c.blob(); }).then(function(c) { return createImageBitmap(c, Object.assign(o.options, { colorSpaceConversion: "none" })); }).then(function(c) { zo.add(e, c), t && t(c), o.manager.itemEnd(e); }).catch(function(c) { n && n(c), o.manager.itemError(e), o.manager.itemEnd(e); }), o.manager.itemStart(e); } } Cf.prototype.isImageBitmapLoader = !0; class r1 { constructor() { this.type = "ShapePath", this.color = new Be(), this.subPaths = [], this.currentPath = null; } moveTo(e, t) { return this.currentPath = new sl(), this.subPaths.push(this.currentPath), this.currentPath.moveTo(e, t), this; } lineTo(e, t) { return this.currentPath.lineTo(e, t), this; } quadraticCurveTo(e, t, r, n) { return this.currentPath.quadraticCurveTo(e, t, r, n), this; } bezierCurveTo(e, t, r, n, o, a) { return this.currentPath.bezierCurveTo(e, t, r, n, o, a), this; } splineThru(e) { return this.currentPath.splineThru(e), this; } toShapes(e, t) { function r(v) { const _ = []; for (let M = 0, T = v.length; M < T; M++) { const w = v[M], b = new Hn(); b.curves = w.curves, _.push(b); } return _; } function n(v, _) { const M = _.length; let T = !1; for (let w = M - 1, b = 0; b < M; w = b++) { let E = _[w], S = _[b], C = S.x - E.x, R = S.y - E.y; if (Math.abs(R) > Number.EPSILON) { if (R < 0 && (E = _[b], C = -C, S = _[w], R = -R), v.y < E.y || v.y > S.y) continue; if (v.y === E.y) { if (v.x === E.x) return !0; } else { const L = R * (v.x - E.x) - C * (v.y - E.y); if (L === 0) return !0; if (L < 0) continue; T = !T; } } else { if (v.y !== E.y) continue; if (S.x <= v.x && v.x <= E.x || E.x <= v.x && v.x <= S.x) return !0; } } return T; } const o = Nr.isClockWise, a = this.subPaths; if (a.length === 0) return []; if (t === !0) return r(a); let s, c, l; const h = []; if (a.length === 1) return c = a[0], l = new Hn(), l.curves = c.curves, h.push(l), h; let u = !o(a[0].getPoints()); u = e ? !u : u; const p = [], m = []; let g = [], d = 0, y; m[d] = void 0, g[d] = []; for (let v = 0, _ = a.length; v < _; v++) c = a[v], y = c.getPoints(), s = o(y), s = e ? !s : s, s ? (!u && m[d] && d++, m[d] = { s: new Hn(), p: y }, m[d].s.curves = c.curves, u && d++, g[d] = []) : g[d].push({ h: c, p: y[0] }); if (!m[0]) return r(a); if (m.length > 1) { let v = !1; const _ = []; for (let M = 0, T = m.length; M < T; M++) p[M] = []; for (let M = 0, T = m.length; M < T; M++) { const w = g[M]; for (let b = 0; b < w.length; b++) { const E = w[b]; let S = !0; for (let C = 0; C < m.length; C++) n(E.p, m[C].p) && (M !== C && _.push({ froms: M, tos: C, hole: b }), S ? (S = !1, p[C].push(E)) : v = !0); S && p[M].push(E); } } _.length > 0 && (v || (g = p)); } let f; for (let v = 0, _ = m.length; v < _; v++) { l = m[v].s, h.push(l), f = g[v]; for (let M = 0, T = f.length; M < T; M++) l.holes.push(f[M].h); } return h; } } class Lf { constructor(e) { this.type = "Font", this.data = e; } generateShapes(e, t = 100) { const r = [], n = _B(e, t, this.data); for (let o = 0, a = n.length; o < a; o++) Array.prototype.push.apply(r, n[o].toShapes()); return r; } } function _B(i, e, t) { const r = Array.from(i), n = e / t.resolution, o = (t.boundingBox.yMax - t.boundingBox.yMin + t.underlineThickness) * n, a = []; let s = 0, c = 0; for (let l = 0; l < r.length; l++) { const h = r[l]; if (h === ` `) s = 0, c -= o; else { const u = MB(h, n, s, c, t); s += u.offsetX, a.push(u.path); } } return a; } function MB(i, e, t, r, n) { const o = n.glyphs[i] || n.glyphs["?"]; if (!o) { console.error('THREE.Font: character "' + i + '" does not exists in font family ' + n.familyName + "."); return; } const a = new r1(); let s, c, l, h, u, p, m, g; if (o.o) { const d = o._cachedOutline || (o._cachedOutline = o.o.split(" ")); for (let y = 0, f = d.length; y < f; ) switch (d[y++]) { case "m": s = d[y++] * e + t, c = d[y++] * e + r, a.moveTo(s, c); break; case "l": s = d[y++] * e + t, c = d[y++] * e + r, a.lineTo(s, c); break; case "q": l = d[y++] * e + t, h = d[y++] * e + r, u = d[y++] * e + t, p = d[y++] * e + r, a.quadraticCurveTo(u, p, l, h); break; case "b": l = d[y++] * e + t, h = d[y++] * e + r, u = d[y++] * e + t, p = d[y++] * e + r, m = d[y++] * e + t, g = d[y++] * e + r, a.bezierCurveTo(u, p, m, g, l, h); break; } } return { offsetX: o.ha * e, path: a }; } Lf.prototype.isFont = !0; class SB extends _i { constructor(e) { super(e); } load(e, t, r, n) { const o = this, a = new Ki(this.manager); a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(o.withCredentials), a.load(e, function(s) { let c; try { c = JSON.parse(s); } catch { console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."), c = JSON.parse(s.substring(65, s.length - 2)); } const l = o.parse(c); t && t(l); }, r, n); } parse(e) { return new Lf(e); } } let wc; const Rf = { getContext: function() { return wc === void 0 && (wc = new (window.AudioContext || window.webkitAudioContext)()), wc; }, setContext: function(i) { wc = i; } }; class n1 extends _i { constructor(e) { super(e); } load(e, t, r, n) { const o = this, a = new Ki(this.manager); a.setResponseType("arraybuffer"), a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(s) { try { const c = s.slice(0); Rf.getContext().decodeAudioData(c, function(l) { t(l); }); } catch (c) { n ? n(c) : console.error(c), o.manager.itemError(e); } }, r, n); } } class o1 extends Il { constructor(e, t, r = 1) { super(void 0, r); const n = new Be().set(e), o = new Be().set(t), a = new Z(n.r, n.g, n.b), s = new Z(o.r, o.g, o.b), c = Math.sqrt(Math.PI), l = c * Math.sqrt(0.75); this.sh.coefficients[0].copy(a).add(s).multiplyScalar(c), this.sh.coefficients[1].copy(a).sub(s).multiplyScalar(l); } } o1.prototype.isHemisphereLightProbe = !0; class a1 extends Il { constructor(e, t = 1) { super(void 0, t); const r = new Be().set(e); this.sh.coefficients[0].set(r.r, r.g, r.b).multiplyScalar(2 * Math.sqrt(Math.PI)); } } a1.prototype.isAmbientLightProbe = !0; const dv = /* @__PURE__ */ new $e(), pv = /* @__PURE__ */ new $e(); class TB { constructor() { this.type = "StereoCamera", this.aspect = 1, this.eyeSep = 0.064, this.cameraL = new oi(), this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new oi(), 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(), n = t.eyeSep / 2, o = n * t.near / t.focus, a = t.near * Math.tan(Co * t.fov * 0.5) / t.zoom; let s, c; pv.elements[12] = -n, dv.elements[12] = n, s = -a * t.aspect + o, c = a * t.aspect + o, r.elements[0] = 2 * t.near / (c - s), r.elements[8] = (c + s) / (c - s), this.cameraL.projectionMatrix.copy(r), s = -a * t.aspect - o, c = a * t.aspect - o, r.elements[0] = 2 * t.near / (c - s), r.elements[8] = (c + s) / (c - s), this.cameraR.projectionMatrix.copy(r); } this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(pv), this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(dv); } } class s1 { constructor(e = !0) { this.autoStart = e, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = !1; } start() { this.startTime = fv(), 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 = fv(); e = (t - this.oldTime) / 1e3, this.oldTime = t, this.elapsedTime += e; } return e; } } function fv() { return (typeof performance > "u" ? Date : performance).now(); } const ho = /* @__PURE__ */ new Z(), mv = /* @__PURE__ */ new wi(), EB = /* @__PURE__ */ new Z(), po = /* @__PURE__ */ new Z(); class AB extends ot { constructor() { super(), this.type = "AudioListener", this.context = Rf.getContext(), this.gain = this.context.createGain(), this.gain.connect(this.context.destination), this.filter = null, this.timeDelta = 0, this._clock = new s1(); } 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, r = this.up; if (this.timeDelta = this._clock.getDelta(), this.matrixWorld.decompose(ho, mv, EB), po.set(0, 0, -1).applyQuaternion(mv), t.positionX) { const n = this.context.currentTime + this.timeDelta; t.positionX.linearRampToValueAtTime(ho.x, n), t.positionY.linearRampToValueAtTime(ho.y, n), t.positionZ.linearRampToValueAtTime(ho.z, n), t.forwardX.linearRampToValueAtTime(po.x, n), t.forwardY.linearRampToValueAtTime(po.y, n), t.forwardZ.linearRampToValueAtTime(po.z, n), t.upX.linearRampToValueAtTime(r.x, n), t.upY.linearRampToValueAtTime(r.y, n), t.upZ.linearRampToValueAtTime(r.z, n); } else t.setPosition(ho.x, ho.y, ho.z), t.setOrientation(po.x, po.y, po.z, r.x, r.y, r.z); } } class Of 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 fo = /* @__PURE__ */ new Z(), gv = /* @__PURE__ */ new wi(), CB = /* @__PURE__ */ new Z(), mo = /* @__PURE__ */ new Z(); class LB extends Of { 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, r) { return this.panner.coneInnerAngle = e, this.panner.coneOuterAngle = t, this.panner.coneOuterGain = r, this; } updateMatrixWorld(e) { if (super.updateMatrixWorld(e), this.hasPlaybackControl === !0 && this.isPlaying === !1) return; this.matrixWorld.decompose(fo, gv, CB), mo.set(0, 0, 1).applyQuaternion(gv); const t = this.panner; if (t.positionX) { const r = this.context.currentTime + this.listener.timeDelta; t.positionX.linearRampToValueAtTime(fo.x, r), t.positionY.linearRampToValueAtTime(fo.y, r), t.positionZ.linearRampToValueAtTime(fo.z, r), t.orientationX.linearRampToValueAtTime(mo.x, r), t.orientationY.linearRampToValueAtTime(mo.y, r), t.orientationZ.linearRampToValueAtTime(mo.z, r); } else t.setPosition(fo.x, fo.y, fo.z), t.setOrientation(mo.x, mo.y, mo.z); } } class l1 { 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 r = 0; r < t.length; r++) e += t[r]; return e / t.length; } } class c1 { constructor(e, t, r) { this.binding = e, this.valueSize = r; let n, o, a; switch (t) { case "quaternion": n = this._slerp, o = this._slerpAdditive, a = this._setAdditiveIdentityQuaternion, this.buffer = new Float64Array(r * 6), this._workIndex = 5; break; case "string": case "bool": n = this._select, o = this._select, a = this._setAdditiveIdentityOther, this.buffer = new Array(r * 5); break; default: n = this._lerp, o = this._lerpAdditive, a = this._setAdditiveIdentityNumeric, this.buffer = new Float64Array(r * 5); } this._mixBufferRegion = n, this._mixBufferRegionAdditive = o, this._setIdentity = a, 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 r = this.buffer, n = this.valueSize, o = e * n + n; let a = this.cumulativeWeight; if (a === 0) { for (let s = 0; s !== n; ++s) r[o + s] = r[s]; a = t; } else { a += t; const s = t / a; this._mixBufferRegion(r, o, 0, s, n); } this.cumulativeWeight = a; } // accumulate data in the 'incoming' region into 'add' accumulateAdditive(e) { const t = this.buffer, r = this.valueSize, n = r * this._addIndex; this.cumulativeWeightAdditive === 0 && this._setIdentity(), this._mixBufferRegionAdditive(t, n, 0, e, r), this.cumulativeWeightAdditive += e; } // apply the state of 'accu' to the binding when accus differ apply(e) { const t = this.valueSize, r = this.buffer, n = e * t + t, o = this.cumulativeWeight, a = this.cumulativeWeightAdditive, s = this.binding; if (this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, o < 1) { const c = t * this._origIndex; this._mixBufferRegion( r, n, c, 1 - o, t ); } a > 0 && this._mixBufferRegionAdditive(r, n, this._addIndex * t, 1, t); for (let c = t, l = t + t; c !== l; ++c) if (r[c] !== r[c + t]) { s.setValue(r, n); break; } } // remember the state of the bound property and copy it to both accus saveOriginalState() { const e = this.binding, t = this.buffer, r = this.valueSize, n = r * this._origIndex; e.getValue(t, n); for (let o = r, a = n; o !== a; ++o) t[o] = t[n + o % r]; 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 r = e; r < t; r++) this.buffer[r] = 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 r = 0; r < this.valueSize; r++) this.buffer[t + r] = this.buffer[e + r]; } // mix functions _select(e, t, r, n, o) { if (n >= 0.5) for (let a = 0; a !== o; ++a) e[t + a] = e[r + a]; } _slerp(e, t, r, n) { wi.slerpFlat(e, t, e, t, e, r, n); } _slerpAdditive(e, t, r, n, o) { const a = this._workIndex * o; wi.multiplyQuaternionsFlat(e, a, e, t, e, r), wi.slerpFlat(e, t, e, t, e, a, n); } _lerp(e, t, r, n, o) { const a = 1 - n; for (let s = 0; s !== o; ++s) { const c = t + s; e[c] = e[c] * a + e[r + s] * n; } } _lerpAdditive(e, t, r, n, o) { for (let a = 0; a !== o; ++a) { const s = t + a; e[s] = e[s] + e[r + a] * n; } } } const Pf = "\\[\\]\\.:\\/", RB = new RegExp("[" + Pf + "]", "g"), If = "[^" + Pf + "]", OB = "[^" + Pf.replace("\\.", "") + "]", PB = /((?:WC+[\/:])*)/.source.replace("WC", If), IB = /(WCOD+)?/.source.replace("WCOD", OB), DB = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", If), NB = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", If), BB = new RegExp( "^" + PB + IB + DB + NB + "$" ), kB = ["material", "materials", "bones"]; class FB { constructor(e, t, r) { const n = r || pt.parseTrackName(t); this._targetGroup = e, this._bindings = e.subscribe_(t, n); } getValue(e, t) { this.bind(); const r = this._targetGroup.nCachedObjects_, n = this._bindings[r]; n !== void 0 && n.getValue(e, t); } setValue(e, t) { const r = this._bindings; for (let n = this._targetGroup.nCachedObjects_, o = r.length; n !== o; ++n) r[n].setValue(e, t); } bind() { const e = this._bindings; for (let t = this._targetGroup.nCachedObjects_, r = e.length; t !== r; ++t) e[t].bind(); } unbind() { const e = this._bindings; for (let t = this._targetGroup.nCachedObjects_, r = e.length; t !== r; ++t) e[t].unbind(); } } class pt { constructor(e, t, r) { this.path = t, this.parsedPath = r || pt.parseTrackName(t), this.node = pt.findNode(e, this.parsedPath.nodeName) || e, this.rootNode = e, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound; } static create(e, t, r) { return e && e.isAnimationObjectGroup ? new pt.Composite(e, t, r) : new pt(e, t, r); } /** * 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(RB, ""); } static parseTrackName(e) { const t = BB.exec(e); if (!t) throw new Error("PropertyBinding: Cannot parse trackName: " + e); const r = { // directoryName: matches[ 1 ], // (tschw) currently unused nodeName: t[2], objectName: t[3], objectIndex: t[4], propertyName: t[5], // required propertyIndex: t[6] }, n = r.nodeName && r.nodeName.lastIndexOf("."); if (n !== void 0 && n !== -1) { const o = r.nodeName.substring(n + 1); kB.indexOf(o) !== -1 && (r.nodeName = r.nodeName.substring(0, n), r.objectName = o); } if (r.propertyName === null || r.propertyName.length === 0) throw new Error("PropertyBinding: can not parse propertyName from trackName: " + e); return r; } static findNode(e, t) { if (!t || t === "" || t === "." || t === -1 || t === e.name || t === e.uuid) return e; if (e.skeleton) { const r = e.skeleton.getBoneByName(t); if (r !== void 0) return r; } if (e.children) { const r = function(o) { for (let a = 0; a < o.length; a++) { const s = o[a]; if (s.name === t || s.uuid === t) return s; const c = r(s.children); if (c) return c; } return null; }, n = r(e.children); if (n) return n; } 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 r = this.resolvedProperty; for (let n = 0, o = r.length; n !== o; ++n) e[t++] = r[n]; } _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 r = this.resolvedProperty; for (let n = 0, o = r.length; n !== o; ++n) r[n] = e[t++]; } _setValue_array_setNeedsUpdate(e, t) { const r = this.resolvedProperty; for (let n = 0, o = r.length; n !== o; ++n) r[n] = e[t++]; this.targetObject.needsUpdate = !0; } _setValue_array_setMatrixWorldNeedsUpdate(e, t) { const r = this.resolvedProperty; for (let n = 0, o = r.length; n !== o; ++n) r[n] = 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, r = t.objectName, n = t.propertyName; let o = t.propertyIndex; if (e || (e = pt.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 (r) { let l = t.objectIndex; switch (r) { 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 h = 0; h < e.length; h++) if (e[h].name === l) { l = h; break; } break; default: if (e[r] === void 0) { console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this); return; } e = e[r]; } 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 a = e[n]; if (a === void 0) { const l = t.nodeName; console.error("THREE.PropertyBinding: Trying to update property for track: " + l + "." + n + " but it wasn't found.", e); return; } let s = this.Versioning.None; this.targetObject = e, e.needsUpdate !== void 0 ? s = this.Versioning.NeedsUpdate : e.matrixWorldNeedsUpdate !== void 0 && (s = this.Versioning.MatrixWorldNeedsUpdate); let c = this.BindingType.Direct; if (o !== void 0) { if (n === "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[o] !== void 0 && (o = e.morphTargetDictionary[o]); } 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 = a, this.propertyIndex = o; } else a.fromArray !== void 0 && a.toArray !== void 0 ? (c = this.BindingType.HasFromToArray, this.resolvedProperty = a) : Array.isArray(a) ? (c = this.BindingType.EntireArray, this.resolvedProperty = a) : this.propertyName = n; this.getValue = this.GetterByBindingType[c], this.setValue = this.SetterByBindingTypeAndVersioning[c][s]; } unbind() { this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound; } } pt.Composite = FB; pt.prototype.BindingType = { Direct: 0, EntireArray: 1, ArrayElement: 2, HasFromToArray: 3 }; pt.prototype.Versioning = { None: 0, NeedsUpdate: 1, MatrixWorldNeedsUpdate: 2 }; pt.prototype.GetterByBindingType = [ pt.prototype._getValue_direct, pt.prototype._getValue_array, pt.prototype._getValue_arrayElement, pt.prototype._getValue_toArray ]; pt.prototype.SetterByBindingTypeAndVersioning = [ [ // Direct pt.prototype._setValue_direct, pt.prototype._setValue_direct_setNeedsUpdate, pt.prototype._setValue_direct_setMatrixWorldNeedsUpdate ], [ // EntireArray pt.prototype._setValue_array, pt.prototype._setValue_array_setNeedsUpdate, pt.prototype._setValue_array_setMatrixWorldNeedsUpdate ], [ // ArrayElement pt.prototype._setValue_arrayElement, pt.prototype._setValue_arrayElement_setNeedsUpdate, pt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate ], [ // HasToFromArray pt.prototype._setValue_fromArray, pt.prototype._setValue_fromArray_setNeedsUpdate, pt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate ] ]; class u1 { constructor() { this.uuid = Zi(), this._objects = Array.prototype.slice.call(arguments), this.nCachedObjects_ = 0; const e = {}; this._indicesByUUID = e; for (let r = 0, n = arguments.length; r !== n; ++r) e[arguments[r].uuid] = r; 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, r = this._paths, n = this._parsedPaths, o = this._bindings, a = o.length; let s, c = e.length, l = this.nCachedObjects_; for (let h = 0, u = arguments.length; h !== u; ++h) { const p = arguments[h], m = p.uuid; let g = t[m]; if (g === void 0) { g = c++, t[m] = g, e.push(p); for (let d = 0, y = a; d !== y; ++d) o[d].push(new pt(p, r[d], n[d])); } else if (g < l) { s = e[g]; const d = --l, y = e[d]; t[y.uuid] = g, e[g] = y, t[m] = d, e[d] = p; for (let f = 0, v = a; f !== v; ++f) { const _ = o[f], M = _[d]; let T = _[g]; _[g] = M, T === void 0 && (T = new pt(p, r[f], n[f])), _[d] = T; } } else e[g] !== s && 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, r = this._bindings, n = r.length; let o = this.nCachedObjects_; for (let a = 0, s = arguments.length; a !== s; ++a) { const c = arguments[a], l = c.uuid, h = t[l]; if (h !== void 0 && h >= o) { const u = o++, p = e[u]; t[p.uuid] = h, e[h] = p, t[l] = u, e[u] = c; for (let m = 0, g = n; m !== g; ++m) { const d = r[m], y = d[u], f = d[h]; d[h] = y, d[u] = f; } } } this.nCachedObjects_ = o; } // remove & forget uncache() { const e = this._objects, t = this._indicesByUUID, r = this._bindings, n = r.length; let o = this.nCachedObjects_, a = e.length; for (let s = 0, c = arguments.length; s !== c; ++s) { const l = arguments[s], h = l.uuid, u = t[h]; if (u !== void 0) if (delete t[h], u < o) { const p = --o, m = e[p], g = --a, d = e[g]; t[m.uuid] = u, e[u] = m, t[d.uuid] = p, e[p] = d, e.pop(); for (let y = 0, f = n; y !== f; ++y) { const v = r[y], _ = v[p], M = v[g]; v[u] = _, v[p] = M, v.pop(); } } else { const p = --a, m = e[p]; p > 0 && (t[m.uuid] = u), e[u] = m, e.pop(); for (let g = 0, d = n; g !== d; ++g) { const y = r[g]; y[u] = y[p], y.pop(); } } } this.nCachedObjects_ = o; } // Internal interface used by befriended PropertyBinding.Composite: subscribe_(e, t) { const r = this._bindingsIndicesByPath; let n = r[e]; const o = this._bindings; if (n !== void 0) return o[n]; const a = this._paths, s = this._parsedPaths, c = this._objects, l = c.length, h = this.nCachedObjects_, u = new Array(l); n = o.length, r[e] = n, a.push(e), s.push(t), o.push(u); for (let p = h, m = c.length; p !== m; ++p) { const g = c[p]; u[p] = new pt(g, e, t); } return u; } unsubscribe_(e) { const t = this._bindingsIndicesByPath, r = t[e]; if (r !== void 0) { const n = this._paths, o = this._parsedPaths, a = this._bindings, s = a.length - 1, c = a[s], l = e[s]; t[l] = r, a[r] = c, a.pop(), o[r] = o[s], o.pop(), n[r] = n[s], n.pop(); } } } u1.prototype.isAnimationObjectGroup = !0; class zB { constructor(e, t, r = null, n = t.blendMode) { this._mixer = e, this._clip = t, this._localRoot = r, this.blendMode = n; const o = t.tracks, a = o.length, s = new Array(a), c = { endingStart: wo, endingEnd: wo }; for (let l = 0; l !== a; ++l) { const h = o[l].createInterpolant(null); s[l] = h, h.settings = c; } this._interpolantSettings = c, this._interpolants = s, this._propertyBindings = new Array(a), this._cacheIndex = null, this._byClipCacheIndex = null, this._timeScaleInterpolant = null, this._weightInterpolant = null, this.loop = rx, 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, r) { if (e.fadeOut(t), this.fadeIn(t), r) { const n = this._clip.duration, o = e._clip.duration, a = o / n, s = n / o; e.warp(1, a, t), this.warp(s, 1, t); } return this; } crossFadeTo(e, t, r) { return e.crossFadeFrom(this, t, r); } 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, r) { const n = this._mixer, o = n.time, a = this.timeScale; let s = this._timeScaleInterpolant; s === null && (s = n._lendControlInterpolant(), this._timeScaleInterpolant = s); const c = s.parameterPositions, l = s.sampleValues; return c[0] = o, c[1] = o + r, l[0] = e / a, l[1] = t / a, 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, r, n) { if (!this.enabled) { this._updateWeight(e); return; } const o = this._startTime; if (o !== null) { const c = (e - o) * r; if (c < 0 || r === 0) return; this._startTime = null, t = r * c; } t *= this._updateTimeScale(e); const a = this._updateTime(t), s = this._updateWeight(e); if (s > 0) { const c = this._interpolants, l = this._propertyBindings; switch (this.blendMode) { case Hp: for (let h = 0, u = c.length; h !== u; ++h) c[h].evaluate(a), l[h].accumulateAdditive(s); break; case Eu: default: for (let h = 0, u = c.length; h !== u; ++h) c[h].evaluate(a), l[h].accumulate(n, s); } } } _updateWeight(e) { let t = 0; if (this.enabled) { t = this.weight; const r = this._weightInterpolant; if (r !== null) { const n = r.evaluate(e)[0]; t *= n, e > r.parameterPositions[1] && (this.stopFading(), n === 0 && (this.enabled = !1)); } } return this._effectiveWeight = t, t; } _updateTimeScale(e) { let t = 0; if (!this.paused) { t = this.timeScale; const r = this._timeScaleInterpolant; if (r !== null) { const n = r.evaluate(e)[0]; t *= n, e > r.parameterPositions[1] && (this.stopWarping(), t === 0 ? this.paused = !0 : this.timeScale = t); } } return this._effectiveTimeScale = t, t; } _updateTime(e) { const t = this._clip.duration, r = this.loop; let n = this.time + e, o = this._loopCount; const a = r === nx; if (e === 0) return o === -1 ? n : a && (o & 1) === 1 ? t - n : n; if (r === ix) { o === -1 && (this._loopCount = 0, this._setEndings(!0, !0, !1)); e: { if (n >= t) n = t; else if (n < 0) n = 0; else { this.time = n; break e; } this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, this.time = n, this._mixer.dispatchEvent({ type: "finished", action: this, direction: e < 0 ? -1 : 1 }); } } else { if (o === -1 && (e >= 0 ? (o = 0, this._setEndings(!0, this.repetitions === 0, a)) : this._setEndings(this.repetitions === 0, !0, a)), n >= t || n < 0) { const s = Math.floor(n / t); n -= t * s, o += Math.abs(s); const c = this.repetitions - o; if (c <= 0) this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, n = e > 0 ? t : 0, this.time = n, this._mixer.dispatchEvent({ type: "finished", action: this, direction: e > 0 ? 1 : -1 }); else { if (c === 1) { const l = e < 0; this._setEndings(l, !l, a); } else this._setEndings(!1, !1, a); this._loopCount = o, this.time = n, this._mixer.dispatchEvent({ type: "loop", action: this, loopDelta: s }); } } else this.time = n; if (a && (o & 1) === 1) return t - n; } return n; } _setEndings(e, t, r) { const n = this._interpolantSettings; r ? (n.endingStart = _o, n.endingEnd = _o) : (e ? n.endingStart = this.zeroSlopeAtStart ? _o : wo : n.endingStart = tl, t ? n.endingEnd = this.zeroSlopeAtEnd ? _o : wo : n.endingEnd = tl); } _scheduleFading(e, t, r) { const n = this._mixer, o = n.time; let a = this._weightInterpolant; a === null && (a = n._lendControlInterpolant(), this._weightInterpolant = a); const s = a.parameterPositions, c = a.sampleValues; return s[0] = o, c[0] = t, s[1] = o + e, c[1] = r, this; } } class h1 extends io { constructor(e) { super(), this._root = e, this._initMemoryManager(), this._accuIndex = 0, this.time = 0, this.timeScale = 1; } _bindAction(e, t) { const r = e._localRoot || this._root, n = e._clip.tracks, o = n.length, a = e._propertyBindings, s = e._interpolants, c = r.uuid, l = this._bindingsByRootAndName; let h = l[c]; h === void 0 && (h = {}, l[c] = h); for (let u = 0; u !== o; ++u) { const p = n[u], m = p.name; let g = h[m]; if (g !== void 0) a[u] = g; else { if (g = a[u], g !== void 0) { g._cacheIndex === null && (++g.referenceCount, this._addInactiveBinding(g, c, m)); continue; } const d = t && t._propertyBindings[u].binding.parsedPath; g = new c1( pt.create(r, m, d), p.ValueTypeName, p.getValueSize() ), ++g.referenceCount, this._addInactiveBinding(g, c, m), a[u] = g; } s[u].resultBuffer = g.buffer; } } _activateAction(e) { if (!this._isActiveAction(e)) { if (e._cacheIndex === null) { const r = (e._localRoot || this._root).uuid, n = e._clip.uuid, o = this._actionsByClip[n]; this._bindAction( e, o && o.knownActions[0] ), this._addInactiveAction(e, n, r); } const t = e._propertyBindings; for (let r = 0, n = t.length; r !== n; ++r) { const o = t[r]; o.useCount++ === 0 && (this._lendBinding(o), o.saveOriginalState()); } this._lendAction(e); } } _deactivateAction(e) { if (this._isActiveAction(e)) { const t = e._propertyBindings; for (let r = 0, n = t.length; r !== n; ++r) { const o = t[r]; --o.useCount === 0 && (o.restoreOriginalState(), this._takeBackBinding(o)); } 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, r) { const n = this._actions, o = this._actionsByClip; let a = o[t]; if (a === void 0) a = { knownActions: [e], actionByRoot: {} }, e._byClipCacheIndex = 0, o[t] = a; else { const s = a.knownActions; e._byClipCacheIndex = s.length, s.push(e); } e._cacheIndex = n.length, n.push(e), a.actionByRoot[r] = e; } _removeInactiveAction(e) { const t = this._actions, r = t[t.length - 1], n = e._cacheIndex; r._cacheIndex = n, t[n] = r, t.pop(), e._cacheIndex = null; const o = e._clip.uuid, a = this._actionsByClip, s = a[o], c = s.knownActions, l = c[c.length - 1], h = e._byClipCacheIndex; l._byClipCacheIndex = h, c[h] = l, c.pop(), e._byClipCacheIndex = null; const u = s.actionByRoot, p = (e._localRoot || this._root).uuid; delete u[p], c.length === 0 && delete a[o], this._removeInactiveBindingsForAction(e); } _removeInactiveBindingsForAction(e) { const t = e._propertyBindings; for (let r = 0, n = t.length; r !== n; ++r) { const o = t[r]; --o.referenceCount === 0 && this._removeInactiveBinding(o); } } _lendAction(e) { const t = this._actions, r = e._cacheIndex, n = this._nActiveActions++, o = t[n]; e._cacheIndex = n, t[n] = e, o._cacheIndex = r, t[r] = o; } _takeBackAction(e) { const t = this._actions, r = e._cacheIndex, n = --this._nActiveActions, o = t[n]; e._cacheIndex = n, t[n] = e, o._cacheIndex = r, t[r] = o; } // Memory management for PropertyMixer objects _addInactiveBinding(e, t, r) { const n = this._bindingsByRootAndName, o = this._bindings; let a = n[t]; a === void 0 && (a = {}, n[t] = a), a[r] = e, e._cacheIndex = o.length, o.push(e); } _removeInactiveBinding(e) { const t = this._bindings, r = e.binding, n = r.rootNode.uuid, o = r.path, a = this._bindingsByRootAndName, s = a[n], c = t[t.length - 1], l = e._cacheIndex; c._cacheIndex = l, t[l] = c, t.pop(), delete s[o], Object.keys(s).length === 0 && delete a[n]; } _lendBinding(e) { const t = this._bindings, r = e._cacheIndex, n = this._nActiveBindings++, o = t[n]; e._cacheIndex = n, t[n] = e, o._cacheIndex = r, t[r] = o; } _takeBackBinding(e) { const t = this._bindings, r = e._cacheIndex, n = --this._nActiveBindings, o = t[n]; e._cacheIndex = n, t[n] = e, o._cacheIndex = r, t[r] = o; } // Memory management of Interpolants for weight and time scale _lendControlInterpolant() { const e = this._controlInterpolants, t = this._nActiveControlInterpolants++; let r = e[t]; return r === void 0 && (r = new vf( new Float32Array(2), new Float32Array(2), 1, this._controlInterpolantsResultBuffer ), r.__cacheIndex = t, e[t] = r), r; } _takeBackControlInterpolant(e) { const t = this._controlInterpolants, r = e.__cacheIndex, n = --this._nActiveControlInterpolants, o = t[n]; e.__cacheIndex = n, t[n] = e, o.__cacheIndex = r, t[r] = o; } // 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, r) { const n = t || this._root, o = n.uuid; let a = typeof e == "string" ? Qa.findByName(n, e) : e; const s = a !== null ? a.uuid : e, c = this._actionsByClip[s]; let l = null; if (r === void 0 && (a !== null ? r = a.blendMode : r = Eu), c !== void 0) { const u = c.actionByRoot[o]; if (u !== void 0 && u.blendMode === r) return u; l = c.knownActions[0], a === null && (a = l._clip); } if (a === null) return null; const h = new zB(this, a, t, r); return this._bindAction(h, l), this._addInactiveAction(h, s, o), h; } // get an existing action existingAction(e, t) { const r = t || this._root, n = r.uuid, o = typeof e == "string" ? Qa.findByName(r, e) : e, a = o ? o.uuid : e, s = this._actionsByClip[a]; return s !== void 0 && s.actionByRoot[n] || null; } // deactivates all previously scheduled actions stopAllAction() { const e = this._actions, t = this._nActiveActions; for (let r = t - 1; r >= 0; --r) e[r].stop(); return this; } // advance the time and update apply the animation update(e) { e *= this.timeScale; const t = this._actions, r = this._nActiveActions, n = this.time += e, o = Math.sign(e), a = this._accuIndex ^= 1; for (let l = 0; l !== r; ++l) t[l]._update(n, e, o, a); const s = this._bindings, c = this._nActiveBindings; for (let l = 0; l !== c; ++l) s[l].apply(a); 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, r = e.uuid, n = this._actionsByClip, o = n[r]; if (o !== void 0) { const a = o.knownActions; for (let s = 0, c = a.length; s !== c; ++s) { const l = a[s]; this._deactivateAction(l); const h = l._cacheIndex, u = t[t.length - 1]; l._cacheIndex = null, l._byClipCacheIndex = null, u._cacheIndex = h, t[h] = u, t.pop(), this._removeInactiveBindingsForAction(l); } delete n[r]; } } // free all resources specific to a particular root target object uncacheRoot(e) { const t = e.uuid, r = this._actionsByClip; for (const a in r) { const s = r[a].actionByRoot, c = s[t]; c !== void 0 && (this._deactivateAction(c), this._removeInactiveAction(c)); } const n = this._bindingsByRootAndName, o = n[t]; if (o !== void 0) for (const a in o) { const s = o[a]; s.restoreOriginalState(), this._removeInactiveBinding(s); } } // remove a targeted clip from the cache uncacheAction(e, t) { const r = this.existingAction(e, t); r !== null && (this._deactivateAction(r), this._removeInactiveAction(r)); } } h1.prototype._controlInterpolantsResultBuffer = new Float32Array(1); class Gu { constructor(e) { typeof e == "string" && (console.warn("THREE.Uniform: Type parameter is no longer needed."), e = arguments[1]), this.value = e; } clone() { return new Gu(this.value.clone === void 0 ? this.value : this.value.clone()); } } class d1 extends no { constructor(e, t, r = 1) { super(e, t), this.meshPerAttribute = r; } 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; } } d1.prototype.isInstancedInterleavedBuffer = !0; class p1 { constructor(e, t, r, n, o) { this.buffer = e, this.type = t, this.itemSize = r, this.elementSize = n, this.count = o, 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; } } p1.prototype.isGLBufferAttribute = !0; class UB { constructor(e, t, r = 0, n = 1 / 0) { this.ray = new ro(e, t), this.near = r, this.far = n, this.camera = null, this.layers = new Zp(), 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, r = []) { return Ud(e, this, r, t), r.sort(vv), r; } intersectObjects(e, t = !1, r = []) { for (let n = 0, o = e.length; n < o; n++) Ud(e[n], this, r, t); return r.sort(vv), r; } } function vv(i, e) { return i.distance - e.distance; } function Ud(i, e, t, r) { if (i.layers.test(e.layers) && i.raycast(e, t), r === !0) { const n = i.children; for (let o = 0, a = n.length; o < a; o++) Ud(n[o], e, t, !0); } } class VB { constructor(e = 1, t = 0, r = 0) { return this.radius = e, this.phi = t, this.theta = r, this; } set(e, t, r) { return this.radius = e, this.phi = t, this.theta = r, 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, r) { return this.radius = Math.sqrt(e * e + t * t + r * r), this.radius === 0 ? (this.theta = 0, this.phi = 0) : (this.theta = Math.atan2(e, r), this.phi = Math.acos(bi(t / this.radius, -1, 1))), this; } clone() { return new this.constructor().copy(this); } } class HB { constructor(e = 1, t = 0, r = 0) { return this.radius = e, this.theta = t, this.y = r, this; } set(e, t, r) { return this.radius = e, this.theta = t, this.y = r, 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, r) { return this.radius = Math.sqrt(e * e + r * r), this.theta = Math.atan2(e, r), this.y = t, this; } clone() { return new this.constructor().copy(this); } } const yv = /* @__PURE__ */ new Re(); class fs { constructor(e = new Re(1 / 0, 1 / 0), t = new Re(-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, r = e.length; t < r; t++) this.expandByPoint(e[t]); return this; } setFromCenterAndSize(e, t) { const r = yv.copy(t).multiplyScalar(0.5); return this.min.copy(e).sub(r), this.max.copy(e).add(r), 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 yv.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); } } fs.prototype.isBox2 = !0; const bv = /* @__PURE__ */ new Z(), _c = /* @__PURE__ */ new Z(); class f1 { constructor(e = new Z(), t = new Z()) { 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) { bv.subVectors(e, this.start), _c.subVectors(this.end, this.start); const r = _c.dot(_c); let n = _c.dot(bv) / r; return t && (n = bi(n, 0, 1)), n; } closestPointToPoint(e, t, r) { const n = this.closestPointToPointParameter(e, t); return this.delta(r).multiplyScalar(n).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 m1 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; } } m1.prototype.isImmediateRenderObject = !0; const xv = /* @__PURE__ */ new Z(); class jB extends ot { constructor(e, t) { super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = t; const r = new Ye(), n = [ 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 a = 0, s = 1, c = 32; a < c; a++, s++) { const l = a / c * Math.PI * 2, h = s / c * Math.PI * 2; n.push( Math.cos(l), Math.sin(l), 1, Math.cos(h), Math.sin(h), 1 ); } r.setAttribute("position", new je(n, 3)); const o = new li({ fog: !1, toneMapped: !1 }); this.cone = new Bi(r, o), 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), xv.setFromMatrixPosition(this.light.target.matrixWorld), this.cone.lookAt(xv), this.color !== void 0 ? this.cone.material.color.set(this.color) : this.cone.material.color.copy(this.light.color); } } const Rn = /* @__PURE__ */ new Z(), Mc = /* @__PURE__ */ new $e(), Fh = /* @__PURE__ */ new $e(); class g1 extends Bi { constructor(e) { const t = v1(e), r = new Ye(), n = [], o = [], a = new Be(0, 0, 1), s = new Be(0, 1, 0); for (let l = 0; l < t.length; l++) { const h = t[l]; h.parent && h.parent.isBone && (n.push(0, 0, 0), n.push(0, 0, 0), o.push(a.r, a.g, a.b), o.push(s.r, s.g, s.b)); } r.setAttribute("position", new je(n, 3)), r.setAttribute("color", new je(o, 3)); const c = new li({ vertexColors: !0, depthTest: !1, depthWrite: !1, toneMapped: !1, transparent: !0 }); super(r, 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, r = this.geometry, n = r.getAttribute("position"); Fh.copy(this.root.matrixWorld).invert(); for (let o = 0, a = 0; o < t.length; o++) { const s = t[o]; s.parent && s.parent.isBone && (Mc.multiplyMatrices(Fh, s.matrixWorld), Rn.setFromMatrixPosition(Mc), n.setXYZ(a, Rn.x, Rn.y, Rn.z), Mc.multiplyMatrices(Fh, s.parent.matrixWorld), Rn.setFromMatrixPosition(Mc), n.setXYZ(a + 1, Rn.x, Rn.y, Rn.z), a += 2); } r.getAttribute("position").needsUpdate = !0, super.updateMatrixWorld(e); } } function v1(i) { const e = []; i && i.isBone && e.push(i); for (let t = 0; t < i.children.length; t++) e.push.apply(e, v1(i.children[t])); return e; } class GB extends ei { constructor(e, t, r) { const n = new Fo(t, 4, 2), o = new Ui({ wireframe: !0, fog: !1, toneMapped: !1 }); super(n, o), this.light = e, this.light.updateMatrixWorld(), this.color = r, 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 WB = /* @__PURE__ */ new Z(), wv = /* @__PURE__ */ new Be(), _v = /* @__PURE__ */ new Be(); class $B extends ot { constructor(e, t, r) { super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = r; const n = new Bo(t); n.rotateY(Math.PI * 0.5), this.material = new Ui({ wireframe: !0, fog: !1, toneMapped: !1 }), this.color === void 0 && (this.material.vertexColors = !0); const o = n.getAttribute("position"), a = new Float32Array(o.count * 3); n.setAttribute("color", new tt(a, 3)), this.add(new ei(n, 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"); wv.copy(this.light.color), _v.copy(this.light.groundColor); for (let r = 0, n = t.count; r < n; r++) { const o = r < n / 2 ? wv : _v; t.setXYZ(r, o.r, o.g, o.b); } t.needsUpdate = !0; } e.lookAt(WB.setFromMatrixPosition(this.light.matrixWorld).negate()); } } class y1 extends Bi { constructor(e = 10, t = 10, r = 4473924, n = 8947848) { r = new Be(r), n = new Be(n); const o = t / 2, a = e / t, s = e / 2, c = [], l = []; for (let p = 0, m = 0, g = -s; p <= t; p++, g += a) { c.push(-s, 0, g, s, 0, g), c.push(g, 0, -s, g, 0, s); const d = p === o ? r : n; d.toArray(l, m), m += 3, d.toArray(l, m), m += 3, d.toArray(l, m), m += 3, d.toArray(l, m), m += 3; } const h = new Ye(); h.setAttribute("position", new je(c, 3)), h.setAttribute("color", new je(l, 3)); const u = new li({ vertexColors: !0, toneMapped: !1 }); super(h, u), this.type = "GridHelper"; } } class qB extends Bi { constructor(e = 10, t = 16, r = 8, n = 64, o = 4473924, a = 8947848) { o = new Be(o), a = new Be(a); const s = [], c = []; for (let u = 0; u <= t; u++) { const p = u / t * (Math.PI * 2), m = Math.sin(p) * e, g = Math.cos(p) * e; s.push(0, 0, 0), s.push(m, 0, g); const d = u & 1 ? o : a; c.push(d.r, d.g, d.b), c.push(d.r, d.g, d.b); } for (let u = 0; u <= r; u++) { const p = u & 1 ? o : a, m = e - e / r * u; for (let g = 0; g < n; g++) { let d = g / n * (Math.PI * 2), y = Math.sin(d) * m, f = Math.cos(d) * m; s.push(y, 0, f), c.push(p.r, p.g, p.b), d = (g + 1) / n * (Math.PI * 2), y = Math.sin(d) * m, f = Math.cos(d) * m, s.push(y, 0, f), c.push(p.r, p.g, p.b); } } const l = new Ye(); l.setAttribute("position", new je(s, 3)), l.setAttribute("color", new je(c, 3)); const h = new li({ vertexColors: !0, toneMapped: !1 }); super(l, h), this.type = "PolarGridHelper"; } } const Mv = /* @__PURE__ */ new Z(), Sc = /* @__PURE__ */ new Z(), Sv = /* @__PURE__ */ new Z(); class XB extends ot { constructor(e, t, r) { super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = r, t === void 0 && (t = 1); let n = new Ye(); n.setAttribute("position", new je([ -t, t, 0, t, t, 0, t, -t, 0, -t, -t, 0, -t, t, 0 ], 3)); const o = new li({ fog: !1, toneMapped: !1 }); this.lightPlane = new Fr(n, o), this.add(this.lightPlane), n = new Ye(), n.setAttribute("position", new je([0, 0, 0, 0, 0, 1], 3)), this.targetLine = new Fr(n, o), this.add(this.targetLine), this.update(); } dispose() { this.lightPlane.geometry.dispose(), this.lightPlane.material.dispose(), this.targetLine.geometry.dispose(), this.targetLine.material.dispose(); } update() { Mv.setFromMatrixPosition(this.light.matrixWorld), Sc.setFromMatrixPosition(this.light.target.matrixWorld), Sv.subVectors(Sc, Mv), this.lightPlane.lookAt(Sc), 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(Sc), this.targetLine.scale.z = Sv.length(); } } const Tc = /* @__PURE__ */ new Z(), Ht = /* @__PURE__ */ new wl(); class ZB extends Bi { constructor(e) { const t = new Ye(), r = new li({ color: 16777215, vertexColors: !0, toneMapped: !1 }), n = [], o = [], a = {}, s = new Be(16755200), c = new Be(16711680), l = new Be(43775), h = new Be(16777215), u = new Be(3355443); p("n1", "n2", s), p("n2", "n4", s), p("n4", "n3", s), p("n3", "n1", s), p("f1", "f2", s), p("f2", "f4", s), p("f4", "f3", s), p("f3", "f1", s), p("n1", "f1", s), p("n2", "f2", s), p("n3", "f3", s), p("n4", "f4", s), 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", h), p("p", "c", u), p("cn1", "cn2", u), p("cn3", "cn4", u), p("cf1", "cf2", u), p("cf3", "cf4", u); function p(g, d, y) { m(g, y), m(d, y); } function m(g, d) { n.push(0, 0, 0), o.push(d.r, d.g, d.b), a[g] === void 0 && (a[g] = []), a[g].push(n.length / 3 - 1); } t.setAttribute("position", new je(n, 3)), t.setAttribute("color", new je(o, 3)), super(t, r), this.type = "CameraHelper", this.camera = e, this.camera.updateProjectionMatrix && this.camera.updateProjectionMatrix(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.pointMap = a, this.update(); } update() { const e = this.geometry, t = this.pointMap, r = 1, n = 1; Ht.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse), Xt("c", t, e, Ht, 0, 0, -1), Xt("t", t, e, Ht, 0, 0, 1), Xt("n1", t, e, Ht, -r, -n, -1), Xt("n2", t, e, Ht, r, -n, -1), Xt("n3", t, e, Ht, -r, n, -1), Xt("n4", t, e, Ht, r, n, -1), Xt("f1", t, e, Ht, -r, -n, 1), Xt("f2", t, e, Ht, r, -n, 1), Xt("f3", t, e, Ht, -r, n, 1), Xt("f4", t, e, Ht, r, n, 1), Xt("u1", t, e, Ht, r * 0.7, n * 1.1, -1), Xt("u2", t, e, Ht, -r * 0.7, n * 1.1, -1), Xt("u3", t, e, Ht, 0, n * 2, -1), Xt("cf1", t, e, Ht, -r, 0, 1), Xt("cf2", t, e, Ht, r, 0, 1), Xt("cf3", t, e, Ht, 0, -n, 1), Xt("cf4", t, e, Ht, 0, n, 1), Xt("cn1", t, e, Ht, -r, 0, -1), Xt("cn2", t, e, Ht, r, 0, -1), Xt("cn3", t, e, Ht, 0, -n, -1), Xt("cn4", t, e, Ht, 0, n, -1), e.getAttribute("position").needsUpdate = !0; } dispose() { this.geometry.dispose(), this.material.dispose(); } } function Xt(i, e, t, r, n, o, a) { Tc.set(n, o, a).unproject(r); const s = e[i]; if (s !== void 0) { const c = t.getAttribute("position"); for (let l = 0, h = s.length; l < h; l++) c.setXYZ(s[l], Tc.x, Tc.y, Tc.z); } } const Ec = /* @__PURE__ */ new ji(); class b1 extends Bi { constructor(e, t = 16776960) { const r = 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]), n = new Float32Array(8 * 3), o = new Ye(); o.setIndex(new tt(r, 1)), o.setAttribute("position", new tt(n, 3)), super(o, new li({ 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, r = Ec.max, n = this.geometry.attributes.position, o = n.array; o[0] = r.x, o[1] = r.y, o[2] = r.z, o[3] = t.x, o[4] = r.y, o[5] = r.z, o[6] = t.x, o[7] = t.y, o[8] = r.z, o[9] = r.x, o[10] = t.y, o[11] = r.z, o[12] = r.x, o[13] = r.y, o[14] = t.z, o[15] = t.x, o[16] = r.y, o[17] = t.z, o[18] = t.x, o[19] = t.y, o[20] = t.z, o[21] = r.x, o[22] = t.y, o[23] = t.z, n.needsUpdate = !0, this.geometry.computeBoundingSphere(); } setFromObject(e) { return this.object = e, this.update(), this; } copy(e) { return Bi.prototype.copy.call(this, e), this.object = e.object, this; } } class YB extends Bi { constructor(e, t = 16776960) { const r = 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]), n = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1], o = new Ye(); o.setIndex(new tt(r, 1)), o.setAttribute("position", new je(n, 3)), super(o, new li({ 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 JB extends Fr { constructor(e, t = 1, r = 16776960) { const n = r, o = [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], a = new Ye(); a.setAttribute("position", new je(o, 3)), a.computeBoundingSphere(), super(a, new li({ color: n, toneMapped: !1 })), this.type = "PlaneHelper", this.plane = e, this.size = t; const s = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1], c = new Ye(); c.setAttribute("position", new je(s, 3)), c.computeBoundingSphere(), this.add(new ei(c, new Ui({ color: n, 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 ? Yt : Xn, this.lookAt(this.plane.normal), super.updateMatrixWorld(e); } } const Tv = /* @__PURE__ */ new Z(); let Ac, zh; class KB extends ot { // dir is assumed to be normalized constructor(e = new Z(0, 0, 1), t = new Z(0, 0, 0), r = 1, n = 16776960, o = r * 0.2, a = o * 0.2) { super(), this.type = "ArrowHelper", Ac === void 0 && (Ac = new Ye(), Ac.setAttribute("position", new je([0, 0, 0, 0, 1, 0], 3)), zh = new Jn(0, 0.5, 1, 5, 1), zh.translate(0, -0.5, 0)), this.position.copy(t), this.line = new Fr(Ac, new li({ color: n, toneMapped: !1 })), this.line.matrixAutoUpdate = !1, this.add(this.line), this.cone = new ei(zh, new Ui({ color: n, toneMapped: !1 })), this.cone.matrixAutoUpdate = !1, this.add(this.cone), this.setDirection(e), this.setLength(r, o, a); } 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 { Tv.set(e.z, 0, -e.x).normalize(); const t = Math.acos(e.y); this.quaternion.setFromAxisAngle(Tv, t); } } setLength(e, t = e * 0.2, r = t * 0.2) { this.line.scale.set(1, Math.max(1e-4, e - t), 1), this.line.updateMatrix(), this.cone.scale.set(r, t, r), 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 x1 extends Bi { constructor(e = 1) { const t = [ 0, 0, 0, e, 0, 0, 0, 0, 0, 0, e, 0, 0, 0, 0, 0, 0, e ], r = [ 1, 0, 0, 1, 0.6, 0, 0, 1, 0, 0.6, 1, 0, 0, 0, 1, 0, 0.6, 1 ], n = new Ye(); n.setAttribute("position", new je(t, 3)), n.setAttribute("color", new je(r, 3)); const o = new li({ vertexColors: !0, toneMapped: !1 }); super(n, o), this.type = "AxesHelper"; } setColors(e, t, r) { const n = new Be(), o = this.geometry.attributes.color.array; return n.set(e), n.toArray(o, 0), n.toArray(o, 3), n.set(t), n.toArray(o, 6), n.toArray(o, 9), n.set(r), n.toArray(o, 12), n.toArray(o, 15), this.geometry.attributes.color.needsUpdate = !0, this; } dispose() { this.geometry.dispose(), this.material.dispose(); } } const w1 = new Float32Array(1), QB = new Int32Array(w1.buffer); class ek { // Converts float32 to float16 (stored as uint16 value). static toHalfFloat(e) { w1[0] = e; const t = QB[0]; let r = t >> 16 & 32768, n = t >> 12 & 2047; const o = t >> 23 & 255; return o < 103 ? r : o > 142 ? (r |= 31744, r |= (o == 255 ? 0 : 1) && t & 8388607, r) : o < 113 ? (n |= 2048, r |= (n >> 114 - o) + (n >> 113 - o & 1), r) : (r |= o - 112 << 10 | n >> 1, r += n & 1, r); } } const Ea = 4, jn = 8, Ar = Math.pow(2, jn), _1 = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], M1 = jn - Ea + 1 + _1.length, ma = 20, Or = { [Di]: 0, [Do]: 1, [Cu]: 2, [Gp]: 3, [Wp]: 4, [$p]: 5, [Au]: 6 }, go = new Ui({ side: Yt, depthWrite: !1, depthTest: !1 }), tk = new ei(new hn(), go), Uh = /* @__PURE__ */ new ps(), { _lodPlanes: Ls, _sizeLods: Ev, _sigmas: Cc } = /* @__PURE__ */ nk(), Av = /* @__PURE__ */ new Be(); let Vh = null; const vo = (1 + Math.sqrt(5)) / 2, ga = 1 / vo, Cv = [ /* @__PURE__ */ new Z(1, 1, 1), /* @__PURE__ */ new Z(-1, 1, 1), /* @__PURE__ */ new Z(1, 1, -1), /* @__PURE__ */ new Z(-1, 1, -1), /* @__PURE__ */ new Z(0, vo, ga), /* @__PURE__ */ new Z(0, vo, -ga), /* @__PURE__ */ new Z(ga, 0, vo), /* @__PURE__ */ new Z(-ga, 0, vo), /* @__PURE__ */ new Z(vo, ga, 0), /* @__PURE__ */ new Z(-vo, ga, 0) ]; function Lv(i) { const e = Math.max(i.r, i.g, i.b), t = Math.min(Math.max(Math.ceil(Math.log2(e)), -128), 127); return i.multiplyScalar(Math.pow(2, -t)), (t + 128) / 255; } class ik { constructor(e) { this._renderer = e, this._pingPongRenderTarget = null, this._blurMaterial = ok(ma), 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, r = 0.1, n = 100) { Vh = this._renderer.getRenderTarget(); const o = this._allocateTargets(); return this._sceneToCubeUV(e, r, n, o), t > 0 && this._blur(o, 0, 0, t), this._applyPMREM(o), this._cleanup(o), o; } /** * 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 = Pv(), 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 < Ls.length; e++) Ls[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: Jt, minFilter: Jt, generateMipmaps: !1, type: Po, format: bb, encoding: rk(e) ? e.encoding : Cu, depthBuffer: !1 }, r = Rv(t); return r.depthBuffer = !e, this._pingPongRenderTarget = Rv(t), r; } _compileMaterial(e) { const t = new ei(Ls[0], e); this._renderer.compile(t, Uh); } _sceneToCubeUV(e, t, r, n) { const o = new oi(90, 1, t, r), a = [1, -1, 1, 1, 1, 1], s = [1, 1, 1, -1, -1, -1], c = this._renderer, l = c.autoClear, h = c.outputEncoding, u = c.toneMapping; c.getClearColor(Av), c.toneMapping = Un, c.outputEncoding = Di, c.autoClear = !1; let p = !1; const m = e.background; if (m) { if (m.isColor) { go.color.copy(m).convertSRGBToLinear(), e.background = null; const g = Lv(go.color); go.opacity = g, p = !0; } } else { go.color.copy(Av).convertSRGBToLinear(); const g = Lv(go.color); go.opacity = g, p = !0; } for (let g = 0; g < 6; g++) { const d = g % 3; d == 0 ? (o.up.set(0, a[g], 0), o.lookAt(s[g], 0, 0)) : d == 1 ? (o.up.set(0, 0, a[g]), o.lookAt(0, s[g], 0)) : (o.up.set(0, a[g], 0), o.lookAt(0, 0, s[g])), Lc( n, d * Ar, g > 2 ? Ar : 0, Ar, Ar ), c.setRenderTarget(n), p && c.render(tk, o), c.render(e, o); } c.toneMapping = u, c.outputEncoding = h, c.autoClear = l; } _textureToCubeUV(e, t) { const r = this._renderer; e.isCubeTexture ? this._cubemapShader == null && (this._cubemapShader = Pv()) : this._equirectShader == null && (this._equirectShader = Ov()); const n = e.isCubeTexture ? this._cubemapShader : this._equirectShader, o = new ei(Ls[0], n), a = n.uniforms; a.envMap.value = e, e.isCubeTexture || a.texelSize.value.set(1 / e.image.width, 1 / e.image.height), a.inputEncoding.value = Or[e.encoding], a.outputEncoding.value = Or[t.texture.encoding], Lc(t, 0, 0, 3 * Ar, 2 * Ar), r.setRenderTarget(t), r.render(o, Uh); } _applyPMREM(e) { const t = this._renderer, r = t.autoClear; t.autoClear = !1; for (let n = 1; n < M1; n++) { const o = Math.sqrt(Cc[n] * Cc[n] - Cc[n - 1] * Cc[n - 1]), a = Cv[(n - 1) % Cv.length]; this._blur(e, n - 1, n, o, a); } t.autoClear = r; } /** * 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, r, n, o) { const a = this._pingPongRenderTarget; this._halfBlur( e, a, t, r, n, "latitudinal", o ), this._halfBlur( a, e, r, r, n, "longitudinal", o ); } _halfBlur(e, t, r, n, o, a, s) { const c = this._renderer, l = this._blurMaterial; a !== "latitudinal" && a !== "longitudinal" && console.error( "blur direction must be either latitudinal or longitudinal!" ); const h = 3, u = new ei(Ls[n], l), p = l.uniforms, m = Ev[r] - 1, g = isFinite(o) ? Math.PI / (2 * m) : 2 * Math.PI / (2 * ma - 1), d = o / g, y = isFinite(o) ? 1 + Math.floor(h * d) : ma; y > ma && console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${ma}`); const f = []; let v = 0; for (let w = 0; w < ma; ++w) { const b = w / d, E = Math.exp(-b * b / 2); f.push(E), w == 0 ? v += E : w < y && (v += 2 * E); } for (let w = 0; w < f.length; w++) f[w] = f[w] / v; p.envMap.value = e.texture, p.samples.value = y, p.weights.value = f, p.latitudinal.value = a === "latitudinal", s && (p.poleAxis.value = s), p.dTheta.value = g, p.mipInt.value = jn - r, p.inputEncoding.value = Or[e.texture.encoding], p.outputEncoding.value = Or[e.texture.encoding]; const _ = Ev[n], M = 3 * Math.max(0, Ar - 2 * _), T = (n === 0 ? 0 : 2 * Ar) + 2 * _ * (n > jn - Ea ? n - jn + Ea : 0); Lc(t, M, T, 3 * _, 2 * _), c.setRenderTarget(t), c.render(u, Uh); } } function rk(i) { return i === void 0 || i.type !== Po ? !1 : i.encoding === Di || i.encoding === Do || i.encoding === Au; } function nk() { const i = [], e = [], t = []; let r = jn; for (let n = 0; n < M1; n++) { const o = Math.pow(2, r); e.push(o); let a = 1 / o; n > jn - Ea ? a = _1[n - jn + Ea - 1] : n == 0 && (a = 0), t.push(a); const s = 1 / (o - 1), c = -s / 2, l = 1 + s / 2, h = [c, c, l, c, l, l, c, c, l, l, c, l], u = 6, p = 6, m = 3, g = 2, d = 1, y = new Float32Array(m * p * u), f = new Float32Array(g * p * u), v = new Float32Array(d * p * u); for (let M = 0; M < u; M++) { const T = M % 3 * 2 / 3 - 1, w = M > 2 ? 0 : -1, b = [ T, w, 0, T + 2 / 3, w, 0, T + 2 / 3, w + 1, 0, T, w, 0, T + 2 / 3, w + 1, 0, T, w + 1, 0 ]; y.set(b, m * p * M), f.set(h, g * p * M); const E = [M, M, M, M, M, M]; v.set(E, d * p * M); } const _ = new Ye(); _.setAttribute("position", new tt(y, m)), _.setAttribute("uv", new tt(f, g)), _.setAttribute("faceIndex", new tt(v, d)), i.push(_), r > Ea && r--; } return { _lodPlanes: i, _sizeLods: e, _sigmas: t }; } function Rv(i) { const e = new yr(3 * Ar, 3 * Ar, i); return e.texture.mapping = ls, e.texture.name = "PMREM.cubeUv", e.scissorTest = !0, e; } function Lc(i, e, t, r, n) { i.viewport.set(e, t, r, n), i.scissor.set(e, t, r, n); } function ok(i) { const e = new Float32Array(i), t = new Z(0, 1, 0); return new ds({ name: "SphericalGaussianBlur", defines: { n: i }, uniforms: { envMap: { value: null }, samples: { value: 1 }, weights: { value: e }, latitudinal: { value: !1 }, dTheta: { value: 0 }, mipInt: { value: 0 }, poleAxis: { value: t }, inputEncoding: { value: Or[Di] }, outputEncoding: { value: Or[Di] } }, vertexShader: Df(), 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; ${Nf()} #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: an, depthTest: !1, depthWrite: !1 }); } function Ov() { const i = new Re(1, 1); return new ds({ name: "EquirectangularToCubeUV", uniforms: { envMap: { value: null }, texelSize: { value: i }, inputEncoding: { value: Or[Di] }, outputEncoding: { value: Or[Di] } }, vertexShader: Df(), fragmentShader: ( /* glsl */ ` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform vec2 texelSize; ${Nf()} #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: an, depthTest: !1, depthWrite: !1 }); } function Pv() { return new ds({ name: "CubemapToCubeUV", uniforms: { envMap: { value: null }, inputEncoding: { value: Or[Di] }, outputEncoding: { value: Or[Di] } }, vertexShader: Df(), fragmentShader: ( /* glsl */ ` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform samplerCube envMap; ${Nf()} 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: an, depthTest: !1, depthWrite: !1 }); } function Df() { 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 Nf() { 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 ak = 0, sk = 1, lk = 0, ck = 1, uk = 2; function hk(i) { return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."), i; } function dk(i = []) { return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."), i.isMultiMaterial = !0, i.materials = i, i.clone = function() { return i.slice(); }, i; } function pk(i, e) { return console.warn("THREE.PointCloud has been renamed to THREE.Points."), new hs(i, e); } function fk(i) { return console.warn("THREE.Particle has been renamed to THREE.Sprite."), new El(i); } function mk(i, e) { return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."), new hs(i, e); } function gk(i) { return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."), new oo(i); } function vk(i) { return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."), new oo(i); } function yk(i) { return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."), new oo(i); } function bk(i, e, t) { return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."), new Z(i, e, t); } function xk(i, e) { return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."), new tt(i, e).setUsage(za); } function wk(i, e) { return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."), new gx(i, e); } function _k(i, e) { return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."), new vx(i, e); } function Mk(i, e) { return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."), new yx(i, e); } function Sk(i, e) { return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."), new bx(i, e); } function Tk(i, e) { return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."), new Lu(i, e); } function Ek(i, e) { return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."), new xx(i, e); } function Ak(i, e) { return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."), new Ru(i, e); } function Ck(i, e) { return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."), new je(i, e); } function Lk(i, e) { return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."), new _x(i, e); } Ji.create = function(i, e) { return console.log("THREE.Curve.create() has been deprecated"), i.prototype = Object.create(Ji.prototype), i.prototype.constructor = i, i.prototype.getPoint = e, i; }; sl.prototype.fromPoints = function(i) { return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."), this.setFromPoints(i); }; function Rk(i) { return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."), new x1(i); } function Ok(i, e) { return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."), new b1(i, e); } function Pk(i, e) { return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."), new Bi(new tf(i.geometry), new li({ color: e !== void 0 ? e : 16777215 })); } y1.prototype.setColors = function() { console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead."); }; g1.prototype.update = function() { console.error("THREE.SkeletonHelper: update() no longer needs to be called."); }; function Ik(i, e) { return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."), new Bi(new cf(i.geometry), new li({ color: e !== void 0 ? e : 16777215 })); } _i.prototype.extractUrlBase = function(i) { return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."), ln.extractUrlBase(i); }; _i.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 Dk(i) { return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."), new Ki(i); } function Nk(i) { return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."), new Yx(i); } fs.prototype.center = function(i) { return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."), this.getCenter(i); }; fs.prototype.empty = function() { return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."), this.isEmpty(); }; fs.prototype.isIntersectionBox = function(i) { return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(i); }; fs.prototype.size = function(i) { return console.warn("THREE.Box2: .size() has been renamed to .getSize()."), this.getSize(i); }; ji.prototype.center = function(i) { return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."), this.getCenter(i); }; ji.prototype.empty = function() { return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."), this.isEmpty(); }; ji.prototype.isIntersectionBox = function(i) { return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(i); }; ji.prototype.isIntersectionSphere = function(i) { return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(i); }; ji.prototype.size = function(i) { return console.warn("THREE.Box3: .size() has been renamed to .getSize()."), this.getSize(i); }; xn.prototype.empty = function() { return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."), this.isEmpty(); }; _l.prototype.setFromMatrix = function(i) { return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."), this.setFromProjectionMatrix(i); }; f1.prototype.center = function(i) { return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."), this.getCenter(i); }; ai.prototype.flattenToArrayOffset = function(i, e) { return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(i, e); }; ai.prototype.multiplyVector3 = function(i) { return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."), i.applyMatrix3(this); }; ai.prototype.multiplyVector3Array = function() { console.error("THREE.Matrix3: .multiplyVector3Array() has been removed."); }; ai.prototype.applyToBufferAttribute = function(i) { return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."), i.applyMatrix3(this); }; ai.prototype.applyToVector3Array = function() { console.error("THREE.Matrix3: .applyToVector3Array() has been removed."); }; ai.prototype.getInverse = function(i) { return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."), this.copy(i).invert(); }; $e.prototype.extractPosition = function(i) { return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."), this.copyPosition(i); }; $e.prototype.flattenToArrayOffset = function(i, e) { return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(i, e); }; $e.prototype.getPosition = function() { return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."), new Z().setFromMatrixColumn(this, 3); }; $e.prototype.setRotationFromQuaternion = function(i) { return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."), this.makeRotationFromQuaternion(i); }; $e.prototype.multiplyToArray = function() { console.warn("THREE.Matrix4: .multiplyToArray() has been removed."); }; $e.prototype.multiplyVector3 = function(i) { return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."), i.applyMatrix4(this); }; $e.prototype.multiplyVector4 = function(i) { return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."), i.applyMatrix4(this); }; $e.prototype.multiplyVector3Array = function() { console.error("THREE.Matrix4: .multiplyVector3Array() has been removed."); }; $e.prototype.rotateAxis = function(i) { console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."), i.transformDirection(this); }; $e.prototype.crossVector = function(i) { return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."), i.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(i) { return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."), i.applyMatrix4(this); }; $e.prototype.applyToVector3Array = function() { console.error("THREE.Matrix4: .applyToVector3Array() has been removed."); }; $e.prototype.makeFrustum = function(i, e, t, r, n, o) { return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."), this.makePerspective(i, e, r, t, n, o); }; $e.prototype.getInverse = function(i) { return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."), this.copy(i).invert(); }; Cr.prototype.isIntersectionLine = function(i) { return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."), this.intersectsLine(i); }; wi.prototype.multiplyVector3 = function(i) { return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."), i.applyQuaternion(this); }; wi.prototype.inverse = function() { return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."), this.invert(); }; ro.prototype.isIntersectionBox = function(i) { return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(i); }; ro.prototype.isIntersectionPlane = function(i) { return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."), this.intersectsPlane(i); }; ro.prototype.isIntersectionSphere = function(i) { return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(i); }; Kt.prototype.area = function() { return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."), this.getArea(); }; Kt.prototype.barycoordFromPoint = function(i, e) { return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), this.getBarycoord(i, e); }; Kt.prototype.midpoint = function(i) { return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."), this.getMidpoint(i); }; Kt.prototypenormal = function(i) { return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), this.getNormal(i); }; Kt.prototype.plane = function(i) { return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."), this.getPlane(i); }; Kt.barycoordFromPoint = function(i, e, t, r, n) { return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), Kt.getBarycoord(i, e, t, r, n); }; Kt.normal = function(i, e, t, r) { return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), Kt.getNormal(i, e, t, r); }; Hn.prototype.extractAllPoints = function(i) { return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."), this.extractPoints(i); }; Hn.prototype.extrude = function(i) { return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."), new xr(this, i); }; Hn.prototype.makeGeometry = function(i) { return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."), new ko(this, i); }; Re.prototype.fromAttribute = function(i, e, t) { return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(i, e, t); }; Re.prototype.distanceToManhattan = function(i) { return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(i); }; Re.prototype.lengthManhattan = function() { return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength(); }; Z.prototype.setEulerFromRotationMatrix = function() { console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead."); }; Z.prototype.setEulerFromQuaternion = function() { console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead."); }; Z.prototype.getPositionFromMatrix = function(i) { return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."), this.setFromMatrixPosition(i); }; Z.prototype.getScaleFromMatrix = function(i) { return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."), this.setFromMatrixScale(i); }; Z.prototype.getColumnFromMatrix = function(i, e) { return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."), this.setFromMatrixColumn(e, i); }; Z.prototype.applyProjection = function(i) { return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."), this.applyMatrix4(i); }; Z.prototype.fromAttribute = function(i, e, t) { return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(i, e, t); }; Z.prototype.distanceToManhattan = function(i) { return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(i); }; Z.prototype.lengthManhattan = function() { return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength(); }; St.prototype.fromAttribute = function(i, e, t) { return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(i, e, t); }; St.prototype.lengthManhattan = function() { return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength(); }; ot.prototype.getChildByName = function(i) { return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."), this.getObjectByName(i); }; ot.prototype.renderDepth = function() { console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead."); }; ot.prototype.translate = function(i, e) { return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."), this.translateOnAxis(e, i); }; ot.prototype.getWorldRotation = function() { console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead."); }; ot.prototype.applyMatrix = function(i) { return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(i); }; Object.defineProperties(ot.prototype, { eulerOrder: { get: function() { return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order; }, set: function(i) { console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order = i; } }, 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."); } } }); ei.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(ei.prototype, { drawMode: { get: function() { return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."), ox; }, 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."); }; oi.prototype.setLens = function(i, e) { console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."), e !== void 0 && (this.filmGauge = e), this.setFocalLength(i); }; Object.defineProperties(wr.prototype, { onlyShadow: { set: function() { console.warn("THREE.Light: .onlyShadow has been removed."); } }, shadowCameraFov: { set: function(i) { console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."), this.shadow.camera.fov = i; } }, shadowCameraLeft: { set: function(i) { console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."), this.shadow.camera.left = i; } }, shadowCameraRight: { set: function(i) { console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."), this.shadow.camera.right = i; } }, shadowCameraTop: { set: function(i) { console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."), this.shadow.camera.top = i; } }, shadowCameraBottom: { set: function(i) { console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."), this.shadow.camera.bottom = i; } }, shadowCameraNear: { set: function(i) { console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."), this.shadow.camera.near = i; } }, shadowCameraFar: { set: function(i) { console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."), this.shadow.camera.far = i; } }, shadowCameraVisible: { set: function() { console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead."); } }, shadowBias: { set: function(i) { console.warn("THREE.Light: .shadowBias is now .shadow.bias."), this.shadow.bias = i; } }, shadowDarkness: { set: function() { console.warn("THREE.Light: .shadowDarkness has been removed."); } }, shadowMapWidth: { set: function(i) { console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."), this.shadow.mapSize.width = i; } }, shadowMapHeight: { set: function(i) { console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."), this.shadow.mapSize.height = i; } } }); Object.defineProperties(tt.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 === za; }, set: function() { console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."), this.setUsage(za); } } }); tt.prototype.setDynamic = function(i) { return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."), this.setUsage(i === !0 ? za : Fa), this; }; tt.prototype.copyIndicesArray = function() { console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed."); }, tt.prototype.setArray = function() { console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers"); }; Ye.prototype.addIndex = function(i) { console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."), this.setIndex(i); }; Ye.prototype.addAttribute = function(i, 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(i, new tt(arguments[1], arguments[2]))) : i === "index" ? (console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."), this.setIndex(e), this) : this.setAttribute(i, e); }; Ye.prototype.addDrawCall = function(i, e, t) { t !== void 0 && console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."), console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."), this.addGroup(i, e); }; Ye.prototype.clearDrawCalls = function() { console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."), this.clearGroups(); }; Ye.prototype.computeOffsets = function() { console.warn("THREE.BufferGeometry: .computeOffsets() has been removed."); }; Ye.prototype.removeAttribute = function(i) { return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."), this.deleteAttribute(i); }; Ye.prototype.applyMatrix = function(i) { return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(i); }; Object.defineProperties(Ye.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; } } }); no.prototype.setDynamic = function(i) { return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."), this.setUsage(i === !0 ? za : Fa), this; }; no.prototype.setArray = function() { console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers"); }; xr.prototype.getArrays = function() { console.error("THREE.ExtrudeGeometry: .getArrays() has been removed."); }; xr.prototype.addShapeList = function() { console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed."); }; xr.prototype.addShape = function() { console.error("THREE.ExtrudeGeometry: .addShape() has been removed."); }; Nu.prototype.dispose = function() { console.error("THREE.Scene: .dispose() has been removed."); }; Gu.prototype.onUpdate = function() { return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."), this; }; Object.defineProperties(ri.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 Be(); } }, shading: { get: function() { console.error("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."); }, set: function(i) { console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."), this.flatShading = i === zp; } }, stencilMask: { get: function() { return console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."), this.stencilFuncMask; }, set: function(i) { console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."), this.stencilFuncMask = i; } } }); Object.defineProperties(dn.prototype, { derivatives: { get: function() { return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives; }, set: function(i) { console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives = i; } } }); Et.prototype.clearTarget = function(i, e, t, r) { console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."), this.setRenderTarget(i), this.clear(e, t, r); }; Et.prototype.animate = function(i) { console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."), this.setAnimationLoop(i); }; 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(i) { console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."), this.setScissorTest(i); }; 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(i) { console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."), this.shadowMap.enabled = i; } }, shadowMapType: { get: function() { return this.shadowMap.type; }, set: function(i) { console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."), this.shadowMap.type = i; } }, 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(i) { console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."), this.outputEncoding = i === !0 ? Do : Di; } }, 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(Ix.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 Bk(i, e, t) { return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."), new Pu(i, t); } Object.defineProperties(yr.prototype, { wrapS: { get: function() { return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS; }, set: function(i) { console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS = i; } }, wrapT: { get: function() { return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT; }, set: function(i) { console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT = i; } }, magFilter: { get: function() { return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter; }, set: function(i) { console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter = i; } }, minFilter: { get: function() { return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter; }, set: function(i) { console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter = i; } }, anisotropy: { get: function() { return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy; }, set: function(i) { console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy = i; } }, offset: { get: function() { return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset; }, set: function(i) { console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset = i; } }, repeat: { get: function() { return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat; }, set: function(i) { console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat = i; } }, format: { get: function() { return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format; }, set: function(i) { console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format = i; } }, type: { get: function() { return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type; }, set: function(i) { console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type = i; } }, generateMipmaps: { get: function() { return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps; }, set: function(i) { console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps = i; } } }); Of.prototype.load = function(i) { console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead."); const e = this; return new n1().load(i, function(t) { e.setBuffer(t); }), this; }; l1.prototype.getData = function() { return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."), this.getFrequencyData(); }; Ou.prototype.updateCubeMap = function(i, e) { return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."), this.update(i, e); }; Ou.prototype.clear = function(i, e, t, r) { return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."), this.renderTarget.clear(i, e, t, r); }; Go.crossOrigin = void 0; Go.loadTexture = function(i, e, t, r) { console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead."); const n = new xf(); n.setCrossOrigin(this.crossOrigin); const o = n.load(i, t, void 0, r); return e && (o.mapping = e), o; }; Go.loadTextureCube = function(i, e, t, r) { console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead."); const n = new Zx(); n.setCrossOrigin(this.crossOrigin); const o = n.load(i, t, void 0, r); return e && (o.mapping = e), o; }; Go.loadCompressedTexture = function() { console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead."); }; Go.loadCompressedTextureCube = function() { console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead."); }; function kk() { console.error("THREE.CanvasRenderer has been removed"); } function Fk() { console.error("THREE.JSONLoader has been removed."); } const zk = { 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 Uk() { 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: kp } })); typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = kp); const Vk = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, ACESFilmicToneMapping: lb, AddEquation: bo, AddOperation: nb, AdditiveAnimationBlendMode: Hp, AdditiveBlending: yd, AlphaFormat: gb, AlwaysDepth: Jy, AlwaysStencilFunc: hx, AmbientLight: Mf, AmbientLightProbe: a1, AnimationClip: Qa, AnimationLoader: yB, AnimationMixer: h1, AnimationObjectGroup: u1, AnimationUtils: Pt, ArcCurve: rf, ArrayCamera: Kp, ArrowHelper: KB, Audio: Of, AudioAnalyser: l1, AudioContext: Rf, AudioListener: AB, AudioLoader: n1, AxesHelper: x1, AxisHelper: Rk, BackSide: Yt, BasicDepthPacking: lx, BasicShadowMap: PR, BinaryTextureLoader: Nk, Bone: Cl, BooleanKeyframeTrack: qo, BoundingBoxHelper: Ok, Box2: fs, Box3: ji, Box3Helper: YB, BoxBufferGeometry: hn, BoxGeometry: hn, BoxHelper: b1, BufferAttribute: tt, BufferGeometry: Ye, BufferGeometryLoader: i1, ByteType: ub, Cache: zo, Camera: wl, CameraHelper: ZB, CanvasRenderer: kk, CanvasTexture: zx, CatmullRomCurve3: of, CineonToneMapping: sb, CircleBufferGeometry: Va, CircleGeometry: Va, ClampToEdgeWrapping: di, Clock: s1, Color: Be, ColorKeyframeTrack: yf, CompressedTexture: ef, CompressedTextureLoader: bB, ConeBufferGeometry: Ha, ConeGeometry: Ha, CubeCamera: Ou, CubeReflectionMapping: yl, CubeRefractionMapping: bl, CubeTexture: cs, CubeTextureLoader: Zx, CubeUVReflectionMapping: ls, CubeUVRefractionMapping: xl, CubicBezierCurve: ku, CubicBezierCurve3: af, CubicInterpolant: Wx, CullFaceBack: vd, CullFaceFront: By, CullFaceFrontBack: OR, CullFaceNone: Ny, Curve: Ji, CurvePath: Jx, CustomBlending: Fy, CustomToneMapping: cb, CylinderBufferGeometry: Jn, CylinderGeometry: Jn, Cylindrical: HB, DataTexture: Lo, DataTexture2DArray: Yp, DataTexture3D: Jp, DataTextureLoader: Yx, DataUtils: ek, DecrementStencilOp: VR, DecrementWrapStencilOp: jR, DefaultLoadingManager: Xx, DepthFormat: Ao, DepthStencilFormat: Ba, DepthTexture: Ux, DirectionalLight: ju, DirectionalLightHelper: XB, DiscreteInterpolant: $x, DodecahedronBufferGeometry: ja, DodecahedronGeometry: ja, DoubleSide: Zn, DstAlphaFactor: Wy, DstColorFactor: qy, DynamicBufferAttribute: xk, DynamicCopyUsage: rO, DynamicDrawUsage: za, DynamicReadUsage: eO, EdgesGeometry: tf, EdgesHelper: Pk, EllipseCurve: Rl, EqualDepth: Qy, EqualStencilFunc: qR, EquirectangularReflectionMapping: Qc, EquirectangularRefractionMapping: eu, Euler: Wo, EventDispatcher: io, ExtrudeBufferGeometry: xr, ExtrudeGeometry: xr, FaceColors: ck, FileLoader: Ki, FlatShading: zp, Float16BufferAttribute: wx, Float32Attribute: Ck, Float32BufferAttribute: je, Float64Attribute: Lk, Float64BufferAttribute: _x, FloatType: tn, Fog: Sl, FogExp2: Ml, Font: Lf, FontLoader: SB, FrontSide: Xn, Frustum: _l, GLBufferAttribute: p1, GLSL1: oO, GLSL3: Id, GammaEncoding: Au, GreaterDepth: tb, GreaterEqualDepth: eb, GreaterEqualStencilFunc: JR, GreaterStencilFunc: ZR, GridHelper: y1, Group: Rr, HalfFloatType: Eo, HemisphereLight: wf, HemisphereLightHelper: $B, HemisphereLightProbe: o1, IcosahedronBufferGeometry: Ga, IcosahedronGeometry: Ga, ImageBitmapLoader: Cf, ImageLoader: al, ImageUtils: Go, ImmediateRenderObject: m1, IncrementStencilOp: UR, IncrementWrapStencilOp: HR, InstancedBufferAttribute: Af, InstancedBufferGeometry: Ef, InstancedInterleavedBuffer: d1, InstancedMesh: Qp, Int16Attribute: Sk, Int16BufferAttribute: bx, Int32Attribute: Ek, Int32BufferAttribute: xx, Int8Attribute: wk, Int8BufferAttribute: gx, IntType: db, InterleavedBuffer: no, InterleavedBufferAttribute: pn, Interpolant: Ur, InterpolateDiscrete: ka, InterpolateLinear: Io, InterpolateSmooth: Uc, InvertStencilOp: GR, JSONLoader: Fk, KeepStencilOp: Vc, KeyframeTrack: Sr, LOD: kx, LatheBufferGeometry: Wa, LatheGeometry: Wa, Layers: Zp, LensFlare: Uk, LessDepth: Ky, LessEqualDepth: Kc, LessEqualStencilFunc: XR, LessStencilFunc: $R, Light: wr, LightProbe: Il, Line: Fr, Line3: f1, LineBasicMaterial: li, LineCurve: Ol, LineCurve3: Vx, LineDashedMaterial: gf, LineLoop: Bu, LinePieces: sk, LineSegments: Bi, LineStrip: ak, LinearEncoding: Di, LinearFilter: Wt, LinearInterpolant: vf, LinearMipMapLinearFilter: kR, LinearMipMapNearestFilter: BR, LinearMipmapLinearFilter: bn, LinearMipmapNearestFilter: Tu, LinearToneMapping: ob, Loader: _i, LoaderUtils: ln, LoadingManager: bf, LogLuvEncoding: sx, LoopOnce: ix, LoopPingPong: nx, LoopRepeat: rx, LuminanceAlphaFormat: yb, LuminanceFormat: vb, MOUSE: LR, Material: ri, MaterialLoader: t1, Math: Nd, MathUtils: Nd, Matrix3: ai, Matrix4: $e, MaxEquation: _d, Mesh: ei, MeshBasicMaterial: Ui, MeshDepthMaterial: Iu, MeshDistanceMaterial: Du, MeshFaceMaterial: hk, MeshLambertMaterial: ff, MeshMatcapMaterial: mf, MeshNormalMaterial: pf, MeshPhongMaterial: hf, MeshPhysicalMaterial: Pl, MeshStandardMaterial: $o, MeshToonMaterial: df, MinEquation: wd, MirroredRepeatWrapping: Na, MixOperation: rb, MultiMaterial: dk, MultiplyBlending: xd, MultiplyOperation: vl, NearestFilter: Jt, NearestMipMapLinearFilter: NR, NearestMipMapNearestFilter: DR, NearestMipmapLinearFilter: Qs, NearestMipmapNearestFilter: Ks, NeverDepth: Yy, NeverStencilFunc: WR, NoBlending: an, NoColors: lk, NoToneMapping: Un, NormalAnimationBlendMode: Eu, NormalBlending: Sa, NotEqualDepth: ib, NotEqualStencilFunc: YR, NumberKeyframeTrack: Ja, Object3D: ot, ObjectLoader: xB, ObjectSpaceNormalMap: ux, OctahedronBufferGeometry: Bo, OctahedronGeometry: Bo, OneFactor: Hy, OneMinusDstAlphaFactor: $y, OneMinusDstColorFactor: Xy, OneMinusSrcAlphaFactor: Vp, OneMinusSrcColorFactor: Gy, OrthographicCamera: ps, PCFShadowMap: Fp, PCFSoftShadowMap: ky, PMREMGenerator: ik, ParametricBufferGeometry: tu, ParametricGeometry: tu, Particle: fk, ParticleBasicMaterial: vk, ParticleSystem: mk, ParticleSystemMaterial: yk, Path: sl, PerspectiveCamera: oi, Plane: Cr, PlaneBufferGeometry: No, PlaneGeometry: No, PlaneHelper: JB, PointCloud: pk, PointCloudMaterial: gk, PointLight: Hu, PointLightHelper: GB, Points: hs, PointsMaterial: oo, PolarGridHelper: qB, PolyhedronBufferGeometry: zr, PolyhedronGeometry: zr, PositionalAudio: LB, PropertyBinding: pt, PropertyMixer: c1, QuadraticBezierCurve: Fu, QuadraticBezierCurve3: sf, Quaternion: wi, QuaternionKeyframeTrack: Xo, QuaternionLinearInterpolant: qx, REVISION: kp, RGBADepthPacking: cx, RGBAFormat: Xi, RGBAIntegerFormat: Tb, RGBA_ASTC_10x10_Format: Fb, RGBA_ASTC_10x5_Format: Nb, RGBA_ASTC_10x6_Format: Bb, RGBA_ASTC_10x8_Format: kb, RGBA_ASTC_12x10_Format: zb, RGBA_ASTC_12x12_Format: Ub, RGBA_ASTC_4x4_Format: Ab, RGBA_ASTC_5x4_Format: Cb, RGBA_ASTC_5x5_Format: Lb, RGBA_ASTC_6x5_Format: Rb, RGBA_ASTC_6x6_Format: Ob, RGBA_ASTC_8x5_Format: Pb, RGBA_ASTC_8x6_Format: Ib, RGBA_ASTC_8x8_Format: Db, RGBA_BPTC_Format: Vb, RGBA_ETC2_EAC_Format: Pd, RGBA_PVRTC_2BPPV1_Format: Rd, RGBA_PVRTC_4BPPV1_Format: Ld, RGBA_S3TC_DXT1_Format: Sd, RGBA_S3TC_DXT3_Format: Td, RGBA_S3TC_DXT5_Format: Ed, RGBDEncoding: $p, RGBEEncoding: Cu, RGBEFormat: bb, RGBFormat: sn, RGBIntegerFormat: Sb, RGBM16Encoding: Wp, RGBM7Encoding: Gp, RGB_ETC1_Format: Eb, RGB_ETC2_Format: Od, RGB_PVRTC_2BPPV1_Format: Cd, RGB_PVRTC_4BPPV1_Format: Ad, RGB_S3TC_DXT1_Format: Md, RGFormat: _b, RGIntegerFormat: Mb, RawShaderMaterial: ds, Ray: ro, Raycaster: UB, RectAreaLight: Sf, RedFormat: xb, RedIntegerFormat: wb, ReinhardToneMapping: ab, RepeatWrapping: Yn, ReplaceStencilOp: zR, ReverseSubtractEquation: Uy, RingBufferGeometry: $a, RingGeometry: $a, SRGB8_ALPHA8_ASTC_10x10_Format: Qb, SRGB8_ALPHA8_ASTC_10x5_Format: Yb, SRGB8_ALPHA8_ASTC_10x6_Format: Jb, SRGB8_ALPHA8_ASTC_10x8_Format: Kb, SRGB8_ALPHA8_ASTC_12x10_Format: ex, SRGB8_ALPHA8_ASTC_12x12_Format: tx, SRGB8_ALPHA8_ASTC_4x4_Format: Hb, SRGB8_ALPHA8_ASTC_5x4_Format: jb, SRGB8_ALPHA8_ASTC_5x5_Format: Gb, SRGB8_ALPHA8_ASTC_6x5_Format: Wb, SRGB8_ALPHA8_ASTC_6x6_Format: $b, SRGB8_ALPHA8_ASTC_8x5_Format: qb, SRGB8_ALPHA8_ASTC_8x6_Format: Xb, SRGB8_ALPHA8_ASTC_8x8_Format: Zb, Scene: Nu, SceneUtils: zk, ShaderChunk: lt, ShaderLib: mr, ShaderMaterial: dn, ShadowMaterial: uf, Shape: Hn, ShapeBufferGeometry: ko, ShapeGeometry: ko, ShapePath: r1, ShapeUtils: Nr, ShortType: hb, Skeleton: Ll, SkeletonHelper: g1, SkinnedMesh: Al, SmoothShading: IR, Sphere: xn, SphereBufferGeometry: Fo, SphereGeometry: Fo, Spherical: VB, SphericalHarmonics3: Tf, SplineCurve: zu, SpotLight: Vu, SpotLightHelper: jB, Sprite: El, SpriteMaterial: Tl, SrcAlphaFactor: Up, SrcAlphaSaturateFactor: Zy, SrcColorFactor: jy, StaticCopyUsage: iO, StaticDrawUsage: Fa, StaticReadUsage: QR, StereoCamera: TB, StreamCopyUsage: nO, StreamDrawUsage: KR, StreamReadUsage: tO, StringKeyframeTrack: Zo, SubtractEquation: zy, SubtractiveBlending: bd, TOUCH: RR, TangentSpaceNormalMap: to, TetrahedronBufferGeometry: qa, TetrahedronGeometry: qa, TextBufferGeometry: iu, TextGeometry: iu, Texture: ti, TextureLoader: xf, TorusBufferGeometry: Xa, TorusGeometry: Xa, TorusKnotBufferGeometry: Za, TorusKnotGeometry: Za, Triangle: Kt, TriangleFanDrawMode: jp, TriangleStripDrawMode: ax, TrianglesDrawMode: ox, TubeBufferGeometry: Ya, TubeGeometry: Ya, UVMapping: Su, Uint16Attribute: Tk, Uint16BufferAttribute: Lu, Uint32Attribute: Ak, Uint32BufferAttribute: Ru, Uint8Attribute: _k, Uint8BufferAttribute: vx, Uint8ClampedAttribute: Mk, Uint8ClampedBufferAttribute: yx, Uniform: Gu, UniformsLib: Fe, UniformsUtils: Sx, UnsignedByteType: Po, UnsignedInt248Type: Ta, UnsignedIntType: Us, UnsignedShort4444Type: pb, UnsignedShort5551Type: fb, UnsignedShort565Type: mb, UnsignedShortType: el, VSMShadowMap: wa, Vector2: Re, Vector3: Z, Vector4: St, VectorKeyframeTrack: Ka, Vertex: bk, VertexColors: uk, VideoTexture: Fx, WebGL1Renderer: Nx, WebGLCubeRenderTarget: Pu, WebGLMultipleRenderTargets: fx, WebGLMultisampleRenderTarget: Xp, WebGLRenderTarget: yr, WebGLRenderTargetCube: Bk, WebGLRenderer: Et, WebGLUtils: Dx, WireframeGeometry: cf, WireframeHelper: Ik, WrapAroundEnding: tl, XHRLoader: Dk, ZeroCurvatureEnding: wo, ZeroFactor: Vy, ZeroSlopeEnding: _o, ZeroStencilOp: FR, sRGBEncoding: Do }, Symbol.toStringTag, { value: "Module" })), Hk = /* @__PURE__ */ xu(Vk); function jk(i, e) { if (!(i instanceof e)) throw new TypeError("Cannot call a class as a function"); } function Gk(i, e) { for (var t = 0; t < e.length; t++) { var r = e[t]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(i, r.key, r); } } function Wk(i, e, t) { return e && Gk(i.prototype, e), i; } function $k(i, e) { if (typeof e != "function" && e !== null) throw new TypeError("Super expression must either be null or a function"); i.prototype = Object.create(e && e.prototype, { constructor: { value: i, writable: !0, configurable: !0 } }), e && Vd(i, e); } function ru(i) { return ru = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) { return e.__proto__ || Object.getPrototypeOf(e); }, ru(i); } function Vd(i, e) { return Vd = Object.setPrototypeOf || function(t, r) { return t.__proto__ = r, t; }, Vd(i, e); } function qk() { 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 Xk(i) { if (i === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return i; } function Zk(i, e) { return e && (typeof e == "object" || typeof e == "function") ? e : Xk(i); } function Yk(i) { var e = qk(); return function() { var t = ru(i), r; if (e) { var n = ru(this).constructor; r = Reflect.construct(t, arguments, n); } else r = t.apply(this, arguments); return Zk(this, r); }; } function Iv(i, e) { return Kk(i) || e4(i, e) || S1(i, e) || i4(); } function Rc(i) { return Jk(i) || Qk(i) || S1(i) || t4(); } function Jk(i) { if (Array.isArray(i)) return Hd(i); } function Kk(i) { if (Array.isArray(i)) return i; } function Qk(i) { if (typeof Symbol < "u" && i[Symbol.iterator] != null || i["@@iterator"] != null) return Array.from(i); } function e4(i, e) { var t = i && (typeof Symbol < "u" && i[Symbol.iterator] || i["@@iterator"]); if (t != null) { var r = [], n = !0, o = !1, a, s; try { for (t = t.call(i); !(n = (a = t.next()).done) && (r.push(a.value), !(e && r.length === e)); n = !0) ; } catch (c) { o = !0, s = c; } finally { try { !n && t.return != null && t.return(); } finally { if (o) throw s; } } return r; } } function S1(i, e) { if (i) { if (typeof i == "string") return Hd(i, e); var t = Object.prototype.toString.call(i).slice(8, -1); if (t === "Object" && i.constructor && (t = i.constructor.name), t === "Map" || t === "Set") return Array.from(i); if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return Hd(i, e); } } function Hd(i, e) { (e == null || e > i.length) && (e = i.length); for (var t = 0, r = new Array(e); t < e; t++) r[t] = i[t]; return r; } function t4() { 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 i4() { 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 Rs = typeof window < "u" && window.THREE ? window.THREE : { LinearFilter: Wt, Sprite: El, SpriteMaterial: Tl, Texture: ti }, r4 = /* @__PURE__ */ function(i) { $k(t, i); var e = Yk(t); function t() { var r, n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "rgba(255, 255, 255, 1)"; return jk(this, t), r = e.call(this, new Rs.SpriteMaterial({ map: new Rs.Texture() })), r._text = "".concat(n), r._textHeight = o, r._color = a, r._backgroundColor = !1, r._padding = 0, r._borderWidth = 0, r._borderRadius = 0, r._borderColor = "white", r._strokeWidth = 0, r._strokeColor = "white", r._fontFace = "Arial", r._fontSize = 90, r._fontWeight = "normal", r._canvas = document.createElement("canvas"), r._texture = r.material.map, r._texture.minFilter = Rs.LinearFilter, r._genCanvas(), r; } return Wk(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, n = this._canvas, o = n.getContext("2d"), a = Array.isArray(this.borderWidth) ? this.borderWidth : [this.borderWidth, this.borderWidth], s = a.map(function(w) { return w * r.fontSize * 0.1; }), c = Array.isArray(this.borderRadius) ? this.borderRadius : [this.borderRadius, this.borderRadius, this.borderRadius, this.borderRadius], l = c.map(function(w) { return w * r.fontSize * 0.1; }), h = Array.isArray(this.padding) ? this.padding : [this.padding, this.padding], u = h.map(function(w) { return w * r.fontSize * 0.1; }), p = this.text.split(` `), m = "".concat(this.fontWeight, " ").concat(this.fontSize, "px ").concat(this.fontFace); o.font = m; var g = Math.max.apply(Math, Rc(p.map(function(w) { return o.measureText(w).width; }))), d = this.fontSize * p.length; if (n.width = g + s[0] * 2 + u[0] * 2, n.height = d + s[1] * 2 + u[1] * 2, this.borderWidth) { if (o.strokeStyle = this.borderColor, s[0]) { var y = s[0] / 2; o.lineWidth = s[0], o.beginPath(), o.moveTo(y, l[0]), o.lineTo(y, n.height - l[3]), o.moveTo(n.width - y, l[1]), o.lineTo(n.width - y, n.height - l[2]), o.stroke(); } if (s[1]) { var f = s[1] / 2; o.lineWidth = s[1], o.beginPath(), o.moveTo(Math.max(s[0], l[0]), f), o.lineTo(n.width - Math.max(s[0], l[1]), f), o.moveTo(Math.max(s[0], l[3]), n.height - f), o.lineTo(n.width - Math.max(s[0], l[2]), n.height - f), o.stroke(); } if (this.borderRadius) { var v = Math.max.apply(Math, Rc(s)), _ = v / 2; o.lineWidth = v, o.beginPath(), [!!l[0] && [l[0], _, _, l[0]], !!l[1] && [n.width - l[1], n.width - _, _, l[1]], !!l[2] && [n.width - l[2], n.width - _, n.height - _, n.height - l[2]], !!l[3] && [l[3], _, n.height - _, n.height - l[3]]].filter(function(w) { return w; }).forEach(function(w) { var b = Iv(w, 4), E = b[0], S = b[1], C = b[2], R = b[3]; o.moveTo(E, C), o.quadraticCurveTo(S, C, S, R); }), o.stroke(); } } this.backgroundColor && (o.fillStyle = this.backgroundColor, this.borderRadius ? (o.beginPath(), o.moveTo(s[0], l[0]), [ [s[0], l[0], n.width - l[1], s[1], s[1], s[1]], // t [n.width - s[0], n.width - s[0], n.width - s[0], s[1], l[1], n.height - l[2]], // r [n.width - s[0], n.width - l[2], l[3], n.height - s[1], n.height - s[1], n.height - s[1]], // b [s[0], s[0], s[0], n.height - s[1], n.height - l[3], l[0]] // t ].forEach(function(w) { var b = Iv(w, 6), E = b[0], S = b[1], C = b[2], R = b[3], L = b[4], A = b[5]; o.quadraticCurveTo(E, R, S, L), o.lineTo(C, A); }), o.closePath(), o.fill()) : o.fillRect(s[0], s[1], n.width - s[0] * 2, n.height - s[1] * 2)), o.translate.apply(o, Rc(s)), o.translate.apply(o, Rc(u)), o.font = m, o.fillStyle = this.color, o.textBaseline = "bottom"; var M = this.strokeWidth > 0; M && (o.lineWidth = this.strokeWidth * this.fontSize / 10, o.strokeStyle = this.strokeColor), p.forEach(function(w, b) { var E = (g - o.measureText(w).width) / 2, S = (b + 1) * r.fontSize; M && o.strokeText(w, E, S), o.fillText(w, E, S); }), this._texture.image = n, this._texture.needsUpdate = !0; var T = this.textHeight * p.length + a[1] * 2 + h[1] * 2; this.scale.set(T * n.width / n.height, T, 0); } }, { key: "clone", value: function() { return new this.constructor(this.text, this.textHeight, this.color).copy(this); } }, { key: "copy", value: function(r) { return Rs.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; }(Rs.Sprite); const n4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: r4 }, Symbol.toStringTag, { value: "Module" })), o4 = /* @__PURE__ */ xu(n4); var Dv = { exports: {} }, Nv; function a4() { return Nv || (Nv = 1, function(i, e) { (function(t, r) { i.exports = r(); })(typeof window < "u" ? window : Bn, 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")(), r = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || function(h) { return t.setTimeout(h, 20); }, n = t.cancelAnimationFrame || t.mozCancelAnimationFrame || t.webkitCancelAnimationFrame || function(h) { t.clearTimeout(h); }; function o(h, u) { var p = Object.prototype.toString.call(h), m = p === "[object Array]" || p === "[object NodeList]" || p === "[object HTMLCollection]" || p === "[object Object]" || typeof jQuery < "u" && h instanceof jQuery || typeof Elements < "u" && h instanceof Elements, g = 0, d = h.length; if (m) for (; g < d; g++) u(h[g]); else u(h); } function a(h) { if (!h.getBoundingClientRect) return { width: h.offsetWidth, height: h.offsetHeight }; var u = h.getBoundingClientRect(); return { width: Math.round(u.width), height: Math.round(u.height) }; } function s(h, u) { Object.keys(u).forEach(function(p) { h.style[p] = u[p]; }); } var c = function(h, u) { var p = 0; function m() { var d = []; this.add = function(v) { d.push(v); }; var y, f; this.call = function(v) { for (y = 0, f = d.length; y < f; y++) d[y].call(this, v); }, this.remove = function(v) { var _ = []; for (y = 0, f = d.length; y < f; y++) d[y] !== v && _.push(d[y]); d = _; }, this.length = function() { return d.length; }; } function g(d, y) { if (d) { if (d.resizedAttached) { d.resizedAttached.add(y); return; } d.resizedAttached = new m(), d.resizedAttached.add(y), d.resizeSensor = document.createElement("div"), d.resizeSensor.dir = "ltr", d.resizeSensor.className = "resize-sensor"; var f = { pointerEvents: "none", position: "absolute", left: "0px", top: "0px", right: "0px", bottom: "0px", overflow: "hidden", zIndex: "-1", visibility: "hidden", maxWidth: "100%" }, v = { position: "absolute", left: "0px", top: "0px", transition: "0s" }; s(d.resizeSensor, f); var _ = document.createElement("div"); _.className = "resize-sensor-expand", s(_, f); var M = document.createElement("div"); s(M, v), _.appendChild(M); var T = document.createElement("div"); T.className = "resize-sensor-shrink", s(T, f); var w = document.createElement("div"); s(w, v), s(w, { width: "200%", height: "200%" }), T.appendChild(w), d.resizeSensor.appendChild(_), d.resizeSensor.appendChild(T), d.appendChild(d.resizeSensor); var b = window.getComputedStyle(d), E = b ? b.getPropertyValue("position") : null; E !== "absolute" && E !== "relative" && E !== "fixed" && E !== "sticky" && (d.style.position = "relative"); var S = !1, C = 0, R = a(d), L = 0, A = 0, P = !0; p = 0; var O = function() { var k = d.offsetWidth, F = d.offsetHeight; M.style.width = k + 10 + "px", M.style.height = F + 10 + "px", _.scrollLeft = k + 10, _.scrollTop = F + 10, T.scrollLeft = k + 10, T.scrollTop = F + 10; }, x = function() { if (P) { var k = d.offsetWidth === 0 && d.offsetHeight === 0; if (k) { p || (p = r(function() { p = 0, x(); })); return; } else P = !1; } O(); }; d.resizeSensor.resetSensor = x; var I = function() { C = 0, S && (L = R.width, A = R.height, d.resizedAttached && d.resizedAttached.call(R)); }, N = function() { R = a(d), S = R.width !== L || R.height !== A, S && !C && (C = r(I)), x(); }, D = function(k, F, W) { k.attachEvent ? k.attachEvent("on" + F, W) : k.addEventListener(F, W); }; D(_, "scroll", N), D(T, "scroll", N), p = r(function() { p = 0, x(); }); } } o(h, function(d) { g(d, u); }), this.detach = function(d) { p || (n(p), p = 0), c.detach(h, d); }, this.reset = function() { h.resizeSensor.resetSensor(); }; }; if (c.reset = function(h) { o(h, function(u) { u.resizeSensor.resetSensor(); }); }, c.detach = function(h, u) { o(h, function(p) { p && (p.resizedAttached && typeof u == "function" && (p.resizedAttached.remove(u), 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(h) { for (var u in h) if (h.hasOwnProperty(u)) for (var p = h[u].addedNodes, m = 0; m < p.length; m++) p[m].resizeSensor && c.reset(p[m]); }); document.addEventListener("DOMContentLoaded", function(h) { l.observe(document.body, { childList: !0, subtree: !0 }); }); } return c; }); }(Dv)), Dv.exports; } class s4 extends _i { constructor(e) { super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) { return new h4(t); }), this.register(function(t) { return new p4(t); }), this.register(function(t) { return new f4(t); }), this.register(function(t) { return new d4(t); }), this.register(function(t) { return new c4(t); }), this.register(function(t) { return new m4(t); }); } load(e, t, r, n) { const o = this; let a; this.resourcePath !== "" ? a = this.resourcePath : this.path !== "" ? a = this.path : a = ln.extractUrlBase(e), this.manager.itemStart(e); const s = function(l) { n ? n(l) : console.error(l), o.manager.itemError(e), o.manager.itemEnd(e); }, c = new Ki(this.manager); c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(e, function(l) { try { o.parse(l, a, function(h) { t(h), o.manager.itemEnd(e); }, s); } catch (h) { s(h); } }, r, s); } 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, r, n) { let o; const a = {}, s = {}; if (typeof e == "string") o = e; else if (ln.decodeText(new Uint8Array(e, 0, 4)) === T1) { try { a[vt.KHR_BINARY_GLTF] = new g4(e); } catch (h) { n && n(h); return; } o = a[vt.KHR_BINARY_GLTF].content; } else o = ln.decodeText(new Uint8Array(e)); const c = JSON.parse(o); if (c.asset === void 0 || c.asset.version[0] < 2) { n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")); return; } const l = new E4(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 h = 0; h < this.pluginCallbacks.length; h++) { const u = this.pluginCallbacks[h](l); s[u.name] = u, a[u.name] = !0; } if (c.extensionsUsed) for (let h = 0; h < c.extensionsUsed.length; ++h) { const u = c.extensionsUsed[h], p = c.extensionsRequired || []; switch (u) { case vt.KHR_MATERIALS_UNLIT: a[u] = new u4(); break; case vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: a[u] = new b4(); break; case vt.KHR_DRACO_MESH_COMPRESSION: a[u] = new v4(c, this.dracoLoader); break; case vt.KHR_TEXTURE_TRANSFORM: a[u] = new y4(); break; case vt.KHR_MESH_QUANTIZATION: a[u] = new x4(); break; default: p.indexOf(u) >= 0 && s[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".'); } } l.setExtensions(a), l.setPlugins(s), l.parse(r, n); } } function l4() { let i = {}; return { get: function(e) { return i[e]; }, add: function(e, t) { i[e] = t; }, remove: function(e) { delete i[e]; }, removeAll: function() { i = {}; } }; } 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 c4 { 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 r = 0, n = t.length; r < n; r++) { const o = t[r]; o.extensions && o.extensions[this.name] && o.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, o.extensions[this.name].light); } } _loadLight(e) { const t = this.parser, r = "light:" + e; let n = t.cache.get(r); if (n) return n; const o = t.json, a = ((o.extensions && o.extensions[this.name] || {}).lights || [])[e]; let s; const c = new Be(16777215); a.color !== void 0 && c.fromArray(a.color); const l = a.range !== void 0 ? a.range : 0; switch (a.type) { case "directional": s = new ju(c), s.target.position.set(0, 0, -1), s.add(s.target); break; case "point": s = new Hu(c), s.distance = l; break; case "spot": s = new Vu(c), s.distance = l, a.spot = a.spot || {}, a.spot.innerConeAngle = a.spot.innerConeAngle !== void 0 ? a.spot.innerConeAngle : 0, a.spot.outerConeAngle = a.spot.outerConeAngle !== void 0 ? a.spot.outerConeAngle : Math.PI / 4, s.angle = a.spot.outerConeAngle, s.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, s.target.position.set(0, 0, -1), s.add(s.target); break; default: throw new Error("THREE.GLTFLoader: Unexpected light type: " + a.type); } return s.position.set(0, 0, 0), s.decay = 2, a.intensity !== void 0 && (s.intensity = a.intensity), s.name = t.createUniqueName(a.name || "light_" + e), n = Promise.resolve(s), t.cache.add(r, n), n; } createNodeAttachment(e) { const t = this, r = this.parser, n = r.json.nodes[e], o = (n.extensions && n.extensions[this.name] || {}).light; return o === void 0 ? null : this._loadLight(o).then(function(a) { return r._getNodeRef(t.cache, o, a); }); } } class u4 { constructor() { this.name = vt.KHR_MATERIALS_UNLIT; } getMaterialType() { return Ui; } extendParams(e, t, r) { const n = []; e.color = new Be(1, 1, 1), e.opacity = 1; const o = t.pbrMetallicRoughness; if (o) { if (Array.isArray(o.baseColorFactor)) { const a = o.baseColorFactor; e.color.fromArray(a), e.opacity = a[3]; } o.baseColorTexture !== void 0 && n.push(r.assignTexture(e, "map", o.baseColorTexture)); } return Promise.all(n); } } class h4 { constructor(e) { this.parser = e, this.name = vt.KHR_MATERIALS_CLEARCOAT; } getMaterialType(e) { const t = this.parser.json.materials[e]; return !t.extensions || !t.extensions[this.name] ? null : Pl; } extendMaterialParams(e, t) { const r = this.parser, n = r.json.materials[e]; if (!n.extensions || !n.extensions[this.name]) return Promise.resolve(); const o = [], a = n.extensions[this.name]; if (a.clearcoatFactor !== void 0 && (t.clearcoat = a.clearcoatFactor), a.clearcoatTexture !== void 0 && o.push(r.assignTexture(t, "clearcoatMap", a.clearcoatTexture)), a.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = a.clearcoatRoughnessFactor), a.clearcoatRoughnessTexture !== void 0 && o.push(r.assignTexture(t, "clearcoatRoughnessMap", a.clearcoatRoughnessTexture)), a.clearcoatNormalTexture !== void 0 && (o.push(r.assignTexture(t, "clearcoatNormalMap", a.clearcoatNormalTexture)), a.clearcoatNormalTexture.scale !== void 0)) { const s = a.clearcoatNormalTexture.scale; t.clearcoatNormalScale = new Re(s, -s); } return Promise.all(o); } } class d4 { constructor(e) { this.parser = e, this.name = vt.KHR_MATERIALS_TRANSMISSION; } getMaterialType(e) { const t = this.parser.json.materials[e]; return !t.extensions || !t.extensions[this.name] ? null : Pl; } extendMaterialParams(e, t) { const r = this.parser, n = r.json.materials[e]; if (!n.extensions || !n.extensions[this.name]) return Promise.resolve(); const o = [], a = n.extensions[this.name]; return a.transmissionFactor !== void 0 && (t.transmission = a.transmissionFactor), a.transmissionTexture !== void 0 && o.push(r.assignTexture(t, "transmissionMap", a.transmissionTexture)), Promise.all(o); } } class p4 { constructor(e) { this.parser = e, this.name = vt.KHR_TEXTURE_BASISU; } loadTexture(e) { const t = this.parser, r = t.json, n = r.textures[e]; if (!n.extensions || !n.extensions[this.name]) return null; const o = n.extensions[this.name], a = r.images[o.source], s = t.options.ktx2Loader; if (!s) { if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0) throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures"); return null; } return t.loadTextureImage(e, a, s); } } class f4 { constructor(e) { this.parser = e, this.name = vt.EXT_TEXTURE_WEBP, this.isSupported = null; } loadTexture(e) { const t = this.name, r = this.parser, n = r.json, o = n.textures[e]; if (!o.extensions || !o.extensions[t]) return null; const a = o.extensions[t], s = n.images[a.source]; let c = r.textureLoader; if (s.uri) { const l = r.options.manager.getHandler(s.uri); l !== null && (c = l); } return this.detectSupport().then(function(l) { if (l) return r.loadTextureImage(e, s, c); if (n.extensionsRequired && n.extensionsRequired.indexOf(t) >= 0) throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported."); return r.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 m4 { constructor(e) { this.name = vt.EXT_MESHOPT_COMPRESSION, this.parser = e; } loadBufferView(e) { const t = this.parser.json, r = t.bufferViews[e]; if (r.extensions && r.extensions[this.name]) { const n = r.extensions[this.name], o = this.parser.getDependency("buffer", n.buffer), a = this.parser.options.meshoptDecoder; if (!a || !a.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([o, a.ready]).then(function(s) { const c = n.byteOffset || 0, l = n.byteLength || 0, h = n.count, u = n.byteStride, p = new ArrayBuffer(h * u), m = new Uint8Array(s[0], c, l); return a.decodeGltfBuffer(new Uint8Array(p), h, u, m, n.mode, n.filter), p; }); } else return null; } } const T1 = "glTF", Os = 12, Bv = { JSON: 1313821514, BIN: 5130562 }; class g4 { constructor(e) { this.name = vt.KHR_BINARY_GLTF, this.content = null, this.body = null; const t = new DataView(e, 0, Os); if (this.header = { magic: ln.decodeText(new Uint8Array(e.slice(0, 4))), version: t.getUint32(4, !0), length: t.getUint32(8, !0) }, this.header.magic !== T1) throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header."); if (this.header.version < 2) throw new Error("THREE.GLTFLoader: Legacy binary file detected."); const r = this.header.length - Os, n = new DataView(e, Os); let o = 0; for (; o < r; ) { const a = n.getUint32(o, !0); o += 4; const s = n.getUint32(o, !0); if (o += 4, s === Bv.JSON) { const c = new Uint8Array(e, Os + o, a); this.content = ln.decodeText(c); } else if (s === Bv.BIN) { const c = Os + o; this.body = e.slice(c, c + a); } o += a; } if (this.content === null) throw new Error("THREE.GLTFLoader: JSON content not found."); } } class v4 { 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 r = this.json, n = this.dracoLoader, o = e.extensions[this.name].bufferView, a = e.extensions[this.name].attributes, s = {}, c = {}, l = {}; for (const h in a) { const u = Gd[h] || h.toLowerCase(); s[u] = a[h]; } for (const h in e.attributes) { const u = Gd[h] || h.toLowerCase(); if (a[h] !== void 0) { const p = r.accessors[e.attributes[h]], m = ll[p.componentType]; l[u] = m, c[u] = p.normalized === !0; } } return t.getDependency("bufferView", o).then(function(h) { return new Promise(function(u) { n.decodeDracoFile(h, function(p) { for (const m in p.attributes) { const g = p.attributes[m], d = c[m]; d !== void 0 && (g.normalized = d); } u(p); }, s, l); }); }); } } class y4 { 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 jd extends $o { constructor(e) { super(), this.isGLTFSpecularGlossinessMaterial = !0; const t = [ "#ifdef USE_SPECULARMAP", " uniform sampler2D specularMap;", "#endif" ].join(` `), r = [ "#ifdef USE_GLOSSINESSMAP", " uniform sampler2D glossinessMap;", "#endif" ].join(` `), n = [ "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(` `), o = [ "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(` `), a = [ "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(` `), s = { specular: { value: new Be().setHex(16777215) }, glossiness: { value: 1 }, specularMap: { value: null }, glossinessMap: { value: null } }; this._extraUniforms = s, this.onBeforeCompile = function(c) { for (const l in s) c.uniforms[l] = s[l]; c.fragmentShader = c.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;").replace("uniform float metalness;", "uniform float glossiness;").replace("#include ", t).replace("#include ", r).replace("#include ", n).replace("#include ", o).replace("#include ", a); }, Object.defineProperties(this, { specular: { get: function() { return s.specular.value; }, set: function(c) { s.specular.value = c; } }, specularMap: { get: function() { return s.specularMap.value; }, set: function(c) { s.specularMap.value = c, c ? this.defines.USE_SPECULARMAP = "" : delete this.defines.USE_SPECULARMAP; } }, glossiness: { get: function() { return s.glossiness.value; }, set: function(c) { s.glossiness.value = c; } }, glossinessMap: { get: function() { return s.glossinessMap.value; }, set: function(c) { s.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 b4 { 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 jd; } extendParams(e, t, r) { const n = t.extensions[this.name]; e.color = new Be(1, 1, 1), e.opacity = 1; const o = []; if (Array.isArray(n.diffuseFactor)) { const a = n.diffuseFactor; e.color.fromArray(a), e.opacity = a[3]; } if (n.diffuseTexture !== void 0 && o.push(r.assignTexture(e, "map", n.diffuseTexture)), e.emissive = new Be(0, 0, 0), e.glossiness = n.glossinessFactor !== void 0 ? n.glossinessFactor : 1, e.specular = new Be(1, 1, 1), Array.isArray(n.specularFactor) && e.specular.fromArray(n.specularFactor), n.specularGlossinessTexture !== void 0) { const a = n.specularGlossinessTexture; o.push(r.assignTexture(e, "glossinessMap", a)), o.push(r.assignTexture(e, "specularMap", a)); } return Promise.all(o); } createMaterial(e) { const t = new jd(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 = to, 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 x4 { constructor() { this.name = vt.KHR_MESH_QUANTIZATION; } } class es extends Ur { constructor(e, t, r, n) { super(e, t, r, n); } copySampleValue_(e) { const t = this.resultBuffer, r = this.sampleValues, n = this.valueSize, o = e * n * 3 + n; for (let a = 0; a !== n; a++) t[a] = r[o + a]; return t; } } es.prototype.beforeStart_ = es.prototype.copySampleValue_; es.prototype.afterEnd_ = es.prototype.copySampleValue_; es.prototype.interpolate_ = function(i, e, t, r) { const n = this.resultBuffer, o = this.sampleValues, a = this.valueSize, s = a * 2, c = a * 3, l = r - e, h = (t - e) / l, u = h * h, p = u * h, m = i * c, g = m - c, d = -2 * p + 3 * u, y = p - u, f = 1 - d, v = y - u + h; for (let _ = 0; _ !== a; _++) { const M = o[g + _ + a], T = o[g + _ + s] * l, w = o[m + _ + a], b = o[m + _] * l; n[_] = f * M + v * T + d * w + y * b; } return n; }; const Yr = { 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 }, kv = { 9728: Jt, 9729: Wt, 9984: Ks, 9985: Tu, 9986: Qs, 9987: bn }, Fv = { 33071: di, 33648: Na, 10497: Yn }, zv = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT2: 4, MAT3: 9, MAT4: 16 }, Gd = { POSITION: "position", NORMAL: "normal", TANGENT: "tangent", TEXCOORD_0: "uv", TEXCOORD_1: "uv2", COLOR_0: "color", WEIGHTS_0: "skinWeight", JOINTS_0: "skinIndex" }, On = { scale: "scale", translation: "position", rotation: "quaternion", weights: "morphTargetInfluences" }, w4 = { 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: Io, STEP: ka }, Hh = { OPAQUE: "OPAQUE", MASK: "MASK", BLEND: "BLEND" }; function Uv(i, e) { return typeof i != "string" || i === "" ? "" : (/^https?:\/\//i.test(e) && /^\//.test(i) && (e = e.replace(/(^https?:\/\/[^\/]+).*/i, "$1")), /^(https?:)?\/\//i.test(i) || /^data:.*,.*$/i.test(i) || /^blob:.*$/i.test(i) ? i : e + i); } function _4(i) { return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new $o({ color: 16777215, emissive: 0, metalness: 1, roughness: 1, transparent: !1, depthTest: !0, side: Xn })), i.DefaultMaterial; } function Ps(i, e, t) { for (const r in t.extensions) i[r] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[r] = t.extensions[r]); } function yo(i, e) { e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(i.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras)); } function M4(i, e, t) { let r = !1, n = !1; for (let s = 0, c = e.length; s < c; s++) { const l = e[s]; if (l.POSITION !== void 0 && (r = !0), l.NORMAL !== void 0 && (n = !0), r && n) break; } if (!r && !n) return Promise.resolve(i); const o = [], a = []; for (let s = 0, c = e.length; s < c; s++) { const l = e[s]; if (r) { const h = l.POSITION !== void 0 ? t.getDependency("accessor", l.POSITION) : i.attributes.position; o.push(h); } if (n) { const h = l.NORMAL !== void 0 ? t.getDependency("accessor", l.NORMAL) : i.attributes.normal; a.push(h); } } return Promise.all([ Promise.all(o), Promise.all(a) ]).then(function(s) { const c = s[0], l = s[1]; return r && (i.morphAttributes.position = c), n && (i.morphAttributes.normal = l), i.morphTargetsRelative = !0, i; }); } function S4(i, e) { if (i.updateMorphTargets(), e.weights !== void 0) for (let t = 0, r = e.weights.length; t < r; t++) i.morphTargetInfluences[t] = e.weights[t]; if (e.extras && Array.isArray(e.extras.targetNames)) { const t = e.extras.targetNames; if (i.morphTargetInfluences.length === t.length) { i.morphTargetDictionary = {}; for (let r = 0, n = t.length; r < n; r++) i.morphTargetDictionary[t[r]] = r; } else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names."); } } function T4(i) { const e = i.extensions && i.extensions[vt.KHR_DRACO_MESH_COMPRESSION]; let t; return e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + Vv(e.attributes) : t = i.indices + ":" + Vv(i.attributes) + ":" + i.mode, t; } function Vv(i) { let e = ""; const t = Object.keys(i).sort(); for (let r = 0, n = t.length; r < n; r++) e += t[r] + ":" + i[t[r]] + ";"; return e; } function Wd(i) { switch (i) { 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 E4 { constructor(e = {}, t = {}) { this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new l4(), 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 Cf(this.options.manager) : this.textureLoader = new xf(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Ki(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 r = this, n = this.json, o = this.extensions; this.cache.removeAll(), this._invokeAll(function(a) { return a._markDefs && a._markDefs(); }), Promise.all(this._invokeAll(function(a) { return a.beforeRoot && a.beforeRoot(); })).then(function() { return Promise.all([ r.getDependencies("scene"), r.getDependencies("animation"), r.getDependencies("camera") ]); }).then(function(a) { const s = { scene: a[0][n.scene || 0], scenes: a[0], animations: a[1], cameras: a[2], asset: n.asset, parser: r, userData: {} }; Ps(o, s, n), yo(s, n), Promise.all(r._invokeAll(function(c) { return c.afterRoot && c.afterRoot(s); })).then(function() { e(s); }); }).catch(t); } /** * Marks the special nodes/meshes in json for efficient parse. */ _markDefs() { const e = this.json.nodes || [], t = this.json.skins || [], r = this.json.meshes || []; for (let n = 0, o = t.length; n < o; n++) { const a = t[n].joints; for (let s = 0, c = a.length; s < c; s++) e[a[s]].isBone = !0; } for (let n = 0, o = e.length; n < o; n++) { const a = e[n]; a.mesh !== void 0 && (this._addNodeRef(this.meshCache, a.mesh), a.skin !== void 0 && (r[a.mesh].isSkinnedMesh = !0)), a.camera !== void 0 && this._addNodeRef(this.cameraCache, a.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, r) { if (e.refs[t] <= 1) return r; const n = r.clone(); return n.name += "_instance_" + e.uses[t]++, n; } _invokeOne(e) { const t = Object.values(this.plugins); t.push(this); for (let r = 0; r < t.length; r++) { const n = e(t[r]); if (n) return n; } return null; } _invokeAll(e) { const t = Object.values(this.plugins); t.unshift(this); const r = []; for (let n = 0; n < t.length; n++) { const o = e(t[n]); o && r.push(o); } return r; } /** * Requests the specified dependency asynchronously, with caching. * @param {string} type * @param {number} index * @return {Promise} */ getDependency(e, t) { const r = e + ":" + t; let n = this.cache.get(r); if (!n) { switch (e) { case "scene": n = this.loadScene(t); break; case "node": n = this.loadNode(t); break; case "mesh": n = this._invokeOne(function(o) { return o.loadMesh && o.loadMesh(t); }); break; case "accessor": n = this.loadAccessor(t); break; case "bufferView": n = this._invokeOne(function(o) { return o.loadBufferView && o.loadBufferView(t); }); break; case "buffer": n = this.loadBuffer(t); break; case "material": n = this._invokeOne(function(o) { return o.loadMaterial && o.loadMaterial(t); }); break; case "texture": n = this._invokeOne(function(o) { return o.loadTexture && o.loadTexture(t); }); break; case "skin": n = this.loadSkin(t); break; case "animation": n = this.loadAnimation(t); break; case "camera": n = this.loadCamera(t); break; default: throw new Error("Unknown type: " + e); } this.cache.add(r, n); } return n; } /** * 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 r = this, n = this.json[e + (e === "mesh" ? "es" : "s")] || []; t = Promise.all(n.map(function(o, a) { return r.getDependency(e, a); })), 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], r = 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 n = this.options; return new Promise(function(o, a) { r.load(Uv(t.uri, n.path), o, void 0, function() { a(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(r) { const n = t.byteLength || 0, o = t.byteOffset || 0; return r.slice(o, o + n); }); } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors * @param {number} accessorIndex * @return {Promise} */ loadAccessor(e) { const t = this, r = this.json, n = this.json.accessors[e]; if (n.bufferView === void 0 && n.sparse === void 0) return Promise.resolve(null); const o = []; return n.bufferView !== void 0 ? o.push(this.getDependency("bufferView", n.bufferView)) : o.push(null), n.sparse !== void 0 && (o.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), o.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(o).then(function(a) { const s = a[0], c = zv[n.type], l = ll[n.componentType], h = l.BYTES_PER_ELEMENT, u = h * c, p = n.byteOffset || 0, m = n.bufferView !== void 0 ? r.bufferViews[n.bufferView].byteStride : void 0, g = n.normalized === !0; let d, y; if (m && m !== u) { const f = Math.floor(p / m), v = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + f + ":" + n.count; let _ = t.cache.get(v); _ || (d = new l(s, f * m, n.count * m / h), _ = new no(d, m / h), t.cache.add(v, _)), y = new pn(_, c, p % m / h, g); } else s === null ? d = new l(n.count * c) : d = new l(s, p, n.count * c), y = new tt(d, c, g); if (n.sparse !== void 0) { const f = zv.SCALAR, v = ll[n.sparse.indices.componentType], _ = n.sparse.indices.byteOffset || 0, M = n.sparse.values.byteOffset || 0, T = new v(a[1], _, n.sparse.count * f), w = new l(a[2], M, n.sparse.count * c); s !== null && (y = new tt(y.array.slice(), y.itemSize, y.normalized)); for (let b = 0, E = T.length; b < E; b++) { const S = T[b]; if (y.setX(S, w[b * c]), c >= 2 && y.setY(S, w[b * c + 1]), c >= 3 && y.setZ(S, w[b * c + 2]), c >= 4 && y.setW(S, w[b * 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, r = this.options, n = t.textures[e], o = t.images[n.source]; let a = this.textureLoader; if (o.uri) { const s = r.manager.getHandler(o.uri); s !== null && (a = s); } return this.loadTextureImage(e, o, a); } loadTextureImage(e, t, r) { const n = this, o = this.json, a = this.options, s = o.textures[e], c = (t.uri || t.bufferView) + ":" + s.sampler; if (this.textureCache[c]) return this.textureCache[c]; const l = self.URL || self.webkitURL; let h = t.uri || "", u = !1, p = !0; const m = h.search(/\.jpe?g($|\?)/i) > 0 || h.search(/^data\:image\/jpeg/) === 0; if ((t.mimeType === "image/jpeg" || m) && (p = !1), t.bufferView !== void 0) h = n.getDependency("bufferView", t.bufferView).then(function(d) { if (t.mimeType === "image/png") { const f = new DataView(d, 25, 1).getUint8(0, !1); p = f === 6 || f === 4 || f === 3; } u = !0; const y = new Blob([d], { type: t.mimeType }); return h = l.createObjectURL(y), h; }); else if (t.uri === void 0) throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView"); const g = Promise.resolve(h).then(function(d) { return new Promise(function(y, f) { let v = y; r.isImageBitmapLoader === !0 && (v = function(_) { const M = new ti(_); M.needsUpdate = !0, y(M); }), r.load(Uv(d, a.path), v, void 0, f); }); }).then(function(d) { u === !0 && l.revokeObjectURL(h), d.flipY = !1, s.name && (d.name = s.name), p || (d.format = sn); const y = (o.samplers || {})[s.sampler] || {}; return d.magFilter = kv[y.magFilter] || Wt, d.minFilter = kv[y.minFilter] || bn, d.wrapS = Fv[y.wrapS] || Yn, d.wrapT = Fv[y.wrapT] || Yn, n.associations.set(d, { type: "textures", index: e }), d; }).catch(function() { return console.error("THREE.GLTFLoader: Couldn't load texture", h), null; }); return this.textureCache[c] = g, g; } /** * Asynchronously assigns a texture to the given material parameters. * @param {Object} materialParams * @param {string} mapName * @param {Object} mapDef * @return {Promise} */ assignTexture(e, t, r) { const n = this; return this.getDependency("texture", r.index).then(function(o) { if (r.texCoord !== void 0 && r.texCoord != 0 && !(t === "aoMap" && r.texCoord == 1) && console.warn("THREE.GLTFLoader: Custom UV set " + r.texCoord + " for texture " + t + " not yet supported."), n.extensions[vt.KHR_TEXTURE_TRANSFORM]) { const a = r.extensions !== void 0 ? r.extensions[vt.KHR_TEXTURE_TRANSFORM] : void 0; if (a) { const s = n.associations.get(o); o = n.extensions[vt.KHR_TEXTURE_TRANSFORM].extendTexture(o, a), n.associations.set(o, s); } } e[t] = o; }); } /** * 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 r = e.material; const n = t.attributes.tangent !== void 0, o = t.attributes.color !== void 0, a = t.attributes.normal === void 0, s = Object.keys(t.morphAttributes).length > 0, c = s && t.morphAttributes.normal !== void 0; if (e.isPoints) { const l = "PointsMaterial:" + r.uuid; let h = this.cache.get(l); h || (h = new oo(), ri.prototype.copy.call(h, r), h.color.copy(r.color), h.map = r.map, h.sizeAttenuation = !1, this.cache.add(l, h)), r = h; } else if (e.isLine) { const l = "LineBasicMaterial:" + r.uuid; let h = this.cache.get(l); h || (h = new li(), ri.prototype.copy.call(h, r), h.color.copy(r.color), this.cache.add(l, h)), r = h; } if (n || o || a || s) { let l = "ClonedMaterial:" + r.uuid + ":"; r.isGLTFSpecularGlossinessMaterial && (l += "specular-glossiness:"), n && (l += "vertex-tangents:"), o && (l += "vertex-colors:"), a && (l += "flat-shading:"), s && (l += "morph-targets:"), c && (l += "morph-normals:"); let h = this.cache.get(l); h || (h = r.clone(), o && (h.vertexColors = !0), a && (h.flatShading = !0), s && (h.morphTargets = !0), c && (h.morphNormals = !0), n && (h.vertexTangents = !0, h.normalScale && (h.normalScale.y *= -1), h.clearcoatNormalScale && (h.clearcoatNormalScale.y *= -1)), this.cache.add(l, h), this.associations.set(h, this.associations.get(r))), r = h; } r.aoMap && t.attributes.uv2 === void 0 && t.attributes.uv !== void 0 && t.setAttribute("uv2", t.attributes.uv), e.material = r; } getMaterialType() { return $o; } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials * @param {number} materialIndex * @return {Promise} */ loadMaterial(e) { const t = this, r = this.json, n = this.extensions, o = r.materials[e]; let a; const s = {}, c = o.extensions || {}, l = []; if (c[vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) { const u = n[vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]; a = u.getMaterialType(), l.push(u.extendParams(s, o, t)); } else if (c[vt.KHR_MATERIALS_UNLIT]) { const u = n[vt.KHR_MATERIALS_UNLIT]; a = u.getMaterialType(), l.push(u.extendParams(s, o, t)); } else { const u = o.pbrMetallicRoughness || {}; if (s.color = new Be(1, 1, 1), s.opacity = 1, Array.isArray(u.baseColorFactor)) { const p = u.baseColorFactor; s.color.fromArray(p), s.opacity = p[3]; } u.baseColorTexture !== void 0 && l.push(t.assignTexture(s, "map", u.baseColorTexture)), s.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, s.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(s, "metalnessMap", u.metallicRoughnessTexture)), l.push(t.assignTexture(s, "roughnessMap", u.metallicRoughnessTexture))), a = this._invokeOne(function(p) { return p.getMaterialType && p.getMaterialType(e); }), l.push(Promise.all(this._invokeAll(function(p) { return p.extendMaterialParams && p.extendMaterialParams(e, s); }))); } o.doubleSided === !0 && (s.side = Zn); const h = o.alphaMode || Hh.OPAQUE; return h === Hh.BLEND ? (s.transparent = !0, s.depthWrite = !1) : (s.transparent = !1, h === Hh.MASK && (s.alphaTest = o.alphaCutoff !== void 0 ? o.alphaCutoff : 0.5)), o.normalTexture !== void 0 && a !== Ui && (l.push(t.assignTexture(s, "normalMap", o.normalTexture)), s.normalScale = new Re(1, -1), o.normalTexture.scale !== void 0 && s.normalScale.set(o.normalTexture.scale, -o.normalTexture.scale)), o.occlusionTexture !== void 0 && a !== Ui && (l.push(t.assignTexture(s, "aoMap", o.occlusionTexture)), o.occlusionTexture.strength !== void 0 && (s.aoMapIntensity = o.occlusionTexture.strength)), o.emissiveFactor !== void 0 && a !== Ui && (s.emissive = new Be().fromArray(o.emissiveFactor)), o.emissiveTexture !== void 0 && a !== Ui && l.push(t.assignTexture(s, "emissiveMap", o.emissiveTexture)), Promise.all(l).then(function() { let u; return a === jd ? u = n[vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s) : u = new a(s), o.name && (u.name = o.name), u.map && (u.map.encoding = Do), u.emissiveMap && (u.emissiveMap.encoding = Do), yo(u, o), t.associations.set(u, { type: "materials", index: e }), o.extensions && Ps(n, u, o), u; }); } /** When Object3D instances are targeted by animation, they need unique names. */ createUniqueName(e) { const t = pt.sanitizeNodeName(e || ""); let r = t; for (let n = 1; this.nodeNamesUsed[r]; ++n) r = t + "_" + n; return this.nodeNamesUsed[r] = !0, r; } /** * 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, r = this.extensions, n = this.primitiveCache; function o(s) { return r[vt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(s, t).then(function(c) { return Hv(c, s, t); }); } const a = []; for (let s = 0, c = e.length; s < c; s++) { const l = e[s], h = T4(l), u = n[h]; if (u) a.push(u.promise); else { let p; l.extensions && l.extensions[vt.KHR_DRACO_MESH_COMPRESSION] ? p = o(l) : p = Hv(new Ye(), l, t), n[h] = { primitive: l, promise: p }, a.push(p); } } return Promise.all(a); } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes * @param {number} meshIndex * @return {Promise} */ loadMesh(e) { const t = this, r = this.json, n = this.extensions, o = r.meshes[e], a = o.primitives, s = []; for (let c = 0, l = a.length; c < l; c++) { const h = a[c].material === void 0 ? _4(this.cache) : this.getDependency("material", a[c].material); s.push(h); } return s.push(t.loadGeometries(a)), Promise.all(s).then(function(c) { const l = c.slice(0, c.length - 1), h = c[c.length - 1], u = []; for (let m = 0, g = h.length; m < g; m++) { const d = h[m], y = a[m]; let f; const v = l[m]; if (y.mode === Yr.TRIANGLES || y.mode === Yr.TRIANGLE_STRIP || y.mode === Yr.TRIANGLE_FAN || y.mode === void 0) f = o.isSkinnedMesh === !0 ? new Al(d, v) : new ei(d, v), f.isSkinnedMesh === !0 && !f.geometry.attributes.skinWeight.normalized && f.normalizeSkinWeights(), y.mode === Yr.TRIANGLE_STRIP ? f.geometry = jv(f.geometry, ax) : y.mode === Yr.TRIANGLE_FAN && (f.geometry = jv(f.geometry, jp)); else if (y.mode === Yr.LINES) f = new Bi(d, v); else if (y.mode === Yr.LINE_STRIP) f = new Fr(d, v); else if (y.mode === Yr.LINE_LOOP) f = new Bu(d, v); else if (y.mode === Yr.POINTS) f = new hs(d, v); else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode); Object.keys(f.geometry.morphAttributes).length > 0 && S4(f, o), f.name = t.createUniqueName(o.name || "mesh_" + e), yo(f, o), y.extensions && Ps(n, f, y), t.assignFinalMaterial(f), u.push(f); } if (u.length === 1) return u[0]; const p = new Rr(); for (let m = 0, g = u.length; m < g; m++) p.add(u[m]); return p; }); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras * @param {number} cameraIndex * @return {Promise} */ loadCamera(e) { let t; const r = this.json.cameras[e], n = r[r.type]; if (!n) { console.warn("THREE.GLTFLoader: Missing camera parameters."); return; } return r.type === "perspective" ? t = new oi(Nd.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : r.type === "orthographic" && (t = new ps(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), r.name && (t.name = this.createUniqueName(r.name)), yo(t, r), 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], r = { joints: t.joints }; return t.inverseBindMatrices === void 0 ? Promise.resolve(r) : this.getDependency("accessor", t.inverseBindMatrices).then(function(n) { return r.inverseBindMatrices = n, r; }); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations * @param {number} animationIndex * @return {Promise} */ loadAnimation(e) { const t = this.json.animations[e], r = [], n = [], o = [], a = [], s = []; for (let c = 0, l = t.channels.length; c < l; c++) { const h = t.channels[c], u = t.samplers[h.sampler], p = h.target, m = p.node !== void 0 ? p.node : p.id, g = t.parameters !== void 0 ? t.parameters[u.input] : u.input, d = t.parameters !== void 0 ? t.parameters[u.output] : u.output; r.push(this.getDependency("node", m)), n.push(this.getDependency("accessor", g)), o.push(this.getDependency("accessor", d)), a.push(u), s.push(p); } return Promise.all([ Promise.all(r), Promise.all(n), Promise.all(o), Promise.all(a), Promise.all(s) ]).then(function(c) { const l = c[0], h = c[1], u = c[2], p = c[3], m = c[4], g = []; for (let y = 0, f = l.length; y < f; y++) { const v = l[y], _ = h[y], M = u[y], T = p[y], w = m[y]; if (v === void 0) continue; v.updateMatrix(), v.matrixAutoUpdate = !0; let b; switch (On[w.path]) { case On.weights: b = Ja; break; case On.rotation: b = Xo; break; case On.position: case On.scale: default: b = Ka; break; } const E = v.name ? v.name : v.uuid, S = T.interpolation !== void 0 ? w4[T.interpolation] : Io, C = []; On[w.path] === On.weights ? v.traverse(function(L) { L.isMesh === !0 && L.morphTargetInfluences && C.push(L.name ? L.name : L.uuid); }) : C.push(E); let R = M.array; if (M.normalized) { const L = Wd(R.constructor), A = new Float32Array(R.length); for (let P = 0, O = R.length; P < O; P++) A[P] = R[P] * L; R = A; } for (let L = 0, A = C.length; L < A; L++) { const P = new b( C[L] + "." + On[w.path], _.array, R, S ); T.interpolation === "CUBICSPLINE" && (P.createInterpolant = function(O) { return new es(this.times, this.values, this.getValueSize() / 3, O); }, P.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0), g.push(P); } } const d = t.name ? t.name : "animation_" + e; return new Qa(d, void 0, g); }); } createNodeMesh(e) { const t = this.json, r = this, n = t.nodes[e]; return n.mesh === void 0 ? null : r.getDependency("mesh", n.mesh).then(function(o) { const a = r._getNodeRef(r.meshCache, n.mesh, o); return n.weights !== void 0 && a.traverse(function(s) { if (s.isMesh) for (let c = 0, l = n.weights.length; c < l; c++) s.morphTargetInfluences[c] = n.weights[c]; }), a; }); } /** * 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, r = this.extensions, n = this, o = t.nodes[e], a = o.name ? n.createUniqueName(o.name) : ""; return function() { const s = [], c = n._invokeOne(function(l) { return l.createNodeMesh && l.createNodeMesh(e); }); return c && s.push(c), o.camera !== void 0 && s.push(n.getDependency("camera", o.camera).then(function(l) { return n._getNodeRef(n.cameraCache, o.camera, l); })), n._invokeAll(function(l) { return l.createNodeAttachment && l.createNodeAttachment(e); }).forEach(function(l) { s.push(l); }), Promise.all(s); }().then(function(s) { let c; if (o.isBone === !0 ? c = new Cl() : s.length > 1 ? c = new Rr() : s.length === 1 ? c = s[0] : c = new ot(), c !== s[0]) for (let l = 0, h = s.length; l < h; l++) c.add(s[l]); if (o.name && (c.userData.name = o.name, c.name = a), yo(c, o), o.extensions && Ps(r, c, o), o.matrix !== void 0) { const l = new $e(); l.fromArray(o.matrix), c.applyMatrix4(l); } else o.translation !== void 0 && c.position.fromArray(o.translation), o.rotation !== void 0 && c.quaternion.fromArray(o.rotation), o.scale !== void 0 && c.scale.fromArray(o.scale); return n.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, r = this.extensions, n = this.json.scenes[e], o = this, a = new Rr(); n.name && (a.name = o.createUniqueName(n.name)), yo(a, n), n.extensions && Ps(r, a, n); const s = n.nodes || [], c = []; for (let l = 0, h = s.length; l < h; l++) c.push(E1(s[l], a, t, o)); return Promise.all(c).then(function() { return a; }); } } function E1(i, e, t, r) { const n = t.nodes[i]; return r.getDependency("node", i).then(function(o) { if (n.skin === void 0) return o; let a; return r.getDependency("skin", n.skin).then(function(s) { a = s; const c = []; for (let l = 0, h = a.joints.length; l < h; l++) c.push(r.getDependency("node", a.joints[l])); return Promise.all(c); }).then(function(s) { return o.traverse(function(c) { if (!c.isMesh) return; const l = [], h = []; for (let u = 0, p = s.length; u < p; u++) { const m = s[u]; if (m) { l.push(m); const g = new $e(); a.inverseBindMatrices !== void 0 && g.fromArray(a.inverseBindMatrices.array, u * 16), h.push(g); } else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', a.joints[u]); } c.bind(new Ll(l, h), c.matrixWorld); }), o; }); }).then(function(o) { e.add(o); const a = []; if (n.children) { const s = n.children; for (let c = 0, l = s.length; c < l; c++) { const h = s[c]; a.push(E1(h, o, t, r)); } } return Promise.all(a); }); } function A4(i, e, t) { const r = e.attributes, n = new ji(); if (r.POSITION !== void 0) { const s = t.json.accessors[r.POSITION], c = s.min, l = s.max; if (c !== void 0 && l !== void 0) { if (n.set( new Z(c[0], c[1], c[2]), new Z(l[0], l[1], l[2]) ), s.normalized) { const h = Wd(ll[s.componentType]); n.min.multiplyScalar(h), n.max.multiplyScalar(h); } } else { console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."); return; } } else return; const o = e.targets; if (o !== void 0) { const s = new Z(), c = new Z(); for (let l = 0, h = o.length; l < h; l++) { const u = o[l]; if (u.POSITION !== void 0) { const p = t.json.accessors[u.POSITION], m = p.min, g = p.max; if (m !== void 0 && g !== void 0) { if (c.setX(Math.max(Math.abs(m[0]), Math.abs(g[0]))), c.setY(Math.max(Math.abs(m[1]), Math.abs(g[1]))), c.setZ(Math.max(Math.abs(m[2]), Math.abs(g[2]))), p.normalized) { const d = Wd(ll[p.componentType]); c.multiplyScalar(d); } s.max(c); } else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."); } } n.expandByVector(s); } i.boundingBox = n; const a = new xn(); n.getCenter(a.center), a.radius = n.min.distanceTo(n.max) / 2, i.boundingSphere = a; } function Hv(i, e, t) { const r = e.attributes, n = []; function o(a, s) { return t.getDependency("accessor", a).then(function(c) { i.setAttribute(s, c); }); } for (const a in r) { const s = Gd[a] || a.toLowerCase(); s in i.attributes || n.push(o(r[a], s)); } if (e.indices !== void 0 && !i.index) { const a = t.getDependency("accessor", e.indices).then(function(s) { i.setIndex(s); }); n.push(a); } return yo(i, e), A4(i, e, t), Promise.all(n).then(function() { return e.targets !== void 0 ? M4(i, e.targets, t) : i; }); } function jv(i, e) { let t = i.getIndex(); if (t === null) { const a = [], s = i.getAttribute("position"); if (s !== void 0) { for (let c = 0; c < s.count; c++) a.push(c); i.setIndex(a), t = i.getIndex(); } else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), i; } const r = t.count - 2, n = []; if (e === jp) for (let a = 1; a <= r; a++) n.push(t.getX(0)), n.push(t.getX(a)), n.push(t.getX(a + 1)); else for (let a = 0; a < r; a++) a % 2 === 0 ? (n.push(t.getX(a)), n.push(t.getX(a + 1)), n.push(t.getX(a + 2))) : (n.push(t.getX(a + 2)), n.push(t.getX(a + 1)), n.push(t.getX(a))); n.length / 3 !== r && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."); const o = i.clone(); return o.setIndex(n), o; } const C4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, GLTFLoader: s4 }, Symbol.toStringTag, { value: "Module" })), L4 = /* @__PURE__ */ xu(C4); var Gv = { exports: {} }, Wv; function R4() { return Wv || (Wv = 1, function(i) { function e(l) { var h = {}; function u(m) { if (h[m]) return h[m].exports; var g = h[m] = { /******/ i: m, /******/ l: !1, /******/ exports: {} /******/ }; return l[m].call(g.exports, g, g.exports, u), g.l = !0, g.exports; } u.m = l, u.c = h, u.i = function(m) { return m; }, u.d = function(m, g, d) { u.o(m, g) || Object.defineProperty(m, g, { /******/ configurable: !1, /******/ enumerable: !0, /******/ get: d /******/ }); }, u.r = function(m) { Object.defineProperty(m, "__esModule", { value: !0 }); }, u.n = function(m) { var g = m && m.__esModule ? ( /******/ function() { return m.default; } ) : ( /******/ function() { return m; } ); return u.d(g, "a", g), g; }, u.o = function(m, g) { return Object.prototype.hasOwnProperty.call(m, g); }, u.p = "/", u.oe = function(m) { throw console.error(m), m; }; var p = u(u.s = ENTRY_MODULE); return p.default || p; } var t = "[\\.|\\-|\\+|\\w|/|@]+", r = "\\(\\s*(/\\*.*?\\*/)?\\s*.*?(" + t + ").*?\\)"; function n(l) { return (l + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&"); } function o(l) { return !isNaN(1 * l); } function a(l, h, u) { var p = {}; p[u] = []; var m = h.toString(), g = m.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/); if (!g) return p; for (var d = g[1], y = new RegExp("(\\\\n|\\W)" + n(d) + r, "g"), f; f = y.exec(m); ) f[3] !== "dll-reference" && p[u].push(f[3]); for (y = new RegExp("\\(" + n(d) + '\\("(dll-reference\\s(' + t + '))"\\)\\)' + r, "g"); f = y.exec(m); ) l[f[2]] || (p[u].push(f[1]), l[f[2]] = __webpack_require__(f[1]).m), p[f[2]] = p[f[2]] || [], p[f[2]].push(f[4]); for (var v = Object.keys(p), _ = 0; _ < v.length; _++) for (var M = 0; M < p[v[_]].length; M++) o(p[v[_]][M]) && (p[v[_]][M] = 1 * p[v[_]][M]); return p; } function s(l) { var h = Object.keys(l); return h.reduce(function(u, p) { return u || l[p].length > 0; }, !1); } function c(l, h) { for (var u = { main: [h] }, p = { main: [] }, m = { main: {} }; s(u); ) for (var g = Object.keys(u), d = 0; d < g.length; d++) { var y = g[d], f = u[y], v = f.pop(); if (m[y] = m[y] || {}, !(m[y][v] || !l[y][v])) { m[y][v] = !0, p[y] = p[y] || [], p[y].push(v); for (var _ = a(l, l[y][v], y), M = Object.keys(_), T = 0; T < M.length; T++) u[M[T]] = u[M[T]] || [], u[M[T]] = u[M[T]].concat(_[M[T]]); } } return p; } i.exports = function(l, h) { h = h || {}; var u = { main: __webpack_modules__ }, p = h.all ? { main: Object.keys(u.main) } : c(u, l), m = ""; Object.keys(p).filter(function(v) { return v !== "main"; }).forEach(function(v) { for (var _ = 0; p[v][_]; ) _++; p[v].push(_), u[v][_] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", m = m + "var " + v + " = (" + e.toString().replace("ENTRY_MODULE", JSON.stringify(_)) + ")({" + p[v].map(function(M) { return "" + JSON.stringify(M) + ": " + u[v][M].toString(); }).join(",") + `}); `; }), m = m + "new ((" + e.toString().replace("ENTRY_MODULE", JSON.stringify(l)) + ")({" + p.main.map(function(v) { return "" + JSON.stringify(v) + ": " + u.main[v].toString(); }).join(",") + "}))(self);"; var g = new window.Blob([m], { type: "text/javascript" }); if (h.bare) return g; var d = window.URL || window.webkitURL || window.mozURL || window.msURL, y = d.createObjectURL(g), f = new window.Worker(y); return f.objectURL = y, f; }; }(Gv)), Gv.exports; } function O4(i) { var e = this.constructor; return this.then( function(t) { return e.resolve(i()).then(function() { return t; }); }, function(t) { return e.resolve(i()).then(function() { return e.reject(t); }); } ); } function P4(i) { var e = this; return new e(function(t, r) { if (!(i && typeof i.length < "u")) return r( new TypeError( typeof i + " " + i + " is not iterable(cannot read property Symbol(Symbol.iterator))" ) ); var n = Array.prototype.slice.call(i); if (n.length === 0) return t([]); var o = n.length; function a(c, l) { if (l && (typeof l == "object" || typeof l == "function")) { var h = l.then; if (typeof h == "function") { h.call( l, function(u) { a(c, u); }, function(u) { n[c] = { status: "rejected", reason: u }, --o === 0 && t(n); } ); return; } } n[c] = { status: "fulfilled", value: l }, --o === 0 && t(n); } for (var s = 0; s < n.length; s++) a(s, n[s]); }); } function A1(i, e) { this.name = "AggregateError", this.errors = i, this.message = e || ""; } A1.prototype = Error.prototype; function I4(i) { var e = this; return new e(function(t, r) { if (!(i && typeof i.length < "u")) return r(new TypeError("Promise.any accepts an array")); var n = Array.prototype.slice.call(i); if (n.length === 0) return r(); for (var o = [], a = 0; a < n.length; a++) try { e.resolve(n[a]).then(t).catch(function(s) { o.push(s), o.length === n.length && r( new A1( o, "All promises were rejected" ) ); }); } catch (s) { r(s); } }); } var D4 = setTimeout; function C1(i) { return !!(i && typeof i.length < "u"); } function N4() { } function B4(i, e) { return function() { i.apply(e, arguments); }; } function zt(i) { if (!(this instanceof zt)) throw new TypeError("Promises must be constructed via new"); if (typeof i != "function") throw new TypeError("not a function"); this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], R1(i, this); } function L1(i, e) { for (; i._state === 3; ) i = i._value; if (i._state === 0) { i._deferreds.push(e); return; } i._handled = !0, zt._immediateFn(function() { var t = i._state === 1 ? e.onFulfilled : e.onRejected; if (t === null) { (i._state === 1 ? $d : cl)(e.promise, i._value); return; } var r; try { r = t(i._value); } catch (n) { cl(e.promise, n); return; } $d(e.promise, r); }); } function $d(i, e) { try { if (e === i) 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 zt) { i._state = 3, i._value = e, qd(i); return; } else if (typeof t == "function") { R1(B4(t, e), i); return; } } i._state = 1, i._value = e, qd(i); } catch (r) { cl(i, r); } } function cl(i, e) { i._state = 2, i._value = e, qd(i); } function qd(i) { i._state === 2 && i._deferreds.length === 0 && zt._immediateFn(function() { i._handled || zt._unhandledRejectionFn(i._value); }); for (var e = 0, t = i._deferreds.length; e < t; e++) L1(i, i._deferreds[e]); i._deferreds = null; } function k4(i, e, t) { this.onFulfilled = typeof i == "function" ? i : null, this.onRejected = typeof e == "function" ? e : null, this.promise = t; } function R1(i, e) { var t = !1; try { i( function(r) { t || (t = !0, $d(e, r)); }, function(r) { t || (t = !0, cl(e, r)); } ); } catch (r) { if (t) return; t = !0, cl(e, r); } } zt.prototype.catch = function(i) { return this.then(null, i); }; zt.prototype.then = function(i, e) { var t = new this.constructor(N4); return L1(this, new k4(i, e, t)), t; }; zt.prototype.finally = O4; zt.all = function(i) { return new zt(function(e, t) { if (!C1(i)) return t(new TypeError("Promise.all accepts an array")); var r = Array.prototype.slice.call(i); if (r.length === 0) return e([]); var n = r.length; function o(s, c) { try { if (c && (typeof c == "object" || typeof c == "function")) { var l = c.then; if (typeof l == "function") { l.call( c, function(h) { o(s, h); }, t ); return; } } r[s] = c, --n === 0 && e(r); } catch (h) { t(h); } } for (var a = 0; a < r.length; a++) o(a, r[a]); }); }; zt.any = I4; zt.allSettled = P4; zt.resolve = function(i) { return i && typeof i == "object" && i.constructor === zt ? i : new zt(function(e) { e(i); }); }; zt.reject = function(i) { return new zt(function(e, t) { t(i); }); }; zt.race = function(i) { return new zt(function(e, t) { if (!C1(i)) return t(new TypeError("Promise.race accepts an array")); for (var r = 0, n = i.length; r < n; r++) zt.resolve(i[r]).then(e, t); }); }; zt._immediateFn = // @ts-ignore typeof setImmediate == "function" && function(i) { setImmediate(i); } || function(i) { D4(i, 0); }; zt._unhandledRejectionFn = function(i) { typeof console < "u" && console && console.warn("Possible Unhandled Promise Rejection:", i); }; const F4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: zt }, Symbol.toStringTag, { value: "Module" })), z4 = /* @__PURE__ */ xu(F4); (function(i, e) { (function(t, r) { i.exports = r(); })(Bn, () => ( /******/ (() => { var t = [ /* 0 */ /***/ (a, s, c) => { c(1); var l = c(2), h = l.version, u = function() { this.Revision = h, 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); }; a.exports = new u(); }, /* 1 */ /***/ (a) => { a.exports = CR(); }, /* 2 */ /***/ (a) => { a.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(a, s, c) { var l = c(4), h = c(5).toBufferGeometry, u = (m, g, d) => { var y = h(m, d), f = !1; 1 > d.opacity && (f = !0); var v; if (y._video === void 0) { var _ = d.localTimeEnabled || d.localMorphColour; g ? (v = g, v.morphTargets = _, v.morphNormals = d.localTimeEnabled) : y instanceof l.BufferGeometry && y.attributes.color === void 0 ? v = new l.MeshPhongMaterial({ color: d.colour, morphTargets: _, morphNormals: d.localTimeEnabled, transparent: f, opacity: d.opacity, side: l.DoubleSide }) : v = new l.MeshPhongMaterial({ color: d.colour, morphTargets: _, morphNormals: d.localTimeEnabled, vertexColors: l.VertexColors, transparent: f, opacity: d.opacity, side: l.DoubleSide }), d.localMorphColour && y.morphAttributes.color && (v.onBeforeCompile = c(9).augmentMorphColor()); } else { var M = y._video.createCanvasVideoTexture(); v = new l.MeshBasicMaterial({ morphTargets: d.localTimeEnabled, color: new l.Color(1, 1, 1), transparent: f, opacity: d.opacity, map: M, side: l.DoubleSide }), this.videoHandler = y._video; } return new l.Mesh(y, v); }, p = function() { c(10).ZincObject.call(this), this.videoHandler = void 0, this.isGeometry = !0, this.createMesh = (m, g, d) => { if (!(this.morph && this.morph.geometry && m != null)) { var y = u(m, g, d); this.setMesh(y, d.localTimeEnabled, d.localMorphColour); } }, this.calculateUVs = () => { this.geometry.computeBoundingBox(); var m = this.geometry.boundingBox.max, g = this.geometry.boundingBox.min, d = new l.Vector2(0 - g.x, 0 - g.y), y = new l.Vector2(m.x - g.x, m.y - g.y); this.geometry.faceVertexUvs[0] = []; for (var f = 0; f < this.geometry.faces.length; f++) { var v = this.geometry.vertices[this.geometry.faces[f].a], _ = this.geometry.vertices[this.geometry.faces[f].b], M = this.geometry.vertices[this.geometry.faces[f].c]; geometry.faceVertexUvs[0].push([new l.Vector2((v.x + d.x) / y.x, (v.y + d.y) / y.y), new l.Vector2((_.x + d.x) / y.x, (_.y + d.y) / y.y), new l.Vector2((M.x + d.x) / y.x, (M.y + d.y) / y.y)]); } geometry.uvsNeedUpdate = !0; }, this.checkTransparentMesh = function() { this._lod.checkTransparentMesh(); }, this.setWireframe = (m) => { this.morph.material.wireframe = m; }, this.editVertices = function(m, g) { if (m && m.length) { var d = this.getMorph(), y = d.geometry.getAttribute("position"); if (!d || 0 > g) return; var f = 3 * g; m.forEach((v) => { y.array[f++] = v[0], y.array[f++] = v[1], y.array[f++] = v[2]; }), y.needsUpdate = !0, d.geometry.computeBoundingBox(), d.geometry.computeBoundingSphere(), this.boundingBoxUpdateRequired = !0; } }; }; p.prototype = Object.create(c(10).ZincObject.prototype), s.Geometry = p; }, /* 4 */ /***/ (a) => { a.exports = Hk; }, /* 5 */ /***/ (a, s, c) => { function l(b) { throw new TypeError('"' + b + '" is read-only'); } var h = c(4), u = c(6).Geometry, p = c(7).default; function m(b) { var E = b, S = c(0).modelPrefix; return S && (S[S.length - 1] != "/" && l("prefix"), /^(?:[a-z]+:)?\/\//i.test(b) || (E = S + b)), E; } function g(b, E) { var S = (R, L) => { try { var A = new URL(R, L).href; if (R && 2 > R.split("?").length) { var P = L.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(b)) return S(b, E); var C = []; return b.forEach((R) => { C.push(S(R, E)); }), C; } function d(b, E, S, C, R) { var L = b.morphTargetInfluences, A = void 0; b.geometry && (A = b.geometry.morphAttributes); var P = !1; if (L && A && A.position) { C.set(0, 0, 0), R.set(0, 0, 0); for (var O = 0; O < L.length; O++) 0 < L[O] && (P = !0, S.setFromArray(A.position[O].array), C.add(S.min.multiplyScalar(L[O])), R.add(S.max.multiplyScalar(L[O]))); P && E.set(C, R); } P || E.setFromBufferAttribute(b.geometry.attributes.position), b.updateWorldMatrix(!0, !0), E.applyMatrix4(b.matrixWorld); } function y(b, E, S, C) { var R = new XMLHttpRequest(); R.open("GET", m(b), !0), R.onreadystatechange = () => { R.readyState == 4 && (R.status == 200 ? S(R.responseText, E) : C(b)); }, R.send(null); } function f(b, E, S) { function C(O, x) { A[x] = O, L++, L == R && E(A); } for (var R = b.length, L = 0, A = [], P = 0; P < R; P++) y(b[P], P, C, S); } s.getColorsRGB = (b, E) => { var S = Math.floor(E / 3), C = E % 3, R = 0; C == 0 ? R = b[S].r : C == 1 ? R = b[S].g : C == 2 && (R = b[S].b); var L = new h.Color(R); return [L.r, L.g, L.b]; }, s.updateMorphColorAttribute = function(b, E) { if (E && b && b.morphAttributes && b.morphAttributes.color) { var S = b.morphAttributes.color, C = E.morphTargetInfluences, R = C.length; b.deleteAttribute("morphColor0"), b.deleteAttribute("morphColor1"); for (var L = 0, A = [], P = 0; 1 > L || P < R; P++) 0 < C[P] && (L++, A.push([P, C[P]])); A.length == 2 ? (b.setAttribute("morphColor0", S[A[0][0]]), b.setAttribute("morphColor1", S[A[1][0]])) : A.length == 1 && (b.setAttribute("morphColor0", S[A[0][0]]), b.setAttribute("morphColor1", S[A[0][0]])); } }, s.toBufferGeometry = (b, E) => { var S; return b instanceof u ? (E.localTimeEnabled && !b.morphNormalsReady && (b.morphNormals == null || b.morphNormals.length == 0) && b.computeMorphNormals(), S = b.toIndexedBufferGeometry(), E.localMorphColour && v(b, S)) : b instanceof h.BufferGeometry && (S = b.clone()), S.colorsNeedUpdate = !0, S.computeBoundingBox(), S.computeBoundingSphere(), b._video && (S._video = b._video), S; }, s.copyMorphColorsToBufferGeometry = (b, E) => { if (b && b.morphColors && 0 < b.morphColors.length) { for (var S = [], C = b.morphColors, R = c(5).getColorsRGB, L = 0, A = C.length; L < A; L++) { for (var P = C[L], O = [], x = 0; x < b.faces.length; x++) { var I = b.faces[x], N = R(P.colors, I.a); O.push(N[0], N[1], N[2]), N = R(P.colors, I.b), O.push(N[0], N[1], N[2]), N = R(P.colors, I.c), O.push(N[0], N[1], N[2]); } var D = new h.Float32BufferAttribute(3 * (3 * b.faces.length), 3); D.name = P.name, S.push(D.copyArray(O)); } E.morphAttributes.color = S; } }; var v = (b, E) => { if (b && b.morphColors && 0 < b.morphColors.length) { for (var S = [], C = b.morphColors, R = c(5).getColorsRGB, L = 0, A = C.length; L < A; L++) { for (var P, O = C[L], x = [], I = 0; I < 3 * O.colors.length; I++) P = R(O.colors, I), x.push(P[0], P[1], P[2]); var N = new h.Float32BufferAttribute(x, 3); N.name = O.name, S.push(N); } E.morphAttributes.color = S; } }; s.mergeVertices = function(b) { var E = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : 1e-4; E = Math.max(E, Number.EPSILON); for (var S, C = {}, R = b.getIndex(), L = b.getAttribute("position"), A = R ? R.count : L.count, P = 0, O = Object.keys(b.attributes), x = {}, I = {}, de = [], N = ["getX", "getY", "getZ", "getW"], D = 0, k = O.length; D < k; D++) { S = O[D], x[S] = []; var F = b.morphAttributes[S]; F && (I[S] = Array(F.length).fill().map(() => [])); } for (var W = Math.log10(1 / E), K = Math.pow(10, W), D = 0; D < A; D++) { for (var ne = R ? R.getX(D) : D, q = "", z = 0, k = O.length; z < k; z++) for (var S = O[z], j = b.getAttribute(S), Q = j.itemSize, Y = 0; Y < Q; Y++) q += "".concat(~~(j[N[Y]](ne) * K), ","); if (q in C) de.push(C[q]); else { for (var z = 0, k = O.length; z < k; z++) for (var ee, S = O[z], j = b.getAttribute(S), F = b.morphAttributes[S], Q = j.itemSize, G = x[S], J = I[S], Y = 0; Y < Q; Y++) if (ee = N[Y], G.push(j[ee](ne)), F) for (var re = 0, B = F.length; re < B; re++) J[re].push(F[re][ee](ne)); C[q] = P, de.push(P), P++; } } for (var $ = b.clone(), D = 0, k = O.length; D < k; D++) { var j, S = O[D], te = b.getAttribute(S), U = new te.array.constructor(x[S]); if (te.isInterleavedBufferAttribute ? j = new h.BufferAttribute(U, te.itemSize, te.itemSize) : (j = b.getAttribute(S).clone(), j.setArray(U)), $.setAttribute(S, j), S in I) for (var V, z = 0; z < I[S].length; z++) V = b.morphAttributes[S][z].clone(), V.setArray(new V.array.constructor(I[S][z])), $.morphAttributes[S][z] = V; } var ae = Uint8Array; de.length >= Math.pow(2, 8) && (ae = Uint16Array), de.length >= Math.pow(2, 16) && (ae = Uint32Array); var ue = new ae(de), de = null; return R === null ? de = new h.BufferAttribute(ue, 1) : (de = b.getIndex().clone(), de.setArray(ue)), $.setIndex(de), $; }; function _(b) { if (b.isMeshPhongMaterial) { var E = new h.MeshToonMaterial({ color: b.color.clone(), morphTargets: b.morphTargets, morphNormals: b.morphNormals, vertexColors: b.vertexColors, transparent: b.transparent, opacity: b.opacity, side: b.side }); return b.map && (E.map = b.map), E; } return b; } function M(b, E) { if (E && b >= E.length) { var S = new h.BufferGeometry(), C = new Float32Array(3 * b), R = 0; return E.forEach((L) => { C[R++] = L[0], C[R++] = L[1], C[R++] = L[2]; }), S.setAttribute("position", new h.BufferAttribute(C, 3)), S.setDrawRange(0, E.length), S; } } function T() { var b = new Image(); b.src = c(8); var E = new h.Texture(); return E.image = b, E.needsUpdate = !0, E; } function w(b, E, S, C, R, L) { var A = new p(b, E, S, C, R, L); return A.fontFace = C, A.fontSize = R, A.fontWeight = L, 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; } s.getBoundingBox = d, s.createNewURL = g, s.createBufferGeometry = M, s.getCircularTexture = T, s.resolveURL = m, s.loadExternalFile = y, s.loadExternalFiles = f, s.PhongToToon = _, s.createNewSpriteText = w; }, /* 6 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ Face3: () => ( /* binding */ y ), /* harmony export */ Geometry: () => ( /* binding */ g ) /* harmony export */ }); var l = c(4), h = new l.Matrix4(), u = new l.Object3D(), p = new l.Vector3(), m = new l.Vector3(); function g() { 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; } g.prototype = Object.assign(Object.create(l.EventDispatcher.prototype), { constructor: g, isGeometry: !0, applyMatrix4: function(f) { for (var v, _ = new l.Matrix3().getNormalMatrix(f), M = 0, T = this.vertices.length; M < T; M++) v = this.vertices[M], v.applyMatrix4(f); for (var w, b = 0, E = this.faces.length; b < E; b++) { w = this.faces[b], w.normal.applyMatrix3(_).normalize(); for (var S = 0, C = w.vertexNormals.length; S < C; S++) w.vertexNormals[S].applyMatrix3(_).normalize(); } return this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this.verticesNeedUpdate = !0, this.normalsNeedUpdate = !0, this; }, rotateX: function(f) { return h.makeRotationX(f), this.applyMatrix4(h), this; }, rotateY: function(f) { return h.makeRotationY(f), this.applyMatrix4(h), this; }, rotateZ: function(f) { return h.makeRotationZ(f), this.applyMatrix4(h), this; }, translate: function(f, v, _) { return h.makeTranslation(f, v, _), this.applyMatrix4(h), this; }, scale: function(f, v, _) { return h.makeScale(f, v, _), this.applyMatrix4(h), this; }, lookAt: function(f) { return u.lookAt(f), u.updateMatrix(), this.applyMatrix4(u.matrix), this; }, fromBufferGeometry: function(f) { function v(F, W, K, ne) { var q = E === void 0 ? [] : [_.colors[F].clone(), _.colors[W].clone(), _.colors[K].clone()], z = b === void 0 ? [] : [new l.Vector3().fromBufferAttribute(b, F), new l.Vector3().fromBufferAttribute(b, W), new l.Vector3().fromBufferAttribute(b, K)], j = new y(F, W, K, z, q, ne); _.faces.push(j), S !== void 0 && _.faceVertexUvs[0].push([new l.Vector2().fromBufferAttribute(S, F), new l.Vector2().fromBufferAttribute(S, W), new l.Vector2().fromBufferAttribute(S, K)]), C !== void 0 && _.faceVertexUvs[1].push([new l.Vector2().fromBufferAttribute(C, F), new l.Vector2().fromBufferAttribute(C, W), new l.Vector2().fromBufferAttribute(C, K)]); } var _ = this, M = f.index === null ? void 0 : f.index, T = f.attributes; if (T.position === void 0) return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."), this; var w = T.position, b = T.normal, E = T.color, S = T.uv, C = T.uv2; C !== void 0 && (this.faceVertexUvs[1] = []); for (var R = 0; R < w.count; R++) _.vertices.push(new l.Vector3().fromBufferAttribute(w, R)), E !== void 0 && _.colors.push(new l.Color().fromBufferAttribute(E, R)); var L = f.groups; if (0 < L.length) for (var A = 0; A < L.length; A++) for (var P = L[A], O = P.start, x = P.count, I = O, N = O + x; I < N; I += 3) M === void 0 ? v(I, I + 1, I + 2, P.materialIndex) : v(M.getX(I), M.getX(I + 1), M.getX(I + 2), P.materialIndex); else if (M !== void 0) for (var D = 0; D < M.count; D += 3) v(M.getX(D), M.getX(D + 1), M.getX(D + 2)); else for (var k = 0; k < w.count; k += 3) v(k, k + 1, k + 2); return this.computeFaceNormals(), f.boundingBox !== null && (this.boundingBox = f.boundingBox.clone()), f.boundingSphere !== null && (this.boundingSphere = f.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 f = this.boundingSphere.center, v = this.boundingSphere.radius, _ = v === 0 ? 1 : 1 / v, M = new l.Matrix4(); return M.set(_, 0, 0, -_ * f.x, 0, _, 0, -_ * f.y, 0, 0, _, -_ * f.z, 0, 0, 0, 1), this.applyMatrix4(M), this; }, computeFaceNormals: function() { for (var f = new l.Vector3(), v = new l.Vector3(), _ = 0, M = this.faces.length; _ < M; _++) { var T = this.faces[_], w = this.vertices[T.a], b = this.vertices[T.b], E = this.vertices[T.c]; f.subVectors(E, b), v.subVectors(w, b), f.cross(v), f.normalize(), T.normal.copy(f); } }, computeVertexNormals: function() { for (var f = !(0 < arguments.length && arguments[0] !== void 0) || arguments[0], v = Array(this.vertices.length), _ = 0, M = this.vertices.length; _ < M; _++) v[_] = new l.Vector3(); if (f) for (var T = new l.Vector3(), w = new l.Vector3(), b = 0, E = this.faces.length; b < E; b++) { var S = this.faces[b], C = this.vertices[S.a], R = this.vertices[S.b], L = this.vertices[S.c]; T.subVectors(L, R), w.subVectors(C, R), T.cross(w), v[S.a].add(T), v[S.b].add(T), v[S.c].add(T); } else { this.computeFaceNormals(); for (var A, P = 0, O = this.faces.length; P < O; P++) A = this.faces[P], v[A.a].add(A.normal), v[A.b].add(A.normal), v[A.c].add(A.normal); } for (var x = 0, I = this.vertices.length; x < I; x++) v[x].normalize(); for (var N = 0, D = this.faces.length; N < D; N++) { var k = this.faces[N], F = k.vertexNormals; F.length === 3 ? (F[0].copy(v[k.a]), F[1].copy(v[k.b]), F[2].copy(v[k.c])) : (F[0] = v[k.a].clone(), F[1] = v[k.b].clone(), F[2] = v[k.c].clone()); } return 0 < this.faces.length && (this.normalsNeedUpdate = !0), v; }, computeFlatVertexNormals: function() { this.computeFaceNormals(); for (var f = 0, v = this.faces.length; f < v; f++) { var _ = this.faces[f], M = _.vertexNormals; M.length === 3 ? (M[0].copy(_.normal), M[1].copy(_.normal), M[2].copy(_.normal)) : (M[0] = _.normal.clone(), M[1] = _.normal.clone(), M[2] = _.normal.clone()); } 0 < this.faces.length && (this.normalsNeedUpdate = !0); }, computeMorphNormals: function() { for (var f, v = 0, _ = this.faces.length; v < _; v++) { f = this.faces[v], f.__originalFaceNormal ? f.__originalFaceNormal.copy(f.normal) : f.__originalFaceNormal = f.normal.clone(), f.__originalVertexNormals || (f.__originalVertexNormals = []); for (var M = 0, T = f.vertexNormals.length; M < T; M++) f.__originalVertexNormals[M] ? f.__originalVertexNormals[M].copy(f.vertexNormals[M]) : f.__originalVertexNormals[M] = f.vertexNormals[M].clone(); } var w = new g(); w.faces = this.faces; for (var b = 0, E = this.morphTargets.length; b < E; b++) { if (!this.morphNormals[b]) { this.morphNormals[b] = {}, this.morphNormals[b].faceNormals = [], this.morphNormals[b].vertexNormals = []; for (var S = this.morphNormals[b].faceNormals, C = this.morphNormals[b].vertexNormals, R = 0, L = this.faces.length; R < L; R++) { var A = new l.Vector3(), P = { a: new l.Vector3(), b: new l.Vector3(), c: new l.Vector3() }; S.push(A), C.push(P); } } var O = this.morphNormals[b]; w.vertices = this.morphTargets[b].vertices, w.computeFaceNormals(); var x = w.computeVertexNormals(); if (x && 0 < x.length) { this.morphTargets[b].normals = Array(this.vertices.length); for (var I = 0; I < x.length; I++) this.morphTargets[b].normals[I] = x[I].clone(); } for (var N = 0, D = this.faces.length; N < D; N++) { var k = this.faces[N], F = O.faceNormals[N], W = O.vertexNormals[N]; F.copy(k.normal), W.a.copy(k.vertexNormals[0]), W.b.copy(k.vertexNormals[1]), W.c.copy(k.vertexNormals[2]); } } for (var K, ne = 0, q = this.faces.length; ne < q; ne++) K = this.faces[ne], K.normal = K.__originalFaceNormal, K.vertexNormals = K.__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(f, v) { var _ = this.morphTargets.length, M = this.morphTargets, T = f.morphTargets, w = this.morphColors.length, b = this.morphColors, E = f.morphColors; if (0 < _ && _ == T.length) for (var S = 0, C = M.length; S < C; S++) { for (var R = M[S], L = T[S], A = 0, P = L.vertices.length; A < P; A++) { var O = L.vertices[A], x = O.clone(); v !== void 0 && x.applyMatrix4(v), R.vertices.push(x); } if (R.normals && L.normals) for (var I = 0; I < L.normals.length; I += 3) m.set(L.normals2[I], L.normals2[I + 1], L.normals2[I + 2]), v !== void 0 && m.applyMatrix4(v), R.normals.push(m.x, m.y, m.z); } if (0 < w && w == E.length) for (var N = 0, D = b.length; N < D; N++) for (var k = b[N], F = E[N], W = 0, K = F.colors; W < K; W++) k.colors.push(F.colors[W].clone()); }, merge: function(f, v) { var _ = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : 0; if (!(f && f.isGeometry)) return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", f); var M, T = this.vertices.length, w = this.vertices, b = f.vertices, E = f.normals, S = this.faces, C = f.faces, R = this.colors, L = f.colors; v !== void 0 && (M = new l.Matrix3().getNormalMatrix(v)); for (var A = 0, P = b.length; A < P; A++) { var O = b[A], x = O.clone(); v !== void 0 && x.applyMatrix4(v), w.push(x); } for (var I = 0; I < E.length; I += 3) m.set(E[I], E[I + 1], E[I + 2]), v !== void 0 && m.applyMatrix4(v), this.normals.push(m.x, m.y, m.z); for (var N = 0, D = L.length; N < D; N++) typeof L[N] == "number" ? R.push(L[N]) : R.push(L[N].clone()); for (var k = 0, F = C.length; k < F; k++) { var W = C[k], K = void 0, ne = void 0, q = W.vertexNormals, z = W.vertexColors, j = new y(W.a + T, W.b + T, W.c + T); j.normal.copy(W.normal), M !== void 0 && j.normal.applyMatrix3(M).normalize(); for (var Q = 0, Y = q.length; Q < Y; Q++) K = q[Q].clone(), M !== void 0 && K.applyMatrix3(M).normalize(), j.vertexNormals.push(K); j.color.copy(W.color); for (var ee = 0, G = z.length; ee < G; ee++) ne = z[ee], j.vertexColors.push(ne.clone()); j.materialIndex = W.materialIndex + _, S.push(j); } for (var J, re = 0, B = f.faceVertexUvs.length; re < B; re++) { J = f.faceVertexUvs[re], this.faceVertexUvs[re] === void 0 && (this.faceVertexUvs[re] = []); for (var $ = 0, te = J.length; $ < te; $++) { for (var U = J[$], V = [], ae = 0, ue = U.length; ae < ue; ae++) V.push(U[ae].clone()); this.faceVertexUvs[re].push(V); } } this.mergeMorph(f, v); }, mergeMesh: function(f) { return f && f.isMesh ? (f.matrixAutoUpdate && f.updateMatrix(), void this.merge(f.geometry, f.matrix)) : void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.", f); }, /* * Checks for duplicate vertices with hashmap. * Duplicated vertices are removed * and faces' vertices are updated. */ mergeVertices: function() { for (var f = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : 4, v = {}, _ = [], M = [], T = Math.pow(10, f), w = 0, b = this.vertices.length; w < b; w++) { var E = this.vertices[w], S = Math.round(E.x * T) + "_" + Math.round(E.y * T) + "_" + Math.round(E.z * T); v[S] === void 0 ? (v[S] = w, _.push(this.vertices[w]), M[w] = _.length - 1) : M[w] = M[v[S]]; } for (var C, R = [], L = 0, A = this.faces.length; L < A; L++) { C = this.faces[L], C.a = M[C.a], C.b = M[C.b], C.c = M[C.c]; for (var P = [C.a, C.b, C.c], O = 0; 3 > O; O++) if (P[O] === P[(O + 1) % 3]) { R.push(L); break; } } for (var x, I = R.length - 1; 0 <= I; I--) { x = R[I], this.faces.splice(x, 1); for (var N = 0, D = this.faceVertexUvs.length; N < D; N++) this.faceVertexUvs[N].splice(x, 1); } var k = this.vertices.length - _.length; return this.vertices = _, k; }, setFromPoints: function(f) { this.vertices = []; for (var v, _ = 0, M = f.length; _ < M; _++) v = f[_], this.vertices.push(new l.Vector3(v.x, v.y, v.z || 0)); return this; }, sortFacesByMaterialIndex: function() { for (var f = this.faces, v = f.length, _ = 0; _ < v; _++) f[_]._id = _; f.sort(function(C, R) { return C.materialIndex - R.materialIndex; }); var M, T, w = this.faceVertexUvs[0], b = this.faceVertexUvs[1]; w && w.length === v && (M = []), b && b.length === v && (T = []); for (var E, S = 0; S < v; S++) E = f[S]._id, M && M.push(w[E]), T && T.push(b[E]); M && (this.faceVertexUvs[0] = M), T && (this.faceVertexUvs[1] = T); }, toJSON: function() { function f(G, J, re) { return re ? G | 1 << J : G & ~(1 << J); } function v(G) { var J = G.x.toString() + G.y.toString() + G.z.toString(); return A[J] === void 0 && (A[J] = L.length / 3, L.push(G.x, G.y, G.z)), A[J]; } function _(G) { var J = G.r.toString() + G.g.toString() + G.b.toString(); return O[J] === void 0 && (O[J] = P.length, P.push(G.getHex())), O[J]; } function M(G) { var J = G.x.toString() + G.y.toString(); return I[J] === void 0 && (I[J] = x.length / 2, x.push(G.x, G.y)), I[J]; } var T = { metadata: { version: 4.5, type: "Geometry", generator: "Geometry.toJSON" } }; if (T.uuid = this.uuid, T.type = this.type, this.name !== "" && (T.name = this.name), this.parameters !== void 0) { var w = this.parameters; for (var b in w) w[b] !== void 0 && (T[b] = w[b]); return T; } for (var E, S = [], C = 0; C < this.vertices.length; C++) E = this.vertices[C], S.push(E.x, E.y, E.z); for (var R = [], L = [], A = {}, P = [], O = {}, x = [], I = {}, N = 0; N < this.faces.length; N++) { var D = this.faces[N], k = !0, F = !1, W = this.faceVertexUvs[0][N] !== void 0, K = 0 < D.normal.length(), ne = 0 < D.vertexNormals.length, q = D.color.r !== 1 || D.color.g !== 1 || D.color.b !== 1, z = 0 < D.vertexColors.length, j = 0; if (j = f(j, 0, 0), j = f(j, 1, k), j = f(j, 2, F), j = f(j, 3, W), j = f(j, 4, K), j = f(j, 5, ne), j = f(j, 6, q), j = f(j, 7, z), R.push(j), R.push(D.a, D.b, D.c), R.push(D.materialIndex), W) { var Q = this.faceVertexUvs[0][N]; R.push(M(Q[0]), M(Q[1]), M(Q[2])); } if (K && R.push(v(D.normal)), ne) { var Y = D.vertexNormals; R.push(v(Y[0]), v(Y[1]), v(Y[2])); } if (q && R.push(_(D.color)), z) { var ee = D.vertexColors; R.push(_(ee[0]), _(ee[1]), _(ee[2])); } } return T.data = {}, T.data.vertices = S, T.data.normals = L, 0 < P.length && (T.data.colors = P), 0 < x.length && (T.data.uvs = [x]), T.data.faces = R, T; }, clone: function() { return new g().copy(this); }, copy: function(f) { 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 = f.name; for (var v = f.vertices, _ = 0, M = v.length; _ < M; _++) this.vertices.push(v[_].clone()); for (var T = f.colors, w = 0, b = T.length; w < b; w++) this.colors.push(T[w].clone()); for (var E = f.faces, S = 0, C = E.length; S < C; S++) this.faces.push(E[S].clone()); for (var R, L = 0, A = f.faceVertexUvs.length; L < A; L++) { R = f.faceVertexUvs[L], this.faceVertexUvs[L] === void 0 && (this.faceVertexUvs[L] = []); for (var P = 0, O = R.length; P < O; P++) { for (var x, I = R[P], N = [], D = 0, k = I.length; D < k; D++) x = I[D], N.push(x.clone()); this.faceVertexUvs[L].push(N); } } for (var F, W = f.morphTargets, K = 0, ne = W.length; K < ne; K++) { if (F = {}, F.name = W[K].name, W[K].vertices !== void 0) { F.vertices = []; for (var q = 0, z = W[K].vertices.length; q < z; q++) F.vertices.push(W[K].vertices[q].clone()); } if (W[K].normals !== void 0) { F.normals = []; for (var j = 0, Q = W[K].normals.length; j < Q; j++) F.normals.push(W[K].normals[j].clone()); } this.morphTargets.push(F); } for (var Y, ee = f.morphNormals, G = 0, J = ee.length; G < J; G++) { if (Y = {}, ee[G].vertexNormals !== void 0) { Y.vertexNormals = []; for (var re = 0, B = ee[G].vertexNormals.length; re < B; re++) { var $ = ee[G].vertexNormals[re], te = {}; te.a = $.a.clone(), te.b = $.b.clone(), te.c = $.c.clone(), Y.vertexNormals.push(te); } } if (ee[G].faceNormals !== void 0) { Y.faceNormals = []; for (var U = 0, V = ee[G].faceNormals.length; U < V; U++) Y.faceNormals.push(ee[G].faceNormals[U].clone()); } this.morphNormals.push(Y); } for (var ae = f.skinWeights, ue = 0, de = ae.length; ue < de; ue++) this.skinWeights.push(ae[ue].clone()); for (var ve = f.skinIndices, ye = 0, le = ve.length; ye < le; ye++) this.skinIndices.push(ve[ye].clone()); for (var Se = f.lineDistances, Te = 0, oe = Se.length; Te < oe; Te++) this.lineDistances.push(Se[Te]); var Me = f.boundingBox; Me !== null && (this.boundingBox = Me.clone()); var ge = f.boundingSphere; return ge !== null && (this.boundingSphere = ge.clone()), this.elementsNeedUpdate = f.elementsNeedUpdate, this.verticesNeedUpdate = f.verticesNeedUpdate, this.uvsNeedUpdate = f.uvsNeedUpdate, this.normalsNeedUpdate = f.normalsNeedUpdate, this.colorsNeedUpdate = f.colorsNeedUpdate, this.lineDistancesNeedUpdate = f.lineDistancesNeedUpdate, this.groupsNeedUpdate = f.groupsNeedUpdate, this; }, computeGroups() { var f, v, _ = [], M = void 0, T = this.faces; for (v = 0; v < T.length; v++) { var w = T[v]; w.materialIndex !== M && (M = w.materialIndex, f !== void 0 && (f.count = 3 * v - f.start, _.push(f)), f = { start: 3 * v, materialIndex: M }); } return f !== void 0 && (f.count = 3 * v - f.start, _.push(f)), _; }, toBufferGeometry: function() { var f = new d().fromGeometry(this), v = new l.BufferGeometry(), _ = new Float32Array(3 * f.vertices.length); if (v.setAttribute("position", new l.BufferAttribute(_, 3).copyVector3sArray(f.vertices)), 0 < f.normals.length) { var M = new Float32Array(3 * f.normals.length); v.setAttribute("normal", new l.BufferAttribute(M, 3).copyVector3sArray(f.normals)); } if (0 < f.colors.length) { var T = new Float32Array(3 * f.colors.length); v.setAttribute("color", new l.BufferAttribute(T, 3).copyColorsArray(f.colors)); } if (0 < f.uvs.length) { var w = new Float32Array(2 * f.uvs.length); v.setAttribute("uv", new l.BufferAttribute(w, 2).copyVector2sArray(f.uvs)); } if (0 < f.uvs2.length) { var b = new Float32Array(2 * f.uvs2.length); v.setAttribute("uv2", new l.BufferAttribute(b, 2).copyVector2sArray(f.uvs2)); } for (var E in v.groups = f.groups, f.morphTargets) { for (var S = [], C = f.morphTargets[E], R = 0, L = C.length; R < L; R++) { var A = C[R], P = new l.Float32BufferAttribute(3 * A.data.length, 3); P.name = A.name, S.push(P.copyVector3sArray(A.data)); } v.morphAttributes[E] = S; } if (0 < f.skinIndices.length) { var O = new l.Float32BufferAttribute(4 * f.skinIndices.length, 4); v.setAttribute("skinIndex", O.copyVector4sArray(f.skinIndices)); } if (0 < f.skinWeights.length) { var x = new l.Float32BufferAttribute(4 * f.skinWeights.length, 4); v.setAttribute("skinWeight", x.copyVector4sArray(f.skinWeights)); } return f.boundingSphere !== null && (v.boundingSphere = f.boundingSphere.clone()), f.boundingBox !== null && (v.boundingBox = f.boundingBox.clone()), v; }, toIndexedBufferGeometry: function() { var f = new l.BufferGeometry(), v = new Float32Array(3 * this.vertices.length); if (f.setAttribute("position", new l.BufferAttribute(v, 3).copyVector3sArray(this.vertices)), 0 < this.normals.length) { var _ = new Float32Array(this.normals.length), M = new l.BufferAttribute(_, 3).copyArray(this.normals); f.setAttribute("normal", M); } if (0 < this.uvs.length && 0 < this.uvs[0].length) { var T = new Float32Array(2 * this.uvs[0].length); f.setAttribute("uv", new l.BufferAttribute(T, 2).copyArray(this.uvs[0])); } if (1 < this.uvs.length && 0 < this.uvs[1].length) { var w = new Float32Array(2 * this.uvs[1].length); f.setAttribute("uv2", new l.BufferAttribute(w, 2).copyArray(this.uvs[1])); } if (0 < this.colors.length) { for (var b = [], E = 0; E < this.colors.length; E++) b.push(new l.Color(this.colors[E])); var S = new Float32Array(3 * b.length); f.setAttribute("color", new l.BufferAttribute(S, 3).copyColorsArray(b)); } else { for (var C = new Float32Array(3 * this.vertices.length), R = 0; R < 3 * this.vertices.length; R++) C[R] = 1; f.setAttribute("color", new l.BufferAttribute(C, 3)); } if (0 < this.faces.length) { for (var L = [], A = [], P = 0; P < this.faces.length; P++) { A.push(this.faces[P].a, this.faces[P].b, this.faces[P].c); var O = this.faces[P].vertexColors; if (O.length === 3) L.push(O[0], O[1], O[2]); else { var x = this.faces[P].color; L.push(x, x, x); } } f.setIndex(A), f.groups = this.computeGroups(); } if (0 < this.morphTargets.length) { for (var I = [], N = [], D = 0, k = this.morphTargets.length; D < k; D++) { var F = this.morphTargets[D], W = new l.Float32BufferAttribute(3 * F.vertices.length, 3); if (W.name = F.name, I.push(W.copyVector3sArray(F.vertices)), F.normals) { var K = new l.Float32BufferAttribute(3 * F.normals.length, 3); K.name = F.name, N.push(K.copyVector3sArray(F.normals)); } } f.morphAttributes.position = I, f.morphAttributes.normal = N; } if (0 < this.skinIndices.length) { var ne = new l.Float32BufferAttribute(4 * this.skinIndices.length, 4); f.setAttribute("skinIndex", ne.copyVector4sArray(this.skinIndices)); } if (0 < this.skinWeights.length) { var q = new l.Float32BufferAttribute(4 * this.skinWeights.length, 4); f.setAttribute("skinWeight", q.copyVector4sArray(this.skinWeights)); } return this.boundingSphere !== null && (f.boundingSphere = this.boundingSphere.clone()), this.boundingBox !== null && (f.boundingBox = this.boundingBox.clone()), f; }, 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(f) { return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(f); }, dispose: function() { this.dispatchEvent({ type: "dispose" }); } }), g.createBufferGeometryFromObject = function(f) { var v = new l.BufferGeometry(), _ = f.geometry; if (f.isPoints || f.isLine) { var M = new l.Float32BufferAttribute(3 * _.vertices.length, 3), T = new l.Float32BufferAttribute(3 * _.colors.length, 3); if (v.setAttribute("position", M.copyVector3sArray(_.vertices)), v.setAttribute("color", T.copyColorsArray(_.colors)), _.lineDistances && _.lineDistances.length === _.vertices.length) { var w = new l.Float32BufferAttribute(_.lineDistances.length, 1); v.setAttribute("lineDistance", w.copyArray(_.lineDistances)); } _.boundingSphere !== null && (v.boundingSphere = _.boundingSphere.clone()), _.boundingBox !== null && (v.boundingBox = _.boundingBox.clone()); } else f.isMesh && (v = _.toBufferGeometry()); return v; }; class d { 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(v) { var _, M, T = [], w = void 0, b = v.faces; for (M = 0; M < b.length; M++) { var E = b[M]; E.materialIndex !== w && (w = E.materialIndex, _ !== void 0 && (_.count = 3 * M - _.start, T.push(_)), _ = { start: 3 * M, materialIndex: w }); } _ !== void 0 && (_.count = 3 * M - _.start, T.push(_)), this.groups = T; } fromGeometry(v) { var _, M = v.faces, T = v.vertices, w = v.faceVertexUvs, b = w[0] && 0 < w[0].length, E = w[1] && 0 < w[1].length, S = v.morphTargets, C = S.length; if (0 < C) { _ = []; for (var R = 0; R < C; R++) _[R] = { name: S[R].name, data: [] }; this.morphTargets.position = _; } var L, A = v.morphNormals, P = A.length; if (0 < P) { L = []; for (var O = 0; O < P; O++) L[O] = { name: A[O].name, data: [] }; this.morphTargets.normal = L; } var x = v.skinIndices, I = v.skinWeights, N = x.length === T.length, D = I.length === T.length; 0 < T.length && M.length === 0 && console.error("THREE.DirectGeometry: Faceless geometries are not supported."); for (var k, F = 0; F < M.length; F++) { k = M[F], this.vertices.push(T[k.a], T[k.b], T[k.c]); var W = k.vertexNormals; if (W.length === 3) this.normals.push(W[0], W[1], W[2]); else { var K = k.normal; this.normals.push(K, K, K); } var ne = k.vertexColors; if (ne.length === 3) this.colors.push(ne[0], ne[1], ne[2]); else { var q = k.color; this.colors.push(q, q, q); } if (b === !0) { var z = w[0][F]; z === void 0 ? (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ", F), this.uvs.push(new l.Vector2(), new l.Vector2(), new l.Vector2())) : this.uvs.push(z[0], z[1], z[2]); } if (E === !0) { var j = w[1][F]; j === void 0 ? (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ", F), this.uvs2.push(new l.Vector2(), new l.Vector2(), new l.Vector2())) : this.uvs2.push(j[0], j[1], j[2]); } for (var Q, Y = 0; Y < C; Y++) Q = S[Y].vertices, _[Y].data.push(Q[k.a], Q[k.b], Q[k.c]); for (var ee, G = 0; G < P; G++) ee = A[G].vertexNormals[F], L[G].data.push(ee.a, ee.b, ee.c); N && this.skinIndices.push(x[k.a], x[k.b], x[k.c]), D && this.skinWeights.push(I[k.a], I[k.b], I[k.c]); } return this.computeGroups(v), this.verticesNeedUpdate = v.verticesNeedUpdate, this.normalsNeedUpdate = v.normalsNeedUpdate, this.colorsNeedUpdate = v.colorsNeedUpdate, this.uvsNeedUpdate = v.uvsNeedUpdate, this.groupsNeedUpdate = v.groupsNeedUpdate, v.boundingSphere !== null && (this.boundingSphere = v.boundingSphere.clone()), v.boundingBox !== null && (this.boundingBox = v.boundingBox.clone()), this; } } class y { constructor(v, _, M, T, w) { var b = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : 0; this.a = v, this.b = _, this.c = M, this.normal = T && T.isVector3 ? T : new l.Vector3(), this.vertexNormals = Array.isArray(T) ? T : [], this.color = w && w.isColor ? w : new l.Color(), this.vertexColors = Array.isArray(w) ? w : [], this.materialIndex = b; } clone() { return new this.constructor().copy(this); } copy(v) { this.a = v.a, this.b = v.b, this.c = v.c, this.normal.copy(v.normal), this.color.copy(v.color), this.materialIndex = v.materialIndex; for (var _ = 0, M = v.vertexNormals.length; _ < M; _++) this.vertexNormals[_] = v.vertexNormals[_].clone(); for (var T = 0, w = v.vertexColors.length; T < w; T++) this.vertexColors[T] = v.vertexColors[T].clone(); return this; } } }, /* 7 */ /***/ (a) => { a.exports = o4; }, /* 8 */ /***/ (a) => { a.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 */ /***/ (a, s) => { s.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 */ /***/ (a, s, c) => { var l = c(4), h = c(5).createBufferGeometry, u = c(5).resolveURL, p = 0, m = function() { return "pr" + p++; }, g = 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 = m(), 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; }; g.prototype.setDuration = function(d) { this.duration = d, this.clipAction && this.clipAction.setDuration(this.duration); }, g.prototype.getDuration = function() { return this.duration; }, g.prototype.setRegion = function(d) { this.region = d; }, g.prototype.getRegion = function() { return this.region; }, g.prototype.getMorph = function() { var d = this._lod.getCurrentMorph(); return d || this.morph; }, g.prototype.getGroup = function() { return this.group; }, g.prototype.setMorph = function(d) { this.morph = d, this.group.add(this.morph); var y = this._lod.calculateDistance("far"); this._lod.addLevel(d, y), this._lod.setMaterial(d.material); }, g.prototype.checkTransparentMesh = function() { }, g.prototype.setMesh = function(d, y, f) { this.animationGroup = new l.AnimationObjectGroup(d), this.mixer = new l.AnimationMixer(this.animationGroup); var v = d.geometry; if (this.geometry = d.geometry, this.clipAction = void 0, v && v.morphAttributes) { var _ = v.morphAttributes.position; _ || (_ = v.morphAttributes.color ? v.morphAttributes.color : v.morphAttributes.normal), _ && (this.animationClip = l.AnimationClip.CreateClipsFromMorphTargetSequences(_, 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 = f, d.userData = this, d.matrixAutoUpdate = !1, this.setMorph(d), this.checkTransparentMesh(), this.timeEnabled ? this.setFrustumCulled(!1) : this.morphColour && (v.setAttribute("morphTarget0", v.getAttribute("position")), v.setAttribute("morphTarget1", v.getAttribute("position"))), this.boundingBoxUpdateRequired = !0; }, g.prototype.setName = function(d) { this.groupName = d, this._lod.setName(d); }, g.prototype.getCurrentTime = function() { if (this.clipAction) { var d = this.clipAction.time / this.clipAction._clip.duration; return this.duration * d; } return this.inbuildTime; }, g.prototype.setMorphTime = function(d) { var y = !1; if (this.clipAction) { var f = d / this.duration, v = this.clipAction._clip.duration, _ = f * v; _ != this.clipAction.time && (this.clipAction.time = _, y = !0), y && this.isTimeVarying() && this.mixer.update(0); } else { var M = d; M = d > this.duration ? this.duration : 0 > d ? 0 : d, M != this.inbuildTime && (this.inbuildTime = M, y = !0); } y && (this.boundingBoxUpdateRequired = !0, this._lod.updateMorphColorAttribute(!0), this.timeEnabled && (this.markerUpdateRequired = !0)); }, g.prototype.isTimeVarying = function() { return !!(this.timeEnabled || this.morphColour); }, g.prototype.getVisibility = function() { return this.visible; }, g.prototype.setVisibility = function(d) { d !== this.visible && (this.visible = d, this.group.visible = d, this.region && (this.region.pickableUpdateRequired = !0)); }, g.prototype.setAlpha = function(d) { var y = this._lod._material, f = !1; 1 > d && (f = !0), y.opacity = d, y.transparent = f, this.checkTransparentMesh(); }, g.prototype.setFrustumCulled = function(d) { this._lod.setFrustumCulled(d); }, g.prototype.setVertexColors = function(d) { this._lod.setVertexColors(d); }, g.prototype.getColour = function() { return this._lod._material ? this._lod._material.color : void 0; }, g.prototype.setColour = function(d) { this._lod.setColour(d); }, g.prototype.getColourHex = function() { return !this.morphColour && this._lod._material && this._lod._material.color ? this._lod._material.color.getHexString() : void 0; }, g.prototype.setColourHex = function(d) { this._lod._material.color.setHex(d), this._lod._secondaryMaterial && this._lod._secondaryMaterial.color.setHex(d); }, g.prototype.setEmissiveRGB = function(d) { this._lod._material && this._lod._material.emissive && this._lod._material.emissive.setRGB(...d), this._lod._secondaryMaterial && this._lod._secondaryMaterial.emissive.setRGB(...d); }, g.prototype.setMaterial = function(d) { this._lod.setMaterial(d); }, g.prototype.getClosestVertexIndex = function() { var d = -1, y = this.getMorph(); if (y && y.geoemtry) { var f = y.geometry.attributes.position; if (this._b1.setFromBufferAttribute(f), this._b1.getCenter(this._v1), f) for (var v = -1, _ = 0, M = 0; M < f.count; M++) this._v2.fromArray(f.array, 3 * M), _ = this._v2.distanceTo(this._v1), v == -1 ? v = _ : v > _ && (v = _, d = M); } return d; }, g.prototype.getClosestVertex = function(d) { var y = new l.Vector3(); this.closestVertexIndex == -1 && (this.closestVertexIndex = this.getClosestVertexIndex()); var f = this.getMorph(); if (f && f.geometry && 0 <= this.closestVertexIndex) { var v = f.morphTargetInfluences, _ = f.geometry.morphAttributes; if (v && _ && _.position) { for (var M = !1, T = 0; T < v.length; T++) 0 < v[T] && (M = !0, this._v1.fromArray(_.position[T].array, 3 * this.closestVertexIndex), y.add(this._v1.multiplyScalar(v[T]))); if (M) return d ? y.applyMatrix4(f.matrixWorld) : y; } else return y.fromArray(f.geometry.attributes.position.array, 3 * this.closestVertexIndex), d ? y.applyMatrix4(f.matrixWorld) : y; } return this.getBoundingBox(), y.copy(this.center), d ? y.applyMatrix4(this.morph.matrixWorld) : y; }, g.prototype.getBoundingBox = function() { if (this.visible) { var d = this._lod.getCurrentMorph(); if (d && d.visible) return this.boundingBoxUpdateRequired && (c(5).getBoundingBox(d, 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; } }, g.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; }, g.prototype.markerIsRequired = function(d) { return !!(this.visible && (this.markerMode === "on" || d && d.displayMarkers && this.markerMode === "inherited")); }, g.prototype.updateMarker = function(d, y) { if (d == !1 && this.markerIsRequired(y)) { var f = y.ndcToBeUpdated; if (this.groupName) { if (this.marker || (this.marker = new (c(14)).Marker(this), this.markerUpdateRequired = !0), this.markerUpdateRequired) { var v = this.getClosestVertex(!1); v && (this.marker.setPosition(v.x, v.y, v.z), this.markerUpdateRequired = !1); } this.marker.isEnabled() || (y.markersList && !(this.marker.uuid in y.markersList) && (f = !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 && (f || 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; }, g.prototype.processMarkerVisual = function(d, y) { this.marker && this.marker.isEnabled() && this.marker.updateVisual(d, y); }, g.prototype.initiateMorphColor = function() { this.morphColour == 1 && this._lod.updateMorphColorAttribute(!1); }, g.prototype.setRenderOrder = function(d) { this._lod.setRenderOrder(d); }, g.prototype.getClosestVertexDOMElementCoords = function(d) { if (d && d.camera) { var y = !0, f = this.getClosestVertex(!0); return f.project(d.camera), f.z = Math.min(Math.max(f.z, 0), 1), (1 < f.x || -1 > f.x || 1 < f.y || -1 > f.y) && (y = !1), d.getZincCameraControls().getRelativeCoordsFromNDC(f.x, f.y, f), { position: f, inView: y }; } }, g.prototype.setMarkerMode = function(d, y) { d !== this.markerMode && (this.markerMode = d === "on" || d === "off" ? d : "inherited", this.region && (this.region.pickableUpdateRequired = !0)), y && (this.markerNumber = y.number, this.markerImgURL = y.imgURL); }, g.prototype.render = function(d, y, f, v) { if (this.visible && !(this.timeEnabled && y) && this._lod.update(f, this.center), y == !0) { if (this.clipAction && this.isTimeVarying()) this.mixer.update(d); else { var _ = this.inbuildTime + d; _ > this.duration && (_ -= this.duration), this.inbuildTime = _; } this.visible && d != 0 && (this.boundingBoxUpdateRequired = !0, this.morphColour == 1 && this._lod.updateMorphColorAttribute(!0)); } this.updateMarker(y, v); }, g.prototype.addLOD = function(d, y, f, v, _) { this._lod.addLevelFromURL(d, y, f, v, _); }, g.prototype.addVertices = function(d) { var y = this.getMorph(), f = void 0; if (!y) f = h(500, d), this.drawRange = d.length; else if (-1 < this.drawRange) { var v = y.geometry.getAttribute("position"); d.forEach((_) => { v.setXYZ(this.drawRange, _[0], _[1], _[2]), ++this.drawRange; }), v.needsUpdate = !0, y.geometry.setDrawRange(0, this.drawRange), y.geometry.computeBoundingBox(), y.geometry.computeBoundingSphere(), f = y.geoemtry, this.boundingBoxUpdateRequired = !0; } return f; }, g.prototype.setPosition = function(d, y, f) { var v = this.getGroup(); v && (v.position.set(d, y, f), v.updateMatrix(), this.boundingBoxUpdateRequired = !0); }, g.prototype.loadAdditionalSources = function(d) { d.load(u(filename), meshloader(region, colour, opacity, localTimeEnabled, localMorphColour, void 0, void 0, void 0, void 0, finishCallback), this.onProgress(filename), this.onError(finishCallback)); }, g.prototype.setScaleAll = function(d) { var y = this.getGroup(); y && (y.scale.set(d, d, d), y.updateMatrix(), this.boundingBoxUpdateRequired = !0); }, s.ZincObject = g; }, /* 11 */ /***/ (a, s, c) => { var l = c(4), h = c(5).updateMorphColorAttribute, u = c(5).toBufferGeometry, p = function(m) { this.levels = [], this._currentLevel = 0, this._renderOrder = 1, this._material = void 0, this._secondaryMaterial = void 0, this._loader = void 0, this._parent = m, this.addLevel = (d, y) => { if (d) { var f, v = Math.abs(y); for (f = 0; f < this.levels.length && !(v < this.levels[f].distance); f++) ; this.levels.splice(f, 0, { distance: v, morph: d, loaded: !0, loading: !1, url: "" }), d.renderOrder = this._renderOrder; } }, this.levelLoaded = (d, y) => { if (d) { for (var f = Math.abs(y), v = 0; v < this.levels.length; v++) if (f === this.levels[v].distance) { this._parent.group.add(d), this.levels[v].morph = d, this.levels[v].loaded = !0, this.levels[v].loading = !1; break; } this.checkTransparentMesh(); } }, this.addLevelFromURL = (d, y, f, v, _) => { this._loader = d; var M, T = this.calculateDistance(y); for (M = 0; M < this.levels.length && !(T < this.levels[M].distance); M++) ; this.levels.splice(M, 0, { distance: T, morph: void 0, loaded: !1, loading: !1, url: f, index: v }), _ && this.loadLevel(M); }, this.loadLevel = (d) => { var y = this.levels[d]; 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(d) { this._parent.getBoundingBox(); var y = this._parent.radius, f = 0; return d === "far" ? f = 4.5 * y : d === "medium" ? f = 2.5 * y : d == "close" && (f = 0), f; }, this.containsLevels = () => !!(this.levels && 1 < this.levels.length), this.checkTransparentMesh = () => { var d = 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, !d.secondaryMesh && (d.secondaryMesh = new l.Mesh(d.morph.geometry, this._secondaryMaterial), d.secondaryMesh.renderOrder = d.morph.renderOrder + 1, d.secondaryMesh.userData = d.morph.userData, d.secondaryMesh.name = d.morph.name), this._material.side = l.BackSide, this._material.needsUpdate = !0, !d.secondaryMesh.parent && (d.morph.add(d.secondaryMesh), this._parent.animationGroup && this._parent.animationGroup.add(d.secondaryMesh))) : (d.secondaryMesh && (d.morph.remove(d.secondaryMesh), this._parent.animationGroup && (this._parent.animationGroup.uncache(d.secondaryMesh), this._parent.animationGroup.remove(d.secondaryMesh))), this._material.side = l.DoubleSide, this._material.needsUpdate = !0)); }, this.dispose = () => { this.levels.forEach((d) => { d.morph && d.morph.geometry && d.morph.geometry.dispose(); }), this._material && this._material.dispose(), this._secondaryMaterial && this._secondaryMaterial.dispose(); }, this.getCurrentLevel = () => this._currentLevel, this.getCurrentMorph = () => { var d = this.levels[this._currentLevel]; return d && d.morph ? d.morph : this._parent.morph; }, this.lodLoader = function(d) { return (y) => { var f = this._material, v = { localTimeEnabled: this._parent.timeEnabled, localMorphColour: this._parent.morphColour }, _ = u(y, v), M = void 0; this._parent.isGeometry ? M = new l.Mesh(_, f) : this._parent.isLines && (M = new (c(12)).LineSegments(_, f)), M.userData = this._parent, M.renderOrder = this._renderOrder, y.dispose(), this.levelLoaded(M, d); }; }, this.updateMorphColorAttribute = (d) => { if (this._material && (this._material.vertexColors == l.VertexColors || this._material.vertexColors == !0)) if (d) { var y = this.getCurrentMorph(); h(y.geometry, y); } else this.levels.forEach((f) => { f.morph && f.morph.geometry && h(f.morph.geometry, f.morph); }); }, this.setColour = (d) => { this._material.color = d, this._secondaryMaterial && (this._secondaryMaterial.color = d), g(); }, this.setFrustumCulled = (d) => { this.levels.forEach((y) => { y.morph && (y.morph.frustumCulled = d), y.secondaryMesh && (y.secondaryMesh.frustumCulled = d); }); }, this.setMaterial = (d) => { d && (!this._material || this._material.id !== d.id) && (this._material = d, this._secondaryMaterial && this._secondaryMaterial.dispose(), this._secondaryMaterial = d.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 = (d) => { this.levels.forEach((y) => { y.morph && (y.morph.name = d), y.secondaryMesh && (y.secondaryMesh.name = d); }); }, this.setRenderOrder = (d) => { this._renderOrder = d, this.levels.forEach((y) => { y.morph && (y.morph.renderOrder = d), y.secondaryMesh && (y.secondaryMesh.renderOrder = d); }); }, this.setVertexColors = (d) => { this._material.vertexColors = d, g(), this._secondaryMaterial && (this._secondaryMaterial.vertexColors = d); }, this.update = (d, y) => { var f = this.levels; if (1 < f.length) { var v, _, M = d.cameraObject.position.distanceTo(y), T = -1, w = -1; for (v = 0, _ = f.length; v < _ && M >= f[v].distance; v++) f[v].morph ? (-1 < T && f[T].morph && (f[T].morph.visible = !1), T = v, f[v].morph.visible = !0, w = -1) : w = v; for (-1 < w && this.loadLevel(w); v < _; v++) f[v].morph && (-1 < T ? f[v].morph.visible = !1 : (f[v].morph.visible = !0, T = v)); this._currentLevel != T && (this._currentLevel = T, this.checkTransparentMesh()); } }, this.toggleMarker = (d, y) => { this.levels.forEach((f) => { f.morph && (y ? f.morph.add(d) : f.morph.remove(d)); }); }; var g = () => { this.levels.forEach((d) => { d.morph && d.morph.geometry && (d.morph.geometry.colorsNeedUpdate = !0); }); }; }; s.LOD = p; }, /* 12 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ LineSegments: () => ( /* binding */ m ) /* harmony export */ }); var l = c(13), h = c(4), u = /* @__PURE__ */ new h.Vector3(), p = /* @__PURE__ */ new h.Vector3(); class m extends l.Line { constructor(d, y) { super(d, y), this.type = "LineSegments"; } computeLineDistances() { var d = this.geometry; if (!d.isBufferGeometry) d.isGeometry && console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); else if (d.index === null) { for (var y = d.attributes.position, f = [], v = 0, _ = y.count; v < _; v += 2) u.fromBufferAttribute(y, v), p.fromBufferAttribute(y, v + 1), f[v] = v == 0 ? 0 : f[v - 1], f[v + 1] = f[v] + u.distanceTo(p); d.setAttribute("lineDistance", new h.Float32BufferAttribute(f, 1)); } else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); return this; } } m.prototype.isLineSegments = !0; }, /* 13 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ Line: () => ( /* binding */ _ ) /* harmony export */ }); var l = c(4), h = /* @__PURE__ */ new l.Vector3(), u = /* @__PURE__ */ new l.Vector3(), p = /* @__PURE__ */ new l.Matrix4(), m = /* @__PURE__ */ new l.Ray(), g = /* @__PURE__ */ new l.Sphere(), d = /* @__PURE__ */ new l.Vector3(), y = /* @__PURE__ */ new l.Vector3(), f = /* @__PURE__ */ new l.Vector3(), v = /* @__PURE__ */ new l.Vector3(); class _ extends l.Object3D { constructor() { var w = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new l.BufferGeometry(), b = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new l.LineBasicMaterial(); super(), this.type = "Line", this.geometry = w, this.material = b, this.updateMorphTargets(); } copy(w) { return super.copy(w), this.material = w.material, this.geometry = w.geometry, this; } computeLineDistances() { var w = this.geometry; if (!w.isBufferGeometry) w.isGeometry && console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); else if (w.index === null) { for (var b = w.attributes.position, E = [0], S = 1, C = b.count; S < C; S++) h.fromBufferAttribute(b, S - 1), u.fromBufferAttribute(b, S), E[S] = E[S - 1], E[S] += h.distanceTo(u); w.setAttribute("lineDistance", new l.Float32BufferAttribute(E, 1)); } else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); return this; } raycast(w, b) { var E = this.geometry, S = this.matrixWorld, C = w.params.Line.threshold, R = E.drawRange, L = E.morphAttributes.position; if (E.boundingSphere === null && E.computeBoundingSphere(), g.copy(E.boundingSphere), g.applyMatrix4(S), g.radius += C, w.ray.intersectsSphere(g) !== !1) { p.copy(S).invert(), m.copy(w.ray).applyMatrix4(p); var A = C / ((this.scale.x + this.scale.y + this.scale.z) / 3), P = A * A, O = new l.Vector3(), x = new l.Vector3(), I = new l.Vector3(), N = new l.Vector3(), D = this.isLineSegments ? 2 : 1; if (E.isBufferGeometry) { var k = E.index, F = E.attributes, W = F.position; if (k !== null) for (var K = Math.max(0, R.start), ne = Math.min(k.count, R.start + R.count), q = K; q < ne - 1; q += D) { var z = k.getX(q), j = k.getX(q + 1); M(O, x, this, W, L, z, j); var Q = m.distanceSqToSegment(O, x, N, I); if (!(Q > P)) { N.applyMatrix4(this.matrixWorld); var Y = w.ray.origin.distanceTo(N); Y < w.near || Y > w.far || b.push({ distance: Y, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: I.clone().applyMatrix4(this.matrixWorld), index: q, face: null, faceIndex: null, object: this }); } } else for (var ee = Math.max(0, R.start), G = Math.min(W.count, R.start + R.count), J = ee; J < G - 1; J += D) { M(O, x, this, W, L, J, J + 1); var re = m.distanceSqToSegment(O, x, N, I); if (!(re > P)) { N.applyMatrix4(this.matrixWorld); var B = w.ray.origin.distanceTo(N); B < w.near || B > w.far || b.push({ distance: B, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: I.clone().applyMatrix4(this.matrixWorld), index: J, face: null, faceIndex: null, object: this }); } } } else E.isGeometry && console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } } updateMorphTargets() { var w = this.geometry; if (w.isBufferGeometry) { var b = w.morphAttributes, E = Object.keys(b); if (0 < E.length) { var S = b[E[0]]; if (S !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (var C, R = 0, L = S.length; R < L; R++) C = S[R].name || R + "", this.morphTargetInfluences.push(0), this.morphTargetDictionary[C] = R; } } } else { var A = w.morphTargets; A !== void 0 && 0 < A.length && console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead."); } } } function M(T, w, b, E, S, C, R) { T.fromBufferAttribute(E, C), w.fromBufferAttribute(E, R); var L = b.morphTargetInfluences; if (b.material.morphTargets && S && L) { d.set(0, 0, 0), y.set(0, 0, 0); for (var A = 0, P = S.length; A < P; A++) { var O = L[A], x = S[A]; O !== 0 && (f.fromBufferAttribute(x, C), v.fromBufferAttribute(x, R), d.addScaledVector(f.sub(T), O), y.addScaledVector(v.sub(w), O)); } T.add(d), w.add(y); } } _.prototype.isLine = !0; }, /* 14 */ /***/ (a, s, c) => { var l = c(4), h = new Image(128, 128); h.src = c(15); var u = new l.Texture(); u.image = h, u.needsUpdate = !0; var p = [0.02, 0.03, 1], m = new l.SpriteMaterial({ map: u, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), g = c(5).createNewSpriteText, d = function(y) { c(10).ZincObject.call(this), this.texture = u; var f = void 0, v = void 0, _ = void 0, M = void 0, T = void 0, w = !0; this.morph = new l.Group(), this.group = this.morph, this.parent = y, this.isMarker = !0; var b = !1; this.ndc = new l.Vector3(); var E = void 0, S = void 0, C = () => { f = new l.Sprite(m), f.center.set(0.5, 0), this.morph.add(f), this.morph.position.set(0, 0, 0), this.morph.renderOrder = 1e4, f.scale.set(p[0], p[1], p[2]), f.userData = this; }; this.updateVisual = (R, L) => { var A = 1, P = 0; R !== L && (P = 1 - (this.ndc.z - R) / (L - 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, L, A) => { this.morph.position.set(R, L, A); }, this.setSpriteSize = (R) => { f.scale.set(0.015, 0.02, 1), f.scale.multiplyScalar(R); }, this.setUserSprite = () => { M && (this.morph.add(M), w && (this.morph.remove(f), S && this.morph.remove(S), w = !1)); }, this.setImageForUserSprite = (R, L) => { M && (this.morph.remove(M), M = void 0), v && v.dispose(), _ && _.dispose(), v = new l.Texture(), v.image = R, v.needsUpdate = !0, _ = new l.SpriteMaterial({ map: v, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), L || (L = [0.05, 0.05, 1]), M = new l.Sprite(_), M.center.set(0.5, 0), M.scale.set(L[0], L[1], L[2]), M.userData = this, this.setUserSprite(); }, this.setDefaultSprite = () => { w || (w = !0, this.morph.add(f), M && this.morph.remove(M), S && this.morph.add(S)); }, this.loadUserSprite = (R, L) => { if (R) if (R !== T) { T = R; var A = new Image(128, 128); A.crossOrigin = "anonymous", A.onload = () => { this.setImageForUserSprite(A, L); }, A.src = R; } else this.setUserSprite(); }, this.dispose = () => { this.morph && this.morph.clear(), f && (f.clear(), f = void 0), S && (S.material.map.dispose(), S.material.dispose(), S = void 0); }, this.isEnabled = () => b, this.setNumber = (R) => { (!R || E != R) && S && (this.morph.remove(S), S.material.map.dispose(), S.material.dispose(), S = void 0), !S && R && (S = g(R, 0.012, "black", "Asap", 120, 700), this.morph.add(S)), E = R; }, this.getNumber = () => E || 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 = () => { b = !0, this.morph.visible = !0, this.visible = !0; }, this.disable = () => { b = !1, this.morph.visible = !1, this.visible = !1; }, C(); }; d.prototype = Object.create(c(10).ZincObject.prototype), s.Marker = d; }, /* 15 */ /***/ (a) => { a.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgdmlld0JveD0iMCAwIDM2NSA1NjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4NCjxkZWZzPg0KPC9kZWZzPg0KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCAwKSIgaWQ9IjgwOGVkMjgzLTI1MjQtNDQwZi04OGFlLTNiZGI0N2JiNTc0OSIgID4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4NCjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItMTgyLjUiIHk9Ii0yODAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIC8+DQo8L2c+DQo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+DQo8ZyBzdHlsZT0iIiAgID4NCjwvZz4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCA5Ny41KSIgID4NCjxnIHN0eWxlPSIiICAgPg0KPC9nPg0KPC9nPg0KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC45OSAwIDAgMC45OSAxODIuNSAyODApIiAgPg0KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii01NDAiIHk9Ii01NDAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjEwODAiIGhlaWdodD0iMTA4MCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHBhdGggc3R5bGU9InN0cm9rZTogcmdiKDAsMCwwKTsgc3Ryb2tlLXdpZHRoOiAwOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMCw4OSwxMTYpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB0cmFuc2Zvcm09IiB0cmFuc2xhdGUoLTE4Mi45LCAtMjc5Ljg1KSIgZD0iTSAxODIuOSA1NTEuNyBDIDE4Mi45IDU1MS44MDAwMDAwMDAwMDAxIDE4My4xIDU1MiAxODMuMSA1NTIgQyAxODMuMSA1NTIgMzU4LjMgMjgzIDM1OC4zIDE5NC42IEMgMzU4LjMgNjQuNSAyNjkuNSA3LjkwMDAwMDAwMDAwMDAwNiAxODIuOSA3LjY5OTk5OTk5OTk5OTk4OSBDIDk2LjMgNy45IDcuNSA2NC41IDcuNSAxOTQuNiBDIDcuNSAyODMgMTgyLjggNTUyIDE4Mi44IDU1MiBDIDE4Mi44IDU1MiAxODIuOSA1NTEuNyAxODIuOSA1NTEuNyB6IE0gMTIyLjIgMTg3LjIgQyAxMjIuMiAxNTMuNiAxNDkuNCAxMjYuMzk5OTk5OTk5OTk5OTkgMTgzIDEyNi4zOTk5OTk5OTk5OTk5OSBDIDIxNi42IDEyNi4zOTk5OTk5OTk5OTk5OSAyNDMuOCAxNTMuNiAyNDMuOCAxODcuMiBDIDI0My44IDIyMC43OTk5OTk5OTk5OTk5OCAyMTYuNSAyNDggMTgyLjkgMjQ4IEMgMTQ5LjQgMjQ4IDEyMi4yIDIyMC44IDEyMi4yIDE4Ny4yIHoiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPg0KPGNpcmNsZSBzdHlsZT0ic3Ryb2tlOiByZ2IoMCwwLDApOyBzdHJva2Utd2lkdGg6IDA7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtZGFzaG9mZnNldDogMDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDQ7IGZpbGw6IHJnYigyNTUsMjU1LDI1NSk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIGN4PSIwIiBjeT0iMCIgcj0iMzUiIC8+DQo8L2c+DQo8L2c+DQo8L2c+DQo8L3N2Zz4="; }, /* 16 */ /***/ (a, s, c) => { var l = c(4), h = function(u, p, m, g) { c(10).ZincObject.call(this); var d; p && (d = p.clone(), d.vertexColors = l.FaceColors), this.id = m; var y = void 0, f = void 0; this.isGlyph = !0, this.fromMesh = (v) => !!(v && v.isMesh) && (this.morph = v.clone(), this.morph.userData = this, this.group.add(this.morph), !0), u && d && this.fromMesh(new l.Mesh(u, d)), this.getGlyphset = function() { return g; }, this.setLabel = (v) => { v && (typeof v == "string" || v instanceof String) && (f = v, this.morph && (this.morph.name = v)), y && this.showLabel(); }, this.showLabel = (v) => { if (y && (position = y.getPosition(), this.group.remove(y.getSprite()), y.dispose(), y = void 0), f && (typeof f == "string" || f instanceof String)) { var _ = [0, 0, 0]; y = new (c(17)).Label(f, v), y.setPosition(_[0], _[1], _[2]), this.group.add(y.getSprite()); } }, this.getLabel = () => f, this.getMesh = () => this.morph, this.setTransformation = (v, _, M, T) => { this.morph && (this.morph.matrix.elements[0] = _[0], this.morph.matrix.elements[1] = _[1], this.morph.matrix.elements[2] = _[2], this.morph.matrix.elements[3] = 0, this.morph.matrix.elements[4] = M[0], this.morph.matrix.elements[5] = M[1], this.morph.matrix.elements[6] = M[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] = v[0], this.morph.matrix.elements[13] = v[1], this.morph.matrix.elements[14] = v[2], this.morph.matrix.elements[15] = 1, this.morph.matrixAutoUpdate = !1), y && y.setPosition(v[0], v[1], v[2]); }, this.setColour = (v) => { y && y.setColour(v), 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; }; }; h.prototype = Object.create(c(10).ZincObject.prototype), s.Glyph = h; }, /* 17 */ /***/ (a, s, c) => { var l = c(7).default; s.Label = function(h, u) { var p = h, m = void 0; m = u ? new l(p, 0.015, u.getStyle()) : new l(p, 0.015), m.fontFace = "Asap", m.fontWeight = 700, m.material.map.generateMipmaps = !1, m.material.sizeAttenuation = !1, m.center.x = -0.05, m.center.y = 0, this.getPosition = () => m ? [m.position.x, m.position.y, m.position.z] : [0, 0, 0], this.setPosition = (g, d, y) => { m && m.position.set(g, d, y); }, this.setColour = (g) => { m.color = g.getStyle(); }, this.setScale = (g) => { m && 0 < g && m.scale.set(g, g, 1); }, this.dispose = () => { m.dispose(); }, this.getSprite = () => m, this.getString = () => p; }; }, /* 18 */ /***/ (a, s, c) => { function l(m) { throw new TypeError('"' + m + '" is read-only'); } var h = c(4), u = c(19).JSONLoader, p = function() { c(10).ZincObject.call(this); var m = [], g = void 0, d = void 0, y = void 0, f = void 0, v = void 0, _ = void 0, M = void 0, T = 0, w = 0, b = [0, 0, 0], E = [0, 0, 0], S = [0, 0, 0], C = "NONE"; this.ready = !1; var R = !1, L = !1; this.isGlyphset = !0; for (var A = new h.Matrix4(), P = new h.Color(), O = new h.Color(), x = new h.Box3(), I = new h.Box3(), N = new h.Box3(), D = [], k = [], F = [], W = [], K = [], ne = [], q = [], z = [], j = 0; 8 > j; j++) D[j] = new h.Vector3(); this.load = (B, $, te, U, V) => { g = B.axis1, d = B.axis2, y = B.axis3, f = B.positions, v = B.scale, _ = B.colors, M = B.label, R = B.metadata.MorphColours, L = B.metadata.MorphVertices, T = B.metadata.number_of_time_steps, C = B.metadata.repeat_mode, w = B.metadata.number_of_vertices, C == "AXES_2D" || C == "MIRROR" ? w *= 2 : C == "AXES_3D" && (w *= 3), b = B.metadata.base_size, E = B.metadata.offset, S = B.metadata.scale_factors; var ae = new u(); this.geometry = new h.BufferGeometry(); var ue = new h.InstancedMesh(this.geometry, void 0, w); if (this.setMorph(ue), U) { var de = ae.parse($); re(te, V)(de.geometry, de.materials), de.geometry.dispose(); } else ae.crossOrigin = "Anonymous", ae.load($, re(te, V)); }; var Q = (B, $, te, U, V, ae) => { if (C == "NONE" || C == "MIRROR") { for (var ue, de = [0, 0, 0], ve = [0, 0, 0], ye = [0, 0, 0], le = [0, 0, 0], Se = [0, 0, 0], Te = [0, 0, 0], oe = [0, 0, 0], Me = [0, 0, 0], ge = [0, 0, 0], xe = 0; 3 > xe; xe++) ue = 0 > V[xe] ? -1 : 1, de[xe] = ue * b[xe] + V[xe] * S[xe]; for (var xe = 0; 3 > xe; xe++) ve[xe] = $[xe] * de[0], ye[xe] = te[xe] * de[1], le[xe] = U[xe] * de[2], Se[xe] = B[xe] + E[0] * ve[xe] + E[1] * ye[xe] + E[2] * le[xe], C == "MIRROR" && (Te[xe] = -ve[xe], oe[xe] = -ye[xe], Me[xe] = -le[xe], ge[xe] = Se[xe], 0 > V[0] && (Se[xe] -= ve[xe], ge[xe] -= Te[xe])); 0 > le[0] * (ve[1] * ye[2] - ve[2] * ye[1]) + le[1] * (ve[2] * ye[0] - ve[0] * ye[2]) + le[2] * (ve[0] * ye[1] - ve[1] * ye[0]) && (le[0] = -le[0], le[1] = -le[1], le[2] = -le[2]), ae[0] = [Se, ve, ye, le], C == "MIRROR" && (0 > Me[0] * (Te[1] * oe[2] - Te[2] * oe[1]) + Me[1] * (Te[2] * oe[0] - Te[0] * oe[2]) + Me[2] * (Te[0] * oe[1] - Te[1] * oe[0]) && (Me[0] = -Me[0], Me[1] = -Me[1], Me[2] = -Me[2]), ae[1] = [ge, Te, oe, Me]); } else if (C == "AXES_2D" || C == "AXES_3D") { for (var ue, Oe = [0, 0, 0], ut = [0, 0, 0], xe = 0; 3 > xe; xe++) ue = 0 > V[xe] ? -1 : 1, Oe[xe] = ue * b[0] + V[xe] * S[0]; for (var xe = 0; 3 > xe; xe++) ut[xe] = B[xe] + E[0] * Oe[0] * $[xe] + E[1] * Oe[1] * te[xe] + E[2] * Oe[2] * U[xe]; for (var mt = glyph_repeat_mode == "AXES_2D" ? 2 : 3, ze = 0; ze < mt; ze++) { var bt = void 0, Ue = void 0, st = V[ze], et = [0, 0, 0], xt = [0, 0, 0], ft = [0, 0, 0]; ze == 0 ? (bt = $, Ue = te) : ze == 1 ? (bt = te, Ue = glyph_repeat_mode == "AXES_2D" ? $ : U) : (bt = U, Ue = $); var Ut = b[0] + st * S[0]; et[0] = bt[0] * Ut, et[1] = bt[1] * Ut, et[2] = bt[2] * Ut, ft[0] = et[1] * Ue[2] - Ue[1] * et[2], ft[1] = et[2] * Ue[0] - Ue[2] * et[0], ft[2] = et[0] * Ue[1] - et[1] * Ue[0]; var Nt = Math.sqrt(ft[0] * ft[0] + ft[1] * ft[1] + ft[2] * ft[2]); if (0 < Nt) { var ie = (b[2] + st * S[2]) / Nt; C == "AXES_2D" && 0 < ze && (ie *= -1), ft[0] *= ie, ft[1] *= ie, ft[2] *= ie; } if (xt[0] = ft[1] * et[2] - et[1] * ft[2], xt[1] = ft[2] * et[0] - et[2] * ft[0], xt[2] = ft[0] * et[1] - ft[1] * et[0], Nt = Math.sqrt(xt[0] * xt[0] + xt[1] * xt[1] + xt[2] * xt[2]), 0 < Nt) { var Ee = (b[1] + st * S[1]) / Nt; xt[0] *= Ee, xt[1] *= Ee, xt[2] *= Ee; } ae[ze] = [ut, et, xt, ft]; } } return ae; }, Y = (B, $, te, U, V) => { var ae = 1; C == "AXES_2D" || C == "MIRROR" ? ae = 2 : C == "AXES_3D" && (ae = 3); var ue = B.length / 3, de = 0; z.length = ae; for (var ve = 0; ve < ue; ve++) { var ye = 3 * ve, le = [B[ye], B[ye + 1], B[ye + 2]], Se = [$[ye], $[ye + 1], $[ye + 2]], Te = [te[ye], te[ye + 1], te[ye + 2]], oe = [U[ye], U[ye + 1], U[ye + 2]], Me = [V[ye], V[ye + 1], V[ye + 2]], ge = Q(le, Se, Te, oe, Me, z); if (ge.length == ae) for (var xe = 0; xe < ae; xe++) { A.elements[0] = ge[xe][1][0], A.elements[1] = ge[xe][1][1], A.elements[2] = ge[xe][1][2], A.elements[3] = 0, A.elements[4] = ge[xe][2][0], A.elements[5] = ge[xe][2][1], A.elements[6] = ge[xe][2][2], A.elements[7] = 0, A.elements[8] = ge[xe][3][0], A.elements[9] = ge[xe][3][1], A.elements[10] = ge[xe][3][2], A.elements[11] = 0, A.elements[12] = ge[xe][0][0], A.elements[13] = ge[xe][0][1], A.elements[14] = ge[xe][0][2], A.elements[15] = 1, this.morph.setMatrixAt(de, A); var Oe = m[de]; Oe && Oe.setTransformation(ge[xe][0], ge[xe][1], ge[xe][2], ge[xe][3]), de++; } } this.morph.instanceMatrix.needsUpdate = !0; }, ee = (B) => { var $ = 1; C == "AXES_2D" || C == "MIRROR" ? $ = 2 : C == "AXES_3D" && ($ = 3); for (var te, U = B.length, V = 0, ae = 0; ae < U; ae++) { te = B[ae]; for (var ue = 0; ue < $; ue++) { P.setHex(te), this.morph.setColorAt(V, P); var de = m[V]; de && de.setColour(P), V++; } } this.morph.instanceColor.needsUpdate = !0; }, G = () => { var B = k, $ = F, te = W, U = K, V = ne, ae = q, ue = this.inbuildTime / this.duration * (T - 1), de = Math.floor(ue), ve = 1 - (ue - de), ye = Math.ceil(ue); if (L) { var le = f[de.toString()], Se = f[ye.toString()], Te = g[de.toString()], oe = g[ye.toString()], Me = d[de.toString()], ge = d[ye.toString()], xe = y[de.toString()], Oe = y[ye.toString()], ut = v[de.toString()], mt = v[ye.toString()]; k.length = le.length, F.length = le.length, W.length = le.length, K.length = le.length, ne.length = le.length; for (var ze = 0; ze < le.length; ze++) B[ze] = ve * le[ze] + (1 - ve) * Se[ze], $[ze] = ve * Te[ze] + (1 - ve) * oe[ze], te[ze] = ve * Me[ze] + (1 - ve) * ge[ze], U[ze] = ve * xe[ze] + (1 - ve) * Oe[ze], V[ze] = ve * ut[ze] + (1 - ve) * mt[ze]; } else f[0], l("current_positions"), g[0], l("current_axis1s"), d[0], l("current_axis2s"), y[0], l("current_axis3s"), v[0], l("current_scales"); if (Y(B, $, te, U, V), this.boundingBoxUpdateRequired = !0, _ != null) { if (R) { var bt = _[de.toString()], Ue = _[ye.toString()]; ae.length = bt.length; for (var st = 0; st < bt.length; st++) P.setHex(bt[st]), O.setHex(Ue[st]), P.setRGB(P.r * ve + O.r * (1 - ve), P.g * ve + O.g * (1 - ve), P.b * ve + O.b * (1 - ve)), ae[st] = P.getHex(); } else _[0], l("current_colors"); ee(ae); } }; this.showLabel = () => { for (var B = 0; B < m.length; B++) m[B].showLabel(this.morph.material ? this.morph.material.color : void 0); }; var J = (B) => { if (M != null && B) for (var $, te = 0; te < w; te++) $ = new (c(16)).Glyph(void 0, void 0, te, this), M != null && M[te] != null && $.setLabel(M[te]), 0 < T && $.setFrustumCulled(!1), m[te] = $, this.morph.add($.getGroup()); M != null && B && this.showLabel(this.morph.material ? this.morph.material.color : void 0), Y(f[0], g[0], d[0], y[0], v[0]), _ != null && ee(_[0]), this.ready = !0, this.boundingBoxUpdateRequired = !0; }; this.addCustomGlyph = (B) => { B.isGlyph && m.push(B), this.ready = !0, this.boundingBoxUpdateRequired = !0; }, this.addMeshAsGlyph = (B, $) => { if (B.isMesh) { var te = new (c(16)).Glyph(void 0, void 0, $, this); return te.fromMesh(B), m.push(te), this.morph.add(te.getGroup()), this.ready = !0, this.boundingBoxUpdateRequired = !0, te; } }, this.forEachGlyph = (B) => { for (var $ = 0; $ < m.length; $++) B(m[$]); }; var re = (B, $) => (te, U) => { var V = te.toBufferGeometry(); this.geometry.copy(V), this.geometry.computeBoundingSphere(), this.geometry.computeBoundingBox(), V.dispose(), U && U[0] && (this.morph.material = U[0]), J($), this.morph.name = this.groupName, this.morph.userData = this, this.setMorph(this.morph), te.dispose(), B != null && typeof B == "function" && B(this); }; this.getClosestVertexIndex = function() { var B = -1; if (this.morph && this.ready) { this.getBoundingBox().getCenter(this._v1); for (var $, te = f[0], U = te.length / 3, V = -1, ae = 0, ue = 0; ue < U; ue++) $ = 3 * ue, this._v2.set(te[$], te[$ + 1], te[$ + 2]), ae = this._v1.distanceTo(this._v2), (V == -1 || V > ae) && (V = ae, B = ue); } return B; }, this.getClosestVertex = function() { if (this.closestVertexIndex == -1 && (this.closestVertexIndex = this.getClosestVertexIndex()), 0 <= this.closestVertexIndex && this.morph) { var B = new h.Vector3(); return this.morph.getMatrixAt(this.closestVertexIndex, A), B.setFromMatrixPosition(A), B; } }, this.getBoundingBox = () => { if (this.morph && this.ready && this.morph.visible) { if (this.boundingBoxUpdateRequired) { x.setFromBufferAttribute(this.morph.geometry.attributes.position); for (var B = 0; B < w; B++) this.morph.getMatrixAt(B, A), I.copy(x).applyMatrix4(A), B == 0 ? N.copy(I) : N.union(I); 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 = (B) => { this.inbuildTime = B > this.duration ? this.duration : 0 > B ? 0 : B, (R || L) && (G(), L && (this.markerUpdateRequired = !0)); }, this.isTimeVarying = () => !!((this.ready === !1 || 0 < T) && (R || L)), this.getCurrentTime = () => this.inbuildTime, this.dispose = () => { for (var B = m.length - 1; 0 <= B; B--) m[B].dispose(); this.geometry && this.geometry.dispose(), this.morph && this.morph.material.dispose(), g = void 0, d = void 0, y = void 0, f = void 0, v = void 0, _ = void 0, this.ready = !1, this.groupName = void 0; }, this.render = (B, $, te) => { if ($ == !0) { var U = this.inbuildTime + B; U > this.duration && (U -= this.duration), this.inbuildTime = U, (R || L) && G(); } this.updateMarker($, te); }; }; p.prototype = Object.create(c(10).ZincObject.prototype), s.Glyphset = p; }, /* 19 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ JSONLoader: () => ( /* binding */ w ) /* harmony export */ }); var l = c(4), h = c(20).Loader, u = l.LoaderUtils, p = l.AnimationClip, m = l.Vector3, g = l.Vector4, d = l.Color, y = l.Vector2, f = c(6).Face3, v = c(6).Geometry, _ = l.FileLoader, M = l.DefaultLoadingManager, T = c(21).VideoHandler; function w(b) { typeof b == "boolean" && (console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."), b = void 0), this.manager = b === void 0 ? M : b, this.withCredentials = !1, this.paramsString = ""; } Object.assign(w.prototype, { load: function(b, E, S, C) { var R = this, L = this.texturePath && typeof this.texturePath == "string" ? this.texturePath : u.extractUrlBase(b), A = new _(this.manager); b.split("?"), this.paramsString = b.length === 2 ? paramsStrings[1] : "", A.setWithCredentials(this.withCredentials), A.load(b, function(P) { var O = JSON.parse(P), x = O.metadata; if (x !== void 0) { var I = x.type; if (I !== void 0 && I.toLowerCase() === "object") return void console.error("THREE.JSONLoader: " + b + " should be loaded with THREE.ObjectLoader instead."); } if (R && R.parse) { var N = R.parse(O, L); E(N.geometry, N.materials); } }, S, C); }, setTexturePath: function(b) { this.texturePath = b; }, parse: /* @__PURE__ */ function() { function b(R, L) { function A(Me, ge) { return Me & 1 << ge; } var P, O, x, I, N, D, k, F, W, K, ne, q, z, j, Q, Y, ee, G, J, re, B, $, te, U, V, ae, ue, de = R.faces, ve = R.vertices, ye = R.normals, le = R.colors, Se = R.scale, Te = 0; if (R.uvs !== void 0) { for (P = 0; P < R.uvs.length; P++) R.uvs[P].length && Te++; for (P = 0; P < Te; P++) L.faceVertexUvs[P] = []; } for (I = 0, N = ve.length; I < N; ) G = new m(), G.x = ve[I++] * Se, G.y = ve[I++] * Se, G.z = ve[I++] * Se, L.vertices.push(G); if (I = 0, N = de.length, R.uvs) for (P = 0; P < R.uvs.length; P++) { L.uvs[P] = []; for (var oe = 0; oe < R.uvs[P].length; oe++) L.uvs[P][oe] = R.uvs[P][oe]; } if (ye) for (P = 0; P < ye.length; P++) L.normals[P] = ye[P]; if (le) for (P = 0; P < le.length; P++) L.colors[P] = le[P]; for (; I < N; ) if (K = de[I++], ne = A(K, 0), q = A(K, 1), z = A(K, 3), j = A(K, 4), Q = A(K, 5), Y = A(K, 6), ee = A(K, 7), ne) { if (re = new f(), re.a = de[I], re.b = de[I + 1], re.c = de[I + 3], B = new f(), B.a = de[I + 1], B.b = de[I + 2], B.c = de[I + 3], I += 4, q && (W = de[I++], re.materialIndex = W, B.materialIndex = W), x = L.faces.length, z) for (P = 0; P < Te; P++) for (U = R.uvs[P], L.faceVertexUvs[P][x] = [], L.faceVertexUvs[P][x + 1] = [], O = 0; 4 > O; O++) F = de[I++], ae = U[2 * F], ue = U[2 * F + 1], V = new y(ae, ue), O !== 2 && L.faceVertexUvs[P][x].push(V), O !== 0 && L.faceVertexUvs[P][x + 1].push(V); if (j && (k = 3 * de[I++], re.normal.set(ye[k++], ye[k++], ye[k]), B.normal.copy(re.normal)), Q) for (P = 0; 4 > P; P++) k = 3 * de[I++], te = new m(ye[k++], ye[k++], ye[k]), P !== 2 && re.vertexNormals.push(te), P !== 0 && B.vertexNormals.push(te); if (Y && (D = de[I++], $ = le[D], re.color.setHex($), B.color.setHex($)), ee) for (P = 0; 4 > P; P++) D = de[I++], $ = le[D], P !== 2 && re.vertexColors.push(new d($)), P !== 0 && B.vertexColors.push(new d($)); L.faces.push(re), L.faces.push(B); } else { if (J = new f(), J.a = de[I++], J.b = de[I++], J.c = de[I++], q && (W = de[I++], J.materialIndex = W), x = L.faces.length, z) for (P = 0; P < Te; P++) for (U = R.uvs[P], L.faceVertexUvs[P][x] = [], O = 0; 3 > O; O++) F = de[I++], ae = U[2 * F], ue = U[2 * F + 1], V = new y(ae, ue), L.faceVertexUvs[P][x].push(V); if (j && (k = 3 * de[I++], J.normal.set(ye[k++], ye[k++], ye[k])), Q) for (P = 0; 3 > P; P++) k = 3 * de[I++], te = new m(ye[k++], ye[k++], ye[k]), J.vertexNormals.push(te); if (Y && (D = de[I++], J.color.setHex(le[D])), ee) for (P = 0; 3 > P; P++) D = de[I++], J.vertexColors.push(new d(le[D])); L.faces.push(J); } } function E(R, L) { var A = R.influencesPerVertex === void 0 ? 2 : R.influencesPerVertex; if (R.skinWeights) for (var P = 0, O = R.skinWeights.length; P < O; P += A) { var x = R.skinWeights[P], I = 1 < A ? R.skinWeights[P + 1] : 0, N = 2 < A ? R.skinWeights[P + 2] : 0, D = 3 < A ? R.skinWeights[P + 3] : 0; L.skinWeights.push(new g(x, I, N, D)); } if (R.skinIndices) for (var P = 0, O = R.skinIndices.length; P < O; P += A) { var k = R.skinIndices[P], F = 1 < A ? R.skinIndices[P + 1] : 0, W = 2 < A ? R.skinIndices[P + 2] : 0, K = 3 < A ? R.skinIndices[P + 3] : 0; L.skinIndices.push(new g(k, F, W, K)); } L.bones = R.bones, L.bones && 0 < L.bones.length && (L.skinWeights.length !== L.skinIndices.length || L.skinIndices.length !== L.vertices.length) && console.warn("When skinning, number of vertices (" + L.vertices.length + "), skinIndices (" + L.skinIndices.length + "), and skinWeights (" + L.skinWeights.length + ") should match."); } function S(R, L) { var A = R.scale; if (R.morphTargets !== void 0) for (var P = 0, O = R.morphTargets.length; P < O; P++) { L.morphTargets[P] = {}, L.morphTargets[P].name = R.morphTargets[P].name, L.morphTargets[P].vertices = []; for (var x, I = L.morphTargets[P].vertices, N = R.morphTargets[P].vertices, D = 0, k = N.length; D < k; D += 3) x = new m(), x.x = N[D] * A, x.y = N[D + 1] * A, x.z = N[D + 2] * A, I.push(x); } if (R.morphNormals !== void 0) { for (var P = 0, O = R.morphNormals.length; P < O; P++) if (L.morphTargets[P]) { L.morphTargets[P].normals = []; for (var F, W = L.morphTargets[P].normals, K = R.morphNormals[P].normals, D = 0, k = K.length; D < k; D += 3) F = new m(), F.x = K[D], F.y = K[D + 1], F.z = K[D + 2], W.push(F); L.morphNormalsReady = !0; } } if (R.morphColors !== void 0) { var P, O, ne, q, z, j, Q; for (P = 0, O = R.morphColors.length; P < O; P++) for (L.morphColors[P] = {}, L.morphColors[P].name = R.morphColors[P].name, L.morphColors[P].colors = [], z = L.morphColors[P].colors, j = R.morphColors[P].colors, ne = 0, q = j.length; ne < q; ne += 3) Q = new l.Color(16755200), Q.setRGB(j[ne], j[ne + 1], j[ne + 2]), z.push(Q); } } function C(R, L) { 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 O, x = 0; x < P.length; x++) O = p.parseAnimation(P[x], L.bones), O && A.push(O); if (L.morphTargets) { var I = p.CreateClipsFromMorphTargetSequences(L.morphTargets, 10); A = A.concat(I); } 0 < A.length && (L.animations = A); } return function(R, L) { R.data !== void 0 && (R = R.data), R.scale = R.scale === void 0 ? 1 : 1 / R.scale; var A = new v(); if (A.morphColors = [], b(R, A), E(R, A), S(R, A), C(R, A), A.computeFaceNormals(), A.computeBoundingSphere(), R.materials === void 0 || R.materials.length === 0) return { geometry: A }; var P = h.prototype.initMaterials(R.materials, L, "Anonymous"); if (R.materials[0].video) { var O = L + R.materials[0].video; this.paramsString && (O += "?".concat(this.paramsString)); var x = new T(O); A._video = x; } 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 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ Loader: () => ( /* binding */ h ) /* harmony export */ }); var l = c(4); c(4); function h() { } h.Handlers = { handlers: [], add: function(u, p) { this.handlers.push(u, p); }, get: function(u) { for (var p = this.handlers, m = 0, g = p.length; m < g; m += 2) { var d = p[m], y = p[m + 1]; if (d.test(u)) return y; } return null; } }, Object.assign(h.prototype, { crossOrigin: "anonymous", onLoadStart: function() { }, onLoadProgress: function() { }, onLoadComplete: function() { }, initMaterials: function(u, p, m) { for (var g = [], d = 0; d < u.length; ++d) g[d] = this.createMaterial(u[d], p, m); return g; }, createMaterial: function() { var u = { NoBlending: l.NoBlending, NormalBlending: l.NormalBlending, AdditiveBlending: l.AdditiveBlending, SubtractiveBlending: l.SubtractiveBlending, MultiplyBlending: l.MultiplyBlending, CustomBlending: l.CustomBlending }, p = new l.Color(), m = new l.TextureLoader(), g = new l.MaterialLoader(); return function(d, y, f) { function v(b, E, S, C, R) { var L, A = y + b, P = h.Handlers.get(A); P === null ? (m.setCrossOrigin(f), L = m.load(A)) : L = P.load(A), E !== void 0 && (L.repeat.fromArray(E), E[0] !== 1 && (L.wrapS = l.RepeatWrapping), E[1] !== 1 && (L.wrapT = l.RepeatWrapping)), S !== void 0 && L.offset.fromArray(S), C !== void 0 && (C[0] === "repeat" && (L.wrapS = l.RepeatWrapping), C[0] === "mirror" && (L.wrapS = l.MirroredRepeatWrapping), C[1] === "repeat" && (L.wrapT = l.RepeatWrapping), C[1] === "mirror" && (L.wrapT = l.MirroredRepeatWrapping)), R !== void 0 && (L.anisotropy = R); var O = l.MathUtils.generateUUID(); return _[O] = L, O; } var _ = {}, M = { uuid: l.MathUtils.generateUUID(), type: "MeshLambertMaterial" }; for (var T in d) { var w = d[T]; switch (T) { case "DbgColor": case "DbgIndex": case "opticalDensity": case "illumination": break; case "DbgName": M.name = w; break; case "blending": M.blending = u[w]; break; case "colorAmbient": case "mapAmbient": console.warn("THREE.Loader.createMaterial:", T, "is no longer supported."); break; case "colorDiffuse": M.color = p.fromArray(w).getHex(); break; case "colorSpecular": M.specular = p.fromArray(w).getHex(); break; case "colorEmissive": M.emissive = p.fromArray(w).getHex(); break; case "specularCoef": M.shininess = w; break; case "shading": w.toLowerCase() === "basic" && (M.type = "MeshBasicMaterial"), w.toLowerCase() === "phong" && (M.type = "MeshPhongMaterial"), w.toLowerCase() === "standard" && (M.type = "MeshStandardMaterial"); break; case "mapDiffuse": M.map = v(w, d.mapDiffuseRepeat, d.mapDiffuseOffset, d.mapDiffuseWrap, d.mapDiffuseAnisotropy); break; case "mapDiffuseRepeat": case "mapDiffuseOffset": case "mapDiffuseWrap": case "mapDiffuseAnisotropy": break; case "mapEmissive": M.emissiveMap = v(w, d.mapEmissiveRepeat, d.mapEmissiveOffset, d.mapEmissiveWrap, d.mapEmissiveAnisotropy); break; case "mapEmissiveRepeat": case "mapEmissiveOffset": case "mapEmissiveWrap": case "mapEmissiveAnisotropy": break; case "mapLight": M.lightMap = v(w, d.mapLightRepeat, d.mapLightOffset, d.mapLightWrap, d.mapLightAnisotropy); break; case "mapLightRepeat": case "mapLightOffset": case "mapLightWrap": case "mapLightAnisotropy": break; case "mapAO": M.aoMap = v(w, d.mapAORepeat, d.mapAOOffset, d.mapAOWrap, d.mapAOAnisotropy); break; case "mapAORepeat": case "mapAOOffset": case "mapAOWrap": case "mapAOAnisotropy": break; case "mapBump": M.bumpMap = v(w, d.mapBumpRepeat, d.mapBumpOffset, d.mapBumpWrap, d.mapBumpAnisotropy); break; case "mapBumpScale": M.bumpScale = w; break; case "mapBumpRepeat": case "mapBumpOffset": case "mapBumpWrap": case "mapBumpAnisotropy": break; case "mapNormal": M.normalMap = v(w, d.mapNormalRepeat, d.mapNormalOffset, d.mapNormalWrap, d.mapNormalAnisotropy); break; case "mapNormalFactor": M.normalScale = w; break; case "mapNormalRepeat": case "mapNormalOffset": case "mapNormalWrap": case "mapNormalAnisotropy": break; case "mapSpecular": M.specularMap = v(w, d.mapSpecularRepeat, d.mapSpecularOffset, d.mapSpecularWrap, d.mapSpecularAnisotropy); break; case "mapSpecularRepeat": case "mapSpecularOffset": case "mapSpecularWrap": case "mapSpecularAnisotropy": break; case "mapMetalness": M.metalnessMap = v(w, d.mapMetalnessRepeat, d.mapMetalnessOffset, d.mapMetalnessWrap, d.mapMetalnessAnisotropy); break; case "mapMetalnessRepeat": case "mapMetalnessOffset": case "mapMetalnessWrap": case "mapMetalnessAnisotropy": break; case "mapRoughness": M.roughnessMap = v(w, d.mapRoughnessRepeat, d.mapRoughnessOffset, d.mapRoughnessWrap, d.mapRoughnessAnisotropy); break; case "mapRoughnessRepeat": case "mapRoughnessOffset": case "mapRoughnessWrap": case "mapRoughnessAnisotropy": break; case "mapAlpha": M.alphaMap = v(w, d.mapAlphaRepeat, d.mapAlphaOffset, d.mapAlphaWrap, d.mapAlphaAnisotropy); break; case "mapAlphaRepeat": case "mapAlphaOffset": case "mapAlphaWrap": case "mapAlphaAnisotropy": break; case "flipSided": M.side = l.BackSide; break; case "doubleSided": M.side = l.DoubleSide; break; case "transparency": console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"), M.opacity = w; break; case "depthTest": case "depthWrite": case "colorWrite": case "opacity": case "reflectivity": case "transparent": case "visible": case "wireframe": M[T] = w; break; case "vertexColors": w === !0 && (M.vertexColors = l.VertexColors), w === "face" && (M.vertexColors = l.FaceColors); break; default: console.error("THREE.Loader.createMaterial: Unsupported", T, w); } } return M.type === "MeshBasicMaterial" && delete M.emissive, M.type !== "MeshPhongMaterial" && delete M.specular, 1 > M.opacity && (M.transparent = !0), g.setTextures(_), g.parse(M); }; }() }); }, /* 21 */ /***/ (a, s, c) => { var l = c(4); s.VideoHandler = function(h) { var u = this; this.video = void 0, this.videoTexture = void 0, this.setMorphTime = function(p, m) { var g = p / m * u.video.duration; u.video.currentTime = g; }, this.getVideoDuration = function() { return u.video.duration; }, this.createCanvasVideoTexture = function() { return u.videoTexture = new l.VideoTexture(u.video), u.videoTexture.minFilter = l.LinearFilter, u.videoTexture.magFilter = l.LinearFilter, u.videoTexture.format = l.RGBFormat, u.video.currentTime = 0, u.videoTexture; }, this.getCurrentTime = function(p) { return u.video ? p * (u.video.currentTime / u.video.duration) : 0; }, this.isReadyToPlay = function() { return !!(u.video && 3 <= u.video.readyState); }, function() { document && (u.video = document.createElement("video"), u.video.crossOrigin = "anonymous", u.video.src = h, u.video.load(), u.video.loop = !0); }(); }; }, /* 22 */ /***/ (a, s, c) => { var l = c(4), h = c(23).Points, u = c(5).toBufferGeometry, p = c(5).getCircularTexture, m = c(17).Label, g = function() { c(10).ZincObject.call(this), this.isPointset = !0; var d = []; this.createMesh = (f, v, _) => { if (f && v) { var M = u(f, _), T = p(); v.map = T; var w = new h(M, v); this.setMesh(w, _.localTimeEnabled, _.localMorphColour); } }; var y = (f, v, _, M) => { if (_) { var T = new l.Color(M), w = new m(_, T); w.setPosition(v[0], v[1], v[2]); var b = w.getSprite(); b.material.sizeAttenuation = !1, b.material.alphaTest = 0.5, b.material.transparent = !0, b.material.depthWrite = !1, b.material.depthTest = !1, this.group.add(b), d[f] = w; } }; this.addPoints = (f, v, _) => { if (f && 0 < f.length) { var M = this.drawRange - 1, T = this.addVertices(f), w = this.getMorph(); if (!w) { var b = new l.PointsMaterial({ alphaTest: 0.5, size: 10, color: _, sizeAttenuation: !1 }); T.colorsNeedUpdate = !0, this.createMesh(T, b, { localTimeEnabled: !1, localMorphColour: !1 }); } var E = M + f.length, S = 0; if (Array.isArray(v) && v.length === f.length || typeof v == "string") for (M; M + S < E; ) { var C = typeof v == "string" ? v : v[S]; y(S, f[S], C, _), S++; } this.region && (this.region.pickableUpdateRequired = !0); } }, this.setSize = (f) => { this.morph && this.morph.material && (this.morph.material.size = f, this.morph.material.needsUpdate = !0); }, this.setSizeAttenuation = (f) => { this.morph && this.morph.material && (this.morph.material.sizeAttenuation = f, this.morph.material.needsUpdate = !0); }, this.getVerticesByIndex = function(f) { if (0 <= f && this.drawRange > f) { var v = this.getMorph().geometry.getAttribute("position"); return [v.getX(f), v.getY(f), v.getZ(f)]; } }, this.editVertices = function(f, v) { if (f && f.length) { var _ = this.getMorph(), M = v + f.length - 1; if (!_ || 0 > v || M >= this.drawRange) return; var T = _.geometry.getAttribute("position"), w = v; f.forEach((b) => { var E = d[w]; E && E.setPosition(b[0], b[1], b[2]), T.setXYZ(w++, b[0], b[1], b[2]); }), T.needsUpdate = !0, this.boundingBoxUpdateRequired = !0; } }, this.render = (f, v, _, M) => { this.morph && _ && (this.morph.sizePerPixel = _.pixelHeight), g.prototype.render.call(this, f, v, _, M); }; }; g.prototype = Object.create(c(10).ZincObject.prototype), s.Pointset = g; }, /* 23 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ Points: () => ( /* binding */ y ) /* harmony export */ }); var l = c(4), h = /* @__PURE__ */ new l.Matrix4(), u = /* @__PURE__ */ new l.Ray(), p = /* @__PURE__ */ new l.Sphere(), m = /* @__PURE__ */ new l.Vector3(), g = /* @__PURE__ */ new l.Vector3(), d = /* @__PURE__ */ new l.Vector3(); class y extends l.Object3D { constructor() { var M = 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 = M, this.material = T, this.sizePerPixel = 1, this.updateMorphTargets(); } copy(M) { return super.copy(M), this.material = M.material, this.geometry = M.geometry, this; } raycast(M, T) { var w = this.geometry, b = this.matrixWorld, E = M.params.Points.threshold, S = w.drawRange; if (w.boundingSphere === null && w.computeBoundingSphere(), p.copy(w.boundingSphere), p.applyMatrix4(b), p.radius += E, M.ray.intersectsSphere(p) !== !1) { h.copy(b).invert(), u.copy(M.ray).applyMatrix4(h); var C = E / ((this.scale.x + this.scale.y + this.scale.z) / 3) * this.material.size * this.sizePerPixel, R = C * C; if (w.isBufferGeometry) { var L = w.index, A = w.attributes, P = A.position, O = w.morphAttributes.position; if (L !== null) for (var x, I = Math.max(0, S.start), N = Math.min(L.count, S.start + S.count), D = I; D < N; D++) x = L.getX(D), v(this, P, O, x), f(m, x, R, b, M, T, this); else for (var k = Math.max(0, S.start), F = Math.min(P.count, S.start + S.count), W = k; W < F; W++) v(this, P, O, W), f(m, W, R, b, M, T, this); } else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } } updateMorphTargets() { var M = this.geometry; if (M.isBufferGeometry) { var T = M.morphAttributes, w = Object.keys(T); if (0 < w.length) { var b = T[w[0]]; if (b !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (var E, S = 0, C = b.length; S < C; S++) E = b[S].name || S + "", this.morphTargetInfluences.push(0), this.morphTargetDictionary[E] = S; } } } else { var R = M.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 f(_, M, T, w, b, E, S) { var C = u.distanceSqToPoint(_); if (C < T) { var R = new l.Vector3(); u.closestPointToPoint(_, R), R.applyMatrix4(w); var L = b.ray.origin.distanceTo(R); if (L < b.near || L > b.far) return; E.push({ distance: L, distanceToRay: Math.sqrt(C), point: R, index: M, face: null, object: S }); } } function v(_, M, T, w) { m.fromBufferAttribute(M, w); var b = _.morphTargetInfluences; if (_.material.morphTargets && T && b) { g.set(0, 0, 0); for (var E = 0, S = T.length; E < S; E++) { var C = b[E], R = T[E]; C !== 0 && (d.fromBufferAttribute(R, w), g.addScaledVector(d.sub(m), C)); } m.add(g); } } }, /* 24 */ /***/ (a, s, c) => { var l = c(4), h = c(5).toBufferGeometry, u = function() { c(10).ZincObject.call(this), this.isLines = !0, this.createLineSegment = (p, m, g) => { if (p && m) { var d = h(p, g); g.localMorphColour && d.morphAttributes.color && (m.onBeforeCompile = c(9).augmentMorphColor()); var y = new (c(12)).LineSegments(d, m); this.setMesh(y, g.localTimeEnabled, g.localMorphColour); } }, this.setWidth = (p) => { this.morph && this.morph.material && (this.morph.material.linewidth = p, this.morph.material.needsUpdate = !0); }, this.addLines = (p, m) => { if (p && 0 < p.length) { var g = this.addVertices(p), d = this.getMorph(); if (!d) { var y = new l.LineBasicMaterial({ color: m }); g.colorsNeedUpdate = !0, this.createLineSegment(g, y, { localTimeEnabled: !1, localMorphColour: !1 }); } this.region && (this.region.pickableUpdateRequired = !0); } }; }; u.prototype = Object.create(c(10).ZincObject.prototype), s.Lines = u; }, /* 25 */ /***/ (a, s, c) => { function l(m, g, d, y, f, v, _) { try { var M = m[v](_), T = M.value; } catch (w) { return void d(w); } M.done ? g(T) : Promise.resolve(T).then(y, f); } function h(m) { return function() { var g = this, d = arguments; return new Promise(function(y, f) { function v(T) { l(M, y, f, v, _, "next", T); } function _(T) { l(M, y, f, v, _, "throw", T); } var M = m.apply(g, d); v(void 0); }); }; } var u = c(4), p = function() { var m = this; c(26).Texture.call(this), this.isTextureArray = !0, this.loadFromImages = /* @__PURE__ */ function() { var g = h(function* (d) { var y = 1, f = 1, v = 0; if (d && d.length) { m.isLoading = !0; var _ = new Image(); _.crossOrigin = "Anonymous"; for (var M, T = document.createElement("canvas"), w = 0, b = Array(d.length), E = 0; E < d.length; E++) M = yield m.imageToUint8Array(m, _, d[E], T), M && M.array && (y = M.width, f = M.height, b[v] = M.array, w += b[v].length, v++); var S = new Uint8Array(w); w = 0, b.forEach((C) => { S.set(C, w), w += C.length; }), m.impl = new u.DataTexture2DArray(S, y, f, v), m.size = { width: y, height: f, depth: v }, m.isLoading = !1, m.impl.needsUpdate = !0; } }); return function() { return g.apply(this, arguments); }; }(), this.getMaterial = (g) => { if (this.impl) { var d; if (!g) d = new u.MeshBasicMaterial({ color: new u.Color(1, 1, 1), transparent: !1, opacity: 1, map: this.impl, side: u.DoubleSide }); else if (g.vs && g.fs) { var y = !0; g.transparent && (y = g.transparent); var f = u.FrontSide; g.side && (f = g.side), d = new u.ShaderMaterial({ transparent: y, uniforms: g.uniforms, vertexShader: g.vs, fragmentShader: g.fs, side: f }), g.glslVersion && (d.glslVersion = g.glslVersion); } if (d) return d.needsUpdate = !0, d; } }; }; p.prototype = Object.create(c(26).Texture.prototype), s.TextureArray = p; }, /* 26 */ /***/ (a, s, c) => { function l(m, g, d, y, f, v, _) { try { var M = m[v](_), T = M.value; } catch (w) { return void d(w); } M.done ? g(T) : Promise.resolve(T).then(y, f); } function h(m) { return function() { var g = this, d = arguments; return new Promise(function(y, f) { function v(T) { l(M, y, f, v, _, "next", T); } function _(T) { l(M, y, f, v, _, "throw", T); } var M = m.apply(g, d); v(void 0); }); }; } var u = 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(m, g) { return new Promise((d, y) => { m.onload = () => d(m), m.onerror = y, m.src = g; }); }, p.prototype.imageToUint8Array = /* @__PURE__ */ function() { var m = h(function* (g, d, y, f) { yield g.loadImage(d, y), f.width = d.width, f.height = d.height; var v = f.getContext("2d"); return v.drawImage(d, 0, 0), { array: new Uint8Array(v.getImageData(0, 0, f.width, f.height).data.buffer), width: f.width, height: f.height }; }); return function() { return m.apply(this, arguments); }; }(), p.prototype.loadFromImages = /* @__PURE__ */ function() { var m = h(function* () { }); return function() { return m.apply(this, arguments); }; }(), p.prototype.isReady = function() { return !(!this.impl || this.isLoading); }, p.prototype.getMaterial = function() { if (this.impl) return new u.MeshBasicMaterial({ color: new u.Color(1, 1, 1), transparent: !1, opacity: 1, map: this.impl, side: u.DoubleSide }); }, s.Texture = p; }, /* 27 */ /***/ (a, s, c) => { function l(f, v) { var _ = Object.keys(f); if (Object.getOwnPropertySymbols) { var M = Object.getOwnPropertySymbols(f); v && (M = M.filter(function(T) { return Object.getOwnPropertyDescriptor(f, T).enumerable; })), _.push.apply(_, M); } return _; } function h(f) { for (var v, _ = 1; _ < arguments.length; _++) v = arguments[_] == null ? {} : arguments[_], _ % 2 ? l(Object(v), !0).forEach(function(M) { u(f, M, v[M]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(f, Object.getOwnPropertyDescriptors(v)) : l(Object(v)).forEach(function(M) { Object.defineProperty(f, M, Object.getOwnPropertyDescriptor(v, M)); }); return f; } function u(f, v, _) { return v = p(v), v in f ? Object.defineProperty(f, v, { value: _, enumerable: !0, configurable: !0, writable: !0 }) : f[v] = _, f; } function p(f) { var v = m(f, "string"); return typeof v == "symbol" ? v : v + ""; } function m(f, v) { if (typeof f != "object" || !f) return f; var _ = f[Symbol.toPrimitive]; if (_ !== void 0) { var M = _.call(f, v || "default"); if (typeof M != "object") return M; throw new TypeError("@@toPrimitive must return a primitive value."); } return (v === "string" ? String : Number)(f); } var g = c(4), d = c(28), y = function(f) { c(29).TexturePrimitive.call(this, f), this.isTextureSlides = !0; var v = [], _ = {}; this.morph = new g.Group(), this.group = this.morph, this.morph.userData = this; var M = !0; this.createSlides = (b) => { b.forEach((E) => this.createSlide(E)); }; var T = (b, E) => { var S = b.material, C = S.uniforms; switch (b.rotation.x = 0, b.rotation.y = 0, b.rotation.z = 0, b.position.x = 0, b.position.y = 0, b.position.z = 0, E.direction) { case "x": var R = M ? -Math.PI / 2 : Math.PI / 2; b.rotation.y = R, C.direction.value = 1, C.slide.value.set(E.value, 0, 0), b.position.x = E.value; break; case "y": b.rotation.x = Math.PI / 2, C.direction.value = 2, C.slide.value.set(0, E.value, 0), b.position.y = E.value; break; case "z": C.direction.value = 3, C.slide.value.set(0, 0, E.value), b.position.z = E.value; break; } S.needsUpdate = !0, this.boundingBoxUpdateRequired = !0; }; this.modifySlideSettings = (b) => { b && b.id && b.id in _ && _[b.id] && T(_[b.id], b); }, this.createSlide = (b) => { if (this.texture && this.texture.isTextureArray && this.texture.isReady() && b && b.direction && b.value !== void 0) { var E = new g.PlaneGeometry(1, 1); E.translate(0.5, 0.5, 0); var S = d.getUniforms(); S.diffuse.value = this.texture.impl, S.depth.value = this.texture.size.depth, S.flipY.value = M; var C = { fs: d.fs, vs: d.vs, uniforms: S, glslVersion: d.glslVersion, side: g.DoubleSide, transparent: !1 }, R = this.texture.getMaterial(C); R.needsUpdate = !0; var L = new g.Mesh(E, R); L.name = this.groupName, L.userData = this; var A = { value: b.value, direction: b.direction, id: L.id }; return v.push(A), T(L, A), _[L.id] = L, this.morph.add(L), this.boundingBoxUpdateRequired = !0, A; } }, this.getTextureSettings = () => [...v], this.getTextureSettingsWithId = (b) => { for (var E = 0; E < v.length; E++) if (b === v[E].id) return h({}, v[E]); }, this.getSlides = () => this.morph ? [...this.morph.children] : [], this.removeSlide = (b) => { b && this.removeSlideWithId(b.id); }, this.removeSlideWithId = (b) => { if (this.morph && b in _ && _[b]) { if (this.morph.getObjectById(b)) { var E = _[b]; this.morph.remove(E), E.clear(), E.geometry && E.geometry.dispose(), E.material && E.material.dispose(), this.boundingBoxUpdateRequired = !0; } var S = v.findIndex((C) => C.id === b); -1 < S && v.splice(S, 1); } }, this.dispose = () => { this.morph.children.forEach((b) => { b.geometry && b.geometry.dispose(), b.material && b.material.dispose(); }), c(29).TexturePrimitive.prototype.dispose.call(this), this.boundingBoxUpdateRequired = !0; }; var w = (b, E, S) => { switch (E.direction.value) { case 1: S.copy(E.slide.value), b.expandByPoint(S), S.setY(1), S.setZ(1), b.expandByPoint(S); break; case 2: S.copy(E.slide.value), b.expandByPoint(S), S.setX(1), S.setZ(1), b.expandByPoint(S); break; case 3: S.copy(E.slide.value), b.expandByPoint(S), S.setX(1), S.setY(1), b.expandByPoint(S); break; } }; this.getBoundingBox = () => { if (this.morph && this.morph.children && this.morph.visible && this.boundingBoxUpdateRequired) { this.cachedBoundingBox.makeEmpty(); var b = new g.Vector3(0, 0, 0); this.morph.children.forEach((E) => { w(this.cachedBoundingBox, E.material.uniforms, b); }), this.morph.updateMatrixWorld(!0, !0), this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld), this.boundingBoxUpdateRequired = !1; } return this.cachedBoundingBox; }, this.applyTransformation = (b, E, S) => { var C = new g.Matrix4(); C.set(b[0], b[1], b[2], 0, b[3], b[4], b[5], 0, b[6], b[7], b[8], 0, 0, 0, 0, 0); var R = new g.Quaternion().setFromRotationMatrix(C); this.morph.position.set(...E), this.morph.quaternion.copy(R), this.morph.scale.set(...S), this.morph.updateMatrix(), this.boundingBoxUpdateRequired = !0; }, this.initialise = (b, E) => { if (b) { var S = b.locations; S && 0 < S.length && (this.applyTransformation(S[0].orientation, S[0].position, S[0].scale), "flipY" in S[0] && (M = S[0].flipY)), this.createSlides(b.settings.slides), E != null && typeof E == "function" && E(this); } }; }; y.prototype = Object.create(c(29).TexturePrimitive.prototype), y.prototype.constructor = y, s.TextureSlides = y; }, /* 28 */ /***/ (a, s, c) => { var l = c(4), h = l.GLSL3, u = ` 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); } `, m = function() { return { diffuse: { value: void 0 }, depth: { value: 1 }, slide: { value: new l.Vector3(0, 0, 1) }, direction: { value: 1 }, flipY: { value: !0 } }; }; s.fs = u, s.vs = p, s.glslVersion = h, s.getUniforms = m; }, /* 29 */ /***/ (a, s, c) => { c(4); var l = c(5).resolveURL, h = function(u) { c(10).ZincObject.call(this), this.isTexturePrimitive = !0, this.texture = u, this.load = (p, m) => { if (p && p.images && p.images.source) { var g = new (c(25)).TextureArray(), d = []; p.images.source.forEach((f) => { d.push(l(f)); }); var y = this; g.loadFromImages(d).then(() => { y.texture = g, y.initialise(p, m); }); } }, this.initialise = (p, m) => { m != null && typeof m == "function" && m(this); }; }; h.prototype = Object.create(c(10).ZincObject.prototype), h.prototype.constructor = h, s.TexturePrimitive = h; }, /* 30 */ /***/ (a, s, c) => { var l = c(4), h = c(31); s.Renderer = function(u, p) { var m = u, g = p, d = void 0, y = new l.Clock(!1); this.playAnimation = !0; var f = 1e3, v = [], _ = 0, M = [], T = 0, w = void 0, b = void 0, E = void 0, S = void 0, C = [], R = [], L = new l.Group(), A = void 0, P = void 0, O = !1; this.getDrawingWidth = () => m ? m.clientWidth : A ? typeof A.clientWidth > "u" ? Math.round(A.width) : Math.round(A.clientWidth) : 0, this.getDrawingHeight = () => m ? m.clientHeight : A ? typeof A.clientHeight > "u" ? Math.round(A.height) : Math.round(A.clientHeight) : 0, this.onWindowResize = () => { d.onWindowResize(); var N = this.getDrawingWidth(), D = this.getDrawingHeight(); if (g != null) { var k; m ? (k = m.getBoundingClientRect(), g.setSize(N, D)) : A && (typeof A.getBoundingClientRect > "u" || (k = A.getBoundingClientRect(), A.width = N, A.height = D), g.setSize(N, D, !1)), k && (k.left, k.top); var F = new l.Vector2(); g.getSize(F), F.x, F.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 && (m = void 0, A = N.canvas), g = new l.WebGLRenderer(N), m !== void 0 && m.appendChild(g.domElement), g.setClearColor(16777215, 1), A && A.style && (A.style.height = "100%", A.style.width = "100%"), g.autoClear = !1; var k = this.createScene("default"); this.setCurrentScene(k); }, this.getCurrentScene = () => d, this.setCurrentScene = (N) => { if (N) { this.removeActiveScene(N); var D = d; d = N, D && D.setInteractiveControlEnable(!1), d.setInteractiveControlEnable(!0), d.setAdditionalScenesGroup(L), this.onWindowResize(); } }, this.getSceneByName = (N) => C[N], this.createScene = (N) => { if (C[N] == null) { var D; return D = A ? new (c(32)).Scene(A, g) : new (c(32)).Scene(m, g), C[N] = D, D.sceneName = N, D; } }, this.resetView = () => { d.resetView(); }, this.viewAll = () => { if (d) { var N = d.getBoundingBox(); if (N) { for (var D, k = 0; k < R.length; k++) D = R[k].getBoundingBox(), D && N.union(D); d.viewAllWithBoundingBox(N); } } }, this.loadModelsURL = (N, D, k, F, W, K) => { d.loadModelsURL(N, D, k, F, W, K); }, this.loadViewURL = (N) => { d.loadViewURL(N); }, this.loadFromViewURL = (N, D) => { d.loadFromViewURL(N, D); }, this.updateDirectionalLight = () => { d.updateDirectionalLight(); }; var x = () => { O ? (w = requestAnimationFrame(x), this.render()) : (cancelAnimationFrame(w), w = void 0); }; this.stopAnimate = () => { O && (y.stop(), O = !1); }, this.animate = () => { O || (y.start(), O = !0, x()); }, this.addPreRenderCallbackFunction = (N) => (++_, v[_] = N, _), this.removePreRenderCallbackFunction = (N) => { N in v && delete v[N]; }, this.addPostRenderCallbackFunction = (N) => (++T, M[T] = N, T), this.removePostRenderCallbackFunction = (N) => { N in M && delete M[N]; }, this.getPlayRate = () => f, this.setPlayRate = (N) => { f = N; }, this.getCurrentTime = () => d.getCurrentTime(), this.setMorphsTime = (N) => { d.setMorphsTime(N); }, this.getZincGeometryByID = (N) => d.getZincGeometryByID(N), this.addToScene = (N) => { d.addObject(N); }, this.addToOrthoScene = (N) => { if (E == null && (E = new l.Scene()), b == null) { var D = this.getDrawingWidth(), k = this.getDrawingHeight(); b = new l.OrthographicCamera(-D / 2, D / 2, k / 2, -k / 2, 1, 10), b.position.z = 10; } E.add(N); }; var I = (N) => (D) => { D.needsUpdate = !0; var k = new l.SpriteMaterial({ map: D }), F = k.map.image.width, W = k.map.image.height; N.material = k, N.scale.set(F, W, 1); var K = this.getDrawingWidth(), ne = this.getDrawingHeight(); N.position.set((K - F) / 2, (-ne + W) / 2, 1), this.addToOrthoScene(N); }; this.addLogo = () => { S = new l.Sprite(), l.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png", void 0, I(S)); }, this.render = () => { P || (m ? 0 < m.clientWidth && 0 < m.clientHeight && (P = new h(m, this.onWindowResize)) : A && 0 < A.width && 0 < A.height && (P = new h(A, this.onWindowResize))); var N = y.getDelta(); d.renderGeometries(f, N, this.playAnimation); for (var D, k = 0; k < R.length; k++) D = R[k], D.renderGeometries(f, N, this.playAnimation); for (var F in b != null && E != null && (g.clearDepth(), g.render(E, b)), v) v.hasOwnProperty(F) && v[F].call(); for (var W in d.render(g), M) M.hasOwnProperty(W) && M[W].call(); }, this.getThreeJSRenderer = () => g, this.isSceneActive = (N) => { if (d === N) return !0; for (var D, k = 0; k < R.length; k++) if (D = R[k], D === N) return !0; return !1; }, this.addActiveScene = (N) => { this.isSceneActive(N) || (R.push(N), L.add(N.getThreeJSScene())); }, this.removeActiveScene = (N) => { for (var D, k = 0; k < R.length; k++) if (D = R[k], D === N) return R.splice(k, 1), void L.remove(N.getThreeJSScene()); }, this.clearAllActiveScene = () => { for (var N = 0; N < R.length; N++) L.remove(R[N].getThreeJSScene()); R.splice(0, R.length); }, this.dispose = () => { for (var N in O && cancelAnimationFrame(w), C) C.hasOwnProperty(N) && C[N].clearAll(); C = [], R = [], L = new l.Group(), this.stopAnimate(), v = [], _ = 0, b = void 0, E = void 0, S = void 0; var D = this.createScene("default"); this.setCurrentScene(D), P = void 0; }, this.transitionScene = (N, D) => { if (d) { var k = d.getZincCameraControls(), F = N.getBoundingBox(); if (F) { var W = F.min.distanceTo(F.max) / 2, K = (F.min.x + F.max.x) / 2, ne = (F.min.y + F.max.y) / 2, q = (F.min.z + F.max.z) / 2, z = k.getViewportFromCentreAndRadius(K, ne, q, W, 40, W * 4), j = k.getCurrentViewport(); k.cameraTransition(j, z, D), k.enableCameraTransition(); } } }, this.isWebGL2 = () => !!g && g.capabilities.isWebGL2; }; }, /* 31 */ /***/ (a) => { a.exports = a4(); }, /* 32 */ /***/ (a, s, c) => { var l = c(4), h = c(33).MarkerCluster, u = c(35).SceneLoader, p = c(41).SceneExporter, m = c(43).Viewport, g = c(5).createBufferGeometry, d = c(5).getCircularTexture, y = 0, f = function() { return "sc" + y++; }, v = function() { return { Duration: "6 secs", OriginalDuration: "-", TimeStamps: {} }; }, _ = 6e3; s.Scene = function(M, T) { var w = this, b = M, E = void 0, S = new u(this), C = void 0, R = {}, L = 0, A = {}, P = 0, O = new l.Scene(), x = new (c(44)).Region(void 0, this); O.add(x.getGroup()); var I = new l.Group(); O.add(I), this.directionalLight = void 0, this.ambient = void 0, this.camera = void 0; var N = 6e3, D = void 0; this.sceneName = void 0; var k = !1, F = 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 W = { x: 0, y: 0 }, K = v(), ne = new l.Vector2(), q = []; this.forcePickableObjectsUpdate = !1, this.uuid = f(); var z = new h(this); z.disable(), O.add(z.group); var j = () => b ? typeof b.clientWidth > "u" ? b.width : b.clientWidth : 0, Q = () => b ? typeof b.clientHeight > "u" ? b.height : b.clientHeight : 0; this.getDownloadProgress = () => S.getDownloadProgress(), this.onWindowResize = () => { var B = Q(); this.camera.aspect = j() / B, this.camera.updateProjectionMatrix(), this.minimapScissor.updateRequired = !0, D.onResize(), D.calculateHeightPerPixelAtZeroDepth(B); }, this.resetView = () => { this.onWindowResize(), D.resetView(); }, this.changeZoomByScrollRateUnit = (B) => { D.changeZoomByScrollRateUnit(B); }; var Y = () => { this.camera = new l.PerspectiveCamera(40, j() / Q(), 0, 10), this.ambient = new l.AmbientLight(16777215, 0.2), O.add(this.ambient), this.directionalLight = new l.DirectionalLight(16777215, 0.8), O.add(this.directionalLight), D = new (c(43)).CameraControls(this.camera, T.domElement, T, this), D.setDirectionalLight(this.directionalLight), D.resetView(), C = new (c(49)).Minimap(this); }; Y(), this.loadView = (B) => { var $ = new m(); return $.setFromObject(B), D.setCurrentCameraSettings($), !0; }, this.setupMultipleViews = (B, $) => { for (var [te, U] of Object.entries($)) { var V = new m(); V.setFromObject(U), D.addViewport(te, V); } D.setDefaultViewport(B); }, this.getBoundingBox = () => x.getBoundingBox(!0), this.viewAllWithBoundingBox = (B) => { if (B) { var $ = D.getViewportFromBoundingBox(B, 1); D.setCurrentCameraSettings($), D.calculateHeightPerPixelAtZeroDepth(Q()), z.markerUpdateRequired = !0; } }, this.viewAll = () => { var B = this.getBoundingBox(); this.viewAllWithBoundingBox(B), z.markerUpdateRequired = !0; }, this.forEachGeometry = (B) => { x.forEachGeometry(B, !0); }, this.forEachGlyphset = (B) => { x.forEachGlyphset(B, !0); }, this.forEachPointset = (B) => { x.forEachPointset(B, !0); }, this.forEachLine = (B) => { x.forEachLine(B, !0); }, this.findGeometriesWithGroupName = (B) => x.findGeometriesWithGroupName(B, !0), this.findPointsetsWithGroupName = (B) => x.findPointsetsWithGroupName(B, !0), this.findGlyphsetsWithGroupName = (B) => x.findGlyphsetsWithGroupName(B, !0), this.findLinesWithGroupName = (B) => x.findLinesWithGroupName(B, !0), this.findObjectsWithGroupName = (B) => x.findObjectsWithGroupName(B, !0), this.findObjectsWithAnatomicalId = (B) => x.findObjectsWithAnatomicalId(B, !0), this.getBoundingBoxOfZincObjects = (B) => { for (var $, te = void 0, U = 0; U < B.length; U++) $ = B[U].getBoundingBox(), $ && (te ? te.union($) : te = $); return te; }, this.vectorToScreenXY = (B) => { B.project(this.camera); var $ = j(), te = Q(), U = $ / 2, V = te / 2; return B.x = B.x * U + U, B.y = -(B.y * V) + V, B; }, this.getObjectsScreenXY = (B) => { if (B && 0 < B.length) { var $ = this.getBoundingBoxOfZincObjects(B), te = new l.Vector3(); return $.getCenter(te), this.vectorToScreenXY(te); } }, this.getNamedObjectsScreenXY = (B) => { var $ = this.findObjectsWithGroupName(B); return this.getObjectsScreenXY($); }, this.addZincObject = (B) => { B && (x.addZincObject(B), D && D.calculateMaxAllowedDistance(this)); }, this.loadGlyphsetURL = (B, $, te, U) => { S.loadGlyphsetURL(x, B, $, te, U); }, this.loadPointsetURL = (B, $, te, U, V) => { S.loadPointsetURL(x, B, $, te, U, V); }, this.loadLinesURL = (B, $, te, U, V) => { S.loadLinesURL(x, B, $, te, U, V); }, this.loadSTL = (B, $, te) => { S.loadSTL(x, B, $, te); }, this.loadOBJ = (B, $, te) => { S.loadOBJ(x, B, $, te); }, this.loadMetadataURL = (B, $, te) => { S.loadMetadataURL(x, B, $, te); }, this.loadModelsURL = (B, $, te, U, V, ae) => { S.loadModelsURL(x.urls, $, te, U, V, ae); }, this.loadViewURL = (B) => { S.loadViewURL(B); }, this.loadFromViewURL = (B, $) => { S.loadFromViewURL(B, $); }, this.loadGLTF = (B, $, te, U) => { S.loadGLTF(x, B, $, te, U); }, this.updateDirectionalLight = () => { D.updateDirectionalLight(); }, this.addObject = (B) => { O.add(B); }, this.removeObject = (B) => { O.remove(B); }, this.getCurrentTime = () => { if (E != null) return E.getCurrentTime(N); var B = x.getCurrentTime(); return B === -1 ? 0 : B; }, this.setMorphsTime = (B) => { E != null && E.setMorphTime(B, N), x.setMorphTime(B, !0); }, this.isTimeVarying = () => !!(E && E.video && !E.video.error) || x.isTimeVarying(), this.renderGeometries = (B, $, te) => { var U = {}; if (U.camera = D, U.displayMarkers = this.displayMarkers, U.markerCluster = z, U.markersList = z.markers, U.ndcToBeUpdated = !1, te && (U.markerCluster.markerUpdateRequired = !0), !E) S.toBeDownloaded == 0 ? (U.ndcToBeUpdated = D.update($), U.ndcToBeUpdated && D.calculateHeightPerPixelAtZeroDepth(Q()), x.renderGeometries(B, $, te, D, U, !0)) : D.update(0); else if (E.isReadyToPlay()) { te ? E.video.play() : E.video.pause(); var V = E.video.currentTime / E.getVideoDuration() * N; S.toBeDownloaded == 0 ? (D.setTime(V), U.ndcToBeUpdated = D.update(0), U.ndcToBeUpdated && D.calculateHeightPerPixelAtZeroDepth(Q()), x.setMorphTime(V, !0), x.renderGeometries(0, 0, te, D, U, !0)) : D.update(0); } else myPlayRate = 0; }, this.getThreeJSScene = () => O, this.setVideoHandler = (B) => { E || (E = B); }, this.setAdditionalScenesGroup = (B) => { O.add(B); }; var ee = (B, $, te, U, V, ae, ue) => { var de = 0, ve = 0; return ve = B.includes("top") ? ue - V - te : B.includes("bottom") ? te : Math.floor((ue - V) / 2), de = B.includes("left") ? $ : B.includes("right") ? ae - $ - U : Math.floor((ae - U) / 2), { x: de, y: ve }; }, G = (B) => { this.displayMinimap === !0 && (B.setScissorTest(!0), B.getSize(ne), this.minimapScissor.updateRequired && (W = ee(this.minimapScissor.align, this.minimapScissor.x_offset, this.minimapScissor.y_offset, this.minimapScissor.width, this.minimapScissor.height, ne.x, ne.y), this.minimapScissor.updateRequired = !1), B.setScissor(W.x, W.y, this.minimapScissor.width, this.minimapScissor.height), B.setViewport(W.x, W.y, this.minimapScissor.width, this.minimapScissor.height), C.updateCamera(), O.add(C.mask), B.render(O, C.camera), O.remove(C.mask), B.setScissorTest(!1), B.setViewport(0, 0, ne.x, ne.y)); }; this.render = (B) => { this.autoClearFlag && B.clear(), k && F ? F.render(O, this.camera) : (B.render(O, this.camera), G(B)); }, this.setInteractiveControlEnable = (B) => { B == !0 ? D.enable() : D.disable(); }, this.getZincCameraControls = () => D, this.getThreeJSScene = () => O, this.setDuration = (B) => { x.setDuration(B), N = B, D.setPathDuration(B), S.duration = B; }, this.getDuration = () => N, this.setStereoEffectEnable = (B) => { B != !0 || F || (F = new c(43).StereoEffect(T)), T.setSize(j(), Q()), this.camera.updateProjectionMatrix(), k = B; }, this.objectIsInScene = (B) => x.objectIsInRegion(B, !0), this.alignBoundingBoxToCameraView = (B, $) => { if (B) { var te = new l.Vector3(); B.getCenter(te); var U = this.getZincCameraControls().getCurrentViewport(), V = new l.Vector3(U.targetPosition[0], U.targetPosition[1], U.targetPosition[2]), ae = new l.Vector3(U.eyePosition[0], U.eyePosition[1], U.eyePosition[2]), ue = new l.Vector3(), de = new l.Vector3(); ue.subVectors(V, ae).normalize(), de.subVectors(V, te).normalize(); var ve = new l.Vector3(); ve.crossVectors(ue, de); var ye = ue.angleTo(de); 0 < $ ? (this.getZincCameraControls().rotateCameraTransition(ve, ye, $), this.getZincCameraControls().enableCameraTransition()) : this.getZincCameraControls().rotateAboutLookAtpoint(ve, ye), z.markerUpdateRequired = !0; } }, this.translateBoundingBoxToCameraView = (B, $, te) => { if (B) { var U = this.getZincCameraControls().getCurrentViewport(), V = this.getZincCameraControls().getViewportFromBoundingBox(B, $); 0 < te && (this.getZincCameraControls().cameraTransition(U, V, te), this.getZincCameraControls().enableCameraTransition()), z.markerUpdateRequired = !0; } }, this.alignObjectToCameraView = (B, $) => { if (this.objectIsInScene(B)) { var te = B.getBoundingBox(); this.alignBoundingBoxToCameraView(te, $); } }, this.setCameraTargetToObject = (B) => { if (this.objectIsInScene(B)) { var $ = new l.Vector3(), te = B.getBoundingBox(), U = this.getZincCameraControls().getCurrentViewport(); te.getCenter($); var V = new l.Vector3(U.targetPosition[0], U.targetPosition[1], U.targetPosition[2]), ae = new l.Vector3(U.eyePosition[0], U.eyePosition[1], U.eyePosition[2]), ue = new l.Vector3(), de = new l.Vector3(); ue.subVectors(ae, V), de.addVectors($, ue), U.eyePosition[0] = de.x, U.eyePosition[1] = de.y, U.eyePosition[2] = de.z, U.targetPosition[0] = $.x, U.targetPosition[1] = $.y, U.targetPosition[2] = $.z, this.getZincCameraControls().setCurrentCameraSettings(U), z.markerUpdateRequired = !0; } }, this.isStereoEffectEnable = () => k, this.removeZincObject = (B) => { x.removeZincObject(B), D && D.calculateMaxAllowedDistance(this), z.markerUpdateRequired = !0; }, this.updatePickableThreeJSObjects = () => { q.length = 0, z.isEnabled && q.push(z.group), x.getPickableThreeJSObjects(q, !0), this.forcePickableObjectsUpdate = !1; }, this.getPickableThreeJSObjects = () => ((this.forcePickableObjectsUpdate || x.checkPickableUpdateRequred(!0)) && this.updatePickableThreeJSObjects(), q), this.getNormalisedMinimapCoordinates = (B, $) => { if (this.displayMinimap) { var te = new l.Vector2(); B.getSize(te); var U = te.y - $.clientY; if (W.x + this.minimapScissor.width > $.clientX && $.clientX > W.x && W.y + this.minimapScissor.height > U && U > W.y) { var V = 2 * (($.clientX - W.x) / this.minimapScissor.width) - 1, ae = 2 * ((U - W.y) / this.minimapScissor.height) - 1; return { x: V, y: ae }; } } }, this.getMinimapDiffFromNormalised = (B, $) => C ? C.getDiffFromNormalised(B, $) : void 0, this.isWebGL2 = () => T.isWebGL2(), this.clearAll = () => { z.clear(), x.clear(!0), this.clearZincObjectAddedCallbacks(), this.clearZincObjectRemovedCallbacks(), S.toBeDwonloaded = 0, D && D.calculateMaxAllowedDistance(this), z.markerUpdateRequired = !0; }, this.addMetadataTimeStamp = (B, $) => { K.TimeStamps[B] = re($); }, this.getMetadataTag = (B) => K[B], this.getMetadata = () => K, this.setMetadataTag = (B, $) => { K[B] = $; }, this.removeMetadataTag = (B) => { delete K[B]; }, this.resetMetadata = () => { K = v(); }, this.resetDuration = () => { this.setDuration(_); }; var J = (B) => [...B.years ? ["".concat(B.years, "years")] : [], ...B.months ? ["".concat(B.months, "months")] : [], ...B.weeks ? ["".concat(B.weeks, "weeks")] : [], ...B.days ? ["".concat(B.days, "days")] : [], ...B.hours ? ["".concat(B.hours, "hours")] : [], ...B.mins ? ["".concat(B.mins, "mins")] : [], ...B.secs ? ["".concat(B.secs, "secs")] : []].join(" "), re = (B) => B.years ? 31536e6 * B.years : 0 + B.months ? 2592e6 * B.months : 0 + B.weeks ? 6048e5 * B.weeks : 0 + B.days ? 864e5 * B.days : 0 + B.hours ? 36e5 * B.hours : 0 + B.mins ? 6e4 * B.mins : 0 + B.secs ? 1e3 * B.secs : 0; this.setDurationFromObject = (B) => { var $ = J(B), te = re(B); this.setMetadataTag("Duration", $), this.setDuration(te); }, this.setOriginalDurationFromObject = (B) => { var $ = J(B); this.setMetadataTag("OriginalDuration", $); }, this.exportGLTF = (B) => { var $ = new p(this); return $.exportGLTF(B); }, this.getRootRegion = () => x, this.createLines = (B, $, te, U) => { var V = x.findChildFromPath(B); return V === void 0 && (V = x.createChildFromPath(B)), V.createLines($, te, U); }, this.createPoints = (B, $, te, U, V) => { var ae = x.findChildFromPath(B); return ae === void 0 && (ae = x.createChildFromPath(B)), ae.createPoints($, te, U, V); }, this.addZincObjectAddedCallbacks = (B) => (++L, R[L] = B, L), this.addZincObjectRemovedCallbacks = (B) => (++P, A[P] = B, P), this.removeZincObjectAddedCallbacks = (B) => { B in L && delete R[B]; }, this.removeZincObjectRemovedCallbacks = (B) => { B in P && delete A[B]; }, this.clearZincObjectAddedCallbacks = () => { R = {}, L = 0; }, this.clearZincObjectRemovedCallbacks = () => { A = {}, P = 0; }, this.triggerObjectAddedCallback = (B) => { for (var $ in R) R.hasOwnProperty($) && R[$](B); }, this.triggerObjectRemovedCallback = (B) => { for (var $ in A) A.hasOwnProperty($) && A[$](B); }, this.addTemporaryPoints = (B, $) => { var te = g(B.length, B), U = new l.PointsMaterial({ alphaTest: 0.5, size: 15, color: $, sizeAttenuation: !1 }), V = d(); U.map = V; var ae = new (c(23)).Points(te, U); return I.add(ae), ae; }, this.addTemporaryLines = (B, $) => { var te = g(B.length, B), U = new l.LineBasicMaterial({ color: $ }), V = new (c(12)).LineSegments(te, U); return I.add(V), V; }, this.removeTemporaryPrimitive = (B) => { I.remove(B), B.geometry.dispose(), B.material.dispose(); }, this.clearTemporaryPrimitives = () => { var B = 0, $ = I.children; return $.forEach((te) => { te.geometry.dispose(), te.material.dispose(), B++; }), I.clear(), B; }, this.addBoundingBoxPrimitive = function(B, $, te, U, V) { var ae = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : void 0, ue = x.findChildFromPath(B); ue === void 0 && (ue = x.createChildFromPath(B)); var de = ae || w.getBoundingBox(), ve = new l.Vector3().subVectors(de.max, de.min), ye = new l.BoxGeometry(ve.x, ve.y, ve.z), le = ue.createGeometryFromThreeJSGeometry($, ye, te, U, V, 1e4); return ve.addVectors(de.min, de.max).multiplyScalar(0.5), le.setPosition(ve.x, ve.y, ve.z), le; }, this.addSlicesPrimitive = function(B, $, te, U, V) { var ae = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : void 0; if ($ && 3 <= $.length && te && 3 <= te.length) { var ue = x.findChildFromPath(B); ue === void 0 && (ue = x.createChildFromPath(B)); var de = ae || w.getBoundingBox(), ve = new l.Vector3().subVectors(de.max, de.min), ye = [], le = 0; return ["x", "y", "z"].forEach((Se) => { var Te; switch (Se) { case "x": Te = new l.PlaneGeometry(ve.z, ve.y), Te.rotateY(Math.PI / 2); break; case "y": Te = new l.PlaneGeometry(ve.x, ve.z), Te.rotateX(Math.PI / 2); break; case "z": Te = new l.PlaneGeometry(ve.x, ve.y); break; } var oe = ue.createGeometryFromThreeJSGeometry($[le], Te, te[le], U, V, 10001); ye.push(oe), le++; }), ve.addVectors(de.min, de.max).multiplyScalar(0.5), ye.forEach((Se) => { Se.setPosition(ve.x, ve.y, ve.z); }), ye; } }, this.enableMarkerCluster = (B) => { B ? (z.markerUpdateRequired = !0, z.enable()) : (z.markerUpdateRequired = !1, z.disable()), this.forcePickableObjectsUpdate = !0; }; }; }, /* 33 */ /***/ (a, s, c) => { function l(T, w) { var b = Object.keys(T); if (Object.getOwnPropertySymbols) { var E = Object.getOwnPropertySymbols(T); w && (E = E.filter(function(S) { return Object.getOwnPropertyDescriptor(T, S).enumerable; })), b.push.apply(b, E); } return b; } function h(T) { for (var w, b = 1; b < arguments.length; b++) w = arguments[b] == null ? {} : arguments[b], b % 2 ? l(Object(w), !0).forEach(function(E) { u(T, E, w[E]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(T, Object.getOwnPropertyDescriptors(w)) : l(Object(w)).forEach(function(E) { Object.defineProperty(T, E, Object.getOwnPropertyDescriptor(w, E)); }); return T; } function u(T, w, b) { return w = p(w), w in T ? Object.defineProperty(T, w, { value: b, enumerable: !0, configurable: !0, writable: !0 }) : T[w] = b, T; } function p(T) { var w = m(T, "string"); return typeof w == "symbol" ? w : w + ""; } function m(T, w) { if (typeof T != "object" || !T) return T; var b = T[Symbol.toPrimitive]; if (b !== void 0) { var E = b.call(T, w || "default"); if (typeof E != "object") return E; throw new TypeError("@@toPrimitive must return a primitive value."); } return (w === "string" ? String : Number)(T); } var g = c(4), d = new Image(128, 128); d.src = c(34); var y = new g.Texture(); y.image = d, y.needsUpdate = !0; var f = [0.02, 0.03, 1], v = new g.SpriteMaterial({ map: y, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), _ = c(5).createNewSpriteText, M = function(T) { c(10).ZincObject.call(this), this.texture = y; var w = void 0; this.morph = new g.Group(), this.group = this.morph, this.isMarkerCluster = !0; var b = !0, E = []; this.markers = {}; var S = new g.Vector2(), C = new g.Vector2(), R = Date.now(); this.setSpriteSize = (x) => { w.scale.set(0.015, 0.02, 1), w.scale.multiplyScalar(x); }, this.clear = () => { this.group.clear(), this.markers = {}; }, this.dispose = () => { this.clear(), this.morph && this.morph.clear(); }; var L = (x) => { var I = new g.Group(), N = new g.Sprite(v); return N.clusterIndex = x, N.center.set(0.5, 0), N.position.set(0, 0, 0), N.renderOrder = 1e4, N.scale.set(f[0], f[1], f[2]), N.userData = this, I.add(N), this.group.add(I), { group: I, marker: N, label: void 0, number: 0, min: [0, 0, 0], max: [1, 1, 1] }; }, A = (x, I, N) => { x.group.visible = !0, x.group.position.set(I.coords[0], I.coords[1], I.coords[2]), (x.label === void 0 || N !== x.number) && (x.label && (x.group.remove(x.label), x.label.material.map.dispose(), x.label.material.dispose()), x.label = _(N, 0.012, "black", "Asap", 120, 700), x.number = N, x.group.add(x.label)), x.min = I.min, x.max = I.max; }, P = (x) => { var I = 0; for (x.forEach((N) => { var D = N.members.length, k = 0; D === 1 ? N.members[0].setVisibility(!0) : (N.members.forEach((F) => { k += F.getNumber(), F.setVisibility(!1); }), !E[I] && E.push(L(I)), A(E[I], N, k), I++); }), I; I < E.length; I++) E[I].group.visible = !1; }, O = (x, I) => { var N = !0, D = { members: [], coords: [0, 0, 0], min: [0, 0, 0], max: [1, 1, 1] }, k = 0; for (var F in x) N ? (S.set(x[F].ndc.x, x[F].ndc.y), this._b1.setFromPoints([x[F].morph.position]), N = !1, D.members.push(x[F]), D.coords = [x[F].morph.position.x, x[F].morph.position.y, x[F].morph.position.z], I.push(D), delete x[F]) : (C.set(x[F].ndc.x, x[F].ndc.y), k = S.distanceTo(C), 0.1 > k && (D.members.push(x[F]), this._b1.expandByPoint(x[F].morph.position), delete x[F])); 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 && O(x, I); }; this.calculate = () => { if (b) { var x = Date.now(); if (500 < x - R) { var I = []; O(h({}, this.markers), I), P(I), R = Date.now(), this.markerUpdateRequired = !1; } } }, this.isEnabled = () => b, this.enable = () => { b = !0, this.morph.visible = !0; }, this.disable = () => { for (var x in b = !1, this.morph.visible = !1, this.markers) { var I; (I = this.markers[x]) !== null && I !== void 0 && I.isMarker && this.markers[x].isEnabled() && this.markers[x].setVisibility(!0); } }, this.zoomToCluster = (x) => !!(x !== void 0 && -1 < x && (this._v1.set(...E[x].min), this._v2.set(...E[x].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 = (x) => { if (x !== void 0 && -1 < x && E[x]) { var I; return (I = E[x].group) === null || I === void 0 ? void 0 : I.visible; } return !1; }; }; M.prototype = Object.create(c(10).ZincObject.prototype), s.MarkerCluster = M; }, /* 34 */ /***/ (a) => { a.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIHZpZXdCb3g9IjAgMCAzNjUgNTYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4KPGRlZnM+CjwvZGVmcz4KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDApIiBpZD0iODA4ZWQyODMtMjUyNC00NDBmLTg4YWUtM2JkYjQ3YmI1NzQ5IiAgPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii0xODIuNSIgeT0iLTI4MCIgcng9IjAiIHJ5PSIwIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgLz4KPC9nPgo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+CjxnIHN0eWxlPSIiICAgPgo8L2c+CjwvZz4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDk3LjUpIiAgPgo8ZyBzdHlsZT0iIiAgID4KPC9nPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDAuOTkgMCAwIDAuOTkgMTgyLjUgMjgwKSIgID4KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItNTQwIiB5PSItNTQwIiByeD0iMCIgcnk9IjAiIHdpZHRoPSIxMDgwIiBoZWlnaHQ9IjEwODAiIC8+CjwvZz4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxwYXRoIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwxNjUsMCk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHRyYW5zZm9ybT0iIHRyYW5zbGF0ZSgtMTgyLjksIC0yNzkuODUpIiBkPSJNIDE4Mi45IDU1MS43IEMgMTgyLjkgNTUxLjgwMDAwMDAwMDAwMDEgMTgzLjEgNTUyIDE4My4xIDU1MiBDIDE4My4xIDU1MiAzNTguMyAyODMgMzU4LjMgMTk0LjYgQyAzNTguMyA2NC41IDI2OS41IDcuOTAwMDAwMDAwMDAwMDA2IDE4Mi45IDcuNjk5OTk5OTk5OTk5OTg5IEMgOTYuMyA3LjkgNy41IDY0LjUgNy41IDE5NC42IEMgNy41IDI4MyAxODIuOCA1NTIgMTgyLjggNTUyIEMgMTgyLjggNTUyIDE4Mi45IDU1MS43IDE4Mi45IDU1MS43IHogTSAxMjIuMiAxODcuMiBDIDEyMi4yIDE1My42IDE0OS40IDEyNi4zOTk5OTk5OTk5OTk5OSAxODMgMTI2LjM5OTk5OTk5OTk5OTk5IEMgMjE2LjYgMTI2LjM5OTk5OTk5OTk5OTk5IDI0My44IDE1My42IDI0My44IDE4Ny4yIEMgMjQzLjggMjIwLjc5OTk5OTk5OTk5OTk4IDIxNi41IDI0OCAxODIuOSAyNDggQyAxNDkuNCAyNDggMTIyLjIgMjIwLjggMTIyLjIgMTg3LjIgeiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiAvPgo8L2c+CgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPgo8Y2lyY2xlIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgY3g9IjAiIGN5PSIwIiByPSIzNSIgLz4KPC9nPgo8L2c+CjwvZz4KPC9zdmc+"; }, /* 35 */ /***/ (a, s, c) => { var l = c(4), h = c(5).resolveURL, u = c(5).createNewURL, p = c(36).STLLoader, m = c(37).OBJLoader, g = c(38).PrimitivesLoader; s.SceneLoader = function(d) { var y = d; this.toBeDownloaded = 0, this.progressMap = {}; var f = !1, v = !1, _ = new g(); this.getDownloadProgress = () => { var q = 0, z = 0, j = !1; for (var Q in this.progressMap) { var Y = this.progressMap[Q]; q += Y[1], z += Y[0], Y[1] == 0 && (j = !0); } return j && (q = 0), [q, z, v]; }, this.onProgress = (q) => (z) => { this.progressMap[q] = [z.loaded, z.total]; }, this.onError = (q) => (z) => { --this.toBeDownloaded, v = !0, console.error("There is an issue with one of the external resource: ".concat(z == null ? void 0 : z.responseURL, ".")), q && q(); }; var M = (q, z) => { var j = z.Default; if (z.Inline) y.setupMultipleViews(j, z.Entries); else { var Q = [], Y = function(J) { q && (newURL = u(G, q), Q.push(new Promise((re, B) => { fetch(newURL).then(($) => $.json()).then(($) => re({ key: J, data: $ })).catch(($) => B($)); }))); }; for (var [ee, G] of Object.entries(z.Entries)) Y(ee); Promise.all(Q).then((J) => { var re = {}; J.forEach(($) => { re[$.key] = $.data; }), y.setupMultipleViews(j, re); var B = y.getZincCameraControls(); B && B.setCurrentViewport(j), f = !0; }); } }; this.loadViewURL = (q, z) => { this.toBeDownloaded += 1; var j = new XMLHttpRequest(); j.onreadystatechange = () => { if (j.readyState == 4) if (j.status == 200) { var Y = JSON.parse(j.responseText); y.setupMultipleViews("default", { default: Y }), y.resetView(), f = !0, --this.toBeDownloaded, z != null && typeof z == "function" && z(); } else this.onError(); }; var Q = h(q); j.open("GET", Q, !0), j.send(); }, this.loadModelsURL = (q, z, j, Q, Y, ee, G) => { var J = z.length; this.toBeDownloaded += J; for (var re = 0; re < J; re++) { var B = z[re], $ = c(0).defaultMaterialColor, te = c(0).defaultOpacity; j != null && j[re] != null && ($ = !!j[re]), Q != null && Q[re] != null && (te = Q[re]); var U = 0; Y != null && Y[re] != null && (U = !!Y[re]); var V = 0; ee != null && ee[re] != null && (V = !!ee[re]), _.load(h(B), P(q, $, te, U, V, void 0, void 0, void 0, void 0, G), this.onProgress(B), this.onError(G)); } }, this.loadFromViewURL = (q, z, j) => { var Q = new XMLHttpRequest(); Q.onreadystatechange = () => { if (Q.readyState == 4 && Q.status == 200) { var ee = JSON.parse(Q.responseText); y.loadView(ee); for (var G, J = [], re = z + "_", B = 0; B < ee.numberOfResources; B++) G = re + (B + 1) + ".json", J.push(G); this.loadModelsURL(q, J, ee.colour, ee.opacity, ee.timeEnabled, ee.morphColour, j); } }; var Y = h(z + "_view.json"); Q.open("GET", Y, !0), Q.send(); }; var T = (q, z, j, Q, Y, ee, G, J) => (re, B) => { var $ = new (c(24)).Lines(), te = void 0; B && B[0] && (te = new l.LineBasicMaterial({ color: B[0].color.clone() }), 1 > B[0].opacity && (te.transparent = !0), te.opacity = B[0].opacity, te.morphTargets = z, te.vertexColors = B[0].vertexColors); var U = { localTimeEnabled: z, localMorphColour: j }; if ($ && ($.createLineSegment(re, te, U), $.setName(Q), $.anatomicalId = Y, $.setRenderOrder(ee), q.addZincObject($), $.setDuration(y.getDuration()), console.log(G), G && G.levels)) for (var [V, ae] of Object.entries(G.levels)) $.addLOD(_, V, ae.URL, ae.Index, G.preload); --this.toBeDownloaded, re.dispose(), J != null && typeof J == "function" && J($); }; this.loadLinesURL = (q, z, j, Q, Y, ee, G) => { var J = 0; this.toBeDownloaded += 1; var re = !!(G && G.isInline) && G.isInline, B = G && G.anatomicalId ? G.anatomicalId : void 0, $ = G && G.renderOrder ? G.renderOrder : void 0; j != null && (J = !!j); var te = 0; if (Q != null && (te = !!Q), re) { var U = _.parse(z); T(q, J, te, Y, B, $, G.lod, ee)(U.geometry, U.materials); } else _.load(z, T(q, J, te, Y, B, $, G.lod, ee), this.onProgress(z), this.onError(ee), G.loaderOptions); }; var w = (q, z, j, Q, Y, ee) => { var G = ee && ee.isInline ? ee.isInline : void 0, J = ee && ee.anatomicalId ? ee.anatomicalId : void 0, re = ee && ee.displayLabels ? ee.displayLabels : void 0, B = ee && ee.renderOrder ? ee.renderOrder : void 0, $ = new (c(18)).Glyphset(); $.setDuration(y.getDuration()), $.groupName = Q; var te = () => { --this.toBeDownloaded, Y != null && typeof Y == "function" && Y($); }; ++this.toBeDownloaded, G ? $.load(z, j, te, G, re) : $.load(z, h(j), te, G, re), $.anatomicalId = J, $.setRenderOrder(B), q.addZincObject($); }, b = (q, z, j, Q, Y, ee) => () => { if (z.readyState == 4 && z.status == 200) { var G = JSON.parse(z.responseText); w(q, G, j, Q, Y, ee); } }, E = (q, z, j, Q, Y, ee, G) => (J, re) => { var B = new (c(22)).Pointset(), $ = new l.PointsMaterial({ alphaTest: 0.5, size: 10, sizeAttenuation: !1 }); re && re[0] && (1 > re[0].opacity && ($.transparent = !0), $.opacity = re[0].opacity, $.color = re[0].color, $.morphTargets = z, $.vertexColors = re[0].vertexColors); var te = {}; te.localTimeEnabled = z, te.localMorphColour = j, B && (B.createMesh(J, $, te), B.setName(Q), B.anatomicalId = Y, q.addZincObject(B), B.setDuration(y.getDuration()), B.setRenderOrder(ee)), J.dispose(), --this.toBeDownloaded, G != null && typeof G == "function" && G(B); }; this.loadSTL = (q, z, j, Q) => { this.toBeDownloaded += 1; var Y = c(0).defaultMaterialColor, ee = c(0).defaultOpacity, G = new p(); G.crossOrigin = "Anonymous", G.load(h(z), P(q, Y, ee, !1, !1, j, void 0, void 0, void 0, Q)); }, this.loadOBJ = (q, z, j, Q) => { this.toBeDownloaded += 1; var Y = c(0).defaultMaterialColor, ee = c(0).defaultOpacity, G = new m(); G.crossOrigin = "Anonymous", G.load(h(z), P(q, Y, ee, !1, !1, j, void 0, void 0, void 0, Q)); }; var S = (q, z, j, Q, Y, ee, G) => { this.toBeDownloaded += 1; var J = c(0).defaultMaterialColor, re = c(0).defaultOpacity, B = 0, $ = !!(G && G.isInline) && G.isInline, te = G && G.fileFormat ? G.fileFormat : void 0, U = G && G.anatomicalId ? G.anatomicalId : void 0, V = G && G.renderOrder ? G.renderOrder : void 0; j != null && (B = !!j); var ae = 0; Q != null && (ae = !!Q); var ue = _; if (te !== void 0) { if (te == "STL") ue = new p(); else if (te == "OBJ") return ue = new m(), ue.crossOrigin = "Anonymous", void ue.load(z, objloader(q, J, re, B, ae, Y, U, ee), this.onProgress(z), this.onError, G.loaderOptions); } if ($) { var de = _.parse(z); P(q, J, re, B, ae, Y, U, V, G, ee)(de.geometry, de.materials); } else ue.crossOrigin = "Anonymous", _.load(z, P(q, J, re, B, ae, Y, U, V, G, ee), this.onProgress(z), this.onError(ee), G.loaderOptions); }, C = function(q, z, j) { var Q = 0; return (Y) => { if (++Q, Y && z != null && typeof z == "function") { z(Y); var ee = y.getZincCameraControls(); ee && ee.calculateMaxAllowedDistance(y); } Q == q && (f == !1 && y.viewAll(), j != null && typeof j == "function" && j()); }; }; this.loadPointsetURL = (q, z, j, Q, Y, ee, G) => { var J = 0; this.toBeDownloaded += 1, j != null && (J = !!j); var re = 0; Q != null && (re = !!Q); var B = !!(G && G.isInline) && G.isInline, $ = G && G.anatomicalId ? G.anatomicalId : void 0, te = G && G.renderOrder ? G.renderOrder : void 0; if (B) { var U = _.parse(z); E(q, J, re, Y, $, te, ee)(U.geometry, U.materials); } else _.load(z, E(q, J, re, Y, $, te, ee), this.onProgress(z), this.onError(ee), G.loaderOptions); }; var R = (q, z, j, Q, Y, ee) => { var G = ee && ee.isInline ? ee.isInline : void 0, J = ee && ee.anatomicalId ? ee.anatomicalId : void 0, re = ee && ee.renderOrder ? ee.renderOrder : void 0, B = void 0; if (j) { if (z && j.images && j.images.source) for (var $, te = j.images.source, U = 0; U < te.length; U++) $ = u(te[U], z), j.images.source[U] = $; if (j.type === "slides" && (B = new (c(27)).TextureSlides()), B) { B.groupName = Q; var V = () => { --this.toBeDownloaded, Y != null && typeof Y == "function" && Y(B); }; ++this.toBeDownloaded, B.load(j, V, G), B.anatomicalId = J, B.setRenderOrder(re), q.addZincObject(B); } } }, L = (q, z, j, Q, Y) => () => { if (z.readyState == 4 && z.status == 200) { var ee = JSON.parse(z.responseText); R(q, z.responseURL, ee, j, Q, Y); } }; this.loadTextureURL = (q, z, j, Q, Y) => { var ee = !!(Y && Y.isInline) && Y.isInline; if (ee) R(q, void 0, z, j, Q, Y); else { var G = new XMLHttpRequest(); G.onreadystatechange = L(q, G, j, Q, Y), G.open("GET", h(z), !0), G.send(); } }, this.loadGlyphsetURL = (q, z, j, Q, Y, ee) => { var G = !!(ee && ee.isInline) && ee.isInline; if (G) w(q, z, j, Q, Y, ee); else { var J = new XMLHttpRequest(); J.onreadystatechange = b(q, J, j, Q, Y, ee), J.open("GET", h(z), !0), J.send(); } }; var A = (q, z, j, Q, Y, ee, G, J, re) => { var B = { colour: j, opacity: Q, localTimeEnabled: Y, localMorphColour: ee }, $ = new (c(3)).Geometry(); return $.createMesh(z, J, B), $.getMorph() ? ($.setName(re), q && q.addZincObject($), $.setDuration(y.getDuration()), $.videoHandler && y.setVideoHandler($.videoHandler), $) : void 0; }, P = (q, z, j, Q, Y, ee, G, J, re, B) => ($, te) => { var U; te && te[0] && (U = te[0]); var V = A(q, $, z, j, Q, Y, void 0, U, ee); if (V.anatomicalId = G, V.setRenderOrder(J), re.lod && re.lod.levels) for (var [ae, ue] of Object.entries(re.lod.levels)) V.addLOD(_, ae, ue.URL, ue.Index, re.lod.preload); --this.toBeDownloaded, $.dispose(), B != null && typeof B == "function" && B(V); }, O = (q) => { var z = /P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/, [, j, Q, Y, ee, G, J, re] = q.match(z); return { years: j, months: Q, weeks: Y, days: ee, hours: G, mins: J, secs: re }; }; this.loadSettings = (q) => { if (q) { if (q.Duration) { var z = O(q.Duration); y.setDurationFromObject(z); } if (q.OriginalDuration) { var j = O(q.OriginalDuration); y.setOriginalDurationFromObject(j); } if (q.TimeStamps) for (var Q in q.TimeStamps) { var Y = O(q.TimeStamps[Q]); y.addMetadataTimeStamp(Q, Y); } } }; var x = (q, z, j, Q, Y) => { if (j) { var ee = void 0, G = !1; j.URL ? (ee = j.URL, z && (ee = u(ee, z))) : j.Inline && (ee = j.Inline.URL, G = !0); var J = {}; if (j.LOD && j.LOD.Levels) { J.preload = !!j.LOD.Preload, J.levels = {}; for (var [re, B] of Object.entries(j.LOD.Levels)) J.levels[re] = {}, J.levels[re].URL = u(B.URL, z), J.levels[re].Index = B.Index; } var $ = j.GroupName; ($ === void 0 || $ === "") && ($ = "_Unnamed"); var te = { loaderOptions: { index: j.Index }, isInline: G, fileFormat: j.FileFormat, anatomicalId: j.AnatomicalId, compression: j.compression, lod: J, renderOrder: Q }; switch (j.Type) { case "Surfaces": S(q, ee, j.MorphVertices, j.MorphColours, $, Y, te); break; case "Glyph": var U; G ? U = j.Inline.GlyphGeometriesURL : (U = j.GlyphGeometriesURL, U = u(j.GlyphGeometriesURL, z)), j.DisplayLabels && (te.displayLabels = !0), this.loadGlyphsetURL(q, ee, U, $, Y, te); break; case "Points": this.loadPointsetURL(q, ee, j.MorphVertices, j.MorphColours, $, Y, te); break; case "Lines": this.loadLinesURL(q, ee, j.MorphVertices, j.MorphColours, $, Y, te); break; case "Texture": this.loadTextureURL(q, ee, $, Y, te); break; } } }, I = (q, z, j) => { if (z) { var Q = void 0, Y = !1; switch (z.URL ? (Q = z.URL, q && (Q = u(z.URL, q))) : z.Inline && (Q = z.Inline.URL, Y = !0), z.Type) { case "View": Y ? (y.setupMultipleViews("default", { default: Q }), f = !0, j != null && typeof j == "function" && j()) : this.loadViewURL(Q, j); break; case "Settings": this.loadSettings(z); break; } } }; this.loadGLTF = (q, z, j, Q, Y) => { var ee = new (c(39)).GLTFToZincJSLoader(); ee.load(y, q, z, j, Q, Y); }; var N = (q, z, j, Q) => { if (j.Primitives && j.Primitives.forEach((J) => { var re = 1; J.Order && (re = J.Order), x(q, z, J, re, Q); }), j.Transformation && q.setTransformation(j.Transformation), j.Children) for (var [Y, ee] of Object.entries(j.Children)) { var G = q.findOrCreateChildFromPath(Y); G && N(G, z, ee, Q); } }, D = (q, z) => { if (Array.isArray(q)) { for (var j = 0, Q = 0; Q < q.length; Q++) q[Q].Type && (z && q[Q].Type === "View" || q[Q].Type === "Surfaces" || q[Q].Type === "Glyph" || q[Q].Type === "Points" || q[Q].Type === "Lines" || q[Q].Type === "Texture") && j++; return j; } return 0; }, k = (q) => { var z = q.Primitives ? D(q.Primitives, !1) : 0; return q.Children && Object.values(q.Children).forEach((j) => { z += k(j); }), z; }, F = (q) => Array.isArray(q) ? D(q, !0) : typeof q == "object" && q !== null && q.Version === "2.0" ? k(q.Regions) : void 0, W = (q, z, j, Q, Y) => { var ee = q; j.RegionPath && j.RegionPath !== "" && (ee = q.findOrCreateChildFromPath(j.RegionPath)), x(ee, z, j, 2 * Q, Y); }, K = (q, z, j, Q, Y) => { for (var ee = F(z), G = new C(ee, Q, Y), J = 0; J < z.length; J++) I(j, z[J], G); for (var re = 0; re < z.length; re++) W(q, j, z[re], re, G); }, ne = (q, z, j, Q, Y) => { var ee = F(z), G = new C(ee, Q, Y); z.Settings && this.loadSettings(z.Settings), z.Views && M(j, z.Views), z.Regions && N(q, j, z.Regions, G); }; this.loadMetadataURL = (q, z, j, Q) => { var Y = new XMLHttpRequest(), ee = h(z); Y.onreadystatechange = () => { if (Y.readyState == 4 && Y.status == 200) { y.resetMetadata(), y.resetDuration(), f = !1; var G = Y.responseURL; G === void 0 && (G = new URL(ee).href); var J = JSON.parse(Y.responseText); Array.isArray(J) ? K(q, J, G, j, Q) : typeof J == "object" && J !== null && J.Version == "2.0" && ne(q, J, G, j, Q); } }, Y.open("GET", ee, !0), Y.send(); }; }; }, /* 36 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ STLLoader: () => ( /* binding */ h ) /* harmony export */ }); var l = c(4); class h extends l.Loader { constructor(p) { super(p); } load(p, m, g, d) { var y = this, f = new l.FileLoader(this.manager); f.setPath(this.path), f.setResponseType("arraybuffer"), f.setRequestHeader(this.requestHeader), f.setWithCredentials(this.withCredentials), f.load(p, function(v) { try { m(y.parse(v)); } catch (_) { d ? d(_) : console.error(_), y.manager.itemError(p); } }, g, d); } parse(p) { function m(d, y, f) { for (var v = 0, _ = d.length; v < _; v++) if (d[v] !== y.getUint8(f + v, !1)) return !1; return !0; } var g = function(d) { if (typeof d == "string") { for (var y = new Uint8Array(d.length), f = 0; f < d.length; f++) y[f] = 255 & d.charCodeAt(f); return y.buffer || y; } return d; }(p); return function(d) { var y = new DataView(d), f = y.getUint32(80, !0); if (84 + f * 50 === y.byteLength) return !0; for (var v = [115, 111, 108, 105, 100], _ = 0; 5 > _; _++) if (m(v, y, _)) return !1; return !0; }(g) ? function(d) { for (var y, f, v, _, M, T, w, b, E = new DataView(d), S = E.getUint32(80, !0), C = !1, R = 0; R < 70; R++) E.getUint32(R, !1) == 1129270351 && E.getUint8(R + 4) == 82 && E.getUint8(R + 5) == 61 && (C = !0, _ = new Float32Array(3 * (3 * S)), M = E.getUint8(R + 6) / 255, T = E.getUint8(R + 7) / 255, w = E.getUint8(R + 8) / 255, b = E.getUint8(R + 9) / 255); for (var L = new l.BufferGeometry(), A = new Float32Array(3 * (3 * S)), P = new Float32Array(3 * (3 * S)), O = 0; O < S; O++) { var x = 84 + O * 50, I = E.getFloat32(x, !0), N = E.getFloat32(x + 4, !0), D = E.getFloat32(x + 8, !0); if (C) { var k = E.getUint16(x + 48, !0); 32768 & k ? (y = M, f = T, v = w) : (y = (31 & k) / 31, f = (31 & k >> 5) / 31, v = (31 & k >> 10) / 31); } for (var F = 1; 3 >= F; F++) { var W = x + 12 * F, K = 3 * (3 * O) + 3 * (F - 1); A[K] = E.getFloat32(W, !0), A[K + 1] = E.getFloat32(W + 4, !0), A[K + 2] = E.getFloat32(W + 8, !0), P[K] = I, P[K + 1] = N, P[K + 2] = D, C && (_[K] = y, _[K + 1] = f, _[K + 2] = v); } } return L.setAttribute("position", new l.BufferAttribute(A, 3)), L.setAttribute("normal", new l.BufferAttribute(P, 3)), C && (L.setAttribute("color", new l.BufferAttribute(_, 3)), L.hasColors = !0, L.alpha = b), L; }(g) : function(d) { for (var y, f = new l.BufferGeometry(), v = /solid([\s\S]*?)endsolid/g, _ = /facet([\s\S]*?)endfacet/g, M = 0, T = /[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source, w = new RegExp("vertex" + T + T + T, "g"), b = new RegExp("normal" + T + T + T, "g"), E = [], S = [], C = new l.Vector3(), R = 0, L = 0, A = 0; (y = v.exec(d)) !== null; ) { L = A; for (var P = y[0]; (y = _.exec(P)) !== null; ) { for (var O = 0, x = 0, I = y[0]; (y = b.exec(I)) !== null; ) C.x = parseFloat(y[1]), C.y = parseFloat(y[2]), C.z = parseFloat(y[3]), x++; for (; (y = w.exec(I)) !== null; ) E.push(parseFloat(y[1]), parseFloat(y[2]), parseFloat(y[3])), S.push(C.x, C.y, C.z), O++, A++; x !== 1 && console.error("THREE.STLLoader: Something isn't right with the normal of face number " + M), O !== 3 && console.error("THREE.STLLoader: Something isn't right with the vertices of face number " + M), M++; } var N = L, D = A - L; f.addGroup(N, D, R), R++; } return f.setAttribute("position", new l.Float32BufferAttribute(E, 3)), f.setAttribute("normal", new l.Float32BufferAttribute(S, 3)), f; }(function(d) { return typeof d == "string" ? d : l.LoaderUtils.decodeText(new Uint8Array(d)); }(p)); } } }, /* 37 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ OBJLoader: () => ( /* binding */ M ) /* harmony export */ }); var l = c(4), h = /^[og]\s*(.+)?/, u = /^mtllib /, p = /^usemtl /, m = /^usemap /, g = new l.Vector3(), d = new l.Vector3(), y = new l.Vector3(), f = new l.Vector3(), v = new l.Vector3(); function _() { var T = { objects: [], object: {}, vertices: [], normals: [], colors: [], uvs: [], materials: {}, materialLibraries: [], startObject: function(w, b) { if (this.object && this.object.fromDeclaration === !1) return this.object.name = w, void (this.object.fromDeclaration = b !== !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: w || "", fromDeclaration: b !== !1, geometry: { vertices: [], normals: [], colors: [], uvs: [], hasUVIndices: !1 }, materials: [], smooth: !0, startMaterial: function(C, R) { var L = this._finalize(!1); L && (L.inherited || 0 >= L.groupCount) && this.materials.splice(L.index, 1); var A = { index: this.materials.length, name: C || "", mtllib: Array.isArray(R) && 0 < R.length ? R[R.length - 1] : "", smooth: L === void 0 ? this.smooth : L.smooth, groupStart: L === void 0 ? 0 : L.groupEnd, groupEnd: -1, groupCount: -1, inherited: !1, clone: function(P) { var O = { index: typeof P == "number" ? P : this.index, name: this.name, mtllib: this.mtllib, smooth: this.smooth, groupStart: 0, groupEnd: -1, groupCount: -1, inherited: !1 }; return O.clone = this.clone.bind(O), O; } }; return this.materials.push(A), A; }, currentMaterial: function() { return 0 < this.materials.length ? this.materials[this.materials.length - 1] : void 0; }, _finalize: function(C) { var R = this.currentMaterial(); if (R && R.groupEnd === -1 && (R.groupEnd = this.geometry.vertices.length / 3, R.groupCount = R.groupEnd - R.groupStart, R.inherited = !1), C && 1 < this.materials.length) for (var L = this.materials.length - 1; 0 <= L; L--) 0 >= this.materials[L].groupCount && this.materials.splice(L, 1); return C && this.materials.length === 0 && this.materials.push({ name: "", smooth: this.smooth }), R; } }, E && E.name && typeof E.clone == "function") { var S = E.clone(0); S.inherited = !0, this.object.materials.push(S); } this.objects.push(this.object); }, finalize: function() { this.object && typeof this.object._finalize == "function" && this.object._finalize(!0); }, parseVertexIndex: function(w, b) { var E = parseInt(w, 10); return 3 * (0 <= E ? E - 1 : E + b / 3); }, parseNormalIndex: function(w, b) { var E = parseInt(w, 10); return 3 * (0 <= E ? E - 1 : E + b / 3); }, parseUVIndex: function(w, b) { var E = parseInt(w, 10); return 2 * (0 <= E ? E - 1 : E + b / 2); }, addVertex: function(w, b, E) { var S = this.vertices, C = this.object.geometry.vertices; C.push(S[w + 0], S[w + 1], S[w + 2]), C.push(S[b + 0], S[b + 1], S[b + 2]), C.push(S[E + 0], S[E + 1], S[E + 2]); }, addVertexPoint: function(w) { var b = this.vertices, E = this.object.geometry.vertices; E.push(b[w + 0], b[w + 1], b[w + 2]); }, addVertexLine: function(w) { var b = this.vertices, E = this.object.geometry.vertices; E.push(b[w + 0], b[w + 1], b[w + 2]); }, addNormal: function(w, b, E) { var S = this.normals, C = this.object.geometry.normals; C.push(S[w + 0], S[w + 1], S[w + 2]), C.push(S[b + 0], S[b + 1], S[b + 2]), C.push(S[E + 0], S[E + 1], S[E + 2]); }, addFaceNormal: function(w, b, E) { var S = this.vertices, C = this.object.geometry.normals; g.fromArray(S, w), d.fromArray(S, b), y.fromArray(S, E), v.subVectors(y, d), f.subVectors(g, d), v.cross(f), v.normalize(), C.push(v.x, v.y, v.z), C.push(v.x, v.y, v.z), C.push(v.x, v.y, v.z); }, addColor: function(w, b, E) { var S = this.colors, C = this.object.geometry.colors; S[w] !== void 0 && C.push(S[w + 0], S[w + 1], S[w + 2]), S[b] !== void 0 && C.push(S[b + 0], S[b + 1], S[b + 2]), S[E] !== void 0 && C.push(S[E + 0], S[E + 1], S[E + 2]); }, addUV: function(w, b, E) { var S = this.uvs, C = this.object.geometry.uvs; C.push(S[w + 0], S[w + 1]), C.push(S[b + 0], S[b + 1]), C.push(S[E + 0], S[E + 1]); }, addDefaultUV: function() { var w = this.object.geometry.uvs; w.push(0, 0), w.push(0, 0), w.push(0, 0); }, addUVLine: function(w) { var b = this.uvs, E = this.object.geometry.uvs; E.push(b[w + 0], b[w + 1]); }, addFace: function(w, b, E, S, C, R, L, A, P) { var O = this.vertices.length, x = this.parseVertexIndex(w, O), I = this.parseVertexIndex(b, O), N = this.parseVertexIndex(E, O); if (this.addVertex(x, I, N), this.addColor(x, I, N), L !== void 0 && L !== "") { var D = this.normals.length; x = this.parseNormalIndex(L, D), I = this.parseNormalIndex(A, D), N = this.parseNormalIndex(P, D), this.addNormal(x, I, N); } else this.addFaceNormal(x, I, N); if (S !== void 0 && S !== "") { var k = this.uvs.length; x = this.parseUVIndex(S, k), I = this.parseUVIndex(C, k), N = this.parseUVIndex(R, k), this.addUV(x, I, N), this.object.geometry.hasUVIndices = !0; } else this.addDefaultUV(); }, addPointGeometry: function(w) { this.object.geometry.type = "Points"; for (var b, E = this.vertices.length, S = 0, C = w.length; S < C; S++) b = this.parseVertexIndex(w[S], E), this.addVertexPoint(b), this.addColor(b); }, addLineGeometry: function(w, b) { this.object.geometry.type = "Line"; for (var E = this.vertices.length, S = this.uvs.length, C = 0, R = w.length; C < R; C++) this.addVertexLine(this.parseVertexIndex(w[C], E)); for (var L = 0, A = b.length; L < A; L++) this.addUVLine(this.parseUVIndex(b[L], S)); } }; return T.startObject("", !1), T; } class M extends l.Loader { constructor(w) { super(w), this.materials = null; } load(w, b, E, S) { var C = this, R = new l.FileLoader(this.manager); R.setPath(this.path), R.setRequestHeader(this.requestHeader), R.setWithCredentials(this.withCredentials), R.load(w, function(L) { try { b(C.parse(L)); } catch (A) { S ? S(A) : console.error(A), C.manager.itemError(w); } }, E, S); } setMaterials(w) { return this.materials = w, this; } parse(w) { var b = new _(); w.indexOf(`\r `) !== -1 && (w = w.replace(/\r\n/g, ` `)), w.indexOf(`\\ `) !== -1 && (w = w.replace(/\\\n/g, "")); for (var E = w.split(` `), S = "", C = "", R = 0, L = [], A = typeof "".trimLeft == "function", P = 0, O = E.length; P < O; P++) if (S = E[P], S = A ? S.trimLeft() : S.trim(), R = S.length, R !== 0 && (C = S.charAt(0), C !== "#")) if (C === "v") { var x = S.split(/\s+/); switch (x[0]) { case "v": b.vertices.push(parseFloat(x[1]), parseFloat(x[2]), parseFloat(x[3])), 7 <= x.length ? b.colors.push(parseFloat(x[4]), parseFloat(x[5]), parseFloat(x[6])) : b.colors.push(void 0, void 0, void 0); break; case "vn": b.normals.push(parseFloat(x[1]), parseFloat(x[2]), parseFloat(x[3])); break; case "vt": b.uvs.push(parseFloat(x[1]), parseFloat(x[2])); } } else if (C === "f") { for (var I, N = S.substr(1).trim(), D = N.split(/\s+/), k = [], F = 0, W = D.length; F < W; F++) if (I = D[F], 0 < I.length) { var K = I.split("/"); k.push(K); } for (var ne = k[0], q = 1, z = k.length - 1; q < z; q++) { var j = k[q], Q = k[q + 1]; b.addFace(ne[0], j[0], Q[0], ne[1], j[1], Q[1], ne[2], j[2], Q[2]); } } else if (C === "l") { var Y = S.substring(1).trim().split(" "), ee = [], G = []; if (S.indexOf("/") === -1) ee = Y; else for (var J, re = 0, B = Y.length; re < B; re++) J = Y[re].split("/"), J[0] !== "" && ee.push(J[0]), J[1] !== "" && G.push(J[1]); b.addLineGeometry(ee, G); } else if (C === "p") { var $ = S.substr(1).trim(), te = $.split(" "); b.addPointGeometry(te); } else if ((L = h.exec(S)) !== null) { var U = (" " + L[0].substr(1).trim()).substr(1); b.startObject(U); } else if (p.test(S)) b.object.startMaterial(S.substring(7).trim(), b.materialLibraries); else if (u.test(S)) b.materialLibraries.push(S.substring(7).trim()); else if (m.test(S)) console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'); else if (C === "s") { if (L = S.split(" "), 1 < L.length) { var V = L[1].trim().toLowerCase(); b.object.smooth = V !== "0" && V !== "off"; } else b.object.smooth = !0; var ae = b.object.currentMaterial(); ae && (ae.smooth = b.object.smooth); } else { if (S === "\0") continue; console.warn('THREE.OBJLoader: Unexpected line: "' + S + '"'); } b.finalize(); var ue = new l.Group(); ue.materialLibraries = [].concat(b.materialLibraries); var de = b.objects.length !== 1 || b.objects[0].geometry.vertices.length !== 0; if (de == !0) for (var ve = 0, ye = b.objects.length; ve < ye; ve++) { var le = b.objects[ve], Se = le.geometry, Te = le.materials, oe = Se.type === "Line", Me = Se.type === "Points", ge = !1; if (Se.vertices.length !== 0) { var xe = new l.BufferGeometry(); xe.setAttribute("position", new l.Float32BufferAttribute(Se.vertices, 3)), 0 < Se.normals.length && xe.setAttribute("normal", new l.Float32BufferAttribute(Se.normals, 3)), 0 < Se.colors.length && (ge = !0, xe.setAttribute("color", new l.Float32BufferAttribute(Se.colors, 3))), Se.hasUVIndices === !0 && xe.setAttribute("uv", new l.Float32BufferAttribute(Se.uvs, 2)); for (var Oe = [], ut = 0, mt = Te.length; ut < mt; ut++) { var ze = Te[ut], bt = ze.name + "_" + ze.smooth + "_" + ge, Ue = b.materials[bt]; if (this.materials !== null) { if (Ue = this.materials.create(ze.name), oe && Ue && !(Ue instanceof l.LineBasicMaterial)) { var st = new l.LineBasicMaterial(); l.Material.prototype.copy.call(st, Ue), st.color.copy(Ue.color), Ue = st; } else if (Me && Ue && !(Ue instanceof l.PointsMaterial)) { var et = new l.PointsMaterial({ size: 10, sizeAttenuation: !1 }); l.Material.prototype.copy.call(et, Ue), et.color.copy(Ue.color), et.map = Ue.map, Ue = et; } } Ue === void 0 && (Ue = oe ? new l.LineBasicMaterial() : Me ? new l.PointsMaterial({ size: 1, sizeAttenuation: !1 }) : new l.MeshPhongMaterial(), Ue.name = ze.name, Ue.flatShading = !ze.smooth, Ue.vertexColors = ge, b.materials[bt] = Ue), Oe.push(Ue); } var xt = void 0; if (1 < Oe.length) { for (var ft, Ut = 0, Nt = Te.length; Ut < Nt; Ut++) ft = Te[Ut], xe.addGroup(ft.groupStart, ft.groupCount, Ut); xt = oe ? new l.LineSegments(xe, Oe) : Me ? new l.Points(xe, Oe) : new l.Mesh(xe, Oe); } else xt = oe ? new l.LineSegments(xe, Oe[0]) : Me ? new l.Points(xe, Oe[0]) : new l.Mesh(xe, Oe[0]); xt.name = le.name, ue.add(xt); } } else if (0 < b.vertices.length) { var ie = new l.PointsMaterial({ size: 1, sizeAttenuation: !1 }), Ee = new l.BufferGeometry(); Ee.setAttribute("position", new l.Float32BufferAttribute(b.vertices, 3)), 0 < b.colors.length && b.colors[0] !== void 0 && (Ee.setAttribute("color", new l.Float32BufferAttribute(b.colors, 3)), ie.vertexColors = !0); var Ne = new l.Points(Ee, ie); ue.add(Ne); } return ue; } } }, /* 38 */ /***/ (a, s, c) => { function l(M, T) { var w = Object.keys(M); if (Object.getOwnPropertySymbols) { var b = Object.getOwnPropertySymbols(M); T && (b = b.filter(function(E) { return Object.getOwnPropertyDescriptor(M, E).enumerable; })), w.push.apply(w, b); } return w; } function h(M) { for (var T, w = 1; w < arguments.length; w++) T = arguments[w] == null ? {} : arguments[w], w % 2 ? l(Object(T), !0).forEach(function(b) { u(M, b, T[b]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(M, Object.getOwnPropertyDescriptors(T)) : l(Object(T)).forEach(function(b) { Object.defineProperty(M, b, Object.getOwnPropertyDescriptor(T, b)); }); return M; } function u(M, T, w) { return T = p(T), T in M ? Object.defineProperty(M, T, { value: w, enumerable: !0, configurable: !0, writable: !0 }) : M[T] = w, M; } function p(M) { var T = m(M, "string"); return typeof T == "symbol" ? T : T + ""; } function m(M, T) { if (typeof M != "object" || !M) return M; var w = M[Symbol.toPrimitive]; if (w !== void 0) { var b = w.call(M, T || "default"); if (typeof b != "object") return b; throw new TypeError("@@toPrimitive must return a primitive value."); } return (T === "string" ? String : Number)(M); } var g = c(19).JSONLoader, d = c(4), y = d.FileLoader, f = (M) => { var T = (b, E) => { b.merge(E); }; if (M && 0 < M.length) { for (; 1 < M.length; ) { var w = M.splice(1, 1); T(M[0], w[0]); } return M[0]; } }, v = function(M, T, w) { var b = new y(), E = new g(); b.crossOrigin = T; var S = M, C = w, R = void 0, L = !1, A = !1, P = void 0, O = [], x = (k) => { var F = R[k.index]; if (F) { var W = E.parse(F); k.onLoad(W.geometry, W.materials); } else I(k); }, I = (k) => { k.onError && (!P && (P = { responseURL: S }), k.onError(P)); }; this.downloadCompleted = (k) => { try { R = JSON.parse(k[0]), L = !1, A = !0, Array.isArray(R) ? O.forEach((F) => x(F)) : O.forEach((F) => I(F)); } catch { O.forEach((F) => I(F)); } }; var N = () => (k) => { P = k, A = !0, L = !1, O.forEach((F) => { I(F); }); }, D = () => (k) => { O.forEach((F) => { F.onProgress && F.onProgress(k); }); }; this.load = (k, F, W, K) => { var ne = { index: k, onLoad: F, onProgress: W, onError: K }; A ? R ? x(ne) : I(P) : L ? O.push(ne) : (O.push(ne), L = !0, b.load(S, C, D, N)); }; }, _ = function(M, T) { var w = [], b = M, E = T, S = 0; this.itemDownloaded = (C, R) => { if (w[C] = R, S++, S == b) { for (var L = w[0][1], A = w.map((x) => x[0]), P = f(A), O = 1; O < b; O++) w[C][0].dispose(), w[C][1].forEach((x) => x.dispose()); E(P, L); } }; }; s.PrimitivesLoader = function() { var M = 0, T = 20; this.crossOrigin = "Anonymous"; var w = new g(), b = [], E = {}, S = (A, P, O, x, I) => { var N = A.length, D = new _(N, P), k = 0; A.forEach((F) => { var W = I ? h({}, I) : {}; W.msHandler = D, W.order = k, k++, R(F, P, O, x, W); }); }, C = (A, P, O, x, I) => { var N = I ? h({}, I) : {}, D = E[A]; if (!D) if (T > M) { var k = new L(void 0, this, N); ++M, D = new v(A, this.crossOrigin, k), E[A] = D; } else b.push({ url: A, onLoad: P, onProgress: O, onError: x, options: I }); D && (N.isHandler = D, D.load(I.index, P, O, x)); }, R = (A, P, O, x, I) => { if (I && I.index !== void 0) C(A, P, O, x, I); else if (T > M) { ++M; var N = new L(P, this, I), D = new L(x, this, I); w.crossOrigin = this.crossOrigin, w.load(A, N, O, D); } else b.push({ url: A, onLoad: P, onProgress: O, onError: x, options: I }); }; this.load = (A, P, O, x, I) => { Array.isArray(A) ? S(A, P, O, x, I) : R(A, P, O, x, I); }, this.loadFromWaitingList = () => { for (; T > M; ) { var A = b.shift(); if (A) this.load(A.url, A.onLoad, A.onProgress, A.onError, A.options); else return; } }, this.itemRemainingCheck = () => { if (b.length === 0 && M == 0) for (var A in E) E.hasOwnProperty(A) && delete E[A]; }; var L = function(A, P, O) { return function() { --M; for (var x = arguments.length, I = Array(x), N = 0; N < x; N++) I[N] = arguments[N]; O != null && O.msHandler ? O.msHandler.itemDownloaded(O.order, I) : O != null && O.isHandler ? O.isHandler.downloadCompleted(I) : A && A(...I), P.loadFromWaitingList(), P.itemRemainingCheck(); }; }; this.parse = (A) => w.parse(A); }; }, /* 39 */ /***/ (a, s, c) => { c(4); var l = c(40).GLTFLoader, h = function() { var u = this; this.parseGLTFObjects = (p, m, g, d) => { var y = m; if (g !== 0) { if (p.type !== "Object3D") { var f; if (p.type === "Mesh" ? f = new (c(3)).Geometry() : p.type === "LineSegments" ? f = new (c(24)).Lines() : p.type === "Points" && (f = new (c(22)).Pointset()), f) { var v = !1, _ = !1; p.geometry && p.geometry.morphAttributes && (v = !!p.geometry.morphAttributes.position, _ = !!p.geometry.morphAttributes.color), f.setMesh(p.clone(), v, _); var M = f.getMorph(); f.groupName = M.name, M.matrixAutoUpdate = !0, m.addZincObject(f), d != null && typeof d == "function" && d(f); } } else if (p.name !== "" && (m && (y = m.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; } } g++, p.children.forEach((w) => { u.parseGLTFObjects(w, y, g, d); }); }, this.setCamera = (p) => { p.viewAll(); var m = p.getZincCameraControls(), g = m.getCurrentViewport(); m.addViewport("default", g), m.setDefaultViewport("default"); }, this.load = (p, m, g, d, y) => { var f = g.substring(0, g.lastIndexOf("/") + 1), v = g.substring(g.lastIndexOf("/") + 1, g.length), _ = new l().setPath(f); _.load(v, function(M) { console.log(M), u.parseGLTFObjects(M.scene, m, 0, d), u.setCamera(p), y != null && typeof y == "function" && y(); }); }; }; s.GLTFToZincJSLoader = h; }, /* 40 */ /***/ (a) => { a.exports = L4; }, /* 41 */ /***/ (a, s, c) => { var l = c(42).GLTFExporter, h = function(u) { var p = u; this.exportGLTF = (m) => { var g = p.getRootRegion(), d = g.getAllObjects(!0), y = []; d.forEach((_) => { _.animationClip && y.push({ clip: _.animationClip[0], mesh: _.getMorph() }); }); var f = new l(), v = { binary: m, animations: y }; return new Promise((_) => { f.parse(p.getThreeJSScene(), function(M) { _(M); }, v); }); }; }; s.SceneExporter = h; }, /* 42 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ GLTFExporter: () => ( /* binding */ h ) /* harmony export */ }); var l = c(4); class h { constructor() { this.pluginCallbacks = [], this.register(function(x) { return new L(x); }), this.register(function(x) { return new A(x); }), this.register(function(x) { return new P(x); }); } register(x) { return this.pluginCallbacks.indexOf(x) === -1 && this.pluginCallbacks.push(x), this; } unregister(x) { return this.pluginCallbacks.indexOf(x) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(x), 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(x, I, N) { for (var D = new R(), k = [], F = 0, W = this.pluginCallbacks.length; F < W; F++) k.push(this.pluginCallbacks[F](D)); D.setPlugins(k), D.write(x, I, N); } } var u = { 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] = u.NEAREST, p[l.NearestMipmapNearestFilter] = u.NEAREST_MIPMAP_NEAREST, p[l.NearestMipmapLinearFilter] = u.NEAREST_MIPMAP_LINEAR, p[l.LinearFilter] = u.LINEAR, p[l.LinearMipmapNearestFilter] = u.LINEAR_MIPMAP_NEAREST, p[l.LinearMipmapLinearFilter] = u.LINEAR_MIPMAP_LINEAR, p[l.ClampToEdgeWrapping] = u.CLAMP_TO_EDGE, p[l.RepeatWrapping] = u.REPEAT, p[l.MirroredRepeatWrapping] = u.MIRRORED_REPEAT; var m = { scale: "scale", position: "translation", quaternion: "rotation", morphTargetInfluences: "weights" }, g = 12, d = 1179937895, y = 2, f = 8, v = 1313821514, _ = 5130562; function M(O, x) { return O.length === x.length && O.every(function(I, N) { return I === x[N]; }); } function T(O) { if (window.TextEncoder !== void 0) return new TextEncoder().encode(O).buffer; for (var x, I = new Uint8Array(new ArrayBuffer(O.length)), N = 0, D = O.length; N < D; N++) x = O.charCodeAt(N), I[N] = 255 < x ? 32 : x; return I.buffer; } function w(O) { return M(O.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); } function b(O, x, I) { for (var N = { min: Array(O.itemSize).fill(Number.POSITIVE_INFINITY), max: Array(O.itemSize).fill(Number.NEGATIVE_INFINITY) }, D = x; D < x + I; D++) for (var k, F = 0; F < O.itemSize; F++) k = void 0, 4 < O.itemSize ? k = O.array[D * O.itemSize + F] : F === 0 ? k = O.getX(D) : F === 1 ? k = O.getY(D) : F === 2 ? k = O.getZ(D) : F == 3 && (k = O.getW(D)), N.min[F] = Math.min(N.min[F], k), N.max[F] = Math.max(N.max[F], k); return N; } function E(O) { return 4 * Math.ceil(O / 4); } function S(O) { var x = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : 0, I = E(O.byteLength); if (I !== O.byteLength) { var N = new Uint8Array(I); if (N.set(new Uint8Array(O)), x !== 0) for (var D = O.byteLength; D < I; D++) N[D] = x; return N.buffer; } return O; } var C = 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(x) { this.plugins = x; } /** * 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(x, I, 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(x); var D = this; Promise.all(this.pending).then(function() { var k = D.buffers, F = D.json, W = D.options, K = D.extensionsUsed, ne = new Blob(k, { type: "application/octet-stream" }), q = Object.keys(K); if (0 < q.length && (F.extensionsUsed = q), F.buffers && 0 < F.buffers.length && (F.buffers[0].byteLength = ne.size), W.binary === !0) { var z = new window.FileReader(); z.readAsArrayBuffer(ne), z.onloadend = function() { var Q = S(z.result), Y = new DataView(new ArrayBuffer(f)); Y.setUint32(0, Q.byteLength, !0), Y.setUint32(4, _, !0); var ee = S(T(JSON.stringify(F)), 32), G = new DataView(new ArrayBuffer(f)); G.setUint32(0, ee.byteLength, !0), G.setUint32(4, v, !0); var J = new ArrayBuffer(g), re = new DataView(J); re.setUint32(0, d, !0), re.setUint32(4, y, !0); var B = g + G.byteLength + ee.byteLength + Y.byteLength + Q.byteLength; re.setUint32(8, B, !0); var $ = new Blob([J, G, ee, Y, Q], { type: "application/octet-stream" }), te = new window.FileReader(); te.readAsArrayBuffer($), te.onloadend = function() { I(te.result); }; }; } else if (F.buffers && 0 < F.buffers.length) { var j = new window.FileReader(); j.readAsDataURL(ne), j.onloadend = function() { var Q = j.result; F.buffers[0].uri = Q, I(F); }; } else I(F); }); } /** * Serializes a userData. * * @param {THREE.Object3D|THREE.Material} object * @param {Object} objectDef */ serializeUserData(x, I) { if (!(x.userData && x.userData.isZincObject) && Object.keys(x.userData).length !== 0) { var N = this.options, D = this.extensionsUsed; try { var k = JSON.parse(JSON.stringify(x.userData)); if (N.includeCustomExtensions && k.gltfExtensions) { for (var F in I.extensions === void 0 && (I.extensions = {}), k.gltfExtensions) I.extensions[F] = k.gltfExtensions[F], D[F] = !0; delete k.gltfExtensions; } 0 < Object.keys(k).length && (I.extras = k); } catch (W) { console.warn("THREE.GLTFExporter: userData of '" + x.name + "' won't be serialized because of JSON.stringify error - " + W.message); } } } /** * Assign and return a temporal unique id for an object * especially which doesn't have .uuid * @param {Object} object * @return {Integer} */ getUID(x) { return this.uids.has(x) || this.uids.set(x, this.uid++), this.uids.get(x); } /** * Checks if normal attribute values are normalized. * * @param {BufferAttribute} normal * @returns {Boolean} */ isNormalizedNormalAttribute(x) { var I = this.cache; if (I.attributesNormalized.has(x)) return !1; for (var N = new l.Vector3(), D = 0, k = x.count; D < k; D++) if (5e-4 < Math.abs(N.fromBufferAttribute(x, D).length() - 1)) return !1; return !0; } /** * Creates normalized normal buffer attribute. * * @param {BufferAttribute} normal * @returns {BufferAttribute} * */ createNormalizedNormalAttribute(x) { var I = this.cache; if (I.attributesNormalized.has(x)) return I.attributesNormalized.get(x); for (var N = x.clone(), D = new l.Vector3(), k = 0, F = N.count; k < F; k++) D.fromBufferAttribute(N, k), D.x === 0 && D.y === 0 && D.z === 0 ? D.setX(1) : D.normalize(), N.setXYZ(k, D.x, D.y, D.z); return I.attributesNormalized.set(x, 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(x, I) { var N = !1, D = {}; (I.offset.x !== 0 || I.offset.y !== 0) && (D.offset = I.offset.toArray(), N = !0), I.rotation !== 0 && (D.rotation = I.rotation, N = !0), (I.repeat.x !== 1 || I.repeat.y !== 1) && (D.scale = I.repeat.toArray(), N = !0), N && (x.extensions = x.extensions || {}, x.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(x) { var I = this.json, N = this.buffers; return I.buffers || (I.buffers = [{ byteLength: 0 }]), N.push(x), 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(x, I, N, D, k) { var F = this.json; F.bufferViews || (F.bufferViews = []); for (var W = I === u.UNSIGNED_BYTE ? 1 : I === u.UNSIGNED_SHORT ? 2 : 4, K = E(D * x.itemSize * W), ne = new DataView(new ArrayBuffer(K)), q = 0, z = N; z < N + D; z++) for (var j, Q = 0; Q < x.itemSize; Q++) j = void 0, 4 < x.itemSize ? j = x.array[z * x.itemSize + Q] : Q === 0 ? j = x.getX(z) : Q === 1 ? j = x.getY(z) : Q === 2 ? j = x.getZ(z) : Q == 3 && (j = x.getW(z)), I === u.FLOAT ? ne.setFloat32(q, j, !0) : I === u.UNSIGNED_INT ? ne.setUint32(q, j, !0) : I === u.UNSIGNED_SHORT ? ne.setUint16(q, j, !0) : I === u.UNSIGNED_BYTE && ne.setUint8(q, j), q += W; var Y = { buffer: this.processBuffer(ne.buffer), byteOffset: this.byteOffset, byteLength: K }; k !== void 0 && (Y.target = k), k === u.ARRAY_BUFFER && (Y.byteStride = x.itemSize * W), this.byteOffset += K, F.bufferViews.push(Y); var ee = { id: F.bufferViews.length - 1, byteLength: 0 }; return ee; } /** * Process and generate a BufferView from an image Blob. * @param {Blob} blob * @return {Promise} */ processBufferViewImage(x) { var I = this, N = I.json; return N.bufferViews || (N.bufferViews = []), new Promise(function(D) { var k = new window.FileReader(); k.readAsArrayBuffer(x), k.onloadend = function() { var F = S(k.result), W = { buffer: I.processBuffer(F), byteOffset: I.byteOffset, byteLength: F.byteLength }; I.byteOffset += F.byteLength, D(N.bufferViews.push(W) - 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(x, I, N, D) { var k, F = this.options, W = this.json; if (x.array.constructor === Float32Array) k = u.FLOAT; else if (x.array.constructor === Uint32Array) k = u.UNSIGNED_INT; else if (x.array.constructor === Uint16Array) k = u.UNSIGNED_SHORT; else if (x.array.constructor === Uint8Array) k = u.UNSIGNED_BYTE; else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type."); if (N === void 0 && (N = 0), D === void 0 && (D = x.count), F.truncateDrawRange && I !== void 0 && I.index === null) { var K = N + D, ne = I.drawRange.count === 1 / 0 ? x.count : I.drawRange.start + I.drawRange.count; N = Math.max(N, I.drawRange.start), D = Math.min(K, ne) - N, 0 > D && (D = 0); } if (D === 0) return null; var q, z = b(x, N, D); I !== void 0 && (q = x === I.index ? u.ELEMENT_ARRAY_BUFFER : u.ARRAY_BUFFER); var j = this.processBufferView(x, k, N, D, q), Q = { bufferView: j.id, byteOffset: j.byteOffset, componentType: k, count: D, max: z.max, min: z.min, type: { 1: "SCALAR", 2: "VEC2", 3: "VEC3", 4: "VEC4", 16: "MAT4" }[x.itemSize] }; return x.normalized === !0 && (Q.normalized = !0), W.accessors || (W.accessors = []), W.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(x, I, N) { var D = this, k = D.cache, F = D.json, W = D.options, K = D.pending; k.images.has(x) || k.images.set(x, {}); var ne = k.images.get(x), q = I === l.RGBAFormat ? "image/png" : "image/jpeg", z = q + ":flipY/" + N.toString(); if (ne[z] !== void 0) return ne[z]; F.images || (F.images = []); var j = { mimeType: q }; if (W.embedImages) { var Q = C = C || document.createElement("canvas"); Q.width = Math.min(x.width, W.maxTextureSize), Q.height = Math.min(x.height, W.maxTextureSize); var Y = Q.getContext("2d"); if (N === !0 && (Y.translate(0, Q.height), Y.scale(1, -1)), typeof HTMLImageElement < "u" && x instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && x instanceof HTMLCanvasElement || typeof OffscreenCanvas < "u" && x instanceof OffscreenCanvas || typeof ImageBitmap < "u" && x instanceof ImageBitmap) Y.drawImage(x, 0, 0, Q.width, Q.height); else { I !== l.RGBAFormat && I !== l.RGBFormat && console.error("GLTFExporter: Only RGB and RGBA formats are supported."), (x.width > W.maxTextureSize || x.height > W.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", x); var ee = new Uint8ClampedArray(4 * (x.height * x.width)); if (I === l.RGBAFormat) for (var G = 0; G < ee.length; G += 4) ee[G + 0] = x.data[G + 0], ee[G + 1] = x.data[G + 1], ee[G + 2] = x.data[G + 2], ee[G + 3] = x.data[G + 3]; else for (var J = 0, re = 0; J < ee.length; J += 4, re += 3) ee[J + 0] = x.data[re + 0], ee[J + 1] = x.data[re + 1], ee[J + 2] = x.data[re + 2], ee[J + 3] = 255; Y.putImageData(new ImageData(ee, x.width, x.height), 0, 0); } W.binary === !0 ? K.push(new Promise(function($) { Q.toBlob(function(te) { D.processBufferViewImage(te).then(function(U) { j.bufferView = U, $(); }); }, q); })) : j.uri = Q.toDataURL(q); } else j.uri = x.src; var B = F.images.push(j) - 1; return ne[z] = B, B; } /** * Process sampler * @param {Texture} map Texture to process * @return {Integer} Index of the processed texture in the "samplers" array */ processSampler(x) { var I = this.json; I.samplers || (I.samplers = []); var N = { magFilter: p[x.magFilter], minFilter: p[x.minFilter], wrapS: p[x.wrapS], wrapT: p[x.wrapT] }; return I.samplers.push(N) - 1; } /** * Process texture * @param {Texture} map Map to process * @return {Integer} Index of the processed texture in the "textures" array */ processTexture(x) { var I = this.cache, N = this.json; if (I.textures.has(x)) return I.textures.get(x); N.textures || (N.textures = []); var D = { sampler: this.processSampler(x), source: this.processImage(x.image, x.format, x.flipY) }; x.name && (D.name = x.name), this._invokeAll(function(F) { F.writeTexture && F.writeTexture(x, D); }); var k = N.textures.push(D) - 1; return I.textures.set(x, k), k; } /** * Process material * @param {THREE.Material} material Material to process * @return {Integer|null} Index of the processed material in the "materials" array */ processMaterial(x) { var I = this.cache, N = this.json; if (I.materials.has(x)) return I.materials.get(x); if (x.isShaderMaterial) return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."), null; N.materials || (N.materials = []); var D = { pbrMetallicRoughness: {} }; x.isMeshStandardMaterial !== !0 && x.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."); var k = x.color.toArray().concat([x.opacity]); if (M(k, [1, 1, 1, 1]) || (D.pbrMetallicRoughness.baseColorFactor = k), x.isMeshStandardMaterial ? (D.pbrMetallicRoughness.metallicFactor = x.metalness, D.pbrMetallicRoughness.roughnessFactor = x.roughness) : (D.pbrMetallicRoughness.metallicFactor = 0.5, D.pbrMetallicRoughness.roughnessFactor = 0.5), x.metalnessMap || x.roughnessMap) if (x.metalnessMap === x.roughnessMap) { var F = { index: this.processTexture(x.metalnessMap) }; this.applyTextureTransform(F, x.metalnessMap), D.pbrMetallicRoughness.metallicRoughnessTexture = F; } else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture."); if (x.map) { var W = { index: this.processTexture(x.map) }; this.applyTextureTransform(W, x.map), D.pbrMetallicRoughness.baseColorTexture = W; } if (x.emissive) { var K = x.emissive.clone().multiplyScalar(x.emissiveIntensity), ne = Math.max(K.r, K.g, K.b); if (1 < ne && (K.multiplyScalar(1 / ne), console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")), 0 < ne && (D.emissiveFactor = K.toArray()), x.emissiveMap) { var q = { index: this.processTexture(x.emissiveMap) }; this.applyTextureTransform(q, x.emissiveMap), D.emissiveTexture = q; } } if (x.normalMap) { var z = { index: this.processTexture(x.normalMap) }; x.normalScale && x.normalScale.x !== -1 && (x.normalScale.x !== x.normalScale.y && console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."), z.scale = x.normalScale.x), this.applyTextureTransform(z, x.normalMap), D.normalTexture = z; } if (x.aoMap) { var j = { index: this.processTexture(x.aoMap), texCoord: 1 }; x.aoMapIntensity !== 1 && (j.strength = x.aoMapIntensity), this.applyTextureTransform(j, x.aoMap), D.occlusionTexture = j; } x.transparent ? D.alphaMode = "BLEND" : 0 < x.alphaTest && (D.alphaMode = "MASK", D.alphaCutoff = x.alphaTest), x.side === l.DoubleSide && (D.doubleSided = !0), x.name !== "" && (D.name = x.name), this.serializeUserData(x, D), this._invokeAll(function(Y) { Y.writeMaterial && Y.writeMaterial(x, D); }); var Q = N.materials.push(D) - 1; return I.materials.set(x, Q), Q; } /** * Process mesh * @param {THREE.Mesh} mesh Mesh to process * @return {Integer|null} Index of the processed mesh in the "meshes" array */ processMesh(x) { var I = this.cache, N = this.json, D = [x.geometry.uuid]; if (Array.isArray(x.material)) for (var k = 0, F = x.material.length; k < F; k++) D.push(x.material[k].uuid); else D.push(x.material.uuid); var W = D.join(":"); if (I.meshes.has(W)) return I.meshes.get(W); var K, ne = x.geometry; if (K = x.isLineSegments ? u.LINES : x.isLineLoop ? u.LINE_LOOP : x.isLine ? u.LINE_STRIP : x.isPoints ? u.POINTS : x.material.wireframe ? u.LINES : u.TRIANGLES, ne.isBufferGeometry !== !0) throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry."); var q = {}, z = {}, j = [], Q = [], Y = { uv: "TEXCOORD_0", uv2: "TEXCOORD_1", color: "COLOR_0", skinWeight: "WEIGHTS_0", skinIndex: "JOINTS_0" }, ee = ne.getAttribute("normal"); ee === void 0 || this.isNormalizedNormalAttribute(ee) || (console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."), ne.setAttribute("normal", this.createNormalizedNormalAttribute(ee))); var G = null; for (var J in ne.attributes) if (J.substr(0, 5) !== "morph") { var re = ne.attributes[J]; J = Y[J] || J.toUpperCase(); var B = /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/; if (B.test(J) || (J = "_" + J), I.attributes.has(this.getUID(re))) { z[J] = I.attributes.get(this.getUID(re)); continue; } G = null; var $ = re.array; J !== "JOINTS_0" || $ instanceof Uint16Array || $ instanceof Uint8Array || (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), G = new l.BufferAttribute(new Uint16Array($), re.itemSize, re.normalized)); var te = this.processAccessor(G || re, ne); te !== null && (z[J] = te, I.attributes.set(this.getUID(re), te)); } if (ee !== void 0 && ne.setAttribute("normal", ee), Object.keys(z).length === 0) return null; if (x.morphTargetInfluences !== void 0 && 0 < x.morphTargetInfluences.length) { var U = [], V = [], ae = {}; if (x.morphTargetDictionary !== void 0) for (var ue in x.morphTargetDictionary) ae[x.morphTargetDictionary[ue]] = ue; for (var de = 0; de < x.morphTargetInfluences.length; ++de) { var ve = {}, ye = !1; for (var le in ne.morphAttributes) { if (le != "position" && le !== "normal" && le !== "color") { ye || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), ye = !0); continue; } var Se = ne.morphAttributes[le][de], Te = le.toUpperCase(); Y[le] && (Te = Y[le]); var oe = ne.attributes[le]; if (I.attributes.has(this.getUID(Se))) { ve[Te] = I.attributes.get(this.getUID(Se)); continue; } var Me = oe.clone(); if (!ne.morphTargetsRelative) if (oe) for (var ge = 0, xe = Se.count; ge < xe; ge++) oe.count > ge && Me.setXYZ(ge, Se.getX(ge) - oe.getX(ge), Se.getY(ge) - oe.getY(ge), Se.getZ(ge) - oe.getZ(ge)); else for (var Oe = 0, ut = Se.count; Oe < ut; Oe++) Me.setXYZ(Oe, 0, 0, 0); ve[Te] = this.processAccessor(Me, ne), I.attributes.set(this.getUID(oe), ve[Te]); } Q.push(ve), U.push(x.morphTargetInfluences[de]), x.morphTargetDictionary !== void 0 && V.push(ae[de]); } q.weights = U, 0 < V.length && (q.extras = {}, q.extras.targetNames = V); } var mt = Array.isArray(x.material); if (mt && ne.groups.length === 0) return null; for (var ze, bt = mt ? x.material : [x.material], Ue = mt ? ne.groups : [{ materialIndex: 0, start: void 0, count: void 0 }], st = 0, et = Ue.length; st < et; st++) { if (ze = { mode: K, attributes: z }, this.serializeUserData(ne, ze), 0 < Q.length && (ze.targets = Q), ne.index !== null) { var xt = this.getUID(ne.index); (Ue[st].start !== void 0 || Ue[st].count !== void 0) && (xt += ":" + Ue[st].start + ":" + Ue[st].count), I.attributes.has(xt) ? ze.indices = I.attributes.get(xt) : (ze.indices = this.processAccessor(ne.index, ne, Ue[st].start, Ue[st].count), I.attributes.set(xt, ze.indices)), ze.indices === null && delete ze.indices; } var ft = this.processMaterial(bt[Ue[st].materialIndex]); ft !== null && (ze.material = ft), j.push(ze); } q.primitives = j, N.meshes || (N.meshes = []), this._invokeAll(function(Nt) { Nt.writeMesh && Nt.writeMesh(x, q); }); var Ut = N.meshes.push(q) - 1; return I.meshes.set(W, Ut), Ut; } /** * Process camera * @param {THREE.Camera} camera Camera to process * @return {Integer} Index of the processed mesh in the "camera" array */ processCamera(x) { var I = this.json; I.cameras || (I.cameras = []); var N = x.isOrthographicCamera, D = { type: N ? "orthographic" : "perspective" }; return N ? D.orthographic = { xmag: 2 * x.right, ymag: 2 * x.top, zfar: 0 >= x.far ? 1e-3 : x.far, znear: 0 > x.near ? 0 : x.near } : D.perspective = { aspectRatio: x.aspect, yfov: l.MathUtils.degToRad(x.fov), zfar: 0 >= x.far ? 1e-3 : x.far, znear: 0 > x.near ? 0 : x.near }, x.name !== "" && (D.name = x.type), I.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(x, I) { var N = this.json, D = this.nodeMap; N.animations || (N.animations = []), x = h.Utils.mergeMorphTargetTracks(x.clone(), I); for (var k = x.tracks, F = [], W = [], K = 0; K < k.length; ++K) { var ne = k[K], q = l.PropertyBinding.parseTrackName(ne.name), z = l.PropertyBinding.findNode(I, q.nodeName), j = m[q.propertyName]; if (q.objectName === "bones" && (z.isSkinnedMesh === !0 ? z = z.skeleton.getBoneByName(q.objectIndex) : z = void 0), !z || !j) return console.warn('THREE.GLTFExporter: Could not export animation track "%s".', ne.name), null; var Q = 1, Y = ne.values.length / ne.times.length; j === m.morphTargetInfluences && (Y /= z.morphTargetInfluences.length); var ee = void 0; ne.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (ee = "CUBICSPLINE", Y /= 3) : ne.getInterpolation() === l.InterpolateDiscrete ? ee = "STEP" : ee = "LINEAR", W.push({ input: this.processAccessor(new l.BufferAttribute(ne.times, Q)), output: this.processAccessor(new l.BufferAttribute(ne.values, Y)), interpolation: ee }), F.push({ sampler: W.length - 1, target: { node: D.get(z), path: j } }); } return N.animations.push({ name: x.name || "clip_" + N.animations.length, samplers: W, channels: F }), N.animations.length - 1; } /** * @param {THREE.Object3D} object * @return {number|null} */ processSkin(x) { var I = this.json, N = this.nodeMap, D = I.nodes[N.get(x)], k = x.skeleton; if (k === void 0) return null; var F = x.skeleton.bones[0]; if (F === void 0) return null; for (var W = [], K = new Float32Array(16 * k.bones.length), ne = new l.Matrix4(), q = 0; q < k.bones.length; ++q) W.push(N.get(k.bones[q])), ne.copy(k.boneInverses[q]), ne.multiply(x.bindMatrix).toArray(K, 16 * q); I.skins === void 0 && (I.skins = []), I.skins.push({ inverseBindMatrices: this.processAccessor(new l.BufferAttribute(K, 16)), joints: W, skeleton: N.get(F) }); var z = D.skin = I.skins.length - 1; return z; } /** * Process Object3D node * @param {THREE.Object3D} node Object3D to processNode * @return {Integer} Index of the node in the nodes list */ processNode(x) { var I = this.json, N = this.options, D = this.nodeMap; I.nodes || (I.nodes = []); var k = {}; if (N.trs) { var F = x.quaternion.toArray(), W = x.position.toArray(), K = x.scale.toArray(); M(F, [0, 0, 0, 1]) || (k.rotation = F), M(W, [0, 0, 0]) || (k.translation = W), M(K, [1, 1, 1]) || (k.scale = K); } else x.matrixAutoUpdate && x.updateMatrix(), w(x.matrix) === !1 && (k.matrix = x.matrix.elements); if (x.name !== "" && (k.name = x.name + ""), this.serializeUserData(x, k), x.isMesh || x.isLine || x.isPoints) { var ne = this.processMesh(x); ne !== null && (k.mesh = ne); } else x.isCamera && (k.camera = this.processCamera(x)); if (x.isSkinnedMesh && this.skins.push(x), 0 < x.children.length) { for (var q, z = [], j = 0, Q = x.children.length; j < Q; j++) if (q = x.children[j], q.visible || N.onlyVisible === !1) { var Y = this.processNode(q); Y !== null && z.push(Y); } 0 < z.length && (k.children = z); } this._invokeAll(function(G) { G.writeNode && G.writeNode(x, k); }); var ee = I.nodes.push(k) - 1; return D.set(x, ee), ee; } /** * Process Scene * @param {Scene} node Scene to process */ processScene(x) { var I = this.json, N = this.options; I.scenes || (I.scenes = [], I.scene = 0); var D = {}; x.name !== "" && (D.name = x.name), I.scenes.push(D); for (var k, F = [], W = 0, K = x.children.length; W < K; W++) if (k = x.children[W], k.visible || N.onlyVisible === !1) { var ne = this.processNode(k); ne !== null && F.push(ne); } 0 < F.length && (D.nodes = F), this.serializeUserData(x, D); } /** * Creates a Scene to hold a list of objects and parse it * @param {Array} objects List of objects to process */ processObjects(x) { var I = new l.Scene(); I.name = "AuxScene"; for (var N = 0; N < x.length; N++) I.children.push(x[N]); this.processScene(I); } /** * @param {THREE.Object3D|Array} input */ processInput(x) { var I = this.options; x = x instanceof Array ? x : [x], this._invokeAll(function(W) { W.beforeParse && W.beforeParse(x); }); for (var N = [], D = 0; D < x.length; D++) x[D] instanceof l.Scene ? this.processScene(x[D]) : N.push(x[D]); 0 < N.length && this.processObjects(N); for (var k = 0; k < this.skins.length; ++k) this.processSkin(this.skins[k]); for (var F = 0; F < I.animations.length; ++F) this.processAnimation(I.animations[F].clip, I.animations[F].mesh); this._invokeAll(function(W) { W.afterParse && W.afterParse(x); }); } _invokeAll(x) { for (var I = 0, N = this.plugins.length; I < N; I++) x(this.plugins[I]); } } class L { constructor(x) { this.writer = x, this.name = "KHR_lights_punctual"; } writeNode(x, I) { if (x.isLight) { if (!x.isDirectionalLight && !x.isPointLight && !x.isSpotLight) return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.", x); var N = this.writer, D = N.json, k = N.extensionsUsed, F = {}; x.name && (F.name = x.name), F.color = x.color.toArray(), F.intensity = x.intensity, x.isDirectionalLight ? F.type = "directional" : x.isPointLight ? (F.type = "point", 0 < x.distance && (F.range = x.distance)) : x.isSpotLight && (F.type = "spot", 0 < x.distance && (F.range = x.distance), F.spot = {}, F.spot.innerConeAngle = -1 * ((x.penumbra - 1) * x.angle), F.spot.outerConeAngle = x.angle), x.decay !== void 0 && x.decay !== 2 && console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."), x.target && (x.target.parent !== x || x.target.position.x !== 0 || x.target.position.y !== 0 || x.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."), k[this.name] || (D.extensions = D.extensions || {}, D.extensions[this.name] = { lights: [] }, k[this.name] = !0); var W = D.extensions[this.name].lights; W.push(F), I.extensions = I.extensions || {}, I.extensions[this.name] = { light: W.length - 1 }; } } } class A { constructor(x) { this.writer = x, this.name = "KHR_materials_unlit"; } writeMaterial(x, I) { if (x.isMeshBasicMaterial) { var N = this.writer, D = N.extensionsUsed; I.extensions = I.extensions || {}, I.extensions[this.name] = {}, D[this.name] = !0, I.pbrMetallicRoughness.metallicFactor = 0, I.pbrMetallicRoughness.roughnessFactor = 0.9; } } } class P { constructor(x) { this.writer = x, this.name = "KHR_materials_pbrSpecularGlossiness"; } writeMaterial(x, I) { if (x.isGLTFSpecularGlossinessMaterial) { var N = this.writer, D = N.extensionsUsed, k = {}; I.pbrMetallicRoughness.baseColorFactor && (k.diffuseFactor = I.pbrMetallicRoughness.baseColorFactor); var F = [1, 1, 1]; if (x.specular.toArray(F, 0), k.specularFactor = F, k.glossinessFactor = x.glossiness, I.pbrMetallicRoughness.baseColorTexture && (k.diffuseTexture = I.pbrMetallicRoughness.baseColorTexture), x.specularMap) { var W = { index: N.processTexture(x.specularMap) }; N.applyTextureTransform(W, x.specularMap), k.specularGlossinessTexture = W; } I.extensions = I.extensions || {}, I.extensions[this.name] = k, D[this.name] = !0; } } } h.Utils = { insertKeyframe: function(O, x) { var I, N = 1e-3, D = O.getValueSize(), k = new O.TimeBufferType(O.times.length + 1), F = new O.ValueBufferType(O.values.length + D), W = O.createInterpolant(new O.ValueBufferType(D)); if (O.times.length === 0) { k[0] = x; for (var K = 0; K < D; K++) F[K] = 0; I = 0; } else if (x < O.times[0]) { if (Math.abs(O.times[0] - x) < N) return 0; k[0] = x, k.set(O.times, 1), F.set(W.evaluate(x), 0), F.set(O.values, D), I = 0; } else if (x > O.times[O.times.length - 1]) { if (Math.abs(O.times[O.times.length - 1] - x) < N) return O.times.length - 1; k[k.length - 1] = x, k.set(O.times, 0), F.set(O.values, 0), F.set(W.evaluate(x), O.values.length), I = k.length - 1; } else for (var ne = 0; ne < O.times.length; ne++) { if (Math.abs(O.times[ne] - x) < N) return ne; if (O.times[ne] < x && O.times[ne + 1] > x) { k.set(O.times.slice(0, ne + 1), 0), k[ne + 1] = x, k.set(O.times.slice(ne + 1), ne + 2), F.set(O.values.slice(0, (ne + 1) * D), 0), F.set(W.evaluate(x), (ne + 1) * D), F.set(O.values.slice((ne + 1) * D), (ne + 2) * D), I = ne + 1; break; } } return O.times = k, O.values = F, I; }, mergeMorphTargetTracks: function(O, x) { for (var I = [], N = {}, D = O.tracks, k = 0; k < D.length; ++k) { var F = D[k], W = l.PropertyBinding.parseTrackName(F.name), K = l.PropertyBinding.findNode(x, W.nodeName); if (W.propertyName !== "morphTargetInfluences" || W.propertyIndex === void 0) { I.push(F); continue; } if (F.createInterpolant !== F.InterpolantFactoryMethodDiscrete && F.createInterpolant !== F.InterpolantFactoryMethodLinear) { if (F.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."), F = F.clone(), F.setInterpolation(l.InterpolateLinear); } var ne = K.morphTargetInfluences.length, q = K.morphTargetDictionary[W.propertyIndex]; if (q === void 0) throw new Error("THREE.GLTFExporter: Morph target name not found: " + W.propertyIndex); var z = void 0; if (N[K.uuid] === void 0) { z = F.clone(); for (var j = new z.ValueBufferType(ne * z.times.length), Q = 0; Q < z.times.length; Q++) j[Q * ne + q] = z.values[Q]; z.name = (W.nodeName || "") + ".morphTargetInfluences", z.values = j, N[K.uuid] = z, I.push(z); continue; } var Y = F.createInterpolant(new F.ValueBufferType(1)); z = N[K.uuid]; for (var ee = 0; ee < z.times.length; ee++) z.values[ee * ne + q] = Y.evaluate(z.times[ee]); for (var G, J = 0; J < F.times.length; J++) G = this.insertKeyframe(z, F.times[J]), z.values[G * ne + q] = F.values[J]; } return O.tracks = I, O; } }; }, /* 43 */ /***/ (a, s, c) => { var l = c(4), h = c(5).resolveURL, u = 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 = (w) => { var { nearPlane: b, farPlane: E, eyePosition: S, targetPosition: C, upVector: R } = w; T.nearPlane = b, T.farPlane = E, T.eyePosition = S, T.targetPosition = C, T.upVector = R; }; }, p = function(T, w, b, E) { var S = { NONE: -1, DEFAULT: 0, PATH: 1, SMOOTH_CAMERA_TRANSITION: 2, AUTO_TUMBLE: 3, ROTATE_TRANSITION: 4, MINIMAP: 5, SYNC_CONTROL: 6 }, C = { 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 }, L = {}; L.MAIN = C.ROTATE, L.AUXILIARY = C.ZOOM, L.SECONDARY = C.PAN, this.cameraObject = T, this.domElement = w === void 0 ? document : w, this.renderer = b, this.scene = E, 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, O = 0, x = void 0, I = void 0, N = !1, D = 500, k = void 0, F = "default", W = S.DEFAULT, K = void 0, ne = void 0, q = void 0, z = 0, j = R.FREE; this._state = C.NONE; var Q; this.targetTouchId = -1; var Y = void 0, ee = new l.Vector3(), G = new l.Vector3(), J = new l.Vector3(), re = new l.Vector3(), B = new l.Vector3(), $ = new l.Vector3(), te = new l.Vector3(), U = new l.Vector3(), V = new l.Sphere(), ae = new l.Vector3(), ue = !1, de = void 0, ve = 0, ye = { default: new u() }; ye.default.nearPlane = 0.1, ye.default.farPlane = 2e3, ye.default.eyePosition = [0, 0, 0], ye.default.targetPosition = [0, 0, -1], ye.default.upVector = [0, 1, 0], this.cameraObject.target === void 0 && (this.cameraObject.target = new l.Vector3(...ye.default.targetPosition)), this.calculateMaxAllowedDistance = (ie) => { var Ee = ie.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 = (ie, Ee) => { ie && Ee && (ye[ie] = Ee); }, this.setDefaultViewport = (ie) => !!(ie && ie in ye) && (F = ie, !0), this.getDefaultViewport = () => F, this.getViewportOfName = (ie) => ye[ie], this.setCurrentViewport = (ie) => ie in ye && (this.setCurrentCameraSettings(ye[ie]), !0), this.setRotationMode = (ie) => { switch (ie) { case "none": j = R.NONE; break; case "horizontal": j = R.HORIZONTAL; break; case "vertical": j = R.VERTICAL; break; case "free": default: j = R.FREE; } }, this.onResize = () => { Y && (Y = void 0), de && de.setCurrentCameraSettings(this.cameraObject, ye[F]); }, this.getVisibleHeightAtZDepth = (ie) => { var Ee = this.cameraObject.position.distanceTo(this.cameraObject.target); ie < Ee ? ie -= Ee : ie += Ee; var Ne = this.cameraObject.fov * Math.PI / 180; return 2 * Math.tan(Ne / 2) * Math.abs(ie); }, this.calculateHeightPerPixelAtZeroDepth = (ie) => { var Ee = this.getVisibleHeightAtZDepth(0); return this.pixelHeight = Ee / ie, this.pixelHeight; }, this.getNDCFromDocumentCoords = (ie, Ee, Ne) => { ze(!1); var Ge = Ne || new l.Vector2(), rt = 2 * ((ie - Y.left) / Y.width) - 1, gt = 2 * -((Ee - Y.top) / Y.height) + 1; return Ge.set(rt, gt); }, this.getRelativeCoordsFromNDC = (ie, Ee, Ne) => { ze(!1); var Ge = Ne || new l.Vector2(); return Ge.x = (ie + 1) * Y.width / 2, Ge.y = (1 - Ee) * Y.height / 2, Ge; }, this.setMouseButtonAction = (ie, Ee) => { L[ie] = C[Ee]; }; var le = () => { if (0 < ve) { var ie = ae.distanceTo(V.center); return ve > ie || this.cameraObject.position.distanceTo(V.center) > ie; } return !0; }, Se = (ie) => { ae.copy(this.cameraObject.position).add(ie), le() && (this.cameraObject.target.add(ie), this.cameraObject.position.add(ie), this.updateDirectionalLight()); }, Te = (ie) => { ze(!1); var Ee; if (W === S.DEFAULT && (Ee = this.scene.getNormalisedMinimapCoordinates(this.renderer, ie)), !Ee) ie.button == 0 ? ie.ctrlKey ? this._state = L.AUXILIARY : ie.shiftKey ? this._state = L.SECONDARY : this._state = L.MAIN : ie.button == 1 ? (ie.preventDefault(), this._state = L.AUXILIARY) : ie.button == 2 && (this._state = L.SECONDARY), this.pointer_x = ie.clientX - Y.left, this.pointer_y = ie.clientY - Y.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 { W = S.MINIMAP; var Ne = this.scene.getMinimapDiffFromNormalised(Ee.x, Ee.y); Se(Ne); } }, oe = (ie) => { if (ze(!1), Y) if (this.pointer_x = ie.clientX - Y.left, this.pointer_y = ie.clientY - Y.top, W === S.MINIMAP) { var Ee = this.scene.getNormalisedMinimapCoordinates(this.renderer, ie); if (Ee) { var Ne = this.scene.getMinimapDiffFromNormalised(Ee.x, Ee.y); Se(Ne); } } else this._state === C.NONE && Q !== void 0 && Q.move(this, ie.clientX, ie.clientY, this.renderer); }, Me = (ie) => { this._state = C.NONE, W == S.MINIMAP && (W = S.DEFAULT), Q !== void 0 && this.pointer_x_start == ie.clientX - Y.left && this.pointer_y_start == ie.clientY - Y.top && Q.pick(this, ie.clientX, ie.clientY, this.renderer); }, ge = (ie) => { this._state = C.NONE; }, xe = (ie) => { ze(!1); var Ee = ie.touches.length; if (Ee == 1) this._state = C.TOUCH_ROTATE, this.pointer_x = ie.touches[0].clientX - Y.left, this.pointer_y = ie.touches[0].clientY - Y.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 = C.TOUCH_ZOOM; var Ne = ie.touches[0].clientX - ie.touches[1].clientX, Ge = ie.touches[0].clientY - ie.touches[1].clientY; this.touchZoomDistanceEnd = this.touchZoomDistanceStart = Math.sqrt(Ne * Ne + Ge * Ge); } else Ee == 3 && (this._state = C.TOUCH_PAN, this.targetTouchId = ie.touches[0].identifier, this.pointer_x = ie.touches[0].clientX - Y.left, this.pointer_y = ie.touches[0].clientY - Y.top, this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y); }, Oe = (ie) => { ie.preventDefault(), ie.stopPropagation(); var Ee = ie.touches.length; if (Ee == 1) this.pointer_x = ie.touches[0].clientX - Y.left, this.pointer_y = ie.touches[0].clientY - Y.top; else if (Ee == 2) { if (this._state === C.TOUCH_ZOOM) { var Ne = ie.touches[0].clientX - ie.touches[1].clientX, Ge = ie.touches[0].clientY - ie.touches[1].clientY; this.touchZoomDistanceEnd = Math.sqrt(Ne * Ne + Ge * Ge); } } else if (Ee == 3 && this._state === C.TOUCH_PAN) for (var rt = 0; 3 > rt; rt++) ie.touches[rt].identifier == this.targetTouchId && (this.pointer_x = ie.touches[0].clientX - Y.left, this.pointer_y = ie.touches[0].clientY - Y.top); }, ut = (ie) => { var Ee = ie.touches.length; this.touchZoomDistanceStart = this.touchZoomDistanceEnd = 0, this.targetTouchId = -1, this._state = C.NONE, Ee == 1 && Q !== void 0 && this.pointer_x_start == ie.touches[0].clientX - Y.left && this.pointer_y_start == ie.touches[0].clientY - Y.top && Q.pick(this.cameraObject, ie.touches[0].clientX, ie.touches[0].clientY, this.renderer); }, mt = () => { ze(!0); }, ze = (ie) => { if (ie || Y === void 0) { var Ee = new IntersectionObserver((Ne) => { for (var Ge of Ne) Y = Ge.boundingClientRect; Ee.disconnect(); }); Ee.observe(this.domElement); } }, bt = (ie) => { ze(!1), this._state = C.SCROLL; var Ee = 0; 0 < ie.deltaY ? Ee = this.scrollRate : 0 > ie.deltaY && (Ee = -1 * this.scrollRate), z += Ee, ie.preventDefault(), ie.stopImmediatePropagation(); }, Ue = () => { if (typeof this.cameraObject < "u") { var ie = Y.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)), G.set(this.previous_pointer_x, ie - this.previous_pointer_y, 0), J.set(this.previous_pointer_x, ie - this.previous_pointer_y, 1), re.set(this.pointer_x, ie - this.pointer_y, 0), B.set(this.pointer_x, ie - this.pointer_y, 1), G.unproject(this.cameraObject), J.unproject(this.cameraObject), re.unproject(this.cameraObject), B.unproject(this.cameraObject); var Ge = -2e-3; re.sub(G).multiplyScalar(1 - Ne), B.sub(J).multiplyScalar(Ne), re.add(B).multiplyScalar(Ge), Se(re); } this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y; }; this.getVectorsFromRotateAboutLookAtPoints = (ie, Ee) => { ie.normalize(), te.copy(this.cameraObject.position).sub(this.cameraObject.target), U.copy(te), te.normalize(), 0.8 < Math.abs(te.dot(ie)) && te.copy(this.cameraObject.up), G.crossVectors(ie, te).normalize(), J.crossVectors(ie, G); var Ne = ie.dot(U), Ge = G.dot(U), rt = J.dot(U), gt = ie.dot(this.cameraObject.up), Tt = G.dot(this.cameraObject.up), Lt = J.dot(this.cameraObject.up), Vt = Math.cos(Ee), X = Math.sin(Ee); return re.set(Vt * G.x + X * J.x, Vt * G.y + X * J.y, Vt * G.z + X * J.z), B.set(Vt * J.x - X * G.x, Vt * J.y - X * G.y, Vt * J.z - X * G.z), te.copy(this.cameraObject.target), te.x = te.x + ie.x * Ne + re.x * Ge + B.x * rt, te.y = te.y + ie.y * Ne + re.y * Ge + B.y * rt, te.z = te.z + ie.z * Ne + re.z * Ge + B.z * rt, ee.set(ie.x * gt + re.x * Tt + B.x * Lt, ie.y * gt + re.y * Tt + B.y * Lt, ie.z * gt + re.z * Tt + B.z * Lt), { position: te, up: ee }; }, this.rotateAboutLookAtpoint = (ie, Ee) => { var Ne = this.getVectorsFromRotateAboutLookAtPoints(ie, Ee); this.cameraObject.position.copy(Ne.position), this.updateDirectionalLight(), this.cameraObject.up.copy(Ne.up); }; var st = () => { if (typeof this.cameraObject < "u") { var ie = Y.width, Ee = Y.height; if (0 < ie && 0 < Ee) { var Ne = 0.25 * (ie + Ee), Ge = 0, rt = 0; (j === R.FREE || j === R.HORIZONTAL) && (Ge = this.pointer_x - this.previous_pointer_x), (j === R.FREE || j === R.VERTICAL) && (rt = this.previous_pointer_y - this.pointer_y); var gt = Math.sqrt(Ge * Ge + rt * rt); if (0 < gt) { var Tt = 1 * -rt / gt, Lt = 1 * Ge / gt, Vt = 0; j === R.FREE && Tt * (this.pointer_x - 0.5 * (ie - 1)) + Lt * (0.5 * (Ee - 1) - this.pointer_y); var X = Math.acos(Vt / Ne) - 0.5 * Math.PI, be = this.tumble_rate * gt / Ne; ee.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(), G.copy(this.cameraObject.up).normalize(), J.copy(G).cross(ee).normalize().multiplyScalar(Tt), G.multiplyScalar(Lt), $.addVectors(J, G).multiplyScalar(Math.cos(X)), ee.multiplyScalar(Math.sin(X)), $.add(ee), this.rotateAboutLookAtpoint($, -be); } } } this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y; }, et = () => { var ie = 0; return this._state === C.ZOOM ? ie = this.previous_pointer_y - this.pointer_y : this._state === C.SCROLL ? ie = z : (ie = -1 * (this.touchZoomDistanceEnd - this.touchZoomDistanceStart), this.touchZoomDistanceStart = this.touchZoomDistanceEnd), ie; }; this.changeZoomByScrollRateUnit = (ie) => { var Ee = ie * this.scrollRate; this.changeZoomByValue(Ee); }, this.changeZoomByValue = (ie) => { if (typeof this.cameraObject < "u") { var Ee = Y.height, Ne = this.cameraObject.position.clone(); Ne.sub(this.cameraObject.target); var Ge = Ne.length(), rt = 1.5 * ie / Ee; if (0.01 < Ge + rt * Ge && (Ne.normalize(), ae.copy(this.cameraObject.position), ae.x += Ne.x * rt * Ge, ae.y += Ne.y * rt * Ge, ae.z += Ne.z * rt * Ge, le())) { this.cameraObject.position.copy(ae), this.updateDirectionalLight(); var gt = 1e-5; if (gt * this.cameraObject.far < this.cameraObject.near + rt * Ge + this.near_plane_fly_debt) this.near_plane_fly_debt != 0 && (this.near_plane_fly_debt += rt * Ge, 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 * Ge, this.cameraObject.far += rt * Ge)); 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 * Ge; } ue = !0; } } }; var xt = () => { var ie = et(); this.changeZoomByValue(ie), this._state === C.ZOOM && (this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y), this._state === C.SCROLL && (z = 0, this._state = C.NONE); }; this.setDirectionalLight = (ie) => { this.directionalLight = ie; }, 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", Te, !1), this.domElement.addEventListener("mousemove", oe, !1), this.domElement.addEventListener("mouseup", Me, !1), this.domElement.addEventListener("mouseleave", ge, !1), this.domElement.addEventListener("touchstart", xe, !1), this.domElement.addEventListener("touchmove", Oe, !1), this.domElement.addEventListener("touchend", ut, !1), this.domElement.addEventListener("wheel", bt, !1), this.domElement.addEventListener("contextmenu", (ie) => { ie.preventDefault(); }, !1), this.domElement.addEventListener("mouseenter", mt, !1)); }, this.disable = function() { P = !1, this.domElement && this.domElement.removeEventListener && (this.domElement.removeEventListener("mousedown", Te, !1), this.domElement.removeEventListener("mousemove", oe, !1), this.domElement.removeEventListener("mouseup", Me, !1), this.domElement.removeEventListener("mouseleave", ge, !1), this.domElement.removeEventListener("touchstart", xe, !1), this.domElement.removeEventListener("touchmove", Oe, !1), this.domElement.removeEventListener("touchend", ut, !1), this.domElement.removeEventListener("wheel", bt, !1), this.domElement.removeEventListener("mouseenter", mt, !1), this.domElement.removeEventListener("contextmenu", (ie) => { ie.preventDefault(); }, !1)); }, this.loadPath = (ie) => { x = ie.CameraPath, I = ie.NumberOfPoints; }, this.loadPathURL = (ie, 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 Ge = h(ie); Ne.open("GET", Ge, !0), Ne.send(); }, this.setPathDuration = (ie) => { A = ie, K && K.setDuration(A), ne && ne.setDuration(A); }, this.getPlayRate = () => D, this.setPlayRate = (ie) => { D = ie; }; var ft = (ie) => { var Ee = O + ie; Ee > A && (Ee -= A), O = Ee; }; this.getTime = () => O, this.setTime = (ie) => { O = ie > A ? A : 0 > ie ? 0 : ie; }, this.getNumberOfTimeFrame = () => I, this.getCurrentTimeFrame = () => { if (2 < I) { var ie = O / A * (I - 1), Ee = Math.floor(ie), Ne = 1 - (ie - Ee), Ge = Math.ceil(ie); return Ee == Ge ? Ee == I - 1 ? [Ee - 1, Ge, 0] : [Ee, Ge + 1, 1] : [Ee, Ge, Ne]; } return I == 1 ? [0, 0, 0] : void 0; }, this.setCurrentTimeFrame = (ie) => { 2 < I && (O = A * ie / (I - 1), 0 > O && (O = 0), O > A && (O = A)); }; var Ut = (ie) => { if (W === S.PATH && (ft(ie), x)) { for (var Ee = this.getCurrentTimeFrame(), Ne = Ee[0], Ge = Ee[1], rt = Ee[2], gt = [x[3 * Ne], x[3 * Ne + 1], x[3 * Ne + 2]], Tt = [x[3 * Ge], x[3 * Ge + 1], x[3 * Ge + 2]], Lt = [], Vt = 0; Vt < gt.length; Vt++) Lt.push(rt * gt[Vt] + (1 - rt) * Tt[Vt]); this.cameraObject.position.set(Lt[0], Lt[1], Lt[2]), this.cameraObject.target.set(Tt[0], Tt[1], Tt[2]), k && 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 = () => { Ut(0); }; var Nt = () => { this._state === C.ROTATE || this._state === C.TOUCH_ROTATE ? st() : this._state === C.PAN || this._state === C.TOUCH_PAN ? (Ue(), de.triggerCallback()) : (this._state === C.ZOOM || this._state === C.TOUCH_ZOOM || this._state === C.SCROLL) && (de.zoom(et()), this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y, this._state === C.SCROLL && (this._state = C.NONE), z = 0, de.triggerCallback()); }; this.update = (ie) => { var Ee = ie * D, Ne = P, Ge = !0; return W === S.PATH ? Ut(Ee) : W === S.SMOOTH_CAMERA_TRANSITION && K ? (K.update(Ee), K.isTransitionCompleted() && (W = S.DEFAULT), Ne = !1) : W === S.ROTATE_CAMERA_TRANSITION && ne ? (ne.update(Ee), ne.isTransitionCompleted() && (W = S.DEFAULT), Ne = !1) : W === S.AUTO_TUMBLE && q ? q.update(Ee) : W === S.SYNC_CONTROL && de ? (Nt(), Ne = !1) : Ge = !1, Ne && (this._state !== C.NONE && (Ge = !0), this._state === C.ROTATE || this._state === C.TOUCH_ROTATE ? st() : this._state === C.PAN || this._state === C.TOUCH_PAN ? Ue() : (this._state === C.ZOOM || this._state === C.TOUCH_ZOOM || this._state === C.SCROLL) && xt(), this._state !== C.NONE && W === S.AUTO_TUMBLE && q && q.stopOnCameraInput, this._state === C.SCROLL && (this._state = C.NONE)), k ? (Ge = !0, k.update()) : this.cameraObject.lookAt(this.cameraObject.target), Ge = Ge || ue, ue = !1, Ge; }, this.playPath = () => { W = S.PATH; }, this.stopPath = () => { W = S.DEFAULT; }, this.isPlayingPath = () => W === S.PATH, this.enableDirectionalLightUpdateWithPath = (ie) => { N = ie; }, this.enableDeviceOrientation = () => { k || (k = new _(this.cameraObject)); }, this.disableDeviceOrientation = () => { k && (k.dispose(), k = void 0); }, this.isDeviceOrientationEnabled = () => !!k, this.resetView = () => { var ie = ye[F]; this.cameraObject.near = ie.nearPlane, this.cameraObject.far = ie.farPlane, this.cameraObject.position.set(ie.eyePosition[0], ie.eyePosition[1], ie.eyePosition[2]), this.cameraObject.target.set(ie.targetPosition[0], ie.targetPosition[1], ie.targetPosition[2]), this.cameraObject.up.set(ie.upVector[0], ie.upVector[1], ie.upVector[2]), this.cameraObject.updateProjectionMatrix(), this.updateDirectionalLight(); }, this.setCurrentCameraSettings = (ie) => { ie.nearPlane && (this.cameraObject.near = ie.nearPlane), ie.farPlane && (this.cameraObject.far = ie.farPlane), ie.eyePosition && this.cameraObject.position.set(ie.eyePosition[0], ie.eyePosition[1], ie.eyePosition[2]), ie.targetPosition && this.cameraObject.target.set(ie.targetPosition[0], ie.targetPosition[1], ie.targetPosition[2]), ie.upVector && this.cameraObject.up.set(ie.upVector[0], ie.upVector[1], ie.upVector[2]), this.cameraObject.updateProjectionMatrix(), this.updateDirectionalLight(), ue = !0; }, this.getViewportFromCentreAndRadius = (ie, Ee, Ne, Ge, rt, gt) => { var Tt = this.cameraObject.position.x - this.cameraObject.target.x, Lt = this.cameraObject.position.y - this.cameraObject.target.y, Vt = this.cameraObject.position.z - this.cameraObject.target.z, X = 1 / Math.sqrt(Tt * Tt + Lt * Lt + Vt * Vt); Tt *= X, Lt *= X, Vt *= X; var be = [ie, Ee, Ne], me = Ge / Math.tan(rt * Math.PI / 360), _e = [ie + Tt * me, Ee + Lt * me, Ne + Vt * me], Pe = me + gt, he = 0, we = 0.95; he = gt > we * me ? (1 - we) * me : me - gt; var De = new u(); return De.nearPlane = he, De.farPlane = Pe, De.eyePosition = _e, De.targetPosition = be, De.upVector = [this.cameraObject.up.x, this.cameraObject.up.y, this.cameraObject.up.z], De; }, this.getViewportFromBoundingBox = (ie, Ee) => { var Ne = ie.min.distanceTo(ie.max) / 2 * Ee, Ge = (ie.min.x + ie.max.x) / 2, rt = (ie.min.y + ie.max.y) / 2, gt = (ie.min.z + ie.max.z) / 2, Tt = 4, Lt = this.getViewportFromCentreAndRadius(Ge, rt, gt, Ne, 40, Ne * Tt); return Lt; }, this.getCurrentViewport = () => { var ie = new u(); return ie.nearPlane = this.cameraObject.near, ie.farPlane = this.cameraObject.far, ie.eyePosition[0] = this.cameraObject.position.x, ie.eyePosition[1] = this.cameraObject.position.y, ie.eyePosition[2] = this.cameraObject.position.z, ie.targetPosition[0] = this.cameraObject.target.x, ie.targetPosition[1] = this.cameraObject.target.y, ie.targetPosition[2] = this.cameraObject.target.z, ie.upVector[0] = this.cameraObject.up.x, ie.upVector[1] = this.cameraObject.up.y, ie.upVector[2] = this.cameraObject.up.z, ie; }, this.getDefaultEyePosition = () => eyePosition, this.getDefaultTargetPosition = () => targetPosition, this.cameraTransition = (ie, Ee, Ne) => { ne == null && (K = new m(ie, Ee, this, Ne)); }, this.rotateCameraTransition = (ie, Ee, Ne) => { K == null && (ne = new g(ie, Ee, this, Ne)); }, this.enableCameraTransition = () => { K && (W = S.SMOOTH_CAMERA_TRANSITION), ne && (W = S.ROTATE_CAMERA_TRANSITION); }, this.pauseCameraTransition = () => { W = S.DEFAULT; }, this.stopCameraTransition = () => { W = S.DEFAULT, K = void 0, ne = void 0; }, this.isTransitioningCamera = () => W === S.SMOOTH_CAMERA_TRANSITION || W === S.ROTATE_CAMERA_TRANSITION, this.autoTumble = (ie, Ee, Ne) => { q = new y(ie, Ee, Ne, this); }, this.enableAutoTumble = () => { W = S.AUTO_TUMBLE; }, this.stopAutoTumble = () => { W = S.DEFAULT, q = void 0; }, this.updateAutoTumble = () => { q && (q.requireUpdate = !0); }, this.isAutoTumble = () => W === S.AUTO_TUMBLE, this.enableRaycaster = (ie, Ee, Ne) => { Q == null && (Q = new d(ie, this.scene, Ee, Ne, this.renderer)); }, this.disableRaycaster = () => { Q.disable(), Q = void 0; }, this.isSyncControl = () => currentMpde === S.SYNC_CONTROL, this.enableSyncControl = () => (W = S.SYNC_CONTROL, de || (de = new M()), de.setCurrentCameraSettings(this.cameraObject, ye[F]), de), this.disableSyncControl = () => { W = S.DEFAULT, this.cameraObject.zoom = 1, this.cameraObject.updateProjectionMatrix(); }, this.enable(); }, m = function(T, w, b, E) { var S = T.eyePosition, C = T.targetPosition, R = T.upVector, L = w.eyePosition, A = w.targetPosition, P = w.upVector, O = b, x = E, I = 0, N = !1; O.near = Math.min(T.nearPlane, w.nearPlane), O.far = Math.max(T.farPlane, w.farPlane), O.cameraObject.up.set(w.upVector[0], w.upVector[1], w.upVector[2]), this.setDuration = (F) => { x = F; }; var D = (F) => { var W = I + F; W > x && (W = x), I = W; }, k = () => { var F = I / x, W = [S[0] * (1 - F) + L[0] * F, S[1] * (1 - F) + L[1] * F, S[2] * (1 - F) + L[2] * F], K = [C[0] * (1 - F) + A[0] * F, C[1] * (1 - F) + A[1] * F, C[2] * (1 - F) + A[2] * F]; R[0] * (1 - F) + P[0] * F, R[1] * (1 - F) + P[1] * F, R[2] * (1 - F) + P[2] * F, O.cameraObject.position.set(W[0], W[1], W[2]), O.cameraObject.target.set(K[0], K[1], K[2]); }; this.update = (F) => { this.enabled === !1 || (D(F), k(), I == x && (N = !0)); }, this.isTransitionCompleted = () => N; }, g = function(T, w, b, E) { var S = T, C = w, R = b, L = E, A = 0, P = !1; this.setDuration = (x) => { L = x; }; var O = (x) => { var I = A, N = A + x; N > L && (N = L), A = N; var D = A - I, k = D / L, F = k * C; R.rotateAboutLookAtpoint(S, F); }; this.update = (x) => { this.enabled === !1 || (O(x), A == L && (P = !0)); }, this.isTransitionCompleted = () => P; }, d = function(T, w, b, E, S) { var C = T, R = w, L = S, A = b, P = E, O = new l.Raycaster(); O.params.Line.threshold = 0.1, O.params.Points.threshold = 1; var x = new l.Vector2(), I = !1, N = /* @__PURE__ */ new Date(), D = !1, k = 0, F = [], W = { zincCamera: void 0, x: -1, y: -1 }, K = void 0; this.enable = () => { enable = !0; }, this.disable = () => { enable = !1; }, this.getIntersectsObject = (z) => { if (R !== C) { var j = C.getThreeJSScene(); L.render(j, z.cameraObject); } var Q = K || C.getPickableThreeJSObjects(); return F.length = 0, O.intersectObjects(Q, !0, F); }, this.setPickableObjects = (z) => { z === void 0 ? K = void 0 : (K = [], z.forEach((j) => { j.getGroup() && j.getGroup().visible && K.push(j.getGroup()); })); }, this.getIntersectsObjectWithOrigin = (z, j, Q) => (O.set(j, Q), this.getIntersectsObject(z)), this.getIntersectsObjectWithCamera = (z, j, Q) => (z.getNDCFromDocumentCoords(j, Q, x), O.setFromCamera(x, z.cameraObject), this.getIntersectsObject(z)), this.pick = (z, j, Q) => { if (L && C && z && A) { this.getIntersectsObjectWithCamera(z, j, Q); for (var Y, ee = F.length, G = 0; G < ee; G++) if (Y = F[G].object ? F[G].object.userData : void 0, Y && Y.isMarkerCluster && Y.visible && Y.clusterIsVisible(F[G].object.clusterIndex) && Y.zoomToCluster(F[G].object.clusterIndex)) return; A(F, j, Q); } }; var ne = (z, j, Q) => { if (L && C && z && P) { if (this.getIntersectsObjectWithCamera(z, j, Q), N.setTime(Date.now()), F.length === 0) { if (D) return; D = !0; } else D = !1; P(F, j, Q); } }; this.move = (z, j, Q) => { L && C && z && P && (C.displayMarkers ? ne(z, j, Q) : (W.zincCamera = z, W.x = j, W.y = Q, !I && (k = N ? Date.now() - N.getTime() : 250, 250 <= k ? ne(z, j, Q) : (I = !0, setTimeout(q(W), k))))); }; var q = (z) => function() { I = !1, ne(z.zincCamera, z.x, z.y); }; }, y = function(T, w, b, E) { var S = new l.Vector3(), C = -w, R = E, L = T; this.stopOnCameraInput = b, this.requireUpdate = !0; var A = new l.Vector3(), P = new l.Vector3(), O = (x) => { var I = Math.sqrt(x[0] * x[0] + x[1] * x[1]), N = 4 * Math.abs(x[0]), D = 4 * Math.abs(x[1]), k = 0.25 * (N + D), F = -x[1] / I, W = x[0] / I, K = F * x[0] + W * -x[1]; K > k ? K = k : K < -k && (K = -k); var ne = Math.acos(K / k) - 0.5 * Math.PI; S.copy(R.cameraObject.position).sub(R.cameraObject.target).normalize(), A.copy(R.cameraObject.up).normalize(), P.crossVectors(A, S).normalize().multiplyScalar(F), A.multiplyScalar(W), A.add(P).multiplyScalar(Math.cos(ne)), S.multiplyScalar(Math.sin(ne)).add(A); }; this.update = (x) => { this.enabled === !1 || (this.requireUpdate && (O(L), this.requireUpdate = !1), R.rotateAboutLookAtpoint(S, C * x / 1e3)); }; }, f = 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(f.prototype, { update: (() => { var T, w, b, E, S, C, R = new l.Matrix4(), L = new l.Matrix4(); return function(A) { var P = T !== A.focus || w !== A.fov || b !== A.aspect * this.aspect || E !== A.near || S !== A.far || C !== A.zoom; if (P) { T = A.focus, w = A.fov, b = A.aspect * this.aspect, E = A.near, S = A.far, C = A.zoom; var O, x, I = A.projectionMatrix.clone(), N = 0.064 / 2, D = N * E / T, k = E * Math.tan(0.5 * (l.Math.DEG2RAD * w)) / A.zoom; L.elements[12] = -N, R.elements[12] = N, O = -k * b + D, x = k * b + D, I.elements[0] = 2 * E / (x - O), I.elements[8] = (x + O) / (x - O), this.cameraL.projectionMatrix.copy(I), O = -k * b - D, x = k * b - D, I.elements[0] = 2 * E / (x - O), I.elements[8] = (x + O) / (x - O), this.cameraR.projectionMatrix.copy(I); } this.cameraL.matrixWorld.copy(A.matrixWorld).multiply(L), this.cameraR.matrixWorld.copy(A.matrixWorld).multiply(R); }; })() }); var v = function(T) { var w = new f(); w.aspect = 0.5, this.setSize = (b, E) => { T.setSize(b, E); }, this.render = (b, E) => { b.updateMatrixWorld(), E.parent === null && E.updateMatrixWorld(), w.update(E); var S = T.getSize(); T.setScissorTest(!0), T.clear(), T.setScissor(0, 0, S.width / 2, S.height), T.setViewport(0, 0, S.width / 2, S.height), T.render(b, w.cameraL), T.setScissor(S.width / 2, 0, S.width / 2, S.height), T.setViewport(S.width / 2, 0, S.width / 2, S.height), T.render(b, w.cameraR), T.setScissorTest(!1); }; }, _ = function(T) { var w = this; this.object = T, this.object.rotation.reorder("YXZ"), this.enabled = !0, this.deviceOrientation = {}, this.screenOrientation = 0; var b = (C) => { w.deviceOrientation = C; }, E = () => { typeof window < "u" && (w.screenOrientation = window.orientation || 0); }, S = (() => { var C = new l.Vector3(0, 0, 1), R = new l.Euler(), L = new l.Quaternion(), A = new l.Quaternion(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5)); return (P, O, x, I, N) => { var D = new l.Vector3(0, 0, 1); D.subVectors(P.target, P.position), R.set(x, O, -I, "YXZ"); var k = new l.Quaternion(); k.setFromEuler(R), k.multiply(A), k.multiply(L.setFromAxisAngle(C, -N)), D.applyQuaternion(k), D.addVectors(P.position, D), P.lookAt(D); }; })(); this.connect = () => { E(), typeof window < "u" && (window.addEventListener("orientationchange", E, !1), window.addEventListener("deviceorientation", b, !1)), w.enabled = !0; }, this.disconnect = () => { typeof window < "u" && (window.removeEventListener("orientationchange", E, !1), window.removeEventListener("deviceorientation", b, !1)), w.enabled = !1; }, this.update = () => { if (w.enabled !== !1) { var C = w.deviceOrientation.alpha ? l.Math.degToRad(w.deviceOrientation.alpha) : 0, R = w.deviceOrientation.beta ? l.Math.degToRad(w.deviceOrientation.beta) : 0, L = w.deviceOrientation.gamma ? l.Math.degToRad(w.deviceOrientation.gamma) : 0, A = w.screenOrientation ? l.Math.degToRad(w.screenOrientation) : 0; S(w.object, C, R, L, A); } }, this.dispose = function() { this.disconnect(); }, this.connect(); }, M = function() { var T = void 0, w = void 0, b = void 0, E = new l.Vector3(), S = new l.Vector3(), C = new l.Vector3(), R = new l.Vector3(), L = void 0; this.setCurrentCameraSettings = (A, P) => { T = A.clone(), w = A, b = P, T.near = b.nearPlane, b.farPlane && (T.far = b.farPlane), b.eyePosition && T.position.set(b.eyePosition[0], b.eyePosition[1], b.eyePosition[2]), b.upVector && T.up.set(b.upVector[0], b.upVector[1], b.upVector[2]), b.targetPosition && (T.target = new l.Vector3(b.targetPosition[0], b.targetPosition[1], b.targetPosition[2]), T.lookAt(T.target)), T.updateProjectionMatrix(), E.copy(T.position).project(T), S.copy(T.target).project(T); }, this.getCurrentPosition = () => (S.copy(w.target).project(T), [S.x, S.y]), this.zoom = (A) => { var P = 2e-3 * A, O = Math.max(w.zoom - P, 1); w.zoom = O, w.updateProjectionMatrix(); }, this.zoomToBox = (A, P) => { A.getCenter(C), C.project(T), this.setCenterZoom([C.x, C.y], P); }, this.getPanZoom = () => ({ target: this.getCurrentPosition(), zoom: w.zoom }), this.setCenterZoom = (A, P) => { C.set(A[0], A[1], S.z).unproject(T), R.copy(C).sub(w.target), w.target.copy(C), w.lookAt(w.target), w.position.add(R), w.zoom = P, w.updateProjectionMatrix(); }, this.setEventCallback = (A) => { (A === void 0 || typeof A == "function") && (L = A); }, this.triggerCallback = () => { L !== void 0 && typeof L == "function" && L(); }; }; s.Viewport = u, s.CameraControls = p, s.SmoothCameraTransition = m, s.RotateCameraTransition = g, s.RayCaster = d, s.CameraAutoTumble = y, s.StereoEffect = v, s.NDCCameraControl = M; }, /* 44 */ /***/ (a, s, c) => { var { Group: l, Matrix4: h } = c(4), u = c(22).Pointset; c(24).Lines; var p = c(45).Lines2, m = c(3).Geometry, g = c(4), d = 0, y = function() { return "re" + d++; }, f = function(v, _) { var M = v, T = new l(); T.matrixAutoUpdate = !1, T.userData = this; var w = [], b = "", E = [], S = _, C = new h(), R = 3e3; C.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 = () => { w.forEach((L) => L.hideAllPrimitives()), E.forEach((L) => L.setVisibility(!1)); }, this.showAllPrimitives = () => { w.forEach((L) => L.showAllPrimitives()), E.forEach((L) => L.setVisibility(!0)); }, this.setVisibility = (L) => { L != T.visible && (T.visible = L, this.pickableUpdateRequired = !0); }, this.getVisibility = () => T.visible, this.getGroup = () => T, this.setTransformation = (L) => { C.set(...L), T.matrix.copy(C), T.updateMatrixWorld(); }, this.setName = (L) => { L && L !== "" && (b = L); }, this.getName = () => b, this.getParent = () => M, this.getFullSeparatedPath = () => { var L = []; if (b !== "") { L.push(b); for (var A, P = M; P !== void 0; ) A = P.getName(), A !== "" && L.unshift(A), P = P.getParent(); } return L; }, this.getFullPath = () => { var L = this.getFullSeparatedPath(); if (0 < L.length) { var A = L.shift(); return L.forEach((P) => { A = A.concat("/", P); }), A; } return ""; }, this.createChild = (L) => { var A = new f(this, S); return A.setName(L), w.push(A), T.add(A.getGroup()), A; }, this.getChildWithName = (L) => { if (L) { for (var A = L.toLowerCase(), P = 0; P < w.length; P++) if (w[P].getName().toLowerCase() === A) return w[P]; } }, this.findChildFromSeparatedPath = (L) => { if (L && 0 < L.length && L[0] === "" && L.shift(), L && 0 < L.length) { var A = this.getChildWithName(L[0]); return A ? (L.shift(), A.findChildFromSeparatedPath(L)) : void 0; } return this; }, this.findChildFromPath = (L) => { var A = L.split("/"); return this.findChildFromSeparatedPath(A); }, this.createChildFromSeparatedPath = (L) => { if (0 < L.length && L[0] === "" && L.shift(), 0 < L.length) { var A = this.getChildWithName(L[0]); return A || (A = this.createChild(L[0])), L.shift(), A.createChildFromSeparatedPath(L); } return this; }, this.createChildFromPath = (L) => { var A = L.split("/"); return this.createChildFromSeparatedPath(A); }, this.findOrCreateChildFromPath = (L) => { var A = this.findChildFromPath(L); return A || (A = this.createChildFromPath(L)), A; }, this.addZincObject = (L) => { L && (L.setRegion(this), T.add(L.getGroup()), E.push(L), this.pickableUpdateRequired = !0, S && S.triggerObjectAddedCallback(L)); }, this.removeZincObject = (L) => { for (var A = 0; A < E.length; A++) if (L === E[A]) return T.remove(L.getGroup()), E.splice(A, 1), S && S.triggerObjectRemovedCallback(L), L.dispose(), void (this.pickableUpdateRequired = !0); }, this.checkPickableUpdateRequred = (L) => { if (this.pickableUpdateRequired) return !0; if (L) { for (var A = !1, P = 0; P < w.length; P++) if (A = w[P].checkPickableUpdateRequred(L), A) return !0; } return !1; }, this.getPickableThreeJSObjects = (L, A) => (T.visible && (E.forEach((P) => { if (P.getGroup() && P.getGroup().visible) { var O = P.marker; O && O.isEnabled() && L.push(O.getMorph()), L.push(P.getGroup()); } }), A && w.forEach((P) => { P.getPickableThreeJSObjects(L, A); }), this.pickableUpdateRequired = !1), L), this.setDuration = (L) => { R = L, E.forEach((A) => A.setDuration(L)), w.forEach((A) => A.setDuration(L)); }, this.getDuration = () => R, this.getBoundingBox = (L) => { var A, P; return E.forEach((O) => { P = O.getBoundingBox(), P && (A == null ? A = P.clone() : A.union(P)); }), L && w.forEach((O) => { P = O.getBoundingBox(L), P && (A == null ? A = P.clone() : A.union(P)); }), A; }, this.clear = (L) => { L && w.forEach((A) => A.clear(L)), E.forEach((A) => { T.remove(A.getGroup()), A.dispose(); }), w = [], E = []; }, this.objectIsInRegion = (L, A) => { for (var P = 0; P < E.length; P++) if (L === E[P]) return !0; if (A) { for (var O = 0; O < w.length; O++) if (w[O].objectIsInRegion(L, A)) return !0; } return !1; }, this.forEachGeometry = (L, A) => { E.forEach((P) => { P.isGeometry && L(P); }), A && w.forEach((P) => P.forEachGeometry(L, A)); }, this.forEachGlyphset = (L, A) => { E.forEach((P) => { P.isGlyphset && L(P); }), A && w.forEach((P) => P.forEachGlyphset(L, A)); }, this.forEachPointset = (L, A) => { E.forEach((P) => { P.isPointset && L(P); }), A && w.forEach((P) => P.forEachPointset(L, A)); }, this.forEachLine = (L, A) => { E.forEach((P) => { P.isLines && L(P); }), A && w.forEach((P) => P.forEachLine(L, A)); }, this.findObjectsWithAnatomicalId = (L, A) => (E.forEach((P) => { P.anatomicalId === L && objectsArray.push(P); }), A && w.forEach((P) => { var O = P.findObjectsWithAnatomicalId(L, A); objectsArray.push(...O); }), objectsArray), this.findObjectsWithGroupName = (L, A) => { var P = []; return E.forEach((O) => { var x = O.groupName ? O.groupName.toLowerCase() : O.groupName, I = L && L.toLowerCase(); x === I && P.push(O); }), A && w.forEach((O) => { var x = O.findObjectsWithGroupName(L, A); P.push(...x); }), P; }, this.findGeometriesWithGroupName = (L, A) => { var P = this.findObjectsWithGroupName(L, A), O = P.filter((x) => x.isGeometry); return O; }, this.findPointsetsWithGroupName = (L, A) => { var P = this.findObjectsWithGroupName(L, A), O = P.filter((x) => x.isPointset); return O; }, this.findGlyphsetsWithGroupName = (L, A) => { var P = this.findObjectsWithGroupName(L, A), O = P.filter((x) => x.isGlyphset); return O; }, this.findLinesWithGroupName = (L, A) => { var P = this.findObjectsWithGroupName(L, A), O = P.filter((x) => x.isLines); return O; }, this.getAllObjects = (L) => { var A = [...E]; return L && w.forEach((P) => { var O = P.getAllObjects(L); A.push(...O); }), A; }, this.getChildRegions = (L) => { var A = [...w]; return L && w.forEach((P) => { var O = P.getChildRegions(L); A.push(...O); }), A; }, this.getCurrentTime = () => { if (E[0] != null) return E[0].getCurrentTime(); for (var L, A = 0; A < w.length; A++) if (L = w[A].getCurrentTime(), L !== -1) return L; return -1; }, this.setMorphTime = (L, A) => { E.forEach((P) => { P.setMorphTime(L); }), A && w.forEach((P) => { P.setMorphTime(L); }); }, this.isTimeVarying = () => { for (var L = 0; L < E.length; L++) if (E[L].isTimeVarying()) return !0; for (var A = 0; A < w.length; A++) if (w[A].isTimeVarying()) return !0; return !1; }, this.renderGeometries = (L, A, P, O, x, I) => { var N, D = this.getAllObjects(I); D.forEach((k) => { k.render(L * A, P, O, x); }), x && P === !1 && (N = x.markerCluster) !== null && N !== void 0 && N.markerUpdateRequired && x.markerCluster.calculate(); }, this.createPoints = (L, A, P, O) => { var x = !1, I = this.findObjectsWithGroupName(L, !1), N = I.findIndex((k) => k.isPointset), D = -1 < N ? I[N] : new u(); return D.addPoints(A, P, O), N === -1 ? (D.setName(L), this.addZincObject(D), x = !0) : this.pickableUpdateRequired = !0, { zincObject: D, isNew: x }; }, this.createLines = (L, A, P) => { var O = !1, x = this.findObjectsWithGroupName(L, !1), I = x.findIndex((D) => D.isLines), N = -1 < I ? x[I] : new p(); return N.addLines(A, P), I === -1 ? (N.setName(L), this.addZincObject(N), O = !0) : this.pickableUpdateRequired = !0, { zincObject: N, isNew: O }; }, this.createGeometryFromThreeJSGeometry = (L, A, P, O, x, I) => { var N = new m(), D = new g.MeshPhongMaterial({ color: P, morphTargets: !1, morphNormals: !1, transparent: !0, opacity: O, side: g.DoubleSide }); return N.createMesh(A, D, { localTimeEnabled: !1, localMorphColour: !1 }), N.getMorph() ? (N.setVisibility(!1), N.setName(L), N.setRenderOrder(I), this.addZincObject(N), N) : void 0; }; }; s.Region = f; }, /* 45 */ /***/ (a, s, c) => { c(4), c(5).toBufferGeometry; var l = c(46).LineSegments2, h = c(48).LineMaterial, u = c(47).LineSegmentsGeometry, p = function() { c(24).Lines.call(this), this.isLines2 = !0; var m = Array(300); this.createLineSegment = (g, d, y) => { if (g && d) { var f = new u(); f.setPositions(g), f.colorsNeedUpdate = !0; var v = new l(f, d); v.scale.set(1, 1, 1), v.computeLineDistances(), this.setMesh(v, y.localTimeEnabled, y.localMorphColour); } }, this.setWidth = (g) => { this.morph && this.morph.material && (this.morph.material.linewidth = g, this.morph.material.needsUpdate = !0); }, this.addVertices = function(g) { if (g && g.length) { var d = this.getMorph(); d || (this.drawRange = 0); var y = 3 * this.drawRange; if (g.forEach((f) => { m[y++] = f[0], m[y++] = f[1], m[y++] = f[2], this.drawRange++; }), !d) for (; 300 > y; ) m[y++] = g[0][0], m[y++] = g[0][1], m[y++] = g[0][2]; d && (d.geometry.setPositions(m), d.computeLineDistances(), this.boundingBoxUpdateRequired = !0); } return m; }, this.getVerticesByFaceIndex = function(g) { var d = 3 * (2 * g), y = this.getMorph(); if (y && 3 * this.drawRange > d) { var f = y.geometry.getAttribute("instanceStart"); return [[f.data.array[d], f.data.array[++d], f.data.array[++d]], [f.data.array[++d], f.data.array[++d], f.data.array[++d]]]; } return []; }, this.editVertices = function(g, d) { if (g && g.length) { var y = this.getMorph(), f = d + g.length - 1; if (!y || 0 > d || f >= this.drawRange) return; var v = 3 * d; for (g.forEach((_) => { m[v++] = _[0], m[v++] = _[1], m[v++] = _[2]; }), v = 3 * this.drawRange; 300 > v; ) m[v++] = g[0][0], m[v++] = g[0][1], m[v++] = g[0][2]; y.geometry.setPositions(m), y.computeLineDistances(), this.boundingBoxUpdateRequired = !0; } return m; }, this.addLines = (g, d) => { if (g && 0 < g.length) { this.addVertices(g); var y = this.getMorph(); if (!y) { var f = new h({ color: d, linewidth: 1, vertexColors: !1, worldUnits: !1 }); f.resolution.set(window.innerWidth, window.innerHeight), this.createLineSegment(m, f, { localTimeEnabled: !1, localMorphColour: !1 }); } this.region && (this.region.pickableUpdateRequired = !0); } }, this.render = () => { var g = this.getMorph().material; g.resolution.set(window.innerWidth, window.innerHeight); }; }; p.prototype = Object.create(c(24).Lines.prototype), p.prototype.constructor = p, s.Lines2 = p; }, /* 46 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ LineSegments2: () => ( /* binding */ E ) /* harmony export */ }); var l = c(4), h = c(47), u = c(48), p = new l.Vector3(), m = new l.Vector3(), g = new l.Vector4(), d = new l.Vector4(), y = new l.Vector4(), f = new l.Vector3(), v = new l.Matrix4(), _ = new l.Line3(), M = new l.Vector3(), T = new l.Box3(), w = new l.Sphere(), b = new l.Vector4(); class E extends l.Mesh { constructor() { var C = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new h.LineSegmentsGeometry(), R = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new u.LineMaterial({ color: 16777215 * Math.random() }); super(C, R), this.type = "LineSegments2"; } // for backwards-compatability, but could be a method of LineSegmentsGeometry... computeLineDistances() { for (var C = this.geometry, R = C.attributes.instanceStart, L = C.attributes.instanceEnd, A = new Float32Array(2 * R.count), P = 0, O = 0, x = R.count; P < x; P++, O += 2) p.fromBufferAttribute(R, P), m.fromBufferAttribute(L, P), A[O] = O == 0 ? 0 : A[O - 1], A[O + 1] = A[O] + p.distanceTo(m); var I = new l.InstancedInterleavedBuffer(A, 2, 1); return C.setAttribute("instanceDistanceStart", new l.InterleavedBufferAttribute(I, 1, 0)), C.setAttribute("instanceDistanceEnd", new l.InterleavedBufferAttribute(I, 1, 1)), this; } raycast(C, R) { C.camera === null && console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.'); var L = C.params.Line2 === void 0 ? 0 : C.params.Line2.threshold || 0, A = C.ray, P = C.camera, O = P.projectionMatrix, x = this.matrixWorld, I = this.geometry, N = this.material, D = N.resolution, k = N.linewidth + L, F = I.attributes.instanceStart, W = I.attributes.instanceEnd, K = -P.near, ne = 2 * Math.max(k / D.width, k / D.height); I.boundingSphere === null && I.computeBoundingSphere(), w.copy(I.boundingSphere).applyMatrix4(x); var q = Math.max(P.near, w.distanceToPoint(A.origin)); b.set(0, 0, -q, 1).applyMatrix4(P.projectionMatrix), b.multiplyScalar(1 / b.w), b.applyMatrix4(P.projectionMatrixInverse); var z = 0.5 * Math.abs(ne / b.w); if (w.radius += z, C.ray.intersectsSphere(w) !== !1) { I.boundingBox === null && I.computeBoundingBox(), T.copy(I.boundingBox).applyMatrix4(x); var j = Math.max(P.near, T.distanceToPoint(A.origin)); b.set(0, 0, -j, 1).applyMatrix4(P.projectionMatrix), b.multiplyScalar(1 / b.w), b.applyMatrix4(P.projectionMatrixInverse); var Q = 0.5 * Math.abs(ne / b.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, C.ray.intersectsBox(T) !== !1) { A.at(1, y), y.w = 1, y.applyMatrix4(P.matrixWorldInverse), y.applyMatrix4(O), y.multiplyScalar(1 / y.w), y.x *= D.x / 2, y.y *= D.y / 2, y.z = 0, f.copy(y), v.multiplyMatrices(P.matrixWorldInverse, x); for (var Y = 0, ee = F.count; Y < ee; Y++) { g.fromBufferAttribute(F, Y), d.fromBufferAttribute(W, Y), g.w = 1, d.w = 1, g.applyMatrix4(v), d.applyMatrix4(v); var G = g.z > K && d.z > K; if (!G) { if (g.z > K) { var J = g.z - d.z, re = (g.z - K) / J; g.lerp(d, re); } else if (d.z > K) { var B = d.z - g.z, $ = (d.z - K) / B; d.lerp(g, $); } g.applyMatrix4(O), d.applyMatrix4(O), g.multiplyScalar(1 / g.w), d.multiplyScalar(1 / d.w), g.x *= D.x / 2, g.y *= D.y / 2, d.x *= D.x / 2, d.y *= D.y / 2, _.start.copy(g), _.start.z = 0, _.end.copy(d), _.end.z = 0; var te = _.closestPointToPointParameter(f, !0); _.at(te, M); var U = l.MathUtils.lerp(g.z, d.z, te), V = -1 <= U && 1 >= U, ae = f.distanceTo(M) < 0.5 * k; if (V && ae) { _.start.fromBufferAttribute(F, Y), _.end.fromBufferAttribute(W, Y), _.start.applyMatrix4(x), _.end.applyMatrix4(x); var ue = new l.Vector3(), de = new l.Vector3(); A.distanceSqToSegment(_.start, _.end, de, ue), R.push({ point: de, pointOnLine: ue, distance: A.origin.distanceTo(de), object: this, face: null, faceIndex: Y, uv: null, uv2: null }); } } } } } } } E.prototype.LineSegments2 = !0; }, /* 47 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ LineSegmentsGeometry: () => ( /* binding */ p ) /* harmony export */ }); var l = c(4), h = new l.Box3(), u = 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(g) { var d = this.attributes.instanceStart, y = this.attributes.instanceEnd; return d !== void 0 && (d.applyMatrix4(g), y.applyMatrix4(g), d.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this; } setPositions(g) { var d; g instanceof Float32Array ? d = g : Array.isArray(g) && (d = new Float32Array(g)); var y = new l.InstancedInterleavedBuffer(d, 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(g) { var d; g instanceof Float32Array ? d = g : Array.isArray(g) && (d = new Float32Array(g)); var y = new l.InstancedInterleavedBuffer(d, 6, 1); return this.setAttribute("instanceColorStart", new l.InterleavedBufferAttribute(y, 3, 0)), this.setAttribute("instanceColorEnd", new l.InterleavedBufferAttribute(y, 3, 3)), this; } fromWireframeGeometry(g) { return this.setPositions(g.attributes.position.array), this; } fromEdgesGeometry(g) { return this.setPositions(g.attributes.position.array), this; } fromMesh(g) { return this.fromWireframeGeometry(new l.WireframeGeometry(g.geometry)), this; } fromLineSegments(g) { var d = g.geometry; return d.isGeometry ? void console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.") : (d.isBufferGeometry && this.setPositions(d.attributes.position.array), this); } computeBoundingBox() { this.boundingBox === null && (this.boundingBox = new l.Box3()); var g = this.attributes.instanceStart, d = this.attributes.instanceEnd; g !== void 0 && d !== void 0 && (this.boundingBox.setFromBufferAttribute(g), h.setFromBufferAttribute(d), this.boundingBox.union(h)); } computeBoundingSphere() { this.boundingSphere === null && (this.boundingSphere = new l.Sphere()), this.boundingBox === null && this.computeBoundingBox(); var g = this.attributes.instanceStart, d = this.attributes.instanceEnd; if (g !== void 0 && d !== void 0) { var y = this.boundingSphere.center; this.boundingBox.getCenter(y); for (var f = 0, v = 0, _ = g.count; v < _; v++) u.fromBufferAttribute(g, v), f = Math.max(f, y.distanceToSquared(u)), u.fromBufferAttribute(d, v), f = Math.max(f, y.distanceToSquared(u)); this.boundingSphere.radius = Math.sqrt(f), 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(g) { return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."), this.applyMatrix4(g); } } p.prototype.isLineSegmentsGeometry = !0; }, /* 48 */ /***/ (a, s, c) => { c.r(s), c.d(s, { /* harmony export */ LineMaterial: () => ( /* binding */ h ) /* 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 h 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(m) { this.uniforms.diffuse.value = m; } }, linewidth: { enumerable: !0, get: function() { return this.uniforms.linewidth.value; }, set: function(m) { this.uniforms.linewidth.value = m; } }, dashed: { enumerable: !0, get: function() { return "USE_DASH" in this.defines; }, set(m) { !!m != "USE_DASH" in this.defines && (this.needsUpdate = !0), m === !0 ? this.defines.USE_DASH = "" : delete this.defines.USE_DASH; } }, dashScale: { enumerable: !0, get: function() { return this.uniforms.dashScale.value; }, set: function(m) { this.uniforms.dashScale.value = m; } }, dashSize: { enumerable: !0, get: function() { return this.uniforms.dashSize.value; }, set: function(m) { this.uniforms.dashSize.value = m; } }, dashOffset: { enumerable: !0, get: function() { return this.uniforms.dashOffset.value; }, set: function(m) { this.uniforms.dashOffset.value = m; } }, gapSize: { enumerable: !0, get: function() { return this.uniforms.gapSize.value; }, set: function(m) { this.uniforms.gapSize.value = m; } }, opacity: { enumerable: !0, get: function() { return this.uniforms.opacity.value; }, set: function(m) { this.uniforms.opacity.value = m; } }, resolution: { enumerable: !0, get: function() { return this.uniforms.resolution.value; }, set: function(m) { this.uniforms.resolution.value.copy(m); } }, alphaToCoverage: { enumerable: !0, get: function() { return "ALPHA_TO_COVERAGE" in this.defines; }, set: function(m) { !!m != "ALPHA_TO_COVERAGE" in this.defines && (this.needsUpdate = !0), m === !0 ? (this.defines.ALPHA_TO_COVERAGE = "", this.extensions.derivatives = !0) : (delete this.defines.ALPHA_TO_COVERAGE, this.extensions.derivatives = !1); } } }), this.setValues(p); } } h.prototype.isLineMaterial = !0; }, /* 49 */ /***/ (a, s, c) => { var l = c(4); s.Minimap = function(h) { var u = h; 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(), m = new Float32Array([-1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1]), g = new l.BufferAttribute(m, 3); p.setAttribute("position", g); var d = new l.MeshBasicMaterial({ color: 3355443, depthTest: !1, depthWrite: !1, opacity: 0.5, transparent: !0 }); this.mask = new l.Mesh(p, d); var y = new l.Box3(), f = new l.Vector3(); this.getDiffFromNormalised = (_, M) => { y.setFromBufferAttribute(g).getCenter(f); var T = f.clone().project(this.camera), w = new l.Vector3(_, M, T.z).unproject(this.camera); return w.sub(f); }; var v = (_, M) => { u.camera.near && (this.camera.near = u.camera.near), M.farPlane && (this.camera.far = M.farPlane), M.eyePosition && this.camera.position.set(M.eyePosition[0], M.eyePosition[1], M.eyePosition[2]), M.upVector && this.camera.up.set(M.upVector[0], M.upVector[1], M.upVector[2]), M.targetPosition && this.camera.lookAt(new l.Vector3(M.targetPosition[0], M.targetPosition[1], M.targetPosition[2])), this.camera.zoom = 1 / _, this.camera.updateProjectionMatrix(); }; this.getBoundary = () => { var _ = new l.Vector3().copy(u.camera.target).project(u.camera), M = new l.Vector3(-1, -1, _.z).unproject(u.camera), T = new l.Vector3(1, -1, _.z).unproject(u.camera), w = new l.Vector3(1, 1, _.z).unproject(u.camera), b = new l.Vector3(-1, 1, _.z).unproject(u.camera); g.copyVector3sArray([M, T, w, w, b, M]), g.needsUpdate = !0; }, this.updateCamera = () => { this.getBoundary(); var _ = u.getZincCameraControls(), M = u.getBoundingBox(); if (M) { var T = M.min.distanceTo(M.max), w = T / 2, b = (M.min.x + M.max.x) / 2, E = (M.min.y + M.max.y) / 2, S = (M.min.z + M.max.z) / 2, C = _.getViewportFromCentreAndRadius(b, E, S, w, 40, w * 4); v(T, C); } }; }; }, /* 50 */ /***/ (a, s, c) => { var l = c(4), h = c(51)(l), u = c(3).Geometry, p = c(52), m = c(53).default, g = l.BufferGeometryLoader, d = function(y) { var f; y && y.isGeometry && (f = y); var v = void 0, _ = void 0, M = !1, T = void 0, w = (R) => { var L = f.getMorph().material.clone(); L.morphTargets = !1; var A = new u(), P = new g(), O = P.parse(R), x = new l.Mesh(O.geometry, L); return A.geometry = x.geometry, x.userData = A, A.setMorph(x), A; }, b = (R) => { switch (R.data.action) { case "message": console.log(R.data.message); break; case "result": var L = new d(w(R.data.object)); T && T(L), T = void 0, M = !1; break; default: throw "Cannot handle specified action."; } }, E = (R) => { if (p !== void 0 && (_ = p( /*require.resolve*/ 54 )), !_) v = new (c(55)).GeometryCSGInternal(R); else if (R && R.isGeometry) { var L = R.getMorph(), A = L.geometry.clone().applyMatrix(L.matrix).toJSON(); _.addEventListener("message", function(P) { b(P); }), _.postMessage({ action: "initialise", object: A }); } }; this.getHostGeometry = () => { var R = new h(f.getMorph()); return new S(R); }, this.getGeometry = () => f; var S = (R) => { var L = f.getMorph().material.clone(); L.morphTargets = !1; var A = R.toMesh(L), P = new u(); return P.geometry = A.geometry, A.userData = P, P.setMorph(A), P; }; this.setCSG = (R) => { v.setCSG(R); }; var C = (R, L, A, P) => { if (M) P("On progress"); else { var O = R.getMorph(), x = O.geometry.clone().applyMatrix(O.matrix).toJSON(); T = A, M = !0, _.postMessage({ action: L, object: x }); } }; this.intersect = (R) => new m((L, A) => { if (_) C(R, "intersect", L, A); else { var P = v.intersect(R), O = new d(S(P)); O.setCSG(P), L(O); } }), this.subtract = (R) => new m((L, A) => { if (_) C(R, "intersect", L, A); else { var P = v.subtract(R), O = new d(S(P)); O.setCSG(P), L(O); } }), this.union = (R) => new m((L, A) => { if (_) C(R, "intersect", L, A); else { var P = v.union(R), O = new d(S(P)); O.setCSG(P), L(O); } }), this.terminateWorker = () => { _ && _.terminate(); }, E(y); }; s.GeometryCSG = d; }, /* 51 */ /***/ (a) => { var s = 1e-5, c = 0, l = 1, h = 2, u = 3; a.exports = function(p) { var m = function(g) { var d, y, f, v, _, M, T, w = []; if (g.isBufferGeometry && (g = new p.Geometry().fromBufferGeometry(g)), g instanceof p.Geometry) this.matrix = new p.Matrix4(); else if (g.isMesh) g.updateMatrix(), this.matrix = g.matrix.clone(), g = g.geometry, g.isBufferGeometry && (g = new p.Geometry().fromBufferGeometry(g)), g.mergeVertices(), g.computeVertexNormals(!1); else { if (g instanceof m.Node) return this.tree = g, this.matrix = new p.Matrix4(), this; throw "ThreeBSP: Given geometry is unsupported"; } for (d = 0, y = g.faces.length; d < y; d++) f = g.faces[d], _ = g.faceVertexUvs[0][d], T = new m.Polygon(), f instanceof p.Face3 ? (v = g.vertices[f.a], M = _ ? new p.Vector2(_[0].x, _[0].y) : null, v = new m.Vertex(v.x, v.y, v.z, f.vertexNormals[0], M), v.applyMatrix4(this.matrix), T.vertices.push(v), v = g.vertices[f.b], M = _ ? new p.Vector2(_[1].x, _[1].y) : null, v = new m.Vertex(v.x, v.y, v.z, f.vertexNormals[2], M), v.applyMatrix4(this.matrix), T.vertices.push(v), v = g.vertices[f.c], M = _ ? new p.Vector2(_[2].x, _[2].y) : null, v = new m.Vertex(v.x, v.y, v.z, f.vertexNormals[2], M), v.applyMatrix4(this.matrix), T.vertices.push(v)) : (p.Face4, v = g.vertices[f.a], M = _ ? new p.Vector2(_[0].x, _[0].y) : null, v = new m.Vertex(v.x, v.y, v.z, f.vertexNormals[0], M), v.applyMatrix4(this.matrix), T.vertices.push(v), v = g.vertices[f.b], M = _ ? new p.Vector2(_[1].x, _[1].y) : null, v = new m.Vertex(v.x, v.y, v.z, f.vertexNormals[1], M), v.applyMatrix4(this.matrix), T.vertices.push(v), v = g.vertices[f.c], M = _ ? new p.Vector2(_[2].x, _[2].y) : null, v = new m.Vertex(v.x, v.y, v.z, f.vertexNormals[2], M), v.applyMatrix4(this.matrix), T.vertices.push(v), v = g.vertices[f.d], M = _ ? new p.Vector2(_[3].x, _[3].y) : null, v = new m.Vertex(v.x, v.y, v.z, f.vertexNormals[3], M), v.applyMatrix4(this.matrix), T.vertices.push(v)), T.calculateProperties(), w.push(T); this.tree = new m.Node(w); }; return m.prototype.subtract = function(g) { var d = this.tree.clone(), y = g.tree.clone(); return d.invert(), d.clipTo(y), y.clipTo(d), y.invert(), y.clipTo(d), y.invert(), d.build(y.allPolygons()), d.invert(), d = new m(d), d.matrix = this.matrix, d; }, m.prototype.union = function(g) { var d = this.tree.clone(), y = g.tree.clone(); return d.clipTo(y), y.clipTo(d), y.invert(), y.clipTo(d), y.invert(), d.build(y.allPolygons()), d = new m(d), d.matrix = this.matrix, d; }, m.prototype.intersect = function(g) { var d = this.tree.clone(), y = g.tree.clone(); return d.invert(), y.clipTo(d), y.invert(), d.clipTo(y), y.clipTo(d), d.build(y.allPolygons()), d.invert(), d = new m(d), d.matrix = this.matrix, d; }, m.prototype.toGeometry = function() { var g, d, y, f, v, _, M, T, w, b, E = new p.Matrix4().getInverse(this.matrix), S = new p.Geometry(), C = this.tree.allPolygons(), R = C.length, L = {}; for (g = 0; g < R; g++) for (y = C[g], f = y.vertices.length, d = 2; d < f; d++) b = [], T = y.vertices[0], b.push(new p.Vector2(T.uv.x, T.uv.y)), T = new p.Vector3(T.x, T.y, T.z), T.applyMatrix4(E), typeof L[T.x + "," + T.y + "," + T.z] > "u" ? (S.vertices.push(T), v = L[T.x + "," + T.y + "," + T.z] = S.vertices.length - 1) : v = L[T.x + "," + T.y + "," + T.z], T = y.vertices[d - 1], b.push(new p.Vector2(T.uv.x, T.uv.y)), T = new p.Vector3(T.x, T.y, T.z), T.applyMatrix4(E), typeof L[T.x + "," + T.y + "," + T.z] > "u" ? (S.vertices.push(T), _ = L[T.x + "," + T.y + "," + T.z] = S.vertices.length - 1) : _ = L[T.x + "," + T.y + "," + T.z], T = y.vertices[d], b.push(new p.Vector2(T.uv.x, T.uv.y)), T = new p.Vector3(T.x, T.y, T.z), T.applyMatrix4(E), typeof L[T.x + "," + T.y + "," + T.z] > "u" ? (S.vertices.push(T), M = L[T.x + "," + T.y + "," + T.z] = S.vertices.length - 1) : M = L[T.x + "," + T.y + "," + T.z], w = new p.Face3(v, _, M, new p.Vector3(y.normal.x, y.normal.y, y.normal.z)), S.faces.push(w), S.faceVertexUvs[0].push(b); return S; }, m.prototype.toBufferGeometry = function() { var g = this.toGeometry(), d = new p.BufferGeometry().fromGeometry(g); return d; }, m.prototype.toMesh = function(g) { var d = this.toBufferGeometry(), y = new p.Mesh(d, g); return y.position.setFromMatrixPosition(this.matrix), y.rotation.setFromRotationMatrix(this.matrix), y; }, m.Polygon = function(g) { g instanceof Array || (g = []), this.vertices = g, 0 < g.length ? this.calculateProperties() : this.normal = this.w = void 0; }, m.Polygon.prototype.calculateProperties = function() { var g = this.vertices[0], d = this.vertices[1], y = this.vertices[2]; return this.normal = d.clone().subtract(g).cross(y.clone().subtract(g)).normalize(), this.w = this.normal.clone().dot(g), this; }, m.Polygon.prototype.clone = function() { var g, d, y = new m.Polygon(); for (g = 0, d = this.vertices.length; g < d; g++) y.vertices.push(this.vertices[g].clone()); return y.calculateProperties(), y; }, m.Polygon.prototype.flip = function() { var g, d = []; for (this.normal.multiplyScalar(-1), this.w *= -1, g = this.vertices.length - 1; 0 <= g; g--) d.push(this.vertices[g]); return this.vertices = d, this; }, m.Polygon.prototype.classifyVertex = function(g) { var d = this.normal.dot(g) - this.w; return d < -s ? h : d > s ? l : c; }, m.Polygon.prototype.classifySide = function(g) { var d, y, f, v = 0, _ = 0, M = g.vertices.length; for (d = 0; d < M; d++) y = g.vertices[d], f = this.classifyVertex(y), f === l ? v++ : f === h && _++; return 0 < v && _ === 0 ? l : v === 0 && 0 < _ ? h : v === 0 && _ === 0 ? c : u; }, m.Polygon.prototype.splitPolygon = function(g, d, y, f, v) { var _ = this.classifySide(g); if (_ === c) (0 < this.normal.dot(g.normal) ? d : y).push(g); else if (_ === l) f.push(g); else if (_ === h) v.push(g); else { var M, T, w, b, E, S, C, R, L, A = [], P = []; for (T = 0, M = g.vertices.length; T < M; T++) w = (T + 1) % M, S = g.vertices[T], C = g.vertices[w], b = this.classifyVertex(S), E = this.classifyVertex(C), b != h && A.push(S), b != l && P.push(S), (b | E) == u && (R = (this.w - this.normal.dot(S)) / this.normal.dot(C.clone().subtract(S)), L = S.interpolate(C, R), A.push(L), P.push(L)); 3 <= A.length && f.push(new m.Polygon(A).calculateProperties()), 3 <= P.length && v.push(new m.Polygon(P).calculateProperties()); } }, m.Vertex = function(g, d, y, f, v) { this.x = g, this.y = d, this.z = y, this.normal = f || new p.Vector3(), this.uv = v || new p.Vector2(); }, m.Vertex.prototype.clone = function() { return new m.Vertex(this.x, this.y, this.z, this.normal.clone(), this.uv.clone()); }, m.Vertex.prototype.add = function(g) { return this.x += g.x, this.y += g.y, this.z += g.z, this; }, m.Vertex.prototype.subtract = function(g) { return this.x -= g.x, this.y -= g.y, this.z -= g.z, this; }, m.Vertex.prototype.multiplyScalar = function(g) { return this.x *= g, this.y *= g, this.z *= g, this; }, m.Vertex.prototype.cross = function(g) { var d = this.x, y = this.y, f = this.z; return this.x = y * g.z - f * g.y, this.y = f * g.x - d * g.z, this.z = d * g.y - y * g.x, this; }, m.Vertex.prototype.normalize = function() { var g = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); return this.x /= g, this.y /= g, this.z /= g, this; }, m.Vertex.prototype.dot = function(g) { return this.x * g.x + this.y * g.y + this.z * g.z; }, m.Vertex.prototype.lerp = function(g, d) { return this.add(g.clone().subtract(this).multiplyScalar(d)), this.normal.add(g.normal.clone().sub(this.normal).multiplyScalar(d)), this.uv.add(g.uv.clone().sub(this.uv).multiplyScalar(d)), this; }, m.Vertex.prototype.interpolate = function(g, d) { return this.clone().lerp(g, d); }, m.Vertex.prototype.applyMatrix4 = function(g) { var d = this.x, y = this.y, f = this.z, v = g.elements; return this.x = v[0] * d + v[4] * y + v[8] * f + v[12], this.y = v[1] * d + v[5] * y + v[9] * f + v[13], this.z = v[2] * d + v[6] * y + v[10] * f + v[14], this; }, m.Node = function(g) { var d, y, f = [], v = []; if (this.polygons = [], this.front = this.back = void 0, g instanceof Array && g.length !== 0) { for (this.divider = g[0].clone(), d = 0, y = g.length; d < y; d++) this.divider.splitPolygon(g[d], this.polygons, this.polygons, f, v); 0 < f.length && (this.front = new m.Node(f)), 0 < v.length && (this.back = new m.Node(v)); } }, m.Node.isConvex = function(g) { var d, y; for (d = 0; d < g.length; d++) for (y = 0; y < g.length; y++) if (d !== y && g[d].classifySide(g[y]) !== h) return !1; return !0; }, m.Node.prototype.build = function(g) { var d, y, f = [], v = []; for (this.divider || (this.divider = g[0].clone()), d = 0, y = g.length; d < y; d++) this.divider.splitPolygon(g[d], this.polygons, this.polygons, f, v); 0 < f.length && (!this.front && (this.front = new m.Node()), this.front.build(f)), 0 < v.length && (!this.back && (this.back = new m.Node()), this.back.build(v)); }, m.Node.prototype.allPolygons = function() { var g = this.polygons.slice(); return this.front && (g = g.concat(this.front.allPolygons())), this.back && (g = g.concat(this.back.allPolygons())), g; }, m.Node.prototype.clone = function() { var g = new m.Node(); return g.divider = this.divider.clone(), g.polygons = this.polygons.map(function(d) { return d.clone(); }), g.front = this.front && this.front.clone(), g.back = this.back && this.back.clone(), g; }, m.Node.prototype.invert = function() { var g, d, y; for (g = 0, d = this.polygons.length; g < d; g++) this.polygons[g].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; }, m.Node.prototype.clipPolygons = function(g) { var d, y, f, v; if (!this.divider) return g.slice(); for (f = [], v = [], d = 0, y = g.length; d < y; d++) this.divider.splitPolygon(g[d], f, v, f, v); return this.front && (f = this.front.clipPolygons(f)), v = this.back ? this.back.clipPolygons(v) : [], f.concat(v); }, m.Node.prototype.clipTo = function(g) { this.polygons = g.clipPolygons(this.polygons), this.front && this.front.clipTo(g), this.back && this.back.clipTo(g); }, m; }; }, /* 52 */ /***/ (a) => { a.exports = R4(); }, /* 53 */ /***/ (a) => { a.exports = z4; }, /* 54 */ /***/ (a, s, c) => { var l = c(3).Geometry, h = c(4), u = h.BufferGeometryLoader; a.exports = function(p) { var m = void 0, g = function(_) { var M = new u(), T = M.parse(_), w = new h.MeshPhongMaterial(), b = new h.Mesh(T.geometry, w), E = new l(); return E.setMorph(b), E; }, d = function(_) { var M = g(_); m = new (c(55)).GeometryCSGInternal(M), p.postMessage({ action: "message", message: "Initialised" }); }, y = function(_) { if (m) { var M = g(_), T = m.intersect(M), w = T.toBufferGeometry().toJSON(); p.postMessage({ action: "result", object: w }); } }, f = function(_) { if (m) { var M = g(_), T = m.subtract(M), w = T.toBufferGeometry().toJSON(); p.postMessage({ action: "result", object: w }); } }, v = function(_) { if (m) { var M = g(_), T = m.union(M), w = T.toBufferGeometry().toJSON(); p.postMessage({ action: "result", object: w }); } }; p.addEventListener("message", function(_) { switch (_.data.action) { case "initialise": d(_.data.object); break; case "intersect": y(_.data.object); break; case "subtract": f(_.data.object); break; case "union": v(_.data.object); break; default: throw "Cannot handle specified action."; } }); }; }, /* 55 */ /***/ (a, s, c) => { var l = c(4), h = c(51)(l); c(3).Geometry, c(50).GeometryCSG; var u = function(p) { var m; p && p.isGeometry && (m = p); var g; this.setGeometry = (y) => { y && y.isGeometry && (m = y), g = void 0; }, this.setCSG = (y) => { g = y; }; var d = (y) => { if (m && m.morph && y && y.morph) { g === void 0 && (g = new h(m.morph)); var f = new h(y.morph); return f; } }; this.intersect = (y) => { var f = d(y); return g && f ? g.intersect(f) : void 0; }, this.subtract = (y) => { var f = d(y); return g && f ? g.subtract(f) : void 0; }, this.union = (y) => { var f = d(y); return g && f ? g.union(f) : void 0; }; }; s.GeometryCSGInternal = u; }, /* 56 */ /***/ (a, s, c) => { var l = c(4), h = c(51)(l); c(18).Glyphset; var u = function(p) { var m; p && p.isGlyphset && (m = p); var g = []; this.setGlyphset = (f) => { f && f.isGlyphset && (m = f), hostCSG = void 0; }, this.getGlyphset = () => m; var d = () => (f) => { var v = f.getMesh(), _ = f.getLabel(); if (v) { var M = new h(v.geometry.clone().applyMatrix(v.matrix)), T = []; T.csg = M, T.label = _, v.material && (T.material = v.material.clone()), g.push(T); } }, y = (f) => { if (m && f && f.getMorph()) { g.length == 0 && m.forEachGlyph(d()); var v = new h(f.getMorph()); return v; } }; this.intersect = (f) => { var v = y(f); if (0 < g.length && v) { for (var _ = new (c(18)).Glyphset(), M = 0; M < g.length; M++) { var T = g[M], w = T.csg.intersect(v), b = w.toMesh(); if (b && b.geometry && 0 < b.geometry.vertices.length) { T.material && (b.material = T.material, b.material.side = l.DoubleSide, b.material.clippingPlanes = null); var E = _.addMeshAsGlyph(b, M + 1); E.setLabel(T.label); } } var S = new u(_); return S; } }; }; s.GlyphsetCSG = u; } /******/ ], r = {}; function n(a) { var s = r[a]; if (s !== void 0) return s.exports; var c = r[a] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; return t[a].call(c.exports, c, c.exports, n), c.exports; } n.n = (a) => { var s = a && a.__esModule ? ( /******/ () => a.default ) : ( /******/ () => a ); return n.d(s, { a: s }), s; }, n.d = (a, s) => { for (var c in s) n.o(s, c) && !n.o(a, c) && Object.defineProperty(a, c, { enumerable: !0, get: s[c] }); }, n.o = (a, s) => Object.prototype.hasOwnProperty.call(a, s), n.r = (a) => { typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(a, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(a, "__esModule", { value: !0 }); }; var o = n(0); return o; })() )); })(Dy); var zn = Dy.exports; const Hc = /* @__PURE__ */ sL(zn), $v = (i, e) => { if (i) { let t = ""; i.forEach((r) => { t = r.uuid, r.region && (t = r.region.uuid + "/" + t), r && r.getVisibility() && e.push(t); }); } return e; }, Xd = (i, e) => { const t = i[0] - e[0], r = i[1] - e[1], n = i[2] - e[2]; return Math.sqrt(t * t + r * r + n * n); }, U4 = (i) => { const e = i.zincObjects; if (e.length > 0 && e[0]) { const t = e[0]; if (t.isEditable && t.isLines2) { const r = i.identifiers[0].extraData.intersected; if (r && r.faceIndex > -1) { const n = t.getVerticesByFaceIndex(r.faceIndex), o = i.identifiers[0].extraData.intersected.pointOnLine; if (n.length > 1) { const a = Xd(n[0], [o.x, o.y, o.z]), s = Xd(n[1], [o.x, o.y, o.z]); return a > s ? { zincObject: t, faceIndex: r.faceIndex, vertexIndex: r.faceIndex * 2 + 1, point: n[0] } : { zincObject: t, faceIndex: r.faceIndex, vertexIndex: r.faceIndex * 2, point: n[1] }; } } } } }, V4 = (i) => { const e = i.zincObjects; if (e.length > 0 && e[0]) { const t = e[0]; if (t.isEditable) return t; } }, H4 = (i, e, t) => { if (i != null && i.isEditable && i != null && i.isPointset) { let r = !1; for (let n = 0; n < 3 && !r; n++) t[n] !== 0 && (r = !0); if (r && e > -1) { const n = i.getVerticesByIndex(e); return n && (n[0] = n[0] + t[0], n[1] = n[1] + t[1], n[2] = n[2] + t[2]), i.editVertices([n], e), i.boundingBoxUpdateRequired = !0, !0; } } return !1; }, Oc = (i, e) => { if (i != null && i.isEditable && i != null && i.isLines2 && e > -1) { const t = i.getVerticesByFaceIndex(e); if (t && t.length > 1) return Xd(t[1], t[0]); } return 0; }, jh = (i, e, t, r) => { if (i && t !== 0 && i.isEditable && i.isLines2 && e > -1) { const n = i.getVerticesByFaceIndex(e); let o = [n[1][0] - n[0][0], n[1][1] - n[0][1], n[1][2] - n[0][2]]; const a = Math.sqrt(o[0] * o[0] + o[1] * o[1] + o[2] * o[2]); for (let s = 0; s < 3; s++) o[s] = o[s] / a * t, r ? n[1][s] = n[0][s] + o[s] : (n[0][s] = n[0][s] + o[s], n[1][s] = n[1][s] + o[s]); return i.editVertices(n, e * 2), i.boundingBoxUpdateRequired = !0, !0; } return !1; }, j4 = (i, e) => { const t = e.getBoundingBox(), r = new zn.THREE.Vector3().subVectors(t.max, t.min), n = new zn.THREE.BoxGeometry(r.x, r.y, r.z); r.addVectors(t.min, t.max).multiplyScalar(0.5); const o = n.getAttribute("position"), a = o.count, s = []; for (let c = 0; c < a; c++) s[c] = [ o.array[c * 3], o.array[c * 3 + 1], o.array[c * 3 + 2] ]; i.editVertices(s, 0), i.setPosition(r.x, r.y, r.z), n.dispose(); }, O1 = (i, e) => { let t = ""; i.isRegion && (t = `__r${i.regionPath}`), i.isPrimitives && (t = `${i.regionPath}/${i.label}`), e.push(t), i.children && i.children.forEach((r) => O1(r, e)); }, Aa = (i, e, t, r) => { let n = i; const o = []; if (t && (n = i.findChildFromPath(t)), n) { const a = Array.isArray(e); let s = e; a || (s = [s]), s.forEach((c) => { const l = n.findObjectsWithGroupName(c, r); o.push(...l); }); } return o; }, Zd = (i, e, t) => { const r = i.findIndex((o) => o.uuid === e); let n; return r > -1 && (n = i[r], t && i.splice(r, 1)), n; }, G4 = (i, e) => { const t = []; if (i && e && e.length > 0) { const r = {}, n = {}, o = [i, ...i.getChildRegions(!0)]; let a, s, c; e.forEach((l) => { const h = l.split("/"); c = h[0], a = Zd(o, c, !1), a && (n[c] || (n[c] = a.getFullPath()), h[1] ? (r[c] || (r[c] = a.getAllObjects(!1)), s = Zd(r[c], h[1], !0), s && t.push(`${n[c]}/${s.groupName}`)) : t.push(`__r/${n[c]}`)); }); } return t; }, W4 = (i) => { if (i) { const e = []; return i.forEach((t) => { t.isZincObject ? e.push(t) : t.isRegion && e.push(...t.getAllObjects(!0)); }), Object.values( e.reduce((t, r) => ({ ...t, [r.uuid]: r }), {}) ); } return []; }, qv = (i, e) => { const t = { label: "Multiple selections", regionPath: "", objects: [] }; if (e && i) { const r = {}, n = i.getRootRegion(); e.length > 0 && (t.regionPath = e[0].data.region, t.label = e[0].data.group), e.forEach((o) => { o.data.region.includes(t.regionPath) || (t.regionPath = ""), t.label !== o.data.group && (t.label = "Multiple selections"); const a = n.findChildFromPath(o.data.region); r[a.uuid] || (r[a.uuid] = a.getAllObjects(!1)); const s = Zd(r[a.uuid], o.data.uuid); s && t.objects.push(s); }); } return t; }, $4 = (i) => { const e = i.getMorph(); let t = "position"; i.isLines2 && (t = "instanceStart"); const r = []; let n = 0; const o = e.geometry.getAttribute(t); for (let a = 0; a < i.drawRange; a++) r.push([ o.array[n++], o.array[n++], o.array[n++] ]); return r; }, q4 = (i, e, t, r, n) => { let o; if (i.isPointset ? o = "MultiPoint" : i.isLines2 && (o = "MultiLineString"), o) { const a = $4(i); let s = e.slice(-1) === "/" ? e : e + "/"; s = s + t; const c = s, l = { resource: r, item: { id: c }, body: { evidence: [], comment: n }, feature: { id: c, properties: { drawn: !0, label: "Drawn annotation" }, geometry: { coordinates: a, type: o } } }; return n === "Deleted" && (l.feature = void 0), l; } }, Xv = (i, e, t, r, n, o, a) => { const s = q4(t, r, n, o, a); if (s) return i && i.currentUser && (s.creator = { ...i.currentUser }, s.creator.orcid || (s.creator.orcid = "0000-0000-0000-0000"), i.addAnnotation(e, s).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"); })), s; }, Zv = async (i, e, t) => { const r = t; return await i.drawnFeatures(e, r); }, Gh = (i, e) => { i && e.forEach((t) => { const r = t.geometry, n = decodeURIComponent(t.id), o = n.lastIndexOf("/"), a = n.substring(0, o), s = n.substring(o + 1); let c; r.type === "MultiPoint" ? c = i.createPoints( a, s, r.coordinates, s, 8942 ) : r.type === "MultiLineString" && (c = i.createLines( a, s, r.coordinates, 60962 )), c && (c.zincObject.isEditable = !0); }); }, wn = (i, e) => { const t = i.__vccOpts || i; for (const [r, n] of e) t[r] = n; return t; }, X4 = { name: "LinesControls", components: { Button: os, Col: Mr, Container: jr, InputNumber: yn, Main: vn, Slider: lr, ElIconArrowLeft: Wn, ElIconArrowRight: $n }, props: { createData: { type: Object } }, data: function() { return { adjust: 0, pAdjust: 0, lengthScale: 0, distance: 0, newDistance: 0, width: 1, currentIndex: 0, ElIconArrowLeft: Pi(Wn), ElIconArrowRight: Pi($n), edited: !1, zincObject: void 0 }; }, watch: { "createData.faceIndex": { handler: function(i) { var e; (e = this.zincObject) != null && e.isLines2 && (this.currentIndex = i, this.distance = Oc(this.zincObject, this.currentIndex)); }, immediate: !0 } }, methods: { changeIndex: function(i) { i ? Oc(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 = jh( 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 = jh( this.zincObject, this.currentIndex, this.newDistance, !0 ) || this.edited; }, onMoveSliding: function() { const i = (this.adjust - this.pAdjust) * this.distance; this.edited = jh( this.zincObject, this.currentIndex, i, !1 ) || this.edited, this.pAdjust = this.adjust; }, reset: function() { this.adjust = 0, this.pAdjust = 0, this.lengthScale = 0, this.distance = Oc(this.zincObject, this.currentIndex), this.newDistance = this.distance, this.edited && (this.$emit("primitivesUpdated", this.zincObject), this.edited = !1); }, setObject: function(i) { this.currentIndex = -1, this.distance = 0, i.isLines2 ? (this.zincObject = Ai(i), this.width = this.zincObject.getMorph().material.linewidth, i.isEditable && (this.currentIndex = 0, this.distance = Oc(i, this.currentIndex))) : (this.zincObject = void 0, this.width = 10); }, modifyWidth: function() { this.zincObject.setWidth(this.width); } } }; function Z4(i, e, t, r, n, o) { const a = Mr, s = lr, c = yn, l = Hr, h = os, u = vn, p = jr; return fe(), He(p, { class: "lines-container" }, { default: pe(() => [ se(u, { class: "slides-block" }, { default: pe(() => [ se(l, null, { default: pe(() => [ se(a, { offset: 0, span: 6 }, { default: pe(() => [ yt(" Width: ") ]), _: 1 }), se(a, { offset: 0, span: 12 }, { default: pe(() => [ se(s, { modelValue: i.width, "onUpdate:modelValue": e[0] || (e[0] = (m) => i.width = m), class: "my-slider", step: 1, min: 1, max: 100, "show-tooltip": !1, onInput: o.modifyWidth }, null, 8, ["modelValue", "onInput"]) ]), _: 1 }), se(a, { offset: 0, span: 4 }, { default: pe(() => [ se(c, { modelValue: i.width, "onUpdate:modelValue": e[1] || (e[1] = (m) => i.width = m), step: 1, min: 1, max: 100, controls: !1, class: "input-box number-input" }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }), i.currentIndex > -1 && i.distance > 0 ? (fe(), Ce(Gt, { key: 0 }, [ se(l, null, { default: pe(() => [ se(a, { offset: 0, span: 4 }, { default: pe(() => [ se(h, { size: "small", disabled: i.currentIndex === 0, icon: i.ElIconArrowLeft, onClick: e[2] || (e[2] = (m) => o.changeIndex(!1)) }, null, 8, ["disabled", "icon"]) ]), _: 1 }), se(a, { offset: 4, span: 9 }, { default: pe(() => [ yt(" Editing Line " + wt(i.currentIndex + 1), 1) ]), _: 1 }), se(a, { offset: 2, span: 2 }, { default: pe(() => [ se(h, { size: "small", icon: i.ElIconArrowRight, onClick: e[3] || (e[3] = (m) => o.changeIndex(!0)) }, null, 8, ["icon"]) ]), _: 1 }) ]), _: 1 }), se(l, null, { default: pe(() => [ se(a, { offset: 0, span: 6 }, { default: pe(() => [ yt(" Move: ") ]), _: 1 }), se(a, { offset: 0, span: 16 }, { default: pe(() => [ se(s, { modelValue: i.adjust, "onUpdate:modelValue": e[4] || (e[4] = (m) => i.adjust = m), step: 0.01, min: -3, max: 3, "show-tooltip": !1, onInput: e[5] || (e[5] = (m) => o.onMoveSliding()), onChange: e[6] || (e[6] = (m) => o.reset()) }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }), se(l, null, { default: pe(() => [ se(a, { offset: 0, span: 6 }, { default: pe(() => [ yt(" Length: ") ]), _: 1 }), se(a, { offset: 0, span: 10 }, { default: pe(() => [ se(s, { modelValue: i.lengthScale, "onUpdate:modelValue": e[7] || (e[7] = (m) => i.lengthScale = m), step: 0.01, min: -1, max: 1, "show-tooltip": !1, onInput: e[8] || (e[8] = (m) => o.onLengthSliding()), onChange: e[9] || (e[9] = (m) => o.reset()) }, null, 8, ["modelValue"]) ]), _: 1 }), se(a, { offset: 0, span: 6 }, { default: pe(() => [ se(c, { modelValue: i.newDistance, "onUpdate:modelValue": e[10] || (e[10] = (m) => i.newDistance = m), controls: !1, class: "input-box number-input", onChange: o.onLengthInput }, null, 8, ["modelValue", "onChange"]) ]), _: 1 }) ]), _: 1 }) ], 64)) : Ve("", !0) ]), _: 1 }) ]), _: 1 }); } const P1 = /* @__PURE__ */ wn(X4, [["render", Z4], ["__scopeId", "data-v-6581aa67"]]), Y4 = { name: "PointsControls", components: { Col: Mr, Container: jr, InputNumber: yn, Main: vn, Select: as, Slider: lr, Row: Hr, Option: ss, ElIconArrowLeft: Wn, ElIconArrowRight: $n }, 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: Pi(Wn), ElIconArrowRight: Pi($n), edited: !1, zincObject: void 0 }; }, watch: { boundingDims: { handler: function(i) { const e = i.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(i) { i ? this.zincObject.drawRange > this.currentIndex + 1 && (this.currentIndex++, this.reset()) : (this.currentIndex--, this.reset()); }, onMoveSliding: function() { const i = [ this.translation[0] - this.pTranslation[0], this.translation[1] - this.pTranslation[1], this.translation[2] - this.pTranslation[2] ]; this.edited = H4(this.zincObject, this.currentIndex, i) || 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(i) { this.currentIndex = -1, i.isPointset ? (this.zincObject = Ai(i), this.size = this.zincObject.morph.material.size, this.attenuation = this.zincObject.morph.material.sizeAttenuation, i.isEditable && this.zincObject.drawRange > 0 && (this.currentIndex = 0)) : (this.zincObject = void 0, this.size = 10, this.attenuation = !1); }, modifyAttenuation: function(i) { this.attenuation = i, this.zincObject.setSizeAttenuation(i); }, modifySize: function() { this.zincObject.setSize(this.size); } } }; function J4(i, e, t, r, n, o) { const a = Mr, s = lr, c = yn, l = Hr, h = ss, u = as, p = os, m = vn, g = jr; return fe(), He(g, { class: "pointset-container" }, { default: pe(() => [ se(m, { class: "slides-block" }, { default: pe(() => [ se(l, null, { default: pe(() => [ se(a, { offset: 0, span: 6 }, { default: pe(() => [ yt(" Size: ") ]), _: 1 }), se(a, { offset: 0, span: 10 }, { default: pe(() => [ se(s, { modelValue: i.size, "onUpdate:modelValue": e[0] || (e[0] = (d) => i.size = d), class: "my-slider", step: 1, min: 0, max: 100, "show-tooltip": !1, onInput: e[1] || (e[1] = (d) => o.modifySize()) }, null, 8, ["modelValue"]) ]), _: 1 }), se(a, { offset: 0, span: 6 }, { default: pe(() => [ se(c, { modelValue: i.size, "onUpdate:modelValue": e[2] || (e[2] = (d) => i.size = d), step: 1, min: 0, max: 100, controls: !1, class: "input-box number-input" }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }), se(l, null, { default: pe(() => [ se(a, { offset: 0, span: 16 }, { default: pe(() => [ yt(" Size attenuation: ") ]), _: 1 }), se(a, { offset: 0, span: 5 }, { default: pe(() => [ se(u, { teleported: !1, "model-value": i.attenuation, placeholder: "Select", class: "input-box", "popper-class": "viewer_dropdown", onChange: e[3] || (e[3] = (d) => o.modifyAttenuation(d, i.slide)) }, { default: pe(() => [ (fe(!0), Ce(Gt, null, rr(i.choices, (d) => (fe(), He(h, { key: d.value, label: d.label, value: d.value }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["model-value"]) ]), _: 1 }) ]), _: 1 }), i.currentIndex > -1 ? (fe(), Ce(Gt, { key: 0 }, [ se(l, null, { default: pe(() => [ se(a, { offset: 0, span: 4 }, { default: pe(() => [ se(p, { size: "small", disabled: i.currentIndex === 0, icon: i.ElIconArrowLeft, onClick: e[4] || (e[4] = (d) => o.changeIndex(!1)) }, null, 8, ["disabled", "icon"]) ]), _: 1 }), se(a, { offset: 4, span: 9 }, { default: pe(() => [ yt(" Editing Point " + wt(i.currentIndex + 1), 1) ]), _: 1 }), se(a, { offset: 2, span: 2 }, { default: pe(() => [ se(p, { size: "small", icon: i.ElIconArrowRight, onClick: e[5] || (e[5] = (d) => o.changeIndex(!0)) }, null, 8, ["icon"]) ]), _: 1 }) ]), _: 1 }), se(l, null, { default: pe(() => [ se(a, { offset: 0, span: 6 }, { default: pe(() => [ yt(" x: ") ]), _: 1 }), se(a, { offset: 0, span: 16 }, { default: pe(() => [ se(s, { modelValue: i.translation[0], "onUpdate:modelValue": e[6] || (e[6] = (d) => i.translation[0] = d), step: 0.01, min: i.min[0], max: i.max[0], "show-tooltip": !1, onInput: e[7] || (e[7] = (d) => o.onMoveSliding()), onChange: e[8] || (e[8] = (d) => o.reset()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), se(l, null, { default: pe(() => [ se(a, { offset: 0, span: 6 }, { default: pe(() => [ yt(" y: ") ]), _: 1 }), se(a, { offset: 0, span: 16 }, { default: pe(() => [ se(s, { modelValue: i.translation[1], "onUpdate:modelValue": e[9] || (e[9] = (d) => i.translation[1] = d), step: 0.01, min: i.min[1], max: i.max[1], "show-tooltip": !1, onInput: e[10] || (e[10] = (d) => o.onMoveSliding()), onChange: e[11] || (e[11] = (d) => o.reset()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), se(l, null, { default: pe(() => [ se(a, { offset: 0, span: 6 }, { default: pe(() => [ yt(" z: ") ]), _: 1 }), se(a, { offset: 0, span: 16 }, { default: pe(() => [ se(s, { modelValue: i.translation[2], "onUpdate:modelValue": e[12] || (e[12] = (d) => i.translation[2] = d), step: 0.01, min: i.min[2], max: i.max[2], "show-tooltip": !1, onInput: e[13] || (e[13] = (d) => o.onMoveSliding()), onChange: e[14] || (e[14] = (d) => o.reset()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }) ], 64)) : Ve("", !0) ]), _: 1 }) ]), _: 1 }); } const I1 = /* @__PURE__ */ wn(Y4, [["render", J4], ["__scopeId", "data-v-d1de9c65"]]), K4 = { name: "TextureSlidesControls", components: { Col: Mr, Container: jr, Footer: Ty, Icon: kt, InputNumber: yn, Main: vn, Row: Hr, Select: as, Slider: lr, Option: ss, ElIconDelete: Xc, ElIconPlus: pu }, data: function() { return { settings: [], directions: [ { value: "x", label: "x" }, { value: "y", label: "y" }, { value: "z", label: "z" } ], zincObject: void 0 }; }, methods: { setObject: function(i) { i.isTextureSlides ? (this.zincObject = Ai(i), this.settings = this.zincObject.getTextureSettings()) : (this.zincObject = void 0, this.settings = []); }, addNewSlide: function() { const i = { direction: "x", value: 0 }, e = this.zincObject.createSlide(i); this.settings.push(e); }, modifyDirection: function(i, e) { e && (e.direction = i, this.zincObject.modifySlideSettings(e)); }, modifySlide: function(i) { i && this.zincObject.modifySlideSettings(i); }, removeSlide: function(i, e) { this.zincObject.removeSlideWithId(e.id), this.settings.splice(i, 1); } } }; function Q4(i, e, t, r, n, o) { const a = ss, s = as, c = Mr, l = lr, h = yn, u = Xc, p = kt, m = Hr, g = vn, d = pu, y = Ty, f = jr; return fe(), He(f, { class: "t-slides-container" }, { default: pe(() => [ se(g, { class: "slides-block" }, { default: pe(() => [ (fe(!0), Ce(Gt, null, rr(i.settings, (v, _) => (fe(), He(m, { key: v.id, class: "slide-row" }, { default: pe(() => [ se(c, { offset: 0, span: 6 }, { default: pe(() => [ se(s, { teleported: !1, "model-value": v.direction, placeholder: "Select", class: "input-box", "popper-class": "viewer_dropdown", onChange: (M) => o.modifyDirection(M, v) }, { default: pe(() => [ (fe(!0), Ce(Gt, null, rr(i.directions, (M) => (fe(), He(a, { key: M.value, label: M.label, value: M.value }, null, 8, ["label", "value"]))), 128)) ]), _: 2 }, 1032, ["model-value", "onChange"]) ]), _: 2 }, 1024), se(c, { offset: 0, span: 10 }, { default: pe(() => [ se(l, { modelValue: v.value, "onUpdate:modelValue": (M) => v.value = M, class: "my-slider", step: 0.01, min: 0, max: 1, "show-tooltip": !1, onInput: (M) => o.modifySlide(v) }, null, 8, ["modelValue", "onUpdate:modelValue", "onInput"]) ]), _: 2 }, 1024), se(c, { offset: 0, span: 6 }, { default: pe(() => [ se(h, { modelValue: v.value, "onUpdate:modelValue": (M) => v.value = M, step: 0.01, min: 0, max: 1, controls: !1, class: "input-box number-input" }, null, 8, ["modelValue", "onUpdate:modelValue"]) ]), _: 2 }, 1024), se(c, { offset: 0, span: 2 }, { default: pe(() => [ se(p, { class: "delete-icon", onClick: (M) => o.removeSlide(_, v) }, { default: pe(() => [ se(u) ]), _: 2 }, 1032, ["onClick"]) ]), _: 2 }, 1024) ]), _: 2 }, 1024))), 128)) ]), _: 1 }), se(y, { height: "30px", class: "add-slides-text", onClick: o.addNewSlide }, { default: pe(() => [ se(m, null, { default: pe(() => [ se(c, { span: 2 }, { default: pe(() => [ se(p, null, { default: pe(() => [ se(d) ]), _: 1 }) ]), _: 1 }), se(c, { span: 20 }, { default: pe(() => [ yt(" Add a new slide ") ]), _: 1 }) ]), _: 1 }) ]), _: 1 }, 8, ["onClick"]) ]), _: 1 }); } const D1 = /* @__PURE__ */ wn(K4, [["render", Q4], ["__scopeId", "data-v-12185b7f"]]), eF = { name: "TransformationControls", components: { Col: Mr, Container: jr, InputNumber: yn, Main: vn, Slider: lr }, 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(i) { const e = i.centre, t = i.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(i) { if (i.isZincObject) { this.zincObject = Ai(i); 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 tF(i, e, t, r, n, o) { const a = Mr, s = lr, c = yn, l = Hr, h = vn, u = jr; return fe(), He(u, { class: "transformation-container" }, { default: pe(() => [ se(h, { class: "slides-block" }, { default: pe(() => [ se(l, { class: "tool-row" }, { default: pe(() => [ se(a, { offset: 0, span: 6 }, { default: pe(() => [ yt(" x: ") ]), _: 1 }), se(a, { offset: 0, span: 10 }, { default: pe(() => [ se(s, { modelValue: i.x, "onUpdate:modelValue": e[0] || (e[0] = (p) => i.x = p), step: 0.01, min: i.min[0], max: i.max[0], "show-tooltip": !1, onInput: e[1] || (e[1] = (p) => o.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }), se(a, { offset: 0, span: 6 }, { default: pe(() => [ se(c, { modelValue: i.x, "onUpdate:modelValue": e[2] || (e[2] = (p) => i.x = p), step: 0.01, min: i.min[0], max: i.max[0], controls: !1, class: "input-box number-input", onChange: e[3] || (e[3] = (p) => o.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), se(l, { class: "tool-row" }, { default: pe(() => [ se(a, { offset: 0, span: 6 }, { default: pe(() => [ yt(" y: ") ]), _: 1 }), se(a, { offset: 0, span: 10 }, { default: pe(() => [ se(s, { modelValue: i.y, "onUpdate:modelValue": e[4] || (e[4] = (p) => i.y = p), step: 0.01, min: i.min[1], max: i.max[1], "show-tooltip": !1, onInput: e[5] || (e[5] = (p) => o.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }), se(a, { offset: 0, span: 6 }, { default: pe(() => [ se(c, { modelValue: i.y, "onUpdate:modelValue": e[6] || (e[6] = (p) => i.y = p), step: 0.01, min: i.min[1], max: i.max[1], controls: !1, class: "input-box number-input", onChange: e[7] || (e[7] = (p) => o.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), se(l, { class: "tool-row" }, { default: pe(() => [ se(a, { offset: 0, span: 6 }, { default: pe(() => [ yt(" z: ") ]), _: 1 }), se(a, { offset: 0, span: 10 }, { default: pe(() => [ se(s, { modelValue: i.z, "onUpdate:modelValue": e[8] || (e[8] = (p) => i.z = p), step: 0.01, min: i.min[2], max: i.max[2], "show-tooltip": !1, onInput: e[9] || (e[9] = (p) => o.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }), se(a, { offset: 0, span: 6 }, { default: pe(() => [ se(c, { modelValue: i.z, "onUpdate:modelValue": e[10] || (e[10] = (p) => i.z = p), step: 0.01, min: i.min[2], max: i.max[2], controls: !1, class: "input-box number-input", onChange: e[11] || (e[11] = (p) => o.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), se(l, { class: "tool-row" }, { default: pe(() => [ se(a, { offset: 0, span: 6 }, { default: pe(() => [ yt(" Scale: ") ]), _: 1 }), se(a, { offset: 0, span: 10 }, { default: pe(() => [ se(s, { modelValue: i.scale, "onUpdate:modelValue": e[12] || (e[12] = (p) => i.scale = p), step: 0.01, min: 0, max: 5, "show-tooltip": !1, onInput: e[13] || (e[13] = (p) => o.modifyScale()) }, null, 8, ["modelValue"]) ]), _: 1 }), se(a, { offset: 0, span: 6 }, { default: pe(() => [ se(c, { modelValue: i.scale, "onUpdate:modelValue": e[14] || (e[14] = (p) => i.scale = p), step: 0.01, min: 0, max: 5, controls: !1, class: "input-box number-input", onChange: e[15] || (e[15] = (p) => o.modifyScale()) }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }) ]), _: 1 }) ]), _: 1 }); } const N1 = /* @__PURE__ */ wn(eF, [["render", tF], ["__scopeId", "data-v-6b3997b7"]]), iF = { name: "OpacityControls", components: { Container: jr, Header: QL, Main: vn, Slider: lr }, 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(i) { return this.displayString = Math.floor(100 * i + 0.5) + "%", this.displayString; } } }, rF = { class: "block" }, nF = { class: "display" }; function oF(i, e, t, r, n, o) { const a = lr, s = jr; return t.material ? (fe(), He(s, { key: 0, class: "opacity-container" }, { default: pe(() => [ ke("div", rF, [ ke("span", nF, wt(i.displayString), 1), se(a, { 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": o.formatTooltip, "show-tooltip": !1 }, null, 8, ["modelValue", "format-tooltip"]) ]) ]), _: 1 })) : Ve("", !0); } const B1 = /* @__PURE__ */ wn(iF, [["render", oF], ["__scopeId", "data-v-cbfc46a5"]]), aF = { name: "PrimitiveControls", components: { Collapse: by, CollapseItem: xy, LinesControls: P1, OpacityControls: B1, PointsControls: I1, TextureSlidesControls: D1, TransformationControls: N1, ElIconArrowRight: $n }, 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(i) { return this.displayString = Math.floor(100 * i + 0.5) + "%", this.displayString; }, toggleDrawer: function() { this.drawerOpen = !this.drawerOpen; }, setObject: function(i) { var e; i ? this.zincObject = Ai(i) : this.zincObject = void 0, this.isEditable = !!((e = this.zincObject) != null && e.isEditable), this.isPointset = !1, this.isTextureSlides = !1, this.isLines = !1, this.activeName = "trControls", i && (i.isTextureSlides ? (this.isTextureSlides = !0, this.$refs.tSlidesControls.setObject(i), this.activeName = "tsControls") : i.isPointset ? (this.isPointset = !0, this.$refs.pointsetControls.setObject(i), this.activeName = "pControls") : i.isLines2 && (this.isLines = !0, this.$refs.linesControls.setObject(i), this.activeName = "lControls"), i.isTextureSlides || this.$refs.transformationControls.setObject(i)), i && i.getMorph() ? this.material = i.getMorph().material : this.material = void 0; } } }; function sF(i, e, t, r, n, o) { const a = B1, s = xy, c = N1, l = D1, h = I1, u = P1, p = by, m = $n, g = kt; return Bt((fe(), Ce("div", { class: Le(["primitive-controls", { open: i.drawerOpen, close: !i.drawerOpen }]) }, [ ke("div", { class: Le(["my-drawer", { open: i.drawerOpen, close: !i.drawerOpen }]) }, [ se(p, { class: "collapse", modelValue: i.activeName, "onUpdate:modelValue": e[2] || (e[2] = (d) => i.activeName = d), accordion: "" }, { default: pe(() => [ Bt(se(s, { title: "Opacity", name: "oControls" }, { default: pe(() => [ se(a, { material: i.material, zincObject: i.zincObject, ref: "opacityControls" }, null, 8, ["material", "zincObject"]) ]), _: 1 }, 512), [ [yi, !i.isTextureSlides] ]), Bt(se(s, { title: "Transformation", name: "trControls" }, { default: pe(() => [ se(c, { class: "transformation-controls", ref: "transformationControls" }, null, 512) ]), _: 1 }, 512), [ [yi, !i.isEditable] ]), Bt(se(s, { title: "Texture Slides", name: "tsControls" }, { default: pe(() => [ se(l, { class: "texture-controls", ref: "tSlidesControls" }, null, 512) ]), _: 1 }, 512), [ [yi, i.isTextureSlides] ]), Bt(se(s, { title: "Points", name: "pControls" }, { default: pe(() => [ se(h, { class: "pointset-controls", ref: "pointsetControls", onPrimitivesUpdated: e[0] || (e[0] = (d) => i.$emit("primitivesUpdated", d)) }, null, 512) ]), _: 1 }, 512), [ [yi, i.isPointset] ]), Bt(se(s, { title: "Lines", name: "lControls" }, { default: pe(() => [ se(u, { class: "lines-controls", ref: "linesControls", createData: t.createData, onPrimitivesUpdated: e[1] || (e[1] = (d) => i.$emit("primitivesUpdated", d)) }, null, 8, ["createData"]) ]), _: 1 }, 512), [ [yi, i.isLines] ]) ]), _: 1 }, 8, ["modelValue"]) ], 2), ke("div", { class: Le(["drawer-button", { open: i.drawerOpen, close: !i.drawerOpen }]), onClick: e[3] || (e[3] = (...d) => o.toggleDrawer && o.toggleDrawer(...d)) }, [ se(g, null, { default: pe(() => [ se(m) ]), _: 1 }) ], 2) ], 2)), [ [yi, i.material || i.isTextureSlides] ]); } const k1 = /* @__PURE__ */ wn(aF, [["render", sF], ["__scopeId", "data-v-764a8efa"]]), lF = (i, e) => { const t = i.label.toUpperCase(), r = e.label.toUpperCase(); return t < r ? -1 : t > r ? 1 : 0; }, cF = { name: "ScaffoldTreeControls", components: { ElIconArrowLeft: Wn, TreeControls: rw }, 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(i) { this.isReady && this.setColourField(i); } } }, methods: { addTreeItem: function(i, e, t) { i.some((r) => r.label === e.label) || (Object.assign(e, { activeColour: this.getColour(e) }), i.push(e), i.sort((r, n) => lF(r, n)), 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(i, 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 r = [...e]; let n = i.children.find( (s) => s.label == r[0] ); const o = t + "/" + e[0], a = this.module.scene.getRootRegion().findChildFromPath(o); return n || (n = { label: r[0], id: a.uuid, children: [], regionPath: o, isRegion: !0 }, this.addTreeItem(i.children, n, a), o === "/_helper" && this.$nextTick(() => { this.$refs.treeControls.$refs.regionTree.setChecked(n.id, !1); })), r.shift(), this.findOrCreateRegion(n, r, o); } else return i; }, /** * This is called when a new zinc object is read into the scene. */ zincObjectAdded: function(i) { const e = i.region; if (e) { const t = e.getFullSeparatedPath(), r = this.findOrCreateRegion(this.treeData[0], t, ""); if (i.groupName && r) { r.children || (r.children = []); const n = { label: i.groupName, id: e.uuid + "/" + i.uuid, isPrimitives: !0, regionPath: i.region.getFullPath(), isTextureSlides: !!i.isTextureSlides }; this.addTreeItem(r.children, n, i); } } }, zincObjectRemoved: function(i) { const e = i.groupName; if (i.region.findObjectsWithGroupName(e, !1).length === 0) { const t = i.region.getFullSeparatedPath(), r = this.findOrCreateRegion(this.treeData[0], t, ""); if (r.children) { for (let n = 0; n < r.children.length; n++) if (r.children[n].label === e) { r.children.splice(n, 1), this.nodeNumbers--; return; } } } }, checkChanged: function(i, e) { const t = i.isRegion, r = i.isPrimitives, n = e.checkedKeys.includes(i.id), o = this.module.scene.getRootRegion().findChildFromPath(i.regionPath); t && (n ? o.showAllPrimitives() : o.hideAllPrimitives()), r && o.findObjectsWithGroupName(i.label).forEach((a) => { a.setVisibility(n); }); }, updateActiveUI: function(i) { this.active.length = 0, $v(i, this.active); }, changeActiveByPrimitives: function(i, e) { i && i.length > 0 ? (this.updateActiveUI(i), this.$emit("object-selected", i, e)) : this.removeActive(e), this.removeHover(e); }, updateHoverUI: function(i) { this.hover.length = 0, $v(i, this.hover); }, changeHoverByPrimitives: function(i, e) { i && i.length > 0 ? (this.updateHoverUI(i), this.$emit("object-hovered", i, e)) : this.removeHover(e); }, /** * Select a region by its name. */ changeActiveByNames: function(i, e, t) { const r = this.module.scene.getRootRegion(), n = Aa( r, i, e, !0 ); this.changeActiveByPrimitives(n, t); }, /** * Hover a region by its name. */ changeHoverByNames: function(i, e, t) { const r = this.module.scene.getRootRegion(), n = Aa( r, i, e, !0 ); this.changeHoverByPrimitives(n, t); }, changeActiveByNode: function(i, e) { if (i.isPrimitives || i.isRegion) { const t = !!i.isRegion, r = this.getZincObjectsFromNode(i, t); this.changeActiveByPrimitives(r, e); } }, changeHoverByNode: function(i, e) { if (i.isPrimitives) { const t = this.getZincObjectsFromNode(i, !1); this.changeHoverByPrimitives(t, e); } }, /** * Unselect the current selected region. */ removeActive: function(i) { this.active = [], this.$emit("object-selected", [], i); }, /** * Unselect the current hover region. */ removeHover: function(i) { this.hover = [], this.$emit("object-hovered", [], i); }, /** * 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(i) { if (i) { let e = this.getZincObjectsFromNode(i, !1)[0]; if (e) { let t = e.getColourHex(); if (t) return "#" + t; } } return "#FFFFFF"; }, getZincObjectsFromNode: function(i, e) { const t = this.module.scene.getRootRegion(); if (i.isPrimitives) return Aa( t, i.label, i.regionPath, e ); if (i.isRegion && i.regionPath) { let r = t.findChildFromPath(i.regionPath); if (r) return r.getAllObjects(e); } return []; }, //Set this right at the beginning. setModule: function(i) { this.module = Ai(i), this.nodeNumbers = 0, this.module.scene.getRootRegion().getAllObjects(!0).forEach((e) => { this.zincObjectAdded(e); }), this.module.addOrganPartAddedCallback(this.zincObjectAdded), this.module.addOrganPartRemovedCallback(this.zincObjectRemoved); }, setColourField: function(i, e = void 0) { i.filter((t) => e && !t.children ? t.id === e.id : !0).map((t) => { if (t.children) this.setColourField(t.children, e); else { const r = this.getColour(t); t.defaultColour || (t.defaultColour = r), t.activeColour = r; } }); }, setColour: function(i, e) { i && i.isPrimitives && this.getZincObjectsFromNode(i, !1).forEach((t) => { let r = (e || i.defaultColour).replace("#", "0x"); t.setColourHex(r), this.setColourField(this.treeData[0].children, i); }); }, visibilityToggle: function(i, e) { this.module.changeOrganPartsVisibility(i, e), e == !1 && (this.activeRegion === i && this.removeActive(!0), this.hoverRegion === i && 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(i, e, t, r) { let n = !1, o = ""; i.isRegion && (o = `__r${i.regionPath}`), i.isPrimitives && (o = `${i.regionPath}/${i.label}`); const a = e.indexOf(o); a > -1 && (n = !0, e.splice(a, 1), t.push(i.id)); const s = this.module.scene.getRootRegion().findChildFromPath(i.regionPath); o && o !== "__r" && i.isPrimitives && s.findObjectsWithGroupName(i.label).forEach((c) => c.setVisibility(n)), i.children && i.children.forEach((c) => { this.setTreeVisibilityWithFullPaths(c, e, t, !0); }); }, checkAllKeys: function() { const i = [], e = []; O1(this.treeData[0], i), this.setTreeVisibilityWithFullPaths( this.treeData[0], i, e, !0 ), this.$refs.treeControls.$refs.regionTree.setCheckedKeys(e); }, getState: function() { let i = this.$refs.treeControls.$refs.regionTree.getCheckedKeys(); return i.length === this.nodeNumbers ? { checkAll: !0, version: "2.0" } : { checkedItems: G4( this.module.scene.getRootRegion(), i ), version: "2.0" }; }, setState: function(i) { if (i) { if (i.checkAll) this.checkAllKeys(); else if (i.checkedItems) { let e = []; i.version !== "2.0" ? (e = i.checkedItems.map((r) => "/" + r), e.shift("__r/")) : e.push(...i.checkedItems); const t = []; this.setTreeVisibilityWithFullPaths( this.treeData[0], e, t, !0 ), this.$refs.treeControls.$refs.regionTree.setCheckedKeys(t); } } } } }, uF = { class: "traditional-container" }; function hF(i, e, t, r, n, o) { const a = Ri("TreeControls"), s = Wn, c = kt; return fe(), Ce("div", { class: Le(["tree-controls", { open: i.drawerOpen, close: !i.drawerOpen }]) }, [ ke("div", uF, [ se(a, { mapType: "scaffold", title: "Regions", isReady: t.isReady, treeData: o.treeDataEntry, active: i.active, hover: i.hover, showColourPicker: t.showColourPicker, onSetColour: o.setColour, onCheckChanged: o.checkChanged, onChangeActive: o.changeActiveByNode, onChangeHover: o.changeHoverByNode, ref: "treeControls" }, null, 8, ["isReady", "treeData", "active", "hover", "showColourPicker", "onSetColour", "onCheckChanged", "onChangeActive", "onChangeHover"]) ]), ke("div", { class: Le(["drawer-button", { open: i.drawerOpen, close: !i.drawerOpen }]), onClick: e[0] || (e[0] = (...l) => o.toggleDrawer && o.toggleDrawer(...l)) }, [ se(c, null, { default: pe(() => [ se(s) ]), _: 1 }) ], 2) ], 2); } const F1 = /* @__PURE__ */ wn(cF, [["render", hF], ["__scopeId", "data-v-13a8c030"]]); var dF = !1; function Pc(i, e, t) { return Array.isArray(i) ? (i.length = Math.max(i.length, e), i.splice(e, 1, t), t) : (i[e] = t, t); } function Wh(i, e) { if (Array.isArray(i)) { i.splice(e, 1); return; } delete i[e]; } /*! * pinia v2.2.1 * (c) 2024 Eduardo San Martin Morote * @license MIT */ let Ns; const nu = (i) => Ns = i, pF = process.env.NODE_ENV !== "production" ? Symbol("pinia") : ( /* istanbul ignore next */ Symbol() ); function Uo(i) { return i && typeof i == "object" && Object.prototype.toString.call(i) === "[object Object]" && typeof i.toJSON != "function"; } var Gs; (function(i) { i.direct = "direct", i.patchObject = "patch object", i.patchFunction = "patch function"; })(Gs || (Gs = {})); const Bs = typeof window < "u"; function z1(i, e) { for (const t in e) { const r = e[t]; if (!(t in i)) continue; const n = i[t]; Uo(n) && Uo(r) && !Ro(r) && !op(r) ? i[t] = z1(n, r) : i[t] = r; } return i; } const U1 = () => { }; function Yv(i, e, t, r = U1) { i.push(e); const n = () => { const o = i.indexOf(e); o > -1 && (i.splice(o, 1), r()); }; return !t && c0() && u0(n), n; } function va(i, ...e) { i.slice().forEach((t) => { t(...e); }); } const fF = (i) => i(), Jv = Symbol(), $h = Symbol(); function Yd(i, e) { i instanceof Map && e instanceof Map ? e.forEach((t, r) => i.set(r, t)) : i instanceof Set && e instanceof Set && e.forEach(i.add, i); for (const t in e) { if (!e.hasOwnProperty(t)) continue; const r = e[t], n = i[t]; Uo(n) && Uo(r) && i.hasOwnProperty(t) && !Ro(r) && !op(r) ? i[t] = Yd(n, r) : i[t] = r; } return i; } const mF = process.env.NODE_ENV !== "production" ? Symbol("pinia:skipHydration") : ( /* istanbul ignore next */ Symbol() ); function gF(i) { return !Uo(i) || !i.hasOwnProperty(mF); } const { assign: tr } = Object; function Kv(i) { return !!(Ro(i) && i.effect); } function Qv(i, e, t, r) { const { state: n, actions: o, getters: a } = e, s = t.state.value[i]; let c; function l() { !s && (process.env.NODE_ENV === "production" || !r) && (t.state.value[i] = n ? n() : {}); const h = process.env.NODE_ENV !== "production" && r ? ( // use ref() to unwrap refs inside state TODO: check if this is still necessary cn(Ae(n ? n() : {}).value) ) : cn(t.state.value[i]); return tr(h, o, Object.keys(a || {}).reduce((u, p) => (process.env.NODE_ENV !== "production" && p in h && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${p}" in store "${i}".`), u[p] = Ai(ce(() => { nu(t); const m = t._s.get(i); return a[p].call(m, m); })), u), {})); } return c = Jd(i, l, e, t, r, !0), c; } function Jd(i, e, t = {}, r, n, o) { let a; const s = tr({ actions: {} }, t); if (process.env.NODE_ENV !== "production" && !r._e.active) throw new Error("Pinia destroyed"); const c = { deep: !0 }; process.env.NODE_ENV !== "production" && !dF && (c.onTrigger = (S) => { l ? m = S : l == !1 && !b._hotUpdating && (Array.isArray(m) ? m.push(S) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.")); }); let l, h, u = [], p = [], m; const g = r.state.value[i]; !o && !g && (process.env.NODE_ENV === "production" || !n) && (r.state.value[i] = {}); const d = Ae({}); let y; function f(S) { let C; l = h = !1, process.env.NODE_ENV !== "production" && (m = []), typeof S == "function" ? (S(r.state.value[i]), C = { type: Gs.patchFunction, storeId: i, events: m }) : (Yd(r.state.value[i], S), C = { type: Gs.patchObject, payload: S, storeId: i, events: m }); const R = y = Symbol(); _t().then(() => { y === R && (l = !0); }), h = !0, va(u, C, r.state.value[i]); } const v = o ? function() { const { state: S } = t, C = S ? S() : {}; this.$patch((R) => { tr(R, C); }); } : ( /* istanbul ignore next */ process.env.NODE_ENV !== "production" ? () => { throw new Error(`🍍: Store "${i}" is built using the setup syntax and does not implement $reset().`); } : U1 ); function _() { a.stop(), u = [], p = [], r._s.delete(i); } const M = (S, C = "") => { if (Jv in S) return S[$h] = C, S; const R = function() { nu(r); const L = Array.from(arguments), A = [], P = []; function O(N) { A.push(N); } function x(N) { P.push(N); } va(p, { args: L, name: R[$h], store: b, after: O, onError: x }); let I; try { I = S.apply(this && this.$id === i ? this : b, L); } catch (N) { throw va(P, N), N; } return I instanceof Promise ? I.then((N) => (va(A, N), N)).catch((N) => (va(P, N), Promise.reject(N))) : (va(A, I), I); }; return R[Jv] = !0, R[$h] = C, R; }, T = /* @__PURE__ */ Ai({ actions: {}, getters: {}, state: [], hotState: d }), w = { _p: r, // _s: scope, $id: i, $onAction: Yv.bind(null, p), $patch: f, $reset: v, $subscribe(S, C = {}) { const R = Yv(u, S, C.detached, () => L()), L = a.run(() => Je(() => r.state.value[i], (A) => { (C.flush === "sync" ? h : l) && S({ storeId: i, type: Gs.direct, events: m }, A); }, tr({}, c, C))); return R; }, $dispose: _ }, b = Yi(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Bs ? tr( { _hmrPayload: T, _customProperties: Ai(/* @__PURE__ */ new Set()) // devtools custom properties }, w // must be added later // setupStore ) : w); r._s.set(i, b); const E = (r._a && r._a.runWithContext || fF)(() => r._e.run(() => (a = _w()).run(() => e({ action: M })))); for (const S in E) { const C = E[S]; if (Ro(C) && !Kv(C) || op(C)) process.env.NODE_ENV !== "production" && n ? Pc(d.value, S, ki(E, S)) : o || (g && gF(C) && (Ro(C) ? C.value = g[S] : Yd(C, g[S])), r.state.value[i][S] = C), process.env.NODE_ENV !== "production" && T.state.push(S); else if (typeof C == "function") { const R = process.env.NODE_ENV !== "production" && n ? C : M(C, S); E[S] = R, process.env.NODE_ENV !== "production" && (T.actions[S] = C), s.actions[S] = C; } else process.env.NODE_ENV !== "production" && Kv(C) && (T.getters[S] = o ? ( // @ts-expect-error t.getters[S] ) : C, Bs && (E._getters || // @ts-expect-error: same (E._getters = Ai([]))).push(S)); } if (tr(b, E), tr(np(b), E), Object.defineProperty(b, "$state", { get: () => process.env.NODE_ENV !== "production" && n ? d.value : r.state.value[i], set: (S) => { if (process.env.NODE_ENV !== "production" && n) throw new Error("cannot set hotState"); f((C) => { tr(C, S); }); } }), process.env.NODE_ENV !== "production" && (b._hotUpdate = Ai((S) => { b._hotUpdating = !0, S._hmrPayload.state.forEach((C) => { if (C in b.$state) { const R = S.$state[C], L = b.$state[C]; typeof R == "object" && Uo(R) && Uo(L) ? z1(R, L) : S.$state[C] = L; } Pc(b, C, ki(S.$state, C)); }), Object.keys(b.$state).forEach((C) => { C in S.$state || Wh(b, C); }), l = !1, h = !1, r.state.value[i] = ki(S._hmrPayload, "hotState"), h = !0, _t().then(() => { l = !0; }); for (const C in S._hmrPayload.actions) { const R = S[C]; Pc(b, C, M(R, C)); } for (const C in S._hmrPayload.getters) { const R = S._hmrPayload.getters[C], L = o ? ( // special handling of options api ce(() => (nu(r), R.call(b, b))) ) : R; Pc(b, C, L); } Object.keys(b._hmrPayload.getters).forEach((C) => { C in S._hmrPayload.getters || Wh(b, C); }), Object.keys(b._hmrPayload.actions).forEach((C) => { C in S._hmrPayload.actions || Wh(b, C); }), b._hmrPayload = S._hmrPayload, b._getters = S._getters, b._hotUpdating = !1; })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Bs) { const S = { writable: !0, configurable: !0, // avoid warning on devtools trying to display this property enumerable: !1 }; ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((C) => { Object.defineProperty(b, C, tr({ value: b[C] }, S)); }); } return r._p.forEach((S) => { if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Bs) { const C = a.run(() => S({ store: b, app: r._a, pinia: r, options: s })); Object.keys(C || {}).forEach((R) => b._customProperties.add(R)), tr(b, C); } else tr(b, a.run(() => S({ store: b, app: r._a, pinia: r, options: s }))); }), process.env.NODE_ENV !== "production" && b.$state && typeof b.$state == "object" && typeof b.$state.constructor == "function" && !b.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be state: () => new MyClass() Found in store "${b.$id}".`), g && o && t.hydrate && t.hydrate(b.$state, g), l = !0, h = !0, b; } function vF(i, e, t) { let r, n; const o = typeof e == "function"; r = i, n = o ? t : e; function a(s, c) { const l = ww(); if (s = // in test mode, ignore the argument provided as we can always retrieve a // pinia instance with getActivePinia() (process.env.NODE_ENV === "test" && Ns && Ns._testing ? null : s) || (l ? ct(pF, null) : null), s && nu(s), process.env.NODE_ENV !== "production" && !Ns) 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.`); s = Ns, s._s.has(r) || (o ? Jd(r, e, n, s) : Qv(r, n, s), process.env.NODE_ENV !== "production" && (a._pinia = s)); const h = s._s.get(r); if (process.env.NODE_ENV !== "production" && c) { const u = "__hot:" + r, p = o ? Jd(u, e, n, s, !0) : Qv(u, tr({}, n), s, !0); c._hotUpdate(p), delete s.state.value[u], s._s.delete(u); } if (process.env.NODE_ENV !== "production" && Bs) { const u = si(); if (u && u.proxy && // avoid adding stores that are just built for hot module replacement !c) { const p = u.proxy, m = "_pStores" in p ? p._pStores : p._pStores = {}; m[r] = h; } } return h; } return a.$id = r, a; } function V1(i, e) { return Array.isArray(e) ? e.reduce((t, r) => (t[r] = function() { return i(this.$pinia)[r]; }, t), {}) : Object.keys(e).reduce((t, r) => (t[r] = function() { const n = i(this.$pinia), o = e[r]; return typeof o == "function" ? o.call(this, n) : n[o]; }, t), {}); } const H1 = vF("main", { state: () => ({ userProfile: { token: "" } }), getters: { userToken(i) { return i.userProfile.token; } }, actions: { setUserToken(i) { this.userProfile.token = i; } } }), yF = { name: "ScaffoldTooltip", components: { Col: Mr, CreateTooltipContent: K1, ElIconDelete: Xc, Icon: kt, Popover: _u, Row: Hr, Tooltip: Q1 }, 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: Pi(Xc) }; }, computed: { ...V1(H1, ["userToken"]), position: function() { let i = 40; return this.region && (i = 55), { left: this.x - 40 + "px", top: this.y - i + "px" }; } }, methods: { checkForDisplay: function() { if (this.visible && this.label && this.label !== "") { if (this.display = !0, this.annotationDisplay) { const i = this.region ? this.region + "/" : ""; this.annotationEntry = { featureId: i + 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 } } }, bF = { class: "tooltip-text" }, xF = { key: 0, class: "tooltip-text" }, wF = { key: 1, class: "delete-container" }; function _F(i, e, t, r, n, o) { const a = Ri("CreateTooltipContent"), s = Ri("Tooltip"), c = Mr, l = os, h = Hr, u = _u; return fe(), Ce("div", { style: It(o.position), class: "region-tooltip" }, [ se(u, { ref: "tooltip", visible: t.visible, placement: "top", "show-arrow": !1, teleported: !1, trigger: "manual", "popper-class": "tooltip-popper non-selectable", "virtual-triggering": "", onHide: o.hideTriggered }, { default: pe(() => [ ke("div", bF, wt(t.label), 1), t.region ? (fe(), Ce("div", xF, "Region: " + wt(t.region), 1)) : Ve("", !0), Bt(se(a, { createData: t.createData, onConfirmCreate: e[0] || (e[0] = (p) => i.$emit("confirm-create", p)), onCancelCreate: e[1] || (e[1] = (p) => i.$emit("cancel-create")) }, null, 8, ["createData"]), [ [yi, t.createData.toBeConfirmed] ]), Bt(se(s, { class: "p-tooltip", ref: "annotationTooltip", annotationDisplay: !0, annotationEntry: i.annotationEntry }, null, 8, ["annotationEntry"]), [ [yi, t.annotationDisplay && !t.createData.toBeConfirmed] ]), t.createData.toBeDeleted ? (fe(), Ce("div", wF, [ se(h, null, { default: pe(() => [ se(c, { span: 10 }, { default: pe(() => [ yt("Delete this feature?") ]), _: 1 }), se(c, { span: 7 }, { default: pe(() => [ se(l, { class: "delete-button", icon: i.ElIconDelete, onClick: e[2] || (e[2] = (p) => i.$emit("confirm-delete")) }, { default: pe(() => [ yt(" Delete ") ]), _: 1 }, 8, ["icon"]) ]), _: 1 }), se(c, { span: 6 }, { default: pe(() => [ se(l, { class: "delete-button", onClick: e[3] || (e[3] = (p) => i.$emit("cancel-create")) }, { default: pe(() => [ yt(" Dismiss ") ]), _: 1 }) ]), _: 1 }) ]), _: 1 }) ])) : Ve("", !0) ]), _: 1 }, 8, ["visible", "onHide"]) ], 4); } const j1 = /* @__PURE__ */ wn(yF, [["render", _F], ["__scopeId", "data-v-e665391a"]]); /*! js-cookie v3.0.5 | MIT */ function Ic(i) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) i[r] = t[r]; } return i; } var MF = { read: function(i) { return i[0] === '"' && (i = i.slice(1, -1)), i.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent); }, write: function(i) { return encodeURIComponent(i).replace( /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent ); } }; function Kd(i, e) { function t(n, o, a) { if (!(typeof document > "u")) { a = Ic({}, e, a), typeof a.expires == "number" && (a.expires = new Date(Date.now() + a.expires * 864e5)), a.expires && (a.expires = a.expires.toUTCString()), n = encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape); var s = ""; for (var c in a) a[c] && (s += "; " + c, a[c] !== !0 && (s += "=" + a[c].split(";")[0])); return document.cookie = n + "=" + i.write(o, n) + s; } } function r(n) { if (!(typeof document > "u" || arguments.length && !n)) { for (var o = document.cookie ? document.cookie.split("; ") : [], a = {}, s = 0; s < o.length; s++) { var c = o[s].split("="), l = c.slice(1).join("="); try { var h = decodeURIComponent(c[0]); if (a[h] = i.read(l, h), n === h) break; } catch { } } return n ? a[n] : a; } } return Object.create( { set: t, get: r, remove: function(n, o) { t( n, "", Ic({}, o, { expires: -1 }) ); }, withAttributes: function(n) { return Kd(this.converter, Ic({}, this.attributes, n)); }, withConverter: function(n) { return Kd(Ic({}, this.converter, n), this.attributes); } }, { attributes: { value: Object.freeze(e) }, converter: { value: Object.freeze(i) } } ); } var Qd = Kd(MF, { path: "/" }), Tr = function(i, e, t, r, n) { if (typeof e == "function" ? i !== e || !n : !e.has(i)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return e.set(i, t), t; }, jt = function(i, e, t, r) { if (t === "a" && !r) throw new TypeError("Private accessor was defined without a getter"); if (typeof e == "function" ? i !== e || !r : !e.has(i)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return t === "m" ? r : t === "a" ? r.call(i) : r ? r.value : e.get(i); }, Jr, Ws, Er, Ei, Dn; const SF = 1e4; class TF { /** * @param serverEndpoint The URL of a map annotation service. */ constructor(e) { Jr.add(this), Ws.set(this, void 0), Er.set(this, null), Ei.set( this, null /** * @param serverEndpoint The URL of a map annotation service. */ ), e.slice(-1) === "/" ? Tr(this, Ws, e.slice(0, -1)) : Tr(this, Ws, e); } /** * Get information about the logged-in SPARC user. * * Requires {@linkcode authenticate} to first be called. */ get currentUser() { return jt(this, Er, "f"); } /** * Get information about any error from the last call * to {@linkcode authenticate}. */ get currentError() { return jt(this, Ei, "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) { Tr(this, Ei, null), Tr(this, Er, null); const t = await jt(this, Jr, "m", Dn).call(this, e, "authenticate"); return "error" in t ? (Qd.remove("annotation-key"), Promise.resolve(jt(this, Ei, "f"))) : (Qd.set("annotation-key", t.session, { secure: !0, expires: 1 }), Tr(this, Er, t.data), Promise.resolve(jt(this, Er, "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) { Tr(this, Ei, null), Tr(this, Er, null); const t = await jt(this, Jr, "m", Dn).call(this, e, "unauthenticate"); return "success" in t ? Promise.resolve(t) : Promise.resolve(jt(this, Ei, "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, r, n) { const o = { resource: t }; r !== void 0 && (o.user = r), n !== void 0 && (o.participated = n); const a = await jt(this, Jr, "m", Dn).call(this, e, "items/", "GET", o); return "error" in a ? Promise.resolve(jt(this, Ei, "f")) : Promise.resolve(a); } /** * 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, r) { const n = { resource: t }; r !== void 0 && (n.items = r); const o = await jt(this, Jr, "m", Dn).call(this, e, "features/", "GET", n); return "error" in o ? Promise.resolve(jt(this, Ei, "f")) : Promise.resolve(o); } /** * 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, r) { const n = await jt(this, Jr, "m", Dn).call(this, e, "annotations/", "GET", { resource: t, item: r }); return "error" in n ? Promise.resolve(jt(this, Ei, "f")) : Promise.resolve(n); } /** * 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 r = await jt(this, Jr, "m", Dn).call(this, e, "annotation/", "GET", { annotation: t }); return "error" in r ? Promise.resolve(jt(this, Ei, "f")) : Promise.resolve(r); } /** * 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 (jt(this, Er, "f") && jt(this, Er, "f").canUpdate) { const r = Object.assign({ creator: jt(this, Er, "f"), created: (/* @__PURE__ */ new Date()).toISOString() }, t), n = await jt(this, Jr, "m", Dn).call(this, e, "annotation/", "POST", { data: r }); if (!("error" in n)) return Promise.resolve(n); Tr(this, Ei, n); } else Tr(this, Ei, { error: "user cannot add annotation" }); return Promise.resolve(jt(this, Ei, "f")); } } Ws = /* @__PURE__ */ new WeakMap(), Er = /* @__PURE__ */ new WeakMap(), Ei = /* @__PURE__ */ new WeakMap(), Jr = /* @__PURE__ */ new WeakSet(), Dn = async function(i, e, t = "GET", r = {}) { let n = !0; const o = new AbortController(); setTimeout(() => { n && (console.log("Annotation server timeout..."), o.abort()); }, SF); const a = { method: t, signal: o.signal }; let s = `${jt(this, Ws, "f")}/${e}`; const c = Qd.get("annotation-key") || ""; if (t === "GET") { const h = []; for (const [u, p] of Object.entries(r)) h.push(`${u}=${encodeURIComponent(JSON.stringify(p))}`); h.push(`key=${encodeURIComponent(i)}`), h.push(`session=${encodeURIComponent(c)}`), s += "?" + h.join("&"), a.headers = { Accept: "application/json; charset=utf-8", "Cache-Control": "no-store" }; } else if (t === "POST") { const h = Object.assign({ key: i, session: c }, 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 l = await fetch(s, a); return n = !1, l.ok ? Promise.resolve(await l.json()) : (Tr(this, Ei, { error: `${l.status} ${l.statusText}` }), Promise.resolve(jt(this, Ei, "f"))); }; const ul = { ALL: 0, SELECTED: 1, HIGHLIGHTED: 2, MOVE: 3 }, EF = function(i, e, t) { this.eventType = i, this.identifiers = e, this.zincObjects = t; }, AF = function(i, e, t) { this.targetedID = []; const r = i, n = e; this.targetEventType = t; const o = this; t === void 0 && (this.targetEventType = ul.ALL), this.getEventType = function() { return t; }, this.notify = function(a, s, c, l) { if (a !== r && (o.targetEventType === ul.ALL || o.targetEventType === s)) { const h = new EF(s, c, l); n(h); } }; }, CF = function() { const i = []; this.publish = function(e, t, r, n) { for (let o = 0; o < i.length; o++) i[o].notify(e, t, r, n); }, this.subscribe = function(e, t, r) { if (typeof t == "function") { const n = new AF(e, t, r); return i.push(n), n; } }, this.unsubscribe = function(e) { for (let t = 0; t < i.length; t++) if (e === i[t]) { i.splice(t, 1); return; } }; }, e0 = { isWebGLAvailable: function() { try { var i = document.createElement("canvas"); return !!(window.WebGLRenderingContext && (i.getContext("webgl") || i.getContext("experimental-webgl"))); } catch { return !1; } }, isWebGL2Available: function() { try { var i = document.createElement("canvas"); return !!(window.WebGL2RenderingContext && i.getContext("webgl2")); } catch { return !1; } }, getWebGLErrorMessage: function() { return this.getErrorMessage(1); }, getWebGL2ErrorMessage: function() { return this.getErrorMessage(2); }, getErrorMessage: function(i) { var e = { 1: "WebGL", 2: "WebGL 2" }, t = { 1: window.WebGLRenderingContext, 2: window.WebGL2RenderingContext }, r = 'This module requires $1 support but your $0 does not seem to support it.', n = document.createElement("div"); return n.id = "webglmessage", n.style.fontFamily = "monospace", n.style.fontSize = "20px", n.style.fontWeight = "normal", n.style.textAlign = "center", n.style.background = "#fff", n.style.color = "#000", n.style.padding = "1.5em", n.style.width = "400px", n.style.margin = "5em auto 0", t[i] ? r = r.replace("$0", "graphics card") : r = r.replace("$0", "browser"), r = r.replace("$1", e[i]), n.innerHTML = r, n; } }, Bf = { ALL: 0, DESTROYED: 1, NAME_CHANGED: 2, SETTINGS_CHANGED: 3 }, Qi = function() { this.typeName = "Base Module", this.instanceName = "default", this.onChangedCallbacks = [], this.eventNotifiers = []; }; Qi.prototype.setName = function(i) { if (i && this.instanceName !== i) { this.instanceName = i; const e = this.onChangedCallbacks.slice(); for (let t = 0; t < e.length; t++) e[t](this, Bf.NAME_CHANGED); } }; Qi.prototype.settingsChanged = function() { const i = this.onChangedCallbacks.slice(); for (let e = 0; e < i.length; e++) i[e](this, Bf.SETTINGS_CHANGED); }; Qi.prototype.exportSettings = function() { const i = {}; return i.dialog = this.typeName, i.name = this.instanceName, i; }; Qi.prototype.importSettings = function(i) { return i.dialog == this.typeName ? (this.setName(i.name), !0) : !1; }; Qi.prototype.publishChanges = function(i, e, t) { for (let r = 0; r < this.eventNotifiers.length; r++) this.eventNotifiers[r].publish(this, e, i, t); }; Qi.prototype.getName = function() { return this.instanceName; }; Qi.prototype.destroy = function() { const i = this.onChangedCallbacks.slice(); for (let e = 0; e < i.length; e++) i[e](this, Bf.DESTROYED); delete this; }; Qi.prototype.addChangedCallback = function(i) { this.onChangedCallbacks.includes(i) == !1 && this.onChangedCallbacks.push(i); }; Qi.prototype.removeChangedCallback = function(i) { const e = this.onChangedCallbacks.indexOf(i); e > -1 && this.onChangedCallbacks.splice(e, 1); }; Qi.prototype.addNotifier = function(i) { this.eventNotifiers.push(i); }; const Dc = (i, e, t) => { for (let r = 0; r < i.length; r++) if (i[r] && i[r].material && i[r].material.emissive) { let n = i[r].userData; n && n.isZincObject ? n.setEmissiveRGB(e) : i[r].material && i[r].material.emissive && i[r].material.emissive.setRGB(...e), t && i[r].material.depthFunc && (i[r].material.depthFunc = zn.THREE.LessEqualDepth), i[r].children.forEach((o) => { const a = o.userData; a && a.isZincObject && o.material && o.material.emissive && o.material.emissive.setRGB(...e); }); } }, LF = function() { let i = [], e = []; this.highlightColour = [1, 0, 0], this.selectColour = [0, 1, 0], this.originalColour = [0, 0, 0]; const t = [], r = [], n = this, o = function(c, l) { if (c.length == 0 && l.length == 0) return !1; for (let h = 0; h < c.length; h++) { let u = !1; for (let p = 0; p < l.length; p++) c[h] === l[p] && (u = !0); if (!u) return !0; } for (let h = 0; h < l.length; h++) { let u = !1; for (let p = 0; p < c.length; p++) l[h] === c[p] && (u = !0); if (!u) return !0; } return !1; }, a = function(c, l) { if (t.length = 0, l.length == 0) return c; for (let h = 0; h < c.length; h++) { let u = !1; for (let p = 0; p < l.length; p++) c[h] === l[p] && (u = !0); u || t.push(c[h]); } return t; }; this.setHighlighted = function(c) { const l = [...i]; n.resetHighlighted(); const h = a(c, e), u = s(h); return Dc(u, n.highlightColour, !1), i = h, o(i, l); }, this.setSelected = function(c) { const l = [...e]; n.resetHighlighted(), n.resetSelected(); const h = s(c); return Dc(h, n.selectColour, !1), e = c, o(e, l); }; const s = function(c) { r.length = 0; for (let l = 0; l < c.length; l++) c[l].material && r.push(c[l]); return r; }; this.resetHighlighted = function() { const c = s(i); Dc(c, n.originalColour, !0), i = []; }, this.resetSelected = function() { const c = s(e); Dc(c, n.originalColour, !0), e = []; }, this.getSelected = function() { return e; }, this.reset = function() { n.resetSelected(), n.resetHighlighted(); }; }, kf = Hc.THREE, RF = function() { const i = document.createElement("div"); let e; if (i.style.height = "100%", e0.isWebGLAvailable()) e = new Hc.Renderer(i, window), Hc.defaultMaterialColor = 16777116, e.initialiseVisualisation(), e.playAnimation = !1; else { const t = e0.getWebGLErrorMessage(); i.appendChild(t); } return { Zinc: Hc, renderer: e, container: i }; }, $t = function() { Qi.call(this), this.scene = void 0, this.rendererContainer = void 0, this.displayArea = void 0, this.graphicsHighlight = new LF(), this.selectObjectOnPick = !0, this.zincRenderer = null, this.selectedScreenCoordinates = new kf.Vector3(), this.selectedCenter = void 0, this.liveUpdatesObjects = void 0, this.ignorePreviousSelected = !1; }; $t.prototype = Object.create(Qi.prototype); $t.prototype.getIntersectedObject = function(i) { if (i) { const e = i.map((r) => { if (r && r.object && r.object.userData) { if (r.object.userData.isMarker) return 1; if (r.object.name && r.object.userData.isZincObject) return 2; } return 0; }); let t = e.indexOf(1); return t = t > -1 ? t : e.indexOf(2), i[t]; } }; $t.prototype.getAnnotationsFromObjects = function(i) { const e = []; for (var t = 0; t < i.length; t++) { const r = i[t].userData; let n; if (r) { if (r.isGlyph || r.isGlyphset) { let o = r; r.isGlyph && (o = r.getGlyphset()), n = o.userData ? o.userData.annotation : void 0, n && n.data && (i[t].name && i[t].name != "" ? n.data.id = i[t].name : n.data.id = o.groupName); } else n = r.userData ? r.userData.annotation : void 0, n && n.data && (n.data.id = i[t].name); n && (n.data.zincObject = r); } n && e.push(n); } return e; }; $t.prototype.setHighlightedByObjects = function(i, e, t, r) { const n = this.graphicsHighlight.setHighlighted(i), o = this.objectsToZincObjects(i); if (r) { let a = ul.MOVE; n && (a = ul.HIGHLIGHTED); const s = this.getAnnotationsFromObjects(i); s.length > 0 && (s[0].coords = e, s[0].extraData = t), this.publishChanges(s, a, o); } return n; }; $t.prototype.setHighlightedByZincObjects = function(i, e, t, r) { let n = []; return i && i.forEach((o) => { o && o.getMorph() && n.push(o.getMorph()); }), this.setHighlightedByObjects(n, e, t, r); }; $t.prototype.setupLiveCoordinates = function(i) { if (this.liveUpdatesObjects = i, i && i.length > 0) { const e = this.scene.getBoundingBoxOfZincObjects(i); let t = new kf.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(i) { const e = []; for (let t = 0; t < i.length; t++) { let r = i[t].userData; if (r) if (r.isGlyph || r.isGlyphset) { let n = r; r.isGlyph && (n = r.getGlyphset()), e.push(n); } else e.push(r); } return e; }; $t.prototype.setSelectedByObjects = function(i, e, t, r) { let n = !1; if (this.selectObjectOnPick ? n = this.graphicsHighlight.setSelected(i) : n = !0, n || this.ignorePreviousSelected) { const o = this.objectsToZincObjects(i); if (this.selectObjectOnPick && this.setupLiveCoordinates(o), r) { const a = ul.SELECTED, s = this.getAnnotationsFromObjects(i); s.length > 0 && (s[0].coords = e, s[0].extraData = t), this.publishChanges(s, a, o); } } return n; }; $t.prototype.setSelectedByZincObjects = function(i, e, t, r) { let n = []; return i && i.forEach((o) => { if (o) { const a = o.getMorph(); a && n.push(a); } }), this.setSelectedByObjects(n, e, t, r); }; $t.prototype.findObjectsByGroupName = function(i) { return this.scene.findObjectsWithGroupName(i); }; $t.prototype.setHighlightedByGroupName = function(i, e) { const t = this.findObjectsByGroupName(i); return this.setHighlightedByObjects(t, void 0, {}, e); }; $t.prototype.setSelectedByGroupName = function(i, e) { const t = this.findObjectsByGroupName(i); return this.setSelectedByObjects(t, void 0, {}, e); }; $t.prototype.changeBackgroundColour = function(i) { const e = new kf.Color(i); 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(i) { this.zincRenderer && (this.zincRenderer.playAnimation = i); }; $t.prototype.setPlayRate = function(i) { this.zincRenderer && this.zincRenderer.setPlayRate(i); }; $t.prototype.getPlayRate = function(i) { return this.zincRenderer ? this.zincRenderer.getPlayRate() : 0; }; $t.prototype.initialiseRenderer = function(i) { if (this.zincRenderer === void 0 || this.rendererContainer === void 0) { let e = RF(); this.Zinc = e.Zinc, this.zincRenderer = e.renderer, this.rendererContainer = e.container; } i && (this.displayArea = i, 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), Qi.prototype.destroy.call(this); }; const OF = function() { this.type = "anatomical", this.data = void 0, this.isAnnotation = !0; }, PF = function() { this.currentName = "", this.currentSystem = "", this.currentPart = "", this.currentSpecies = "", this.metaURL = "", this.viewURL = "", this.timeVarying = !1, this.currentTime = 0; }, G1 = function(i) { $t.call(this); const e = this; let t; this.sceneData = new PF(); const r = new Array(), n = new Array(), o = new Array(), a = new Array(); let s; const c = i; this.NDCCameraControl = void 0, e.typeName = "Organ Viewer", this.getSceneData = function() { return e.sceneData; }, this.updateTime = function(b) { let E = 6e3; e.scene && (E = e.scene.getDuration()); const S = b / 100 * E; e.sceneData.nerveMapIsActive || e.scene && e.scene.setMorphsTime(S), e.sceneData.currentTime = b; }; const l = function() { let b = 3e3; e.scene && (b = e.scene.getDuration()); const E = e.zincRenderer.getCurrentTime(); for (let S = 0; S < r.length; S++) r[S](E); !e.sceneData.nerveMapIsActive && t && t.setMorphsTime(E), e.sceneData.nerveMap && e.sceneData.nerveMap.additionalReader && e.sceneData.nerveMap.additionalReader.setTime(E / b), e.sceneData.currentTime = E / b * 100; }; this.getCurrentTime = function() { return e.sceneData.currentTime; }, this.toggleSyncControl = (b, E) => { let S = this.scene.getZincCameraControls(); b ? (S.resetView(), this.NDCCameraControl = S.enableSyncControl(), S.setRotationMode(E)) : (S.disableSyncControl(), this.NDCCameraControl = void 0, S.setRotationMode("free")); }, this.isSyncControl = () => this.NDCCameraControl !== void 0, this.setSyncControlZoomToBox = (b) => { this.NDCCameraControl && this.NDCCameraControl.zoomToBox(b, 2); }, this.setSyncControlCallback = (b) => { this.NDCCameraControl && this.NDCCameraControl.setEventCallback(b); }, this.setSyncControlCenterZoom = (b, E) => { this.NDCCameraControl && this.NDCCameraControl.setCenterZoom(b, E); }; const h = function() { if (e.zincRenderer.playAnimation && e.liveUpdatesObjects && e.setupLiveCoordinates(e.liveUpdatesObjects), e.selectedCenter) { const b = new zn.THREE.Vector3(); b.copy(e.selectedCenter); const E = e.scene.vectorToScreenXY(b); e.selectedScreenCoordinates.x = E.x, e.selectedScreenCoordinates.y = E.y; } }, u = function() { return function() { l(); }; }, p = function() { return function() { h(); }; }; this.addTimeChangedCallback = function(b) { r.push(b); }, this.setTexturePos = function(b) { e.sceneData.nerveMap && e.sceneData.nerveMap.additionalReader && e.sceneData.nerveMap.additionalReader.setSliderPos(b); }, this.addSceneChangedCallback = function(b) { n.push(b); }, this.addOrganPartAddedCallback = function(b) { o.push(b); }, this.addOrganPartRemovedCallback = function(b) { a.push(b); }, this.setFinishDownloadCallback = function(b) { s = b; }, this.unsetFinishDownloadCallback = function() { s = void 0; }, this.getNamedObjectsToScreenCoordinates = function(b, E) { const S = new zn.THREE.Vector3(); S.setFromMatrixPosition(obj.matrixWorld); const C = width / 2, R = height / 2; return S.project(E), S.x = S.x * C + C, S.y = -(S.y * R) + R, S; }; const m = function(b) { let E, S; if (b !== void 0) { let C = !1; b.object.userData && b.object.userData.isMarker ? (C = !0, S = b.object.userData.parent.getMorph()) : S = b.object; try { S.userData.userData.annotation.data.lastActionOnMarker = C; } finally { } if (S) if (S.name) E = S.name; else { const R = e.getAnnotationsFromObjects( [S] ); R && R[0] && (E = R[0].data.group); } } return { id: E, object: S }; }, g = function() { return function(b, E, S) { var C; const R = e.getIntersectedObject(b), L = m(R), A = { worldCoords: [ R ? R.point.x : 0, R ? R.point.y : 0, R ? R.point.z : 0 ], intersected: R, intersects: b }, P = { x: E, y: S }; if (L.id) { A.threeID = (C = L.object) == null ? void 0 : C.id, L.object.userData.isGlyph ? L.object.name ? e.setSelectedByObjects( [L.object], P, A, !0 ) : e.setSelectedByZincObjects( L.object.userData.getGlyphset(), P, A, !0 ) : e.setSelectedByObjects([L.object], P, A, !0); return; } else e.setSelectedByObjects([], P, A, !0); }; }, d = function() { return function(b, E, S) { var C; const R = e.getIntersectedObject(b), L = m(R), A = { worldCoords: [ R ? R.point.x : 0, R ? R.point.y : 0, R ? R.point.z : 0 ] }, P = { x: E, y: S }; if (L.id) { A.threeID = (C = L.object) == null ? void 0 : C.id, e.displayArea.style.cursor = "pointer", e.setHighlightedByObjects([L.object], P, A, !0); return; } else e.displayArea.style.cursor = "auto", e.setHighlightedByObjects([], P, A, !0); }; }, y = function(b, E, S, C) { if (C == "all" || C == "geometries") { const R = b.findGeometriesWithGroupName(E); for (let L = 0; L < R.length; L++) R[L].setVisibility(S); } if (C == "all" || C == "glyphsets") { const R = b.findGlyphsetsWithGroupName(E); for (let L = 0; L < R.length; L++) R[L].setVisibility(S); } if (C == "all" || C == "pointsets") { const R = b.findPointsetsWithGroupName(E); for (let L = 0; L < R.length; L++) R[L].setVisibility(S); } if (C == "all" || C == "lines") { const R = b.findLinesWithGroupName(E); for (let L = 0; L < R.length; L++) R[L].setVisibility(S); } }; this.changeGeometriesVisibility = function(b, E) { y(e.scene, b, E, "geometries"); }, this.changeGlyphsetsVisibility = function(b, E) { y(e.scene, b, E, "glyphsets"); }, this.changeLinesVisibility = function(b, E) { y(e.scene, b, E, "lines"); }, this.changePointsetsVisibility = function(b, E) { y(e.scene, b, E, "pointsets"); }, this.changeOrganPartsVisibility = function(b, E, S) { let C = "all"; S !== void 0 && (C = S), y(e.scene, b, E, C); }, this.changeOrganPartsVisibilityCallback = function(b) { return function(E) { e.changeOrganPartsVisibility(b, E); }; }, this.changeBackgroundColour = function(b) { const E = new zn.THREE.Color(b); e.zincRenderer && e.zincRenderer.getThreeJSRenderer().setClearColor(E, 1); }; const f = function(b, E, S, C) { for (let A = 0; A < o.length; A++) o[A](C, e.scene.isTimeVarying()); const R = new OF(), L = C.region.getFullPath(); R.data = { species: e.sceneData.currentSpecies, system: b, part: E, group: C.groupName, region: L, uuid: C.uuid, lastActionOnMarker: !1 }, C.userData.annotation = R; }, v = function(b, E, S, C) { for (let R = 0; R < a.length; R++) a[R](C); }, _ = function(b, E, S) { return function(C) { f(b, E, S, C); }; }, M = function(b, E, S) { return function(C) { v(b, E, S, C); }; }, T = function() { return function() { e.settingsChanged(), e.sceneData.timeVarying = e.scene.isTimeVarying(), s && s(); }; }; this.updateFieldvisibility = function(b, E) { for (let S = 0; S < b.length; S++) if (E != S) { const C = b[S].PartName; e.changeOrganPartsVisibility(C, !1); } if (E > -1) { const S = b[E].PartName; if (e.scene.findGeometriesWithGroupName(S).length > 0 || e.scene.findGlyphsetsWithGroupName(S).length > 0) e.changeOrganPartsVisibility(S, !0); else { const C = getOrganDetails(b[E].SystemName, S); C != null && e.scene.loadMetadataURL(c.getOrgansDirectoryPrefix() + "/" + C.meta); } } }, this.getAvailableSpecies = function(b, E, S) { const C = new Array(); C.push("none"); const R = Object.keys(organsFileMap); for (index in R) { const L = R[index]; L != b && organsFileMap[L].hasOwnProperty(E) && organsFileMap[L][E].hasOwnProperty(S) && C.push(L); } return C; }, this.getCentreAndSize = function() { const b = new zn.THREE.Vector3(), E = this.scene.getBoundingBox(); E.getCenter(b); const S = [b.x, b.y, b.z]; E.getSize(b); const C = [b.x, b.y, b.z]; return { centre: S, size: C }; }; const w = function(b, E, S, C) { e.sceneData.nerveMapIsActive = !1, e.sceneData.nerveMap = void 0, e.sceneData.metaURL = "", e.sceneData.viewURL = "", e.sceneData.currentSpecies = b, e.sceneData.currentSystem = E, e.sceneData.currentPart = S, e.sceneData.currentTime = 0, e.sceneData.timeVarying = !1; let R = ""; b && (R = b + "/"), E && (R = E + "/"), S && (R = S), e.sceneData.currentName = R; }; this.loadOrgansFromURL = function(b, E, S, C, R, L) { if (e.zincRenderer && C && e.sceneData.metaURL !== b) { w(E, S, C); const A = e.sceneData.currentName; let P = e.zincRenderer.getSceneByName(A); P ? L && P.clearAll() : P = e.zincRenderer.createScene(A), e.selectObjectOnPick = !0; for (let x = 0; x < n.length; x++) n[x](e.sceneData); R && R != "" ? (e.sceneData.viewURL = R, P.loadViewURL(e.sceneData.viewURL)) : e.sceneData.viewURL = void 0, e.sceneData.metaURL = b, P.addZincObjectAddedCallbacks(_(S, C, !1)), P.addZincObjectRemovedCallbacks(M(void 0, C, !1)), P.loadMetadataURL(b, void 0, T()), e.scene = P, e.zincRenderer.setCurrentScene(P), e.graphicsHighlight.reset(); const O = P.getZincCameraControls(); O.enableRaycaster(P, g(), d()), O.setMouseButtonAction("AUXILIARY", "ZOOM"), O.setMouseButtonAction("SECONDARY", "PAN"); } }, this.loadGLTFFromURL = function(b, E, S) { if (e.zincRenderer && E && e.sceneData.metaURL !== b) { w(void 0, void 0, E); const C = e.sceneData.currentName; let R = e.zincRenderer.getSceneByName(C); R ? S && R.clearAll() : R = e.zincRenderer.createScene(C); for (let A = 0; A < n.length; A++) n[A](e.sceneData); e.sceneData.viewURL = void 0, e.sceneData.metaURL = b, R.addZincObjectAddedCallbacks(_(void 0, E, !1)), R.addZincObjectRemovedCallbacks(M(void 0, E, !1)), R.loadGLTF(b, void 0, T()), e.scene = R, e.zincRenderer.setCurrentScene(R), e.graphicsHighlight.reset(); const L = R.getZincCameraControls(); L.enableRaycaster(R, g(), d()), L.setMouseButtonAction("AUXILIARY", "ZOOM"), L.setMouseButtonAction("SECONDARY", "PAN"); } }, this.alignCameraWithSelectedObject = function(b) { const E = e.graphicsHighlight.getSelected(); E && E[0] && E[0].userData && e.scene.alignObjectToCameraView(E[0].userData, b); }, this.exportSettings = function() { const b = {}; return b.name = e.instanceName, e.sceneData.currentSystem && (b.system = e.sceneData.currentSystem), e.sceneData.currentSpecies && (b.species = e.sceneData.currentSpecies), e.sceneData.currentPart && (b.part = e.sceneData.currentPart), b.metaURL = e.sceneData.metaURL, e.sceneData.viewURL && (b.viewURL = e.sceneData.viewURL), b.dialog = "Organ Viewer", b; }, this.importSettings = function(b) { return b && b.dialog == this.typeName ? (e.setName(b.name), b.metaURL !== void 0 && b.metaURL != "" ? e.loadOrgansFromURL( b.metaURL, b.species, b.system, b.part, b.viewURL, !0 ) : e.loadOrgans(b.species, b.system, b.part), !0) : !1; }, function() { e.initialiseRenderer(void 0), e.zincRenderer && (e.zincRenderer.addPreRenderCallbackFunction(u()), e.zincRenderer.addPostRenderCallbackFunction(p())); }(); }; G1.prototype = Object.create($t.prototype); var Ct = function() { return Ct = Object.assign || function(i) { for (var e, t = 1, r = arguments.length; t < r; t++) { e = arguments[t]; for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (i[n] = e[n]); } return i; }, Ct.apply(this, arguments); }; function IF(i, e, t, r) { function n(o) { return o instanceof t ? o : new t(function(a) { a(o); }); } return new (t || (t = Promise))(function(o, a) { function s(h) { try { l(r.next(h)); } catch (u) { a(u); } } function c(h) { try { l(r.throw(h)); } catch (u) { a(u); } } function l(h) { h.done ? o(h.value) : n(h.value).then(s, c); } l((r = r.apply(i, [])).next()); }); } function DF(i, e) { var t = { label: 0, sent: function() { if (o[0] & 1) throw o[1]; return o[1]; }, trys: [], ops: [] }, r, n, o, a; return a = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function s(l) { return function(h) { return c([l, h]); }; } function c(l) { if (r) throw new TypeError("Generator is already executing."); for (; a && (a = 0, l[0] && (t = 0)), t; ) try { if (r = 1, n && (o = l[0] & 2 ? n.return : l[0] ? n.throw || ((o = n.return) && o.call(n), 0) : n.next) && !(o = o.call(n, l[1])).done) return o; switch (n = 0, o && (l = [l[0] & 2, o.value]), l[0]) { case 0: case 1: o = l; break; case 4: return t.label++, { value: l[1], done: !1 }; case 5: t.label++, n = l[1], l = [0]; continue; case 7: l = t.ops.pop(), t.trys.pop(); continue; default: if (o = t.trys, !(o = o.length > 0 && o[o.length - 1]) && (l[0] === 6 || l[0] === 2)) { t = 0; continue; } if (l[0] === 3 && (!o || l[1] > o[0] && l[1] < o[3])) { t.label = l[1]; break; } if (l[0] === 6 && t.label < o[1]) { t.label = o[1], o = l; break; } if (o && t.label < o[2]) { t.label = o[2], t.ops.push(l); break; } o[2] && t.ops.pop(), t.trys.pop(); continue; } l = e.call(i, t); } catch (h) { l = [6, h], n = 0; } finally { r = o = 0; } if (l[0] & 5) throw l[1]; return { value: l[0] ? l[1] : void 0, done: !0 }; } } function nt(i) { var e = typeof Symbol == "function" && Symbol.iterator, t = e && i[e], r = 0; if (t) return t.call(i); if (i && typeof i.length == "number") return { next: function() { return i && r >= i.length && (i = void 0), { value: i && i[r++], done: !i }; } }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } function Zt(i, e) { var t = typeof Symbol == "function" && i[Symbol.iterator]; if (!t) return i; var r = t.call(i), n, o = [], a; try { for (; (e === void 0 || e-- > 0) && !(n = r.next()).done; ) o.push(n.value); } catch (s) { a = { error: s }; } finally { try { n && !n.done && (t = r.return) && t.call(r); } finally { if (a) throw a.error; } } return o; } var NF = "ENTRIES", W1 = "KEYS", $1 = "VALUES", vi = "", qh = ( /** @class */ function() { function i(e, t) { var r = e._tree, n = Array.from(r.keys()); this.set = e, this._type = t, this._path = n.length > 0 ? [{ node: r, keys: n }] : []; } return i.prototype.next = function() { var e = this.dive(); return this.backtrack(), e; }, i.prototype.dive = function() { if (this._path.length === 0) return { done: !0, value: void 0 }; var e = ya(this._path), t = e.node, r = e.keys; if (ya(r) === vi) return { done: !1, value: this.result() }; var n = t.get(ya(r)); return this._path.push({ node: n, keys: Array.from(n.keys()) }), this.dive(); }, i.prototype.backtrack = function() { if (this._path.length !== 0) { var e = ya(this._path).keys; e.pop(), !(e.length > 0) && (this._path.pop(), this.backtrack()); } }, i.prototype.key = function() { return this.set._prefix + this._path.map(function(e) { var t = e.keys; return ya(t); }).filter(function(e) { return e !== vi; }).join(""); }, i.prototype.value = function() { return ya(this._path).node.get(vi); }, i.prototype.result = function() { switch (this._type) { case $1: return this.value(); case W1: return this.key(); default: return [this.key(), this.value()]; } }, i.prototype[Symbol.iterator] = function() { return this; }, i; }() ), ya = function(i) { return i[i.length - 1]; }, BF = function(i, e, t) { var r = /* @__PURE__ */ new Map(); if (e === void 0) return r; for (var n = e.length + 1, o = n + t, a = new Uint8Array(o * n).fill(t + 1), s = 0; s < n; ++s) a[s] = s; for (var c = 1; c < o; ++c) a[c * n] = c; return q1(i, e, t, r, a, 1, n, ""), r; }, q1 = function(i, e, t, r, n, o, a, s) { var c, l, h = o * a; try { e: for (var u = nt(i.keys()), p = u.next(); !p.done; p = u.next()) { var m = p.value; if (m === vi) { var g = n[h - 1]; g <= t && r.set(s, [i.get(m), g]); } else { for (var d = o, y = 0; y < m.length; ++y, ++d) { for (var f = m[y], v = a * d, _ = v - a, M = n[v], T = Math.max(0, d - t - 1), w = Math.min(a - 1, d + t), b = T; b < w; ++b) { var E = f !== e[b], S = n[_ + b] + +E, C = n[_ + b + 1] + 1, R = n[v + b] + 1, L = n[v + b + 1] = Math.min(S, C, R); L < M && (M = L); } if (M > t) continue e; } q1(i.get(m), e, t, r, n, d, a, s + m); } } } catch (A) { c = { error: A }; } finally { try { p && !p.done && (l = u.return) && l.call(u); } finally { if (c) throw c.error; } } }, Xh = ( /** @class */ function() { function i(e, t) { e === void 0 && (e = /* @__PURE__ */ new Map()), t === void 0 && (t = ""), this._size = void 0, this._tree = e, this._prefix = t; } return i.prototype.atPrefix = function(e) { var t, r; if (!e.startsWith(this._prefix)) throw new Error("Mismatched prefix"); var n = Zt(ou(this._tree, e.slice(this._prefix.length)), 2), o = n[0], a = n[1]; if (o === void 0) { var s = Zt(Ff(a), 2), c = s[0], l = s[1]; try { for (var h = nt(c.keys()), u = h.next(); !u.done; u = h.next()) { var p = u.value; if (p !== vi && p.startsWith(l)) { var m = /* @__PURE__ */ new Map(); return m.set(p.slice(l.length), c.get(p)), new i(m, e); } } } catch (g) { t = { error: g }; } finally { try { u && !u.done && (r = h.return) && r.call(h); } finally { if (t) throw t.error; } } } return new i(o, e); }, i.prototype.clear = function() { this._size = void 0, this._tree.clear(); }, i.prototype.delete = function(e) { return this._size = void 0, kF(this._tree, e); }, i.prototype.entries = function() { return new qh(this, NF); }, i.prototype.forEach = function(e) { var t, r; try { for (var n = nt(this), o = n.next(); !o.done; o = n.next()) { var a = Zt(o.value, 2), s = a[0], c = a[1]; e(s, c, this); } } catch (l) { t = { error: l }; } finally { try { o && !o.done && (r = n.return) && r.call(n); } finally { if (t) throw t.error; } } }, i.prototype.fuzzyGet = function(e, t) { return BF(this._tree, e, t); }, i.prototype.get = function(e) { var t = ep(this._tree, e); return t !== void 0 ? t.get(vi) : void 0; }, i.prototype.has = function(e) { var t = ep(this._tree, e); return t !== void 0 && t.has(vi); }, i.prototype.keys = function() { return new qh(this, W1); }, i.prototype.set = function(e, t) { if (typeof e != "string") throw new Error("key must be a string"); this._size = void 0; var r = Zh(this._tree, e); return r.set(vi, t), this; }, Object.defineProperty(i.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 }), i.prototype.update = function(e, t) { if (typeof e != "string") throw new Error("key must be a string"); this._size = void 0; var r = Zh(this._tree, e); return r.set(vi, t(r.get(vi))), this; }, i.prototype.fetch = function(e, t) { if (typeof e != "string") throw new Error("key must be a string"); this._size = void 0; var r = Zh(this._tree, e), n = r.get(vi); return n === void 0 && r.set(vi, n = t()), n; }, i.prototype.values = function() { return new qh(this, $1); }, i.prototype[Symbol.iterator] = function() { return this.entries(); }, i.from = function(e) { var t, r, n = new i(); try { for (var o = nt(e), a = o.next(); !a.done; a = o.next()) { var s = Zt(a.value, 2), c = s[0], l = s[1]; n.set(c, l); } } catch (h) { t = { error: h }; } finally { try { a && !a.done && (r = o.return) && r.call(o); } finally { if (t) throw t.error; } } return n; }, i.fromObject = function(e) { return i.from(Object.entries(e)); }, i; }() ), ou = function(i, e, t) { var r, n; if (t === void 0 && (t = []), e.length === 0 || i == null) return [i, t]; try { for (var o = nt(i.keys()), a = o.next(); !a.done; a = o.next()) { var s = a.value; if (s !== vi && e.startsWith(s)) return t.push([i, s]), ou(i.get(s), e.slice(s.length), t); } } catch (c) { r = { error: c }; } finally { try { a && !a.done && (n = o.return) && n.call(o); } finally { if (r) throw r.error; } } return t.push([i, e]), ou(void 0, "", t); }, ep = function(i, e) { var t, r; if (e.length === 0 || i == null) return i; try { for (var n = nt(i.keys()), o = n.next(); !o.done; o = n.next()) { var a = o.value; if (a !== vi && e.startsWith(a)) return ep(i.get(a), e.slice(a.length)); } } catch (s) { t = { error: s }; } finally { try { o && !o.done && (r = n.return) && r.call(n); } finally { if (t) throw t.error; } } }, Zh = function(i, e) { var t, r, n = e.length; e: for (var o = 0; i && o < n; ) { try { for (var a = (t = void 0, nt(i.keys())), s = a.next(); !s.done; s = a.next()) { var c = s.value; if (c !== vi && e[o] === c[0]) { for (var l = Math.min(n - o, c.length), h = 1; h < l && e[o + h] === c[h]; ) ++h; var u = i.get(c); if (h === c.length) i = u; else { var p = /* @__PURE__ */ new Map(); p.set(c.slice(h), u), i.set(e.slice(o, o + h), p), i.delete(c), i = p; } o += h; continue e; } } } catch (g) { t = { error: g }; } finally { try { s && !s.done && (r = a.return) && r.call(a); } finally { if (t) throw t.error; } } var m = /* @__PURE__ */ new Map(); return i.set(e.slice(o), m), m; } return i; }, kF = function(i, e) { var t = Zt(ou(i, e), 2), r = t[0], n = t[1]; if (r !== void 0) { if (r.delete(vi), r.size === 0) X1(n); else if (r.size === 1) { var o = Zt(r.entries().next().value, 2), a = o[0], s = o[1]; Z1(n, a, s); } } }, X1 = function(i) { if (i.length !== 0) { var e = Zt(Ff(i), 2), t = e[0], r = e[1]; if (t.delete(r), t.size === 0) X1(i.slice(0, -1)); else if (t.size === 1) { var n = Zt(t.entries().next().value, 2), o = n[0], a = n[1]; o !== vi && Z1(i.slice(0, -1), o, a); } } }, Z1 = function(i, e, t) { if (i.length !== 0) { var r = Zt(Ff(i), 2), n = r[0], o = r[1]; n.set(o + e, t), n.delete(o); } }, Ff = function(i) { return i[i.length - 1]; }, Is, zf = "or", Y1 = "and", FF = "and_not", zF = ( /** @class */ function() { function i(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 ? Kh : e.autoVacuum; this._options = Ct(Ct(Ct({}, Jh), e), { autoVacuum: t, searchOptions: Ct(Ct({}, t0), e.searchOptions || {}), autoSuggestOptions: Ct(Ct({}, GF), e.autoSuggestOptions || {}) }), this._index = new Xh(), 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 = ip, this.addFields(this._options.fields); } return i.prototype.add = function(e) { var t, r, n, o, a, s, c = this._options, l = c.extractField, h = c.tokenize, u = c.processTerm, p = c.fields, m = c.idField, g = l(e, m); if (g == null) throw new Error('MiniSearch: document does not have ID field "'.concat(m, '"')); if (this._idToShortId.has(g)) throw new Error("MiniSearch: duplicate ID ".concat(g)); var d = this.addDocumentId(g); this.saveStoredFields(d, e); try { for (var y = nt(p), f = y.next(); !f.done; f = y.next()) { var v = f.value, _ = l(e, v); if (_ != null) { var M = h(_.toString(), v), T = this._fieldIds[v], w = new Set(M).size; this.addFieldLength(d, T, this._documentCount - 1, w); try { for (var b = (n = void 0, nt(M)), E = b.next(); !E.done; E = b.next()) { var S = E.value, C = u(S, v); if (Array.isArray(C)) try { for (var R = (a = void 0, nt(C)), L = R.next(); !L.done; L = R.next()) { var A = L.value; this.addTerm(T, d, A); } } catch (P) { a = { error: P }; } finally { try { L && !L.done && (s = R.return) && s.call(R); } finally { if (a) throw a.error; } } else C && this.addTerm(T, d, C); } } catch (P) { n = { error: P }; } finally { try { E && !E.done && (o = b.return) && o.call(b); } finally { if (n) throw n.error; } } } } } catch (P) { t = { error: P }; } finally { try { f && !f.done && (r = y.return) && r.call(y); } finally { if (t) throw t.error; } } }, i.prototype.addAll = function(e) { var t, r; try { for (var n = nt(e), o = n.next(); !o.done; o = n.next()) { var a = o.value; this.add(a); } } catch (s) { t = { error: s }; } finally { try { o && !o.done && (r = n.return) && r.call(n); } finally { if (t) throw t.error; } } }, i.prototype.addAllAsync = function(e, t) { var r = this; t === void 0 && (t = {}); var n = t.chunkSize, o = n === void 0 ? 10 : n, a = { chunk: [], promise: Promise.resolve() }, s = e.reduce(function(h, u, p) { var m = h.chunk, g = h.promise; return m.push(u), (p + 1) % o === 0 ? { chunk: [], promise: g.then(function() { return new Promise(function(d) { return setTimeout(d, 0); }); }).then(function() { return r.addAll(m); }) } : { chunk: m, promise: g }; }, a), c = s.chunk, l = s.promise; return l.then(function() { return r.addAll(c); }); }, i.prototype.remove = function(e) { var t, r, n, o, a, s, c = this._options, l = c.tokenize, h = c.processTerm, u = c.extractField, p = c.fields, m = c.idField, g = u(e, m); if (g == null) throw new Error('MiniSearch: document does not have ID field "'.concat(m, '"')); var d = this._idToShortId.get(g); if (d == null) throw new Error("MiniSearch: cannot remove document with ID ".concat(g, ": it is not in the index")); try { for (var y = nt(p), f = y.next(); !f.done; f = y.next()) { var v = f.value, _ = u(e, v); if (_ != null) { var M = l(_.toString(), v), T = this._fieldIds[v], w = new Set(M).size; this.removeFieldLength(d, T, this._documentCount, w); try { for (var b = (n = void 0, nt(M)), E = b.next(); !E.done; E = b.next()) { var S = E.value, C = h(S, v); if (Array.isArray(C)) try { for (var R = (a = void 0, nt(C)), L = R.next(); !L.done; L = R.next()) { var A = L.value; this.removeTerm(T, d, A); } } catch (P) { a = { error: P }; } finally { try { L && !L.done && (s = R.return) && s.call(R); } finally { if (a) throw a.error; } } else C && this.removeTerm(T, d, C); } } catch (P) { n = { error: P }; } finally { try { E && !E.done && (o = b.return) && o.call(b); } finally { if (n) throw n.error; } } } } } catch (P) { t = { error: P }; } finally { try { f && !f.done && (r = y.return) && r.call(y); } finally { if (t) throw t.error; } } this._storedFields.delete(d), this._documentIds.delete(d), this._idToShortId.delete(g), this._fieldLength.delete(d), this._documentCount -= 1; }, i.prototype.removeAll = function(e) { var t, r; if (e) try { for (var n = nt(e), o = n.next(); !o.done; o = n.next()) { var a = o.value; this.remove(a); } } catch (s) { t = { error: s }; } finally { try { o && !o.done && (r = n.return) && r.call(n); } 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 Xh(), 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; } }, i.prototype.discard = function(e) { var t = this, r = this._idToShortId.get(e); if (r == 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(r), this._storedFields.delete(r), (this._fieldLength.get(r) || []).forEach(function(n, o) { t.removeFieldLength(r, o, t._documentCount, n); }), this._fieldLength.delete(r), this._documentCount -= 1, this._dirtCount += 1, this.maybeAutoVacuum(); }, i.prototype.maybeAutoVacuum = function() { if (this._options.autoVacuum !== !1) { var e = this._options.autoVacuum, t = e.minDirtFactor, r = e.minDirtCount, n = e.batchSize, o = e.batchWait; this.conditionalVacuum({ batchSize: n, batchWait: o }, { minDirtCount: r, minDirtFactor: t }); } }, i.prototype.discardAll = function(e) { var t, r, n = this._options.autoVacuum; try { this._options.autoVacuum = !1; try { for (var o = nt(e), a = o.next(); !a.done; a = o.next()) { var s = a.value; this.discard(s); } } catch (c) { t = { error: c }; } finally { try { a && !a.done && (r = o.return) && r.call(o); } finally { if (t) throw t.error; } } } finally { this._options.autoVacuum = n; } this.maybeAutoVacuum(); }, i.prototype.replace = function(e) { var t = this._options, r = t.idField, n = t.extractField, o = n(e, r); this.discard(o), this.add(e); }, i.prototype.vacuum = function(e) { return e === void 0 && (e = {}), this.conditionalVacuum(e); }, i.prototype.conditionalVacuum = function(e, t) { var r = this; return this._currentVacuum ? (this._enqueuedVacuumConditions = this._enqueuedVacuumConditions && t, this._enqueuedVacuum != null ? this._enqueuedVacuum : (this._enqueuedVacuum = this._currentVacuum.then(function() { var n = r._enqueuedVacuumConditions; return r._enqueuedVacuumConditions = ip, r.performVacuuming(e, n); }), this._enqueuedVacuum)) : this.vacuumConditionsMet(t) === !1 ? Promise.resolve() : (this._currentVacuum = this.performVacuuming(e), this._currentVacuum); }, i.prototype.performVacuuming = function(e, t) { return IF(this, void 0, void 0, function() { var r, n, o, a, s, c, l, h, u, p, m, g, d, y, f, v, _, M, T, w, b, E, S, C, R; return DF(this, function(L) { switch (L.label) { case 0: if (r = this._dirtCount, !this.vacuumConditionsMet(t)) return [3, 10]; n = e.batchSize || tp.batchSize, o = e.batchWait || tp.batchWait, a = 1, L.label = 1; case 1: L.trys.push([1, 7, 8, 9]), s = nt(this._index), c = s.next(), L.label = 2; case 2: if (c.done) return [3, 6]; l = Zt(c.value, 2), h = l[0], u = l[1]; try { for (p = (E = void 0, nt(u)), m = p.next(); !m.done; m = p.next()) { g = Zt(m.value, 2), d = g[0], y = g[1]; try { for (f = (C = void 0, nt(y)), v = f.next(); !v.done; v = f.next()) _ = Zt(v.value, 1), M = _[0], !this._documentIds.has(M) && (y.size <= 1 ? u.delete(d) : y.delete(M)); } catch (A) { C = { error: A }; } finally { try { v && !v.done && (R = f.return) && R.call(f); } finally { if (C) throw C.error; } } } } catch (A) { E = { error: A }; } finally { try { m && !m.done && (S = p.return) && S.call(p); } finally { if (E) throw E.error; } } return this._index.get(h).size === 0 && this._index.delete(h), a % n !== 0 ? [3, 4] : [4, new Promise(function(A) { return setTimeout(A, o); })]; case 3: L.sent(), L.label = 4; case 4: a += 1, L.label = 5; case 5: return c = s.next(), [3, 2]; case 6: return [3, 9]; case 7: return T = L.sent(), w = { error: T }, [3, 9]; case 8: try { c && !c.done && (b = s.return) && b.call(s); } finally { if (w) throw w.error; } return [ 7 /*endfinally*/ ]; case 9: this._dirtCount -= r, L.label = 10; case 10: return [4, null]; case 11: return L.sent(), this._currentVacuum = this._enqueuedVacuum, this._enqueuedVacuum = null, [ 2 /*return*/ ]; } }); }); }, i.prototype.vacuumConditionsMet = function(e) { if (e == null) return !0; var t = e.minDirtCount, r = e.minDirtFactor; return t = t || Kh.minDirtCount, r = r || Kh.minDirtFactor, this.dirtCount >= t && this.dirtFactor >= r; }, Object.defineProperty(i.prototype, "isVacuuming", { /** * Is `true` if a vacuuming operation is ongoing, `false` otherwise */ get: function() { return this._currentVacuum != null; }, enumerable: !1, configurable: !0 }), Object.defineProperty(i.prototype, "dirtCount", { /** * The number of documents discarded since the most recent vacuuming */ get: function() { return this._dirtCount; }, enumerable: !1, configurable: !0 }), Object.defineProperty(i.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 }), i.prototype.has = function(e) { return this._idToShortId.has(e); }, i.prototype.getStoredFields = function(e) { var t = this._idToShortId.get(e); if (t != null) return this._storedFields.get(t); }, i.prototype.search = function(e, t) { var r, n; t === void 0 && (t = {}); var o = this.executeQuery(e, t), a = []; try { for (var s = nt(o), c = s.next(); !c.done; c = s.next()) { var l = Zt(c.value, 2), h = l[0], u = l[1], p = u.score, m = u.terms, g = u.match, d = m.length || 1, y = { id: this._documentIds.get(h), score: p * d, terms: Object.keys(g), queryTerms: m, match: g }; Object.assign(y, this._storedFields.get(h)), (t.filter == null || t.filter(y)) && a.push(y); } } catch (f) { r = { error: f }; } finally { try { c && !c.done && (n = s.return) && n.call(s); } finally { if (r) throw r.error; } } return e === i.wildcard && t.boostDocument == null && this._options.searchOptions.boostDocument == null || a.sort(r0), a; }, i.prototype.autoSuggest = function(e, t) { var r, n, o, a; t === void 0 && (t = {}), t = Ct(Ct({}, this._options.autoSuggestOptions), t); var s = /* @__PURE__ */ new Map(); try { for (var c = nt(this.search(e, t)), l = c.next(); !l.done; l = c.next()) { var h = l.value, u = h.score, p = h.terms, m = p.join(" "), g = s.get(m); g != null ? (g.score += u, g.count += 1) : s.set(m, { score: u, terms: p, count: 1 }); } } catch (T) { r = { error: T }; } finally { try { l && !l.done && (n = c.return) && n.call(c); } finally { if (r) throw r.error; } } var d = []; try { for (var y = nt(s), f = y.next(); !f.done; f = y.next()) { var v = Zt(f.value, 2), g = v[0], _ = v[1], u = _.score, p = _.terms, M = _.count; d.push({ suggestion: g, terms: p, score: u / M }); } } catch (T) { o = { error: T }; } finally { try { f && !f.done && (a = y.return) && a.call(y); } finally { if (o) throw o.error; } } return d.sort(r0), d; }, Object.defineProperty(i.prototype, "documentCount", { /** * Total number of documents available to search */ get: function() { return this._documentCount; }, enumerable: !1, configurable: !0 }), Object.defineProperty(i.prototype, "termCount", { /** * Number of terms in the index */ get: function() { return this._index.size; }, enumerable: !1, configurable: !0 }), i.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); }, i.getDefault = function(e) { if (Jh.hasOwnProperty(e)) return Yh(Jh, e); throw new Error('MiniSearch: unknown option "'.concat(e, '"')); }, i.loadJS = function(e, t) { var r, n, o, a, s, c, l = e.index, h = e.documentCount, u = e.nextId, p = e.documentIds, m = e.fieldIds, g = e.fieldLength, d = e.averageFieldLength, y = e.storedFields, f = e.dirtCount, v = e.serializationVersion; if (v !== 1 && v !== 2) throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version"); var _ = new i(t); _._documentCount = h, _._nextId = u, _._documentIds = Nc(p), _._idToShortId = /* @__PURE__ */ new Map(), _._fieldIds = m, _._fieldLength = Nc(g), _._avgFieldLength = d, _._storedFields = Nc(y), _._dirtCount = f || 0, _._index = new Xh(); try { for (var M = nt(_._documentIds), T = M.next(); !T.done; T = M.next()) { var w = Zt(T.value, 2), b = w[0], E = w[1]; _._idToShortId.set(E, b); } } catch (D) { r = { error: D }; } finally { try { T && !T.done && (n = M.return) && n.call(M); } finally { if (r) throw r.error; } } try { for (var S = nt(l), C = S.next(); !C.done; C = S.next()) { var R = Zt(C.value, 2), L = R[0], A = R[1], P = /* @__PURE__ */ new Map(); try { for (var O = (s = void 0, nt(Object.keys(A))), x = O.next(); !x.done; x = O.next()) { var I = x.value, N = A[I]; v === 1 && (N = N.ds), P.set(parseInt(I, 10), Nc(N)); } } catch (D) { s = { error: D }; } finally { try { x && !x.done && (c = O.return) && c.call(O); } finally { if (s) throw s.error; } } _._index.set(L, P); } } catch (D) { o = { error: D }; } finally { try { C && !C.done && (a = S.return) && a.call(S); } finally { if (o) throw o.error; } } return _; }, i.prototype.executeQuery = function(e, t) { var r = this; if (t === void 0 && (t = {}), e === i.wildcard) return this.executeWildcardQuery(t); if (typeof e != "string") { var n = Ct(Ct(Ct({}, t), e), { queries: void 0 }), o = e.queries.map(function(y) { return r.executeQuery(y, n); }); return this.combineResults(o, n.combineWith); } var a = this._options, s = a.tokenize, c = a.processTerm, l = a.searchOptions, h = Ct(Ct({ tokenize: s, processTerm: c }, l), t), u = h.tokenize, p = h.processTerm, m = u(e).flatMap(function(y) { return p(y); }).filter(function(y) { return !!y; }), g = m.map(jF(h)), d = g.map(function(y) { return r.executeQuerySpec(y, h); }); return this.combineResults(d, h.combineWith); }, i.prototype.executeQuerySpec = function(e, t) { var r, n, o, a, s = Ct(Ct({}, this._options.searchOptions), t), c = (s.fields || this._options.fields).reduce(function(I, N) { var D; return Ct(Ct({}, I), (D = {}, D[N] = Yh(s.boost, N) || 1, D)); }, {}), l = s.boostDocument, h = s.weights, u = s.maxFuzzy, p = s.bm25, m = Ct(Ct({}, t0.weights), h), g = m.fuzzy, d = m.prefix, y = this._index.get(e.term), f = this.termResults(e.term, e.term, 1, y, c, l, p), v, _; if (e.prefix && (v = this._index.atPrefix(e.term)), e.fuzzy) { var M = e.fuzzy === !0 ? 0.2 : e.fuzzy, T = M < 1 ? Math.min(u, Math.round(e.term.length * M)) : M; T && (_ = this._index.fuzzyGet(e.term, T)); } if (v) try { for (var w = nt(v), b = w.next(); !b.done; b = w.next()) { var E = Zt(b.value, 2), S = E[0], C = E[1], R = S.length - e.term.length; if (R) { _ == null || _.delete(S); var L = d * S.length / (S.length + 0.3 * R); this.termResults(e.term, S, L, C, c, l, p, f); } } } catch (I) { r = { error: I }; } finally { try { b && !b.done && (n = w.return) && n.call(w); } finally { if (r) throw r.error; } } if (_) try { for (var A = nt(_.keys()), P = A.next(); !P.done; P = A.next()) { var S = P.value, O = Zt(_.get(S), 2), x = O[0], R = O[1]; if (R) { var L = g * S.length / (S.length + R); this.termResults(e.term, S, L, x, c, l, p, f); } } } catch (I) { o = { error: I }; } finally { try { P && !P.done && (a = A.return) && a.call(A); } finally { if (o) throw o.error; } } return f; }, i.prototype.executeWildcardQuery = function(e) { var t, r, n = /* @__PURE__ */ new Map(), o = Ct(Ct({}, this._options.searchOptions), e); try { for (var a = nt(this._documentIds), s = a.next(); !s.done; s = a.next()) { var c = Zt(s.value, 2), l = c[0], h = c[1], u = o.boostDocument ? o.boostDocument(h, "", this._storedFields.get(l)) : 1; n.set(l, { score: u, terms: [], match: {} }); } } catch (p) { t = { error: p }; } finally { try { s && !s.done && (r = a.return) && r.call(a); } finally { if (t) throw t.error; } } return n; }, i.prototype.combineResults = function(e, t) { if (t === void 0 && (t = zf), e.length === 0) return /* @__PURE__ */ new Map(); var r = t.toLowerCase(); return e.reduce(UF[r]) || /* @__PURE__ */ new Map(); }, i.prototype.toJSON = function() { var e, t, r, n, o = []; try { for (var a = nt(this._index), s = a.next(); !s.done; s = a.next()) { var c = Zt(s.value, 2), l = c[0], h = c[1], u = {}; try { for (var p = (r = void 0, nt(h)), m = p.next(); !m.done; m = p.next()) { var g = Zt(m.value, 2), d = g[0], y = g[1]; u[d] = Object.fromEntries(y); } } catch (f) { r = { error: f }; } finally { try { m && !m.done && (n = p.return) && n.call(p); } finally { if (r) throw r.error; } } o.push([l, u]); } } catch (f) { e = { error: f }; } finally { try { s && !s.done && (t = a.return) && t.call(a); } 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: o, serializationVersion: 2 }; }, i.prototype.termResults = function(e, t, r, n, o, a, s, c) { var l, h, u, p, m; if (c === void 0 && (c = /* @__PURE__ */ new Map()), n == null) return c; try { for (var g = nt(Object.keys(o)), d = g.next(); !d.done; d = g.next()) { var y = d.value, f = o[y], v = this._fieldIds[y], _ = n.get(v); if (_ != null) { var M = _.size, T = this._avgFieldLength[v]; try { for (var w = (u = void 0, nt(_.keys())), b = w.next(); !b.done; b = w.next()) { var E = b.value; if (!this._documentIds.has(E)) { this.removeTerm(v, E, t), M -= 1; continue; } var S = a ? a(this._documentIds.get(E), t, this._storedFields.get(E)) : 1; if (S) { var C = _.get(E), R = this._fieldLength.get(E)[v], L = HF(C, M, this._documentCount, R, T, s), A = r * f * S * L, P = c.get(E); if (P) { P.score += A, WF(P.terms, e); var O = Yh(P.match, t); O ? O.push(y) : P.match[t] = [y]; } else c.set(E, { score: A, terms: [e], match: (m = {}, m[t] = [y], m) }); } } } catch (x) { u = { error: x }; } finally { try { b && !b.done && (p = w.return) && p.call(w); } finally { if (u) throw u.error; } } } } } catch (x) { l = { error: x }; } finally { try { d && !d.done && (h = g.return) && h.call(g); } finally { if (l) throw l.error; } } return c; }, i.prototype.addTerm = function(e, t, r) { var n = this._index.fetch(r, n0), o = n.get(e); if (o == null) o = /* @__PURE__ */ new Map(), o.set(t, 1), n.set(e, o); else { var a = o.get(t); o.set(t, (a || 0) + 1); } }, i.prototype.removeTerm = function(e, t, r) { if (!this._index.has(r)) { this.warnDocumentChanged(t, e, r); return; } var n = this._index.fetch(r, n0), o = n.get(e); o == null || o.get(t) == null ? this.warnDocumentChanged(t, e, r) : o.get(t) <= 1 ? o.size <= 1 ? n.delete(e) : o.delete(t) : o.set(t, o.get(t) - 1), this._index.get(r).size === 0 && this._index.delete(r); }, i.prototype.warnDocumentChanged = function(e, t, r) { var n, o; try { for (var a = nt(Object.keys(this._fieldIds)), s = a.next(); !s.done; s = a.next()) { var c = s.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(r, '" was not present in field "').concat(c, '". Removing a document after it has changed can corrupt the index!'), "version_conflict"); return; } } } catch (l) { n = { error: l }; } finally { try { s && !s.done && (o = a.return) && o.call(a); } finally { if (n) throw n.error; } } }, i.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; }, i.prototype.addFields = function(e) { for (var t = 0; t < e.length; t++) this._fieldIds[e[t]] = t; }, i.prototype.addFieldLength = function(e, t, r, n) { var o = this._fieldLength.get(e); o == null && this._fieldLength.set(e, o = []), o[t] = n; var a = this._avgFieldLength[t] || 0, s = a * r + n; this._avgFieldLength[t] = s / (r + 1); }, i.prototype.removeFieldLength = function(e, t, r, n) { if (r === 1) { this._avgFieldLength[t] = 0; return; } var o = this._avgFieldLength[t] * r - n; this._avgFieldLength[t] = o / (r - 1); }, i.prototype.saveStoredFields = function(e, t) { var r, n, o = this._options, a = o.storeFields, s = o.extractField; if (!(a == null || a.length === 0)) { var c = this._storedFields.get(e); c == null && this._storedFields.set(e, c = {}); try { for (var l = nt(a), h = l.next(); !h.done; h = l.next()) { var u = h.value, p = s(t, u); p !== void 0 && (c[u] = p); } } catch (m) { r = { error: m }; } finally { try { h && !h.done && (n = l.return) && n.call(l); } finally { if (r) throw r.error; } } } }, i.wildcard = Symbol("*"), i; }() ), Yh = function(i, e) { return Object.prototype.hasOwnProperty.call(i, e) ? i[e] : void 0; }, UF = (Is = {}, Is[zf] = function(i, e) { var t, r; try { for (var n = nt(e.keys()), o = n.next(); !o.done; o = n.next()) { var a = o.value, s = i.get(a); if (s == null) i.set(a, e.get(a)); else { var c = e.get(a), l = c.score, h = c.terms, u = c.match; s.score = s.score + l, s.match = Object.assign(s.match, u), i0(s.terms, h); } } } catch (p) { t = { error: p }; } finally { try { o && !o.done && (r = n.return) && r.call(n); } finally { if (t) throw t.error; } } return i; }, Is[Y1] = function(i, e) { var t, r, n = /* @__PURE__ */ new Map(); try { for (var o = nt(e.keys()), a = o.next(); !a.done; a = o.next()) { var s = a.value, c = i.get(s); if (c != null) { var l = e.get(s), h = l.score, u = l.terms, p = l.match; i0(c.terms, u), n.set(s, { score: c.score + h, terms: c.terms, match: Object.assign(c.match, p) }); } } } catch (m) { t = { error: m }; } finally { try { a && !a.done && (r = o.return) && r.call(o); } finally { if (t) throw t.error; } } return n; }, Is[FF] = function(i, e) { var t, r; try { for (var n = nt(e.keys()), o = n.next(); !o.done; o = n.next()) { var a = o.value; i.delete(a); } } catch (s) { t = { error: s }; } finally { try { o && !o.done && (r = n.return) && r.call(n); } finally { if (t) throw t.error; } } return i; }, Is), VF = { k: 1.2, b: 0.7, d: 0.5 }, HF = function(i, e, t, r, n, o) { var a = o.k, s = o.b, c = o.d, l = Math.log(1 + (t - e + 0.5) / (e + 0.5)); return l * (c + i * (a + 1) / (i + a * (1 - s + s * r / n))); }, jF = function(i) { return function(e, t, r) { var n = typeof i.fuzzy == "function" ? i.fuzzy(e, t, r) : i.fuzzy || !1, o = typeof i.prefix == "function" ? i.prefix(e, t, r) : i.prefix === !0; return { term: e, fuzzy: n, prefix: o }; }; }, Jh = { idField: "id", extractField: function(i, e) { return i[e]; }, tokenize: function(i) { return i.split($F); }, processTerm: function(i) { return i.toLowerCase(); }, fields: void 0, searchOptions: void 0, storeFields: [], logger: function(i, e) { typeof (console == null ? void 0 : console[i]) == "function" && console[i](e); }, autoVacuum: !0 }, t0 = { combineWith: zf, prefix: !1, fuzzy: !1, maxFuzzy: 6, boost: {}, weights: { fuzzy: 0.45, prefix: 0.375 }, bm25: VF }, GF = { combineWith: Y1, prefix: function(i, e, t) { return e === t.length - 1; } }, tp = { batchSize: 1e3, batchWait: 10 }, ip = { minDirtFactor: 0.1, minDirtCount: 20 }, Kh = Ct(Ct({}, tp), ip), WF = function(i, e) { i.includes(e) || i.push(e); }, i0 = function(i, e) { var t, r; try { for (var n = nt(e), o = n.next(); !o.done; o = n.next()) { var a = o.value; i.includes(a) || i.push(a); } } catch (s) { t = { error: s }; } finally { try { o && !o.done && (r = n.return) && r.call(n); } finally { if (t) throw t.error; } } }, r0 = function(i, e) { var t = i.score, r = e.score; return r - t; }, n0 = function() { return /* @__PURE__ */ new Map(); }, Nc = function(i) { var e, t, r = /* @__PURE__ */ new Map(); try { for (var n = nt(Object.keys(i)), o = n.next(); !o.done; o = n.next()) { var a = o.value; r.set(parseInt(a, 10), i[a]); } } catch (s) { e = { error: s }; } finally { try { o && !o.done && (t = n.return) && t.call(n); } finally { if (e) throw e.error; } } return r; }, $F = /[\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 qF { constructor() { this._searchEngine = new zF({ fields: ["path", "name"], storeFields: ["path"], tokenize: (e, t) => e.split(/[\s/]+/) // indexing tokenizer }), this.idMaps = {}; } addZincObject(e, t) { const r = e.getRegion().getFullPath(); let n = e.groupName, o = r ? `${r}/${e.groupName}` : e.groupName; n = n.replaceAll('"', ""), o = o.replaceAll('"', ""); const a = { path: o, name: n, id: t }; this._searchEngine.add(a), this.idMaps[t] = { path: o, zincObject: e }; } removeZincObject(e, t) { const r = e.getRegion().getFullPath(); let n = e.groupName, o = r ? `${r}/${e.groupName}` : e.groupName; n = n.replaceAll('"', ""), o = o.replaceAll('"', ""); const a = { path: o, name: n, id: t }; this._searchEngine.remove(a), delete this.idMaps[t]; } addRegion(e, t) { let r = e.getFullPath(), n = e.getName(); r = r.replaceAll('"', ""), n = n.replaceAll('"', ""); const o = { path: r, name: n, id: t }; this._searchEngine.add(o), this.idMaps[t] = { path: r, 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 r = []; t.forEach((a) => { a.id in this.idMaps && r.push(this.idMaps[a.id].path); }); const n = [...new Set(r)], o = []; return n.forEach((a) => o.push({ suggestion: '"' + a + '"' })), o; } processResults(e, t) { const r = { regionPath: void 0, label: 'Search Results for "' }; return Array.isArray(t) ? r.label += ",".join(t) : r.label += t, r.label += '"', e.length === 1 && (e[0].isRegion ? r.regionPath = e[0].getFullPath() : e[0].isZincObject && (r.regionPath = e[0].getRegion().getFullPath(), r.label = e[0].groupName)), r.zincObjects = W4(e), r; } 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 r = []; return t.forEach((n) => { n.id in this.idMaps && r.push(this.idMaps[n.id].zincObject); }), r; } searchTerms(e) { let t = []; return e.forEach((r) => { const n = this.search(r); t.push(...n); }), t; } searchAndProcessResult(e) { let t = []; return Array.isArray(e) ? t = this.searchTerms(e) : t = this.search(e), this.processResults(t, e); } } const XF = { name: "ScaffoldVuer", components: { Button: os, Col: Mr, Loading: ER, Option: ss, Popover: _u, Row: Hr, Select: as, Slider: lr, TabPane: Iy, Tabs: Py, MapSvgIcon: ew, MapSvgSpriteColor: tw, PrimitiveControls: k1, ScaffoldTooltip: j1, ElIconWarningFilled: P0, ElIconArrowDown: mp, ElIconArrowLeft: Wn, DrawToolbar: iw, ScaffoldTreeControls: F1 }, setup(i) { let e = ct("$annotator"); return e || (e = Ai(new TF(`${i.flatmapAPI}annotator`)), pi("$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: Ai({}), 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: Ai([]), boundingDims: { centre: [0, 0, 0], size: [1, 1, 1] }, lastSelected: Ai({ region: "", group: "", isSearch: !1 }) }; }, watch: { format: { handler: function(i) { this.fileFormat = i; }, immediate: !0 }, url: { handler: function(i) { (this.state === void 0 || this.state.url === void 0) && this.setURL(i); }, immediate: !0 }, region: { handler: function(i) { this.state || this.viewURL || this.setFocusedRegion(i); }, immediate: !0 }, state: { handler: function(i) { this.setState(i); }, immediate: !0, deep: !0 }, viewURL: { handler: function(i) { this.updateViewURL(i); }, immediate: !0 }, helpMode: function(i, e) { i !== e && this.setHelpMode(i); }, helpModeActiveItem: function() { this.helpMode && (this.helpModeActiveIndex += 1, this.setHelpMode(this.helpMode)); }, displayMarkers: function(i) { this.$module.scene.displayMarkers = i, this.$module.scene.forcePickableObjectsUpdate = !0; }, displayMinimap: function(i) { this.$module.scene.displayMinimap = i; }, currentTime: { handler: function() { this.$emit("timeChanged", this.currentTime); } }, duration: function() { this.$module.scene.setDuration(this.duration); }, minimapSettings: { deep: !0, handler: "updateMinimapScissor" }, render: function(i) { this.toggleRendering(i); }, markerCluster: { handler: function(i) { this.$module.scene.enableMarkerCluster(i); }, immediate: !0 }, markerLabels: function(i) { for (const [e, t] of Object.entries(this.previousMarkerLabels)) this.setMarkerModeForObjectsWithName(e, t, "off"); for (const [e, t] of Object.entries(i)) this.setMarkerModeForObjectsWithName(e, t, "on"); this.previousMarkerLabels = Ai({ ...i }); }, annotationDisplay: function(i) { if (this.annotationSidebar) if (i) { const e = { featureId: (this.tData.region ? this.tData.region + "/" : "") + this.tData.label, resourceId: this.url, resource: this.url }; this.$emit("annotation-open", { annotationEntry: e, commitCallback: this.commitAnnotationEvent }); } else (!this.createData.toBeConfirmed || !this.createData.toBeDeleted) && this.$emit("annotation-close"); } }, beforeCreate: function() { this.$module = new G1(), this.selectedObjects = [], this.hoveredObjects = [], this.currentBackground = "white", this._currentURL = void 0, this.availableBackground = ["white", "black", "lightskyblue"], this.$_searchIndex = new qF(); }, mounted: function() { this.openMapRef = Pi(this.$refs.openMapRef), this.backgroundIconRef = Pi(this.$refs.backgroundIconRef), this.$refs.scaffoldTreeControls.setModule(this.$module); let i = new CF(); i.subscribe(this, this.eventNotifierCallback), this.$module.addNotifier(i), 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: { ...V1(H1, ["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(i) { this.$module.scene && this.$module.scene.addZincObject(i); }, /** * Internal only. * This is called when a new zinc object is read into the scene. */ zincObjectAdded: function(i) { this.loading = !1, this.$_searchIndex.addZincObject(i, i.uuid), this.timeVarying === !1 && i.isTimeVarying() && (this.timeVarying = !0), this.$emit("zinc-object-added", i); }, /** * Internal only. * Remove an entry matching region and group from * local annotation list. */ removeFromLocalAnnotationList: function(i, e) { for (let t = 0; t < this.localAnnotationsList.length; t++) { const r = this.localAnnotationsList[t]; if (r.region === i && r.group === e) { this.localAnnotationsList.splice(t, 1); return; } } }, /** * Internal only. * This is called when a zinc object is removed. */ zincObjectRemoved: function(i) { if (this.$module.scene) { const e = i.region.getFullPath(), t = i.groupName; i.region.findObjectsWithGroupName(t, !1).length === 0 && (this.$_searchIndex.removeZincObject(i, i.uuid), this.removeFromLocalAnnotationList(e, t)); } }, /** * Internal only. * Add regions to search index. */ addRegionsToSearchIndex: function() { this.$module.scene.getRootRegion().getChildRegions(!0).forEach((i) => { this.$_searchIndex.addRegion(i, i.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(i) { this.currentBackground = i, 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 i = 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 = i, e.click(), e.remove(); }, /** * @public * Function for capturing a screenshot of the current rendering. * * @arg {String} "filename given to the screenshot." */ captureScreenshot: function(i) { this.captureFilename = i, 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(i, e, t, r) { const n = Xv( this.annotator, this.userToken, t, i, e, this.url, r ); if (this.enableLocalAnnotations) { n.group = e; let o = i; o.slice(-1) === "/" && (o = o.slice(0, -1)), n.region = o, this.removeFromLocalAnnotationList(o, e), this.localAnnotationsList.push(n); } this.$emit("userPrimitivesUpdated", { region: i, 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(i) { if (i.isZincObject && i.isEditable) { const e = i.groupName, t = i.region.getFullPath(); this.addAndEditAnnotations(t, e, i, "Position Updated"); } }, /** * @public * Confirm creation of new primitive. This is only called from callback. * @arg `payload` */ confirmCreate: function(i) { if (i) { let e; if (i.shape === "Point") e = this.$module.scene.createPoints( i.region, i.group, this.createData.points, i.group, 8942 ); else if (i.shape === "LineString") e = this.$module.scene.createLines( i.region, i.group, [this.createData.points[0], this.createData.points[1]], 60962 ); else if (i.editingIndex > -1 && this._editingZincObject) { this._editingZincObject.editVertices( [this.createData.points[1]], i.editingIndex ); const t = this._editingZincObject.region.getFullPath() + "/", r = this._editingZincObject.groupName; this.addAndEditAnnotations(t, r, this._editingZincObject, "Position Updated"); } e && (this.addAndEditAnnotations(i.region, i.group, e.zincObject, "Create"), e.zincObject.isEditable = !0, this.tData.region = i.region, this.tData.label = i.group, this.changeActiveByName([i.group], i.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 i; if ((i = this._editingZincObject) != null && i.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(i) { if (this.timeMax >= 1e3 && i) { let e = (i % 6e4 / 1e3).toFixed(2) + "s"; return (i > 6e4 ? (i / 6e4).toFixed(0) + "m " : "") + e; } return i ? i.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 i = !1; this._boundingBoxGeo && (i = this._boundingBoxGeo.getVisibility(), this._boundingBoxGeo.setVisibility(!1)), this.$module.scene.viewAll(), this._boundingBoxGeo && (j4(this._boundingBoxGeo, this.$module.scene), this._boundingBoxGeo.setVisibility(i)); } }, /** * @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(i) { this.currentSpeed = i, 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(i) { let e = []; return i && i != "" && this.$module.scene && (e = this.$module.scene.findObjectsWithGroupName(i)), e; }, /** * @public * Switch active drawing type * @arg {String} `type` * @arg {String} `icon` */ toggleDrawing: function(i, e) { this.createData.toBeDeleted = !1, i === "mode" ? (this.cancelCreate(), this.activeDrawMode = e, this.createData.shape = "", this.$module.selectObjectOnPick = !0) : i === "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(i) { const e = this.$module.scene.getRootRegion(), t = Array.isArray(i) ? i : [i], r = Aa(e, t, "", !0); let n = this.$module.scene.getBoundingBoxOfZincObjects(r); if (n) { if (this.$module.isSyncControl()) this.$module.setSyncControlZoomToBox(n); else { const o = this.$module.scene.camera.far - this.$module.scene.camera.near; this.$module.scene.viewAllWithBoundingBox(n), this.$module.scene.camera.far = this.$module.scene.camera.near + o, this.$module.scene.camera.updateProjectionMatrix(); } return !0; } return !1; }, setFocusedRegion: function(i) { i && (this.isReady ? this.viewRegion(i) : this.$module.setFinishDownloadCallback( this.setURLFinishCallback({ region: i }) )); }, updateViewURL: function(i) { if (i) if (this.isReady) { const e = new URL(i, this.url); this.$module.scene.loadViewURL(e); } else this.$module.setFinishDownloadCallback( this.setURLFinishCallback({ viewURL: i }) ); }, createEditTemporaryLines: function(i) { const e = i[0].extraData.worldCoords; if (e && (this.createData.shape === "LineString" || this.createData.editingIndex > -1) && this.createData.points.length === 1) if (this.showRegionTooltipWithAnnotations(i, !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(i) { i && i.length > 0 && i[0].data.group && i[0].extraData.worldCoords && (this.createData.shape === "Point" ? this.drawPoint(i[0].extraData.worldCoords, i) : (this.createData.shape === "LineString" || this.createData.editingIndex > -1) && this.drawLine(i[0].extraData.worldCoords, i)); }, drawPoint: function(i, e) { this.createData.toBeConfirmed === !1 && (this.createData.points.length = 0, this.createData.points.push(i), this.createData.toBeConfirmed = !0, this.showRegionTooltipWithAnnotations(e, !0, !1), this.tData.x = 50, this.tData.y = 200, this._tempPoint = this.$module.scene.addTemporaryPoints([i], 16776960)); }, drawLine: function(i, e) { this.createData.toBeConfirmed === !1 && (this.createData.points.length === 1 ? (this.createData.points.push(i), this.createData.toBeConfirmed = !0, this.showRegionTooltipWithAnnotations(e, !0, !1), this.tData.x = 50, this.tData.y = 200) : (this._tempPoint = this.$module.scene.addTemporaryPoints([i], 16776960), this.createData.points.push(i))); }, /** * 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 i = this.$module.scene.getZincCameraControls(); this.isTransitioning = !0, i.enableAutoTumble(), i.autoTumble([1, 0], Math.PI, !0), setTimeout(this.stopFreeSpin, 4e3); } }, activateAnnotationMode: function(i, e) { if (this.userInformation || this.enableLocalAnnotations) if (this.createData.toBeDeleted = !1, this.createData.shape !== "" || this.createData.editingIndex > -1) i.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 = U4(e); t && this.activateEditingMode( t.zincObject, t.faceIndex, t.vertexIndex, t.point ); } else if (this.activeDrawMode === "Delete") { const t = V4(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(i, e, t, r) { this._editingZincObject = i, this.createData.faceIndex = e, this.createData.editingIndex = t, this.drawLine(r, void 0); }, /** * Callback when a region is selected/highlighted. * It will also update other controls. * */ eventNotifierCallback: function(i) { if (!(this.createData.toBeConfirmed || this.createData.toBeDeleted)) { const e = []; let t = []; (i.eventType == 1 || i.eventType == 2) && (i.identifiers.forEach((o) => { if (o) { let a = o.data.id ? o.data.id : o.data.group; e.push(a); } }), t = i.zincObjects); let r, n; if (i.identifiers.length > 0 && i.identifiers[0] && (r = i.identifiers[0].data.id ? i.identifiers[0].data.id : i.identifiers[0].data.group, i.identifiers[0].data.region && (n = i.identifiers[0].data.region)), i.eventType == 1) this.viewingMode === "Annotation" ? (this.tData.label = r, this.tData.region = n, this.activateAnnotationMode(e, i)) : (this.$refs.scaffoldTreeControls && (e.length > 0 ? (this.$refs.scaffoldTreeControls.updateActiveUI(t), this.updatePrimitiveControls(t)) : (this.hideRegionTooltip(), this.$refs.scaffoldTreeControls.removeActive(!1))), i.identifiers.length === 1 ? (this.lastSelected.isSearch = !1, this.lastSelected.region = n, this.lastSelected.group = i.identifiers[0].data.group) : i.identifiers.length === 0 && (this.lastSelected.isSearch = !1, this.lastSelected.region = "", this.lastSelected.group = ""), this.$emit("scaffold-selected", i.identifiers)); else if (i.eventType == 2) this.selectedObjects.length === 0 && (this.hideRegionTooltip(), this.$refs.scaffoldTreeControls && (e.length > 0 ? this.$refs.scaffoldTreeControls.updateHoverUI(t) : this.$refs.scaffoldTreeControls.removeHover(!0)), i.identifiers.length > 0 && i.identifiers[0] && i.identifiers[0].coords && (this.tData.active = !1, (this.viewingMode !== "Annotation" || !this.annotationSidebar) && (this.tData.visible = !0), this.tData.label = r, this.tData.region = n, this.tData.x = i.identifiers[0].coords.x, this.tData.y = i.identifiers[0].coords.y, this.createEditTemporaryLines(i.identifiers)), this.$emit("scaffold-highlighted", i.identifiers)); else if (i.eventType == 3 && i.identifiers.length > 0 && i.identifiers[0]) { if (i.identifiers[0].coords) { const o = this.$refs.scaffoldContainer.getBoundingClientRect(); this.tData.x = i.identifiers[0].coords.x - o.left, this.tData.y = i.identifiers[0].coords.y - o.top; } this.createEditTemporaryLines(i.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(i) { let e = i / 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(i) { this.selectedObjects = i, 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(i, e) { this.updatePrimitiveControls(i), this.$module.setSelectedByZincObjects(i, 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(i, e) { this.hoveredObjects = i, this.$module.setHighlightedByZincObjects(i, void 0, {}, e); }, /** * Set the selected by name. * * @param {} name Name of the group */ changeActiveByName: function(i, e, t) { const r = Array.isArray(i); if (i === void 0 || r && i.length === 0) this.$refs.scaffoldTreeControls.removeActive(t); else { let n = i; r || (n = [n]), this.$refs.scaffoldTreeControls.changeActiveByNames(n, e, t); } }, /** * Set the highlighted by name. * * @param {name} name Name of the group */ changeHighlightedByName: function(i, e, t) { const r = Array.isArray(i); if (i === void 0 || r && i.length === 0) this.$refs.scaffoldTreeControls.removeHover(t); else { let n = i; r || (n = [n]), this.$refs.scaffoldTreeControls.changeHoverByNames(n, e, t); } }, /** * @public * Start the animation. * * @arg "flag to turn the animation on/off" */ play: function(i) { this.$module.playAnimation(i), this.isPlaying = i; }, /** * @public * Function to toggle on/off overlay help. */ setHelpMode: function(i) { const e = this.hoverVisibilities.length, t = e - 1, r = this.hoverVisibilities[this.helpModeActiveIndex]; if (r) { const n = r == null ? void 0 : r.refs, o = r == null ? void 0 : r.ref; this.$refs[n || o] || (this.helpModeActiveIndex += 1); } i || (this.helpModeActiveIndex = this.helpModeInitialIndex), i && this.helpModeActiveIndex >= t && this.$emit("help-mode-last-item", !0), i && !this.helpModeDialog ? (this.inHelp = !0, this.hoverVisibilities.forEach((n) => { n.value = !0; })) : i && this.helpModeDialog && e > this.helpModeActiveIndex ? this.helpModeActiveIndex > -1 && setTimeout(() => { this.inHelp = !1, this.hoverVisibilities.forEach((n) => { n.value = !1; }), this.showHelpText(this.helpModeActiveIndex, 200); }, 300) : (this.inHelp = !1, this.hoverVisibilities.forEach((n) => { n.value = !1; })); }, /** * Callback function used by showRegionTooltip in the case when the tooltip * is out of view. */ displayTooltipOfObjectsCallback: function(i, e, t, r, n) { const o = this; return function() { o.$module.zincRenderer.removePostRenderCallbackFunction( o.$_regionTooltipCallback ), o.$_regionTooltipCallback = void 0, o.displayTooltipOfObjects(i, e, t, r, n); }; }, liveUpdateTooltipPosition: function() { this.$module.selectedCenter && (this.tData.x = this.$module.selectedScreenCoordinates.x, this.tData.y = this.$module.selectedScreenCoordinates.y); }, displayTooltipOfObjects: function(i, e, t, r, n) { if (e.length > 0) { let o = e[0].getClosestVertexDOMElementCoords( this.$module.scene ); if (o) return o.inView ? (i.includes("Search Results for") ? this.tData.active = !1 : this.tData.active = !0, this.tData.visible = !0, this.tData.label = i, this.tData.x = o.position.x, this.tData.y = o.position.y, this.tData.region = t, this.$_liveCoordinatesUpdated && this.$module.zincRenderer.removePostRenderCallbackFunction( this.$_liveCoordinatesUpdated ), n && (this.$module.setupLiveCoordinates(e), this.$_liveCoordinatesUpdated = this.$module.zincRenderer.addPostRenderCallbackFunction( this.liveUpdateTooltipPosition ))) : (this.hideRegionTooltip(), r && (this.$module.scene.viewAll(), this.$_regionTooltipCallback && this.$module.zincRenderer.removePostRenderCallbackFunction( this.$_regionTooltipCallback ), this.$_regionTooltipCallback = this.$module.zincRenderer.addPostRenderCallbackFunction( this.displayTooltipOfObjectsCallback( i, e, t, r, n ) ))), !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(i, e, t, r, n) { return i && e && e.length > 0 && this.$module.scene ? this.displayTooltipOfObjects( i, e, t, r, n ) : (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(i, e, t) { if (i && this.$module.scene) { const r = this.$module.scene.getRootRegion(), n = Aa(r, [i], "", !0); let o; return n && n.length > 0 && (o = n[0].getRegion().getFullPath()), this.showRegionTooltipWithObjects( i, n, 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(i, e, t) { if (this.$module.scene) { const r = qv(this.$module.scene, i); if (r && r.objects.length > 0) if (this.annotationSidebar) { const n = { featureId: (this.tData.region ? this.tData.region + "/" : "") + this.tData.label, resourceId: this.url, resource: this.url }; this.$emit("annotation-open", { annotationEntry: n, createData: this.createData, confirmCreate: this.confirmCreate, cancelCreate: this.cancelCreate, confirmDelete: this.confirmDelete }); return; } else return this.showRegionTooltipWithObjects( r.label, r.objects, r.regionPath, e, t ); } return this.hideRegionTooltip(), !1; }, /** * Callback on viewing mode change * Optional, can be used to update the view mode. */ changeViewingMode: function(i) { if (this.$module) { if (i && (this.viewingMode = i), 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 || (Zv(this.annotator, this.userToken, this.url).then((r) => { r && r.features && Gh(this.$module.scene, r.features); }), Zv(this.annotator, this.userToken, encodeURIComponent(this.url)).then((r) => { r && r.features && Gh(this.$module.scene, r.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(i, e, t) { if (i && this.$module.scene) { let r = e; typeof e == "number" && (r = { number: e, imgURL: void 0 }); const n = this.$module.scene.getRootRegion(); Aa(n, [i], "", !0).forEach((o) => o.setMarkerMode(t, r)); } }, /** * @public * Set the marker modes for objects specified by the list of annotations * @arg `annotations` * @arg `mode` */ setMarkerModeWithAnnotations: function(i, e) { if (this.$module.scene) { const t = qv(this.$module.scene, i); t && t.objects.length > 0 && t.objects.forEach((r) => r.setMarkerMode(e)); } }, /** * This is called when mouse cursor enters supported elements * with help tootltips. */ showHelpText: function(i, e = 500) { this.inHelp || (clearTimeout(this.helpTextWait[i]), this.helpTextWait[i] = setTimeout(() => { this.hoverVisibilities[i].value = !0, this.$emit("shown-tooltip"); }, e)); }, /** * This is called when mouse cursor exits supported element.. */ hideHelpText: function(i, e = 500) { this.inHelp || (clearTimeout(this.helpTextWait[i]), this.helpTextWait[i] = setTimeout(() => { this.hoverVisibilities[i].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(i, e) { if (this.$_searchIndex) { if (i === void 0 || i === "" || Array.isArray(i) && i.length === 0) return this.lastSelected.region = "", this.lastSelected.group = "", this.lastSelected.isSearch = !0, this.objectSelected([], !0), !1; { this.lastSelected.region = "", this.lastSelected.group = i, this.lastSelected.isSearch = !0; const t = this.$_searchIndex.searchAndProcessResult(i), r = t.zincObjects; if (r.length > 0) { if (this.objectSelected(r, !0), e) for (let n = 0; n < r.length; n++) r[n] && r[n].groupName && this.showRegionTooltipWithObjects( t.label, r, 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(i) { return this.$_searchIndex === void 0 ? [] : this.$_searchIndex.auto_suggest(i); }, /** * Called when minimap settings has changed. Pass the * parameters to ZincJS and marked it for update. */ updateMinimapScissor: function() { Object.keys(this.minimapSettings).forEach((i) => { this.$module.scene.minimapScissor[i] = this.minimapSettings[i]; }), 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 i = this.$module.scene.getMetadataTag("TimeStamps"); this.timeStamps = {}; for (const e in i) this.timeStamps[i[e]] = e; this.timeMax = this.$module.scene.getDuration(); }, restoreSettings: function(i) { if (i) { if (i.viewport) this.$module.scene.getZincCameraControls().setCurrentCameraSettings(i.viewport); else if (i.viewURL && i.viewURL !== "") { const t = new URL(i.viewURL, this.url); this.$module.scene.loadViewURL(t); } else i.region && i.region !== "" && this.viewRegion(i.region); i.visibility && this.$nextTick(() => { this.$refs.scaffoldTreeControls.setState(i.visibility); }), i.background && this.backgroundChangeCallback(i.background), i.viewingMode && this.changeViewingMode(i.viewingMode); const e = i.search; e && e.group && (e.isSearch ? this.search(e.group, !0) : this.changeActiveByName(e.group, e.region, !0)); } }, setURLFinishCallback: function(i) { 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(i)), 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 i = { format: this.fileFormat, url: this._currentURL, viewport: void 0, visibility: void 0, background: this.currentBackground, viewingMode: this.viewingMode }; if (this.$refs.scaffoldTreeControls && (i.visibility = this.$refs.scaffoldTreeControls.getState()), this.$module.scene) { let e = this.$module.scene.getZincCameraControls(); i.viewport = e.getCurrentViewport(); } return this.lastSelected && this.lastSelected.group && (i.search = { ...this.lastSelected }), i; }, /** * 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(i) { i && (i.url && i.url !== this._currentURL ? this.setURLAndState(i.url, { fileFormat: i.fileFormat, viewport: i.viewport, visibility: i.visibility, background: i.background, viewingMode: this.viewingMode, search: i.search }) : (i.background || i.search || i.viewport || i.viewingMode || i.visibility) && (this.isReady && this.$module.scene ? this.restoreSettings(i) : this.$module.setFinishDownloadCallback( this.setURLFinishCallback({ background: i.background, viewingMode: i.viewingMode, viewport: i.viewport, visibility: i.visibility, search: i.search }) ))); }, /** * export current scene in GLTF. * @arg "Return in binary form when set to true" * * @public */ exportGLTF: function(i) { return this.$module.scene.exportGLTF(i); }, /** * 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(i) { if (this.enableLocalAnnotations) { i.forEach((t) => { const r = t.group, n = t.region; let o = n.slice(-1) === "/" ? n : n + "/"; const a = o.slice(0, -1); t.region = a, o = o + r; const s = o; t.item.id = s, t.feature.id = s; }); const e = i.map((t) => t.feature); Gh(this.$module.scene, e), i.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(i, e) { i != this._currentURL && (e != null && e.format && (this.fileFormat = e.format), this._currentURL = i, 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(i, "scene", !0) : this.$module.loadOrgansFromURL( i, 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(i) { this.setURLAndState(i, void 0); }, /** * Callback when drawer is toggled. */ drawerToggled: function(i) { this.drawerOpen = i, this.adjustLayout(); }, /** * Callback using ResizeObserver. */ adjustLayout: function() { if (this.$refs.scaffoldContainer) { let i = this.$refs.scaffoldContainer.clientWidth; this.minimisedSlider = i < 812, this.minimisedSlider ? this.sliderPosition = this.drawerOpen ? "right" : "left" : this.sliderPosition = ""; } }, toggleRendering: function(i) { this.$module.zincRenderer && (i ? 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 i = this.$module.NDCCameraControl.getPanZoom(); this.tData.visible && this.showRegionTooltip(this.tData.label, !0, !0), this.$emit("scaffold-navigated", i); }, /** * Rotate mode - "none", "horizontal", "vertical", "free" but * it will be ignored if flag is set to false. */ toggleSyncControl: function(i, e) { this.$module.toggleSyncControl(i, e), this.$module.setSyncControlCallback(this.syncControlCallback); }, /** * Set the markers for the scene. */ setMarkers: function() { for (const [i, e] of Object.entries(this.markerLabels)) this.setMarkerModeForObjectsWithName(i, e, "on"); } } }, Uf = (i) => (Mw("data-v-3a5a2c2d"), i = i(), Sw(), i), ZF = { ref: "scaffoldContainer", class: "scaffold-container", "element-loading-text": "Loading...", "element-loading-background": "rgba(0, 0, 0, 0.3)" }, YF = /* @__PURE__ */ Uf(() => /* @__PURE__ */ ke("span", { class: "message-text" }, "Beta", -1)), JF = /* @__PURE__ */ Uf(() => /* @__PURE__ */ ke("span", { class: "message-text" }, "What's new?", -1)), KF = { class: "primitive-controls-box" }, QF = { class: "animation-data" }, ez = { class: "purple" }, tz = { class: "animation-data" }, iz = { class: "purple" }, rz = { class: "animation-data" }, nz = { class: "bottom-right-control" }, oz = /* @__PURE__ */ Uf(() => /* @__PURE__ */ ke("div", null, [ /* @__PURE__ */ yt(" Fit to "), /* @__PURE__ */ ke("br"), /* @__PURE__ */ yt(" window ") ], -1)), az = { style: { "margin-bottom": "2px" } }, sz = { key: 0, class: "viewing-mode-title" }, lz = ["onClick"], cz = ["onClick"]; function uz(i, e, t, r, n, o) { const a = Ri("map-svg-sprite-color"), s = j1, c = Ri("DrawToolbar"), l = P0, h = kt, u = _u, p = F1, m = k1, g = Ri("map-svg-icon"), d = lr, y = Hr, f = Iy, v = ss, _ = as, M = Py, T = os, w = gd; return Bt((fe(), Ce("div", ZF, [ se(a), se(s, { createData: i.createData, label: i.tData.label, region: i.tData.region, visible: i.tData.visible, x: i.tData.x, y: i.tData.y, annotationDisplay: o.annotationDisplay, onConfirmCreate: e[0] || (e[0] = (b) => o.confirmCreate(b)), onCancelCreate: e[1] || (e[1] = (b) => o.cancelCreate()), onConfirmDelete: e[2] || (e[2] = (b) => o.confirmDelete()), onTooltipHide: e[3] || (e[3] = (b) => o.onTooltipHide()) }, null, 8, ["createData", "label", "region", "visible", "x", "y", "annotationDisplay"]), ke("div", { id: "organsDisplayArea", ref: "display", tabindex: "-1", style: { height: "100%", width: "100%" }, onKeydown: e[4] || (e[4] = gr((...b) => o.backgroundChangeCallback && o.backgroundChangeCallback(...b), ["66"])) }, null, 544), Bt(ke("div", null, [ i.viewingMode === "Annotation" && (i.userInformation || t.enableLocalAnnotations) ? (fe(), He(c, { key: 0, toolbarOptions: i.toolbarOptions, activeDrawTool: i.activeDrawTool, activeDrawMode: i.activeDrawMode, hoverVisibilities: i.hoverVisibilities, onClickToolbar: o.toggleDrawing, onShowTooltip: o.showHelpText, onHideTooltip: o.hideHelpText, ref: "toolbarPopover" }, null, 8, ["toolbarOptions", "activeDrawTool", "activeDrawMode", "hoverVisibilities", "onClickToolbar", "onShowTooltip", "onHideTooltip"])) : Ve("", !0), t.displayWarning ? (fe(), He(u, { key: 1, ref: "warningPopover", visible: i.hoverVisibilities[7].value, content: t.warningMessage, placement: "right", width: "max-content", teleported: !1, "popper-class": "scaffold-popper message-popper right-popper non-selectable" }, { reference: pe(() => [ t.displayWarning ? (fe(), Ce("div", { key: 0, class: "message-icon warning-icon", onMouseover: e[5] || (e[5] = (b) => o.showHelpText(7)), onMouseout: e[6] || (e[6] = (b) => o.hideHelpText(7)) }, [ se(h, null, { default: pe(() => [ se(l) ]), _: 1 }), YF ], 32)) : Ve("", !0) ]), _: 1 }, 8, ["visible", "content"])) : Ve("", !0), t.displayLatestChanges ? (fe(), He(u, { key: 2, visible: i.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: pe(() => [ t.displayLatestChanges && t.latestChangesMessage ? (fe(), Ce("div", { key: 0, class: "el-icon-warning message-icon latest-changesicon", onMouseover: e[7] || (e[7] = (b) => o.showHelpText(8)), onMouseout: e[8] || (e[8] = (b) => o.hideHelpText(8)) }, [ se(h, null, { default: pe(() => [ se(l) ]), _: 1 }), JF ], 32)) : Ve("", !0) ]), _: 1 }, 8, ["visible", "content"])) : Ve("", !0), se(u, { visible: i.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: pe(() => [ se(p, { ref: "scaffoldTreeControls", isReady: i.isReady, "show-colour-picker": t.showColourPicker, onObjectSelected: o.objectSelected, onObjectHovered: o.objectHovered, onDrawerToggled: o.drawerToggled }, null, 8, ["isReady", "show-colour-picker", "onObjectSelected", "onObjectHovered", "onDrawerToggled"]) ]), _: 1 }, 8, ["visible"]), ke("div", KF, [ se(m, { ref: "primitiveControls", createData: i.createData, onPrimitivesUpdated: o.primitivesUpdated }, null, 8, ["createData", "onPrimitivesUpdated"]) ]), i.timeVarying ? (fe(), He(u, { key: 3, ref: "sliderPopover", width: "max-content", visible: i.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: pe(() => [ i.timeVarying ? (fe(), Ce("div", { key: 0, class: Le(["time-slider-container", [i.minimisedSlider ? "minimised" : "", i.sliderPosition]]) }, [ se(M, { type: "card" }, { default: pe(() => [ se(f, { label: "Animate scaffold" }, { default: pe(() => [ se(y, { class: "tab-content" }, { default: pe(() => [ i.isPlaying ? (fe(), He(g, { key: 0, icon: "pause", class: "icon-button video-button", onClick: e[9] || (e[9] = (b) => o.play(!1)) })) : (fe(), He(g, { key: 1, icon: "play", class: "video-button icon-button", onClick: e[10] || (e[10] = (b) => o.play(!0)) })), se(d, { min: 0, max: i.timeMax, "model-value": i.currentTime / 100 * i.timeMax, step: 0.1, "tooltip-class": "time-slider-tooltip", class: "slider", "format-tooltip": o.formatTooltip, marks: i.timeStamps, onInput: e[11] || (e[11] = (b) => o.timeChange(b)) }, null, 8, ["max", "model-value", "format-tooltip", "marks"]) ]), _: 1 }) ]), _: 1 }), se(f, { label: "Animation data" }, { default: pe(() => [ se(y, { class: "tab-content" }, { default: pe(() => [ ke("div", QF, [ yt(" Original duration: "), ke("div", ez, wt(i.orginalDuration), 1) ]), ke("div", tz, [ yt(" Animation duration: "), ke("div", iz, wt(i.animateDuration), 1) ]), ke("div", rz, [ yt(" Playback speed "), se(_, { teleported: !0, "model-value": i.currentSpeed, placeholder: "Select", class: "scaffold-select-box speed", "popper-class": "scaffold_viewer_dropdown", onChange: e[12] || (e[12] = (b) => o.speedChanged(b)) }, { default: pe(() => [ (fe(!0), Ce(Gt, null, rr(i.playSpeed, (b) => (fe(), He(v, { key: b.value, label: b.label, value: b.value }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["model-value"]) ]) ]), _: 1 }) ]), _: 1 }) ]), _: 1 }) ], 2)) : Ve("", !0) ]), _: 1 }, 8, ["visible"])) : Ve("", !0), ke("div", nz, [ se(u, { visible: i.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: pe(() => [ se(g, { icon: "zoomIn", class: "icon-button zoomIn", onClick: e[13] || (e[13] = (b) => o.zoomIn()), onMouseover: e[14] || (e[14] = (b) => o.showHelpText(0)), onMouseout: e[15] || (e[15] = (b) => o.hideHelpText(0)) }) ]), _: 1 }, 8, ["visible"]), se(u, { visible: i.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: pe(() => [ se(g, { icon: "zoomOut", class: "icon-button zoomOut", onClick: e[16] || (e[16] = (b) => o.zoomOut()), onMouseover: e[17] || (e[17] = (b) => o.showHelpText(1)), onMouseout: e[18] || (e[18] = (b) => o.hideHelpText(1)) }) ]), _: 1 }, 8, ["visible"]), se(u, { visible: i.hoverVisibilities[2].value, placement: "top", teleported: !1, trigger: "manual", width: "max-content", "popper-class": "scaffold-popper non-selectable", ref: "zoomFitPopover" }, { reference: pe(() => [ se(g, { icon: "fitWindow", class: "icon-button fitWindow", onClick: e[19] || (e[19] = (b) => o.fitWindow()), onMouseover: e[20] || (e[20] = (b) => o.showHelpText(2)), onMouseout: e[21] || (e[21] = (b) => o.hideHelpText(2)) }) ]), default: pe(() => [ oz ]), _: 1 }, 8, ["visible"]) ]), i.openMapRef ? (fe(), He(u, { key: 4, ref: "open-map-popover", "virtual-ref": i.openMapRef, placement: "top-start", width: "128", teleported: !1, trigger: "click", "popper-class": "open-map-popper", "virtual-triggering": "" }, { default: pe(() => [ (fe(!0), Ce(Gt, null, rr(t.openMapOptions, (b) => (fe(), He(y, { key: b.key }, { default: pe(() => [ se(T, { type: "primary", plain: "", onClick: (E) => i.$emit("open-map", b.key) }, { default: pe(() => [ yt(wt(b.display), 1) ]), _: 2 }, 1032, ["onClick"]) ]), _: 2 }, 1024))), 128)) ]), _: 1 }, 8, ["virtual-ref"])) : Ve("", !0), se(u, { ref: "backgroundPopover", "virtual-ref": i.backgroundIconRef, placement: "top-start", width: "128", teleported: !1, trigger: "click", "popper-class": "background-popper non-selectable h-auto", "virtual-triggering": "" }, { default: pe(() => [ ke("div", null, [ se(y, { class: "backgroundText" }, { default: pe(() => [ yt("Viewing Mode") ]), _: 1 }), se(y, { class: "backgroundControl" }, { default: pe(() => [ ke("div", az, [ (fe(!0), Ce(Gt, null, rr(i.viewingModes, (b, E, S) => (fe(), Ce(Gt, { key: E }, [ E === i.viewingMode ? (fe(), Ce("span", sz, [ ke("b", null, wt(E), 1) ])) : (fe(), Ce("span", { key: 1, class: "viewing-mode-unselected", onClick: (C) => o.changeViewingMode(E) }, wt(E), 9, lz)) ], 64))), 128)) ]), se(y, { class: "viewing-mode-description" }, { default: pe(() => [ yt(wt(i.viewingModes[i.viewingMode]), 1) ]), _: 1 }) ]), _: 1 }), se(y, { class: "backgroundSpacer" }), se(y, { class: "backgroundText" }, { default: pe(() => [ yt(" Change background ") ]), _: 1 }), se(y, { class: "backgroundChooser" }, { default: pe(() => [ (fe(!0), Ce(Gt, null, rr(i.availableBackground, (b) => (fe(), Ce("div", { key: b, class: Le([ "backgroundChoice", b, b == i.currentBackground ? "active" : "" ]), onClick: (E) => o.backgroundChangeCallback(b) }, null, 10, cz))), 128)) ]), _: 1 }) ]) ]), _: 1 }, 8, ["virtual-ref"]), ke("div", { class: Le(["settings-group", { open: i.drawerOpen, close: !i.drawerOpen }]) }, [ se(y, null, { default: pe(() => [ se(u, { visible: i.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: pe(() => [ t.enableOpenMapUI && t.openMapOptions.length > 0 ? (fe(), He(g, { key: 0, ref: "openMapRef", icon: "openMap", class: "icon-button open-map-button", onMouseover: e[22] || (e[22] = (b) => o.showHelpText(3)), onMouseout: e[23] || (e[23] = (b) => o.hideHelpText(3)) }, null, 512)) : Ve("", !0) ]), _: 1 }, 8, ["visible"]) ]), _: 1 }), se(y, null, { default: pe(() => [ se(u, { visible: i.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: pe(() => [ se(g, { ref: "backgroundIconRef", icon: "changeBckgd", class: "icon-button", onMouseover: e[24] || (e[24] = (b) => o.showHelpText(4)), onMouseout: e[25] || (e[25] = (b) => o.hideHelpText(4)) }, null, 512) ]), _: 1 }, 8, ["visible"]) ]), _: 1 }) ], 2) ], 512), [ [yi, t.displayUI && !i.isTransitioning] ]) ])), [ [w, i.loading] ]); } const hz = /* @__PURE__ */ wn(XF, [["render", uz], ["__scopeId", "data-v-3a5a2c2d"]]), dz = { name: "Scaffold", mixins: [aw], components: { ScaffoldVuer: hz, HelpModeDialog: ow }, methods: { onResize: function() { this.scaffoldCamera.onResize(); }, getState: function() { return this.$refs.scaffold.getState(); }, /** * Perform a local search on this contentvuer */ search: function(i) { return this.$refs.scaffold.search(i, !0); }, searchSuggestions: function(i, e) { if (i === "" || !this.$refs.scaffold) return e; this.$refs.scaffold.fetchSuggestions(i).forEach((r) => { r.suggestion && e.push(r.suggestion); }); }, /** * Handle sync pan zoom event */ handleSyncPanZoomEvent: function(i) { if (!this.mouseHovered && i.type !== this.entry.type) { const e = i.payload.origin, t = i.payload.size, r = [e[0] + t[0] / 2, e[1] + t[1] / 2], n = [ (r[0] - 0.5) * 2, (0.5 - r[1]) * 2 ], o = 1 / Math.max(t[0], t[1]); this.$refs.scaffold.$module.setSyncControlCenterZoom( n, o ); } }, displayTooltip: function(i) { let e; i && (e = i.name), e ? this.$refs.scaffold.search(e, !0) : this.$refs.scaffold.hideRegionTooltip(); }, zoomToFeatures: function(i, e) { let t; Array.isArray(i) ? t = i : t = [i.name], e && this.$refs.scaffold.changeActiveByName(t, "", !1), this.$refs.scaffold.viewRegion(t); }, highlightFeatures: function(i) { let e; Array.isArray(i) ? e = i : e = [i.name], this.$refs.scaffold.changeHighlightedByName(e, "", !1); }, scaffoldIsReady: function() { if (this.scaffoldLoaded = !0, this.$refs.scaffold.$module.graphicsHighlight.highlightColour = [1, 0, 1], this.isVisible()) { let i = "free"; this.entry.rotation && (i = this.entry.rotation), this.$refs.scaffold.toggleSyncControl(this.splitFlowStore.globalCallback, i), this.splitFlowStore.syncMode && this.$refs.scaffold.fitWindow(); } Wu.emit("mapLoaded", this.$refs.scaffold); }, requestSynchronisedEvent: function(i) { if (this.scaffoldLoaded) { let e = "free"; this.entry.rotation && (e = this.entry.rotation), this.$refs.scaffold.toggleSyncControl(i, e); } }, /** * Callback when the vuers emit a selected event. */ scaffoldHighlighted: function(i, e) { var r, n, o; const t = { paneIndex: this.entry.id, type: i, resource: e, internalName: void 0 }; e && e[0] && ((((r = e[0].data) == null ? void 0 : r.id) === void 0 || ((n = e[0].data) == null ? void 0 : n.id) === "") && (e[0].data.id = (o = e[0].data) == null ? void 0 : o.group), t.internalName = e[0].data.id, t.eventType = "highlighted"), this.$emit("resource-selected", t); }, /** * Callback when the vuers emit a selected event. */ scaffoldNavigated: function(i, e) { if (this.mouseHovered) { const t = { paneIndex: this.entry.id, eventType: "panZoom", payload: e, type: i }; this.$emit("resource-selected", t); } }, updateWithViewUrl: function(i) { this.$refs.scaffold.updateViewURL(i); }, /** * Change the view mode of the current scaffold */ changeViewingMode: function(i) { this.$refs.scaffold.changeViewingMode(i); } }, computed: { warningMessage: function() { return this.entry.isBodyScaffold ? "This map displays the anatomical location and connectivity of nerves, through which the neuron populations from the ApiNATOMY models available in SCKAN can be routed." : "Under active development"; }, markerLabels: function() { return this.settingsStore.numberOfDatasetsForFacets; } }, data: function() { return { apiLocation: process.env.VUE_APP_API_LOCATION, scaffoldCamera: void 0, scaffoldLoaded: !1 }; }, mounted: function() { this.scaffoldCamera = this.$refs.scaffold.$module.scene.getZincCameraControls(), Wu.on("startHelp", () => { this.startHelp(); }), Wu.on("hoverUpdate", () => { this.scaffoldLoaded && this.mapHoverHighlight(this.$refs.scaffold); }); } }, pz = { class: "viewer-container" }; function fz(i, e, t, r, n, o) { const a = Ri("ScaffoldVuer"), s = Ri("HelpModeDialog"); return fe(), Ce("div", pz, [ se(a, { state: i.entry.state, url: i.entry.resource, region: i.entry.region, onScaffoldSelected: e[0] || (e[0] = (c) => i.resourceSelected(i.entry.type, c, !0)), onScaffoldHighlighted: e[1] || (e[1] = (c) => o.scaffoldHighlighted(i.entry.type, c)), onScaffoldNavigated: e[2] || (e[2] = (c) => o.scaffoldNavigated(i.entry.type, c)), onOnReady: o.scaffoldIsReady, onOpenMap: i.openMap, ref: "scaffold", "background-toggle": !0, traditional: !0, helpMode: i.helpMode, helpModeActiveItem: i.helpModeActiveItem, helpModeDialog: i.useHelpModeDialog, onAnnotationOpen: i.onAnnotationOpen, onAnnotationClose: i.onAnnotationClose, annotationSidebar: i.annotationSidebar, onHelpModeLastItem: i.onHelpModeLastItem, onShownTooltip: i.onTooltipShown, onShownMapTooltip: i.onMapTooltipShown, render: i.visible, "display-latest-message": !0, "warning-message": o.warningMessage, "display-minimap": !1, "display-markers": !1, enableOpenMapUI: !0, "view-u-r-l": i.entry.viewUrl, markerCluster: !0, markerLabels: o.markerLabels, flatmapAPI: i.flatmapAPI }, null, 8, ["state", "url", "region", "onOnReady", "onOpenMap", "helpMode", "helpModeActiveItem", "helpModeDialog", "onAnnotationOpen", "onAnnotationClose", "annotationSidebar", "onHelpModeLastItem", "onShownTooltip", "onShownMapTooltip", "render", "warning-message", "view-u-r-l", "markerLabels", "flatmapAPI"]), i.helpMode && i.useHelpModeDialog ? (fe(), He(s, { key: 0, ref: "scaffoldHelp", scaffoldRef: i.scaffoldRef, lastItem: i.helpModeLastItem, onShowNext: i.onHelpModeShowNext, onFinishHelpMode: i.onFinishHelpMode }, null, 8, ["scaffoldRef", "lastItem", "onShowNext", "onFinishHelpMode"])) : Ve("", !0) ]); } const yz = /* @__PURE__ */ nw(dz, [["render", fz], ["__scopeId", "data-v-343030f1"]]); export { yz as default };